pull/1647/head
filip mertens 3 years ago
parent e70ce1306e
commit 5a6230e995
  1. 18
      apps/remix-ide/src/app/panels/tab-proxy.js
  2. 4
      apps/remix-ide/src/app/ui/renderer.js
  3. 10
      libs/remix-ui/workspace/src/lib/actions/index.ts

@ -69,12 +69,12 @@ export class TabProxy extends Plugin {
this.tabsApi.activateTab(workspacePath) this.tabsApi.activateTab(workspacePath)
return return
} }
this.addTab(workspacePath, '', () => { this.addTab(workspacePath, '', async () => {
this.fileManager.open(file) await this.fileManager.open(file)
this.event.emit('openFile', file) this.event.emit('openFile', file)
}, },
() => { () => {
this.fileManager.closeFile(file) await this.fileManager.closeFile(file)
this.event.emit('closeFile', file) this.event.emit('closeFile', file)
}) })
this.tabsApi.activateTab(workspacePath) this.tabsApi.activateTab(workspacePath)
@ -85,12 +85,12 @@ export class TabProxy extends Plugin {
this.tabsApi.activateTab(path) this.tabsApi.activateTab(path)
return return
} }
this.addTab(path, '', () => { this.addTab(path, '', async () => {
this.fileManager.open(file) await this.fileManager.open(file)
this.event.emit('openFile', file) this.event.emit('openFile', file)
}, },
() => { () => {
this.fileManager.closeFile(file) await this.fileManager.closeFile(file)
this.event.emit('closeFile', file) this.event.emit('closeFile', file)
}) })
this.tabsApi.activateTab(path) this.tabsApi.activateTab(path)
@ -192,12 +192,12 @@ export class TabProxy extends Plugin {
} }
renameTab (oldName, newName) { renameTab (oldName, newName) {
this.addTab(newName, '', () => { this.addTab(newName, '', async () => {
this.fileManager.open(newName) await this.fileManager.open(newName)
this.event.emit('openFile', newName) this.event.emit('openFile', newName)
}, },
() => { () => {
this.fileManager.closeFile(newName) await this.fileManager.closeFile(newName)
this.event.emit('closeFile', newName) this.event.emit('closeFile', newName)
}) })
this.removeTab(oldName) this.removeTab(oldName)

@ -39,8 +39,8 @@ Renderer.prototype._errorClick = function (errFile, errLine, errCol) {
// TODO: refactor with this._components.contextView.jumpTo // TODO: refactor with this._components.contextView.jumpTo
var provider = self._deps.fileManager.fileProviderOf(errFile) var provider = self._deps.fileManager.fileProviderOf(errFile)
if (provider) { if (provider) {
provider.exists(errFile).then(exist => { provider.exists(errFile).then(async exist => {
self._deps.fileManager.open(errFile) await self._deps.fileManager.open(errFile)
editor.gotoLine(errLine, errCol) editor.gotoLine(errLine, errCol)
}).catch(error => { }).catch(error => {
if (error) return console.log(error) if (error) return console.log(error)

@ -35,7 +35,7 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
plugin.setWorkspace({ name: 'code-sample', isLocalhost: false }) plugin.setWorkspace({ name: 'code-sample', isLocalhost: false })
dispatch(setCurrentWorkspace('code-sample')) dispatch(setCurrentWorkspace('code-sample'))
const filePath = await loadWorkspacePreset('code-template') const filePath = await loadWorkspacePreset('code-template')
plugin.on('editor', 'editorMounted', () => plugin.fileManager.openFile(filePath)) plugin.on('editor', 'editorMounted', async () => await plugin.fileManager.openFile(filePath))
} else { } else {
if (workspaces.length === 0) { if (workspaces.length === 0) {
await createWorkspaceTemplate('default_workspace', 'default-template') await createWorkspaceTemplate('default_workspace', 'default-template')
@ -215,7 +215,7 @@ export const copyFile = async (src: string, dest: string) => {
const fileManager = plugin.fileManager const fileManager = plugin.fileManager
try { try {
fileManager.copyFile(src, dest) await fileManager.copyFile(src, dest)
} catch (error) { } catch (error) {
dispatch(displayPopUp('Oops! An error ocurred while performing copyFile operation.' + error)) dispatch(displayPopUp('Oops! An error ocurred while performing copyFile operation.' + error))
} }
@ -225,7 +225,7 @@ export const copyFolder = async (src: string, dest: string) => {
const fileManager = plugin.fileManager const fileManager = plugin.fileManager
try { try {
fileManager.copyDir(src, dest) await fileManager.copyDir(src, dest)
} catch (error) { } catch (error) {
dispatch(displayPopUp('Oops! An error ocurred while performing copyDir operation.' + error)) dispatch(displayPopUp('Oops! An error ocurred while performing copyDir operation.' + error))
} }
@ -243,11 +243,11 @@ export const runScript = async (path: string) => {
} }
export const emitContextMenuEvent = async (cmd: customAction) => { export const emitContextMenuEvent = async (cmd: customAction) => {
plugin.call(cmd.id, cmd.name, cmd) await plugin.call(cmd.id, cmd.name, cmd)
} }
export const handleClickFile = async (path: string, type: 'file' | 'folder' | 'gist') => { export const handleClickFile = async (path: string, type: 'file' | 'folder' | 'gist') => {
plugin.fileManager.open(path) await plugin.fileManager.open(path)
dispatch(focusElement([{ key: path, type }])) dispatch(focusElement([{ key: path, type }]))
} }

Loading…
Cancel
Save