pull/4594/head
Rim Rakhimov 9 months ago committed by Aniket
parent daee5cc7ae
commit 98b925ae30
  1. 23
      libs/remix-ui/workspace/src/lib/actions/index.ts

@ -80,15 +80,14 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
await loadWorkspacePreset('gist-template')
} else if (params.code || params.url || params.shareCode) {
await createWorkspaceTemplate('code-sample', 'code-template')
plugin.setWorkspace({name: 'code-sample', isLocalhost: false})
dispatch(setCurrentWorkspace({name: 'code-sample', isGitRepo: false}))
plugin.setWorkspace({ name: 'code-sample', isLocalhost: false })
dispatch(setCurrentWorkspace({ name: 'code-sample', isGitRepo: false }))
const filePath = await loadWorkspacePreset('code-template')
plugin.on('filePanel', 'workspaceInitializationCompleted', async () => {
if (editorMounted) {
plugin.on('filePanel', 'workspaceInitializationCompleted', async () => {
if (editorMounted){
setTimeout(async () => {
await plugin.fileManager.openFile(filePath)
}, 1000)
} else {
await plugin.fileManager.openFile(filePath)}, 1000)
}else{
filePathToOpen = filePath
}
})
@ -169,7 +168,7 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
await workspaceProvider.set(filePath, data.compilationTargets[filePath]['content'])
}
plugin.on('filePanel', 'workspaceInitializationCompleted', async () => {
plugin.on('filePanel', 'workspaceInitializationCompleted', async () => {
if (editorMounted){
setTimeout(async () => {
await plugin.fileManager.openFile(filePath)}, 1000)
@ -191,7 +190,7 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
const currentPath = await plugin.call('fs', 'getWorkingDir')
dispatch(setCurrentLocalFilePath(currentPath))
plugin.setWorkspace({ name: 'electron', isLocalhost: false })
dispatch(setCurrentWorkspace({ name: 'electron', isGitRepo: false }))
electrOnProvider.init()
listenOnProviderEvents(electrOnProvider)(dispatch)
@ -211,7 +210,7 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
} else {
_paq.push(['trackEvent', 'Storage', 'error', `Workspace in localstorage not found: ${localStorage.getItem("currentWorkspace")}`])
await basicWorkspaceInit(workspaces, workspaceProvider)
}
}
} else {
await basicWorkspaceInit(workspaces, workspaceProvider)
}
@ -264,7 +263,7 @@ export type SolidityConfiguration = {
export const publishToGist = async (path?: string) => {
// If 'id' is not defined, it is not a gist update but a creation so we have to take the files from the browser explorer.
const folder = path || '/'
try {
let id
if (path) {
@ -433,7 +432,7 @@ export const copyShareURL = async (path: string) => {
const ipfs = IpfsHttpClient({ port, host, protocol
, headers: {
// authorization: auth
}
}
})
const fileContent = await fileManager.readFile(path)

Loading…
Cancel
Save