fixed switch to workspace

pull/5370/head
lianahus 1 year ago
parent b6241d6c60
commit 4a13b36e48
  1. 20
      libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx

@ -119,22 +119,20 @@ function HomeTabFile({plugin}: HomeTabFileProps) {
const workspaces = await plugin.call('filePanel', 'getWorkspaces') const workspaces = await plugin.call('filePanel', 'getWorkspaces')
if (!workspaces.find(workspace => workspace.name === wName)) { if (!workspaces.find(workspace => workspace.name === wName)) {
await plugin.call('filePanel', 'createWorkspace', wName, 'remixDefault') await plugin.call('filePanel', 'createWorkspace', wName, 'remixDefault')
await plugin.call('filePanel', 'setWorkspace', wName)
} else {
await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false })
} }
await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false })
await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false }) // don't ask why
const content = `// SPDX-License-Identifier: MIT const content = `
pragma solidity >=0.7.0 <0.9.0; // SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
contract helloWorld { contract helloWorld {
} }
` `
const {newPath} = await plugin.call('fileManager', 'writeFileNoRewrite', '/contracts/helloWorld.sol', content)
const {newContent, newPath} = await plugin.call('fileManager', 'writeFileNoRewrite', '/contracts/helloWorld.sol', content)
await plugin.call('fileManager', 'open', newPath) await plugin.call('fileManager', 'open', newPath)
} }
const uploadFile = async (target) => { const uploadFile = async (target) => {
_paq.push(['trackEvent', 'hometab', 'filesSection', 'uploadFile']) _paq.push(['trackEvent', 'hometab', 'filesSection', 'uploadFile'])
await plugin.call('filePanel', 'uploadFile', target) await plugin.call('filePanel', 'uploadFile', target)

Loading…
Cancel
Save