Commit b7997fb9 authored by yann300's avatar yann300

current folder changed

parent 34f65366
......@@ -391,6 +391,10 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
filePanel.gitHandle
])
if (isElectron()) {
appManager.activatePlugin('remixd')
}
try {
engine.register(await appManager.registeredPlugins())
} catch (e) {
......@@ -455,9 +459,5 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
})
}
if (isElectron()) {
appManager.activatePlugin('remixd')
}
if (params.embed) framingService.embed()
}
......@@ -41,6 +41,10 @@ module.exports = class RemixDProvider {
this._appManager.on('remixd', 'fileRenamed', (oldPath, newPath) => {
this.event.trigger('fileRemoved', [this.addPrefix(oldPath), this.addPrefix(newPath)])
})
this._appManager.on('remixd', 'rootFolderChanged', () => {
this.event.trigger('rootFolderChanged', [])
})
}
isConnected () {
......
......@@ -127,6 +127,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
if (state.fileManager) {
filesProvider.event.register('fileExternallyChanged', fileExternallyChanged)
filesProvider.event.register('fileRenamedError', fileRenamedError)
filesProvider.event.register('rootFolderChanged', rootFolderChanged)
}
}, [state.fileManager])
......@@ -482,6 +483,15 @@ export const FileExplorer = (props: FileExplorerProps) => {
}, null)
}
// register to event of the file provider
// files.event.register('rootFolderChanged', rootFolderChanged)
const rootFolderChanged = async () => {
const files = await fetchDirectoryContent(name)
setState(prevState => {
return { ...prevState, files }
})
}
const uploadFile = (target) => {
// TODO The file explorer is merely a view on the current state of
// the files module. Please ask the user here if they want to overwrite
......
'use strict'
import { RemixdClient as sharedFolder } from './services/remixdClient'
import { GitClient } from './services/gitClient'
import Websocket from './websocket'
import * as utils from './utils'
......@@ -7,6 +8,7 @@ module.exports = {
Websocket,
utils,
services: {
sharedFolder
sharedFolder,
GitClient
}
}
......@@ -20,6 +20,7 @@ export class RemixdClient extends PluginClient {
sharedFolder (currentSharedFolder: string, readOnly: boolean): void {
this.currentSharedFolder = currentSharedFolder
this.readOnly = readOnly
if (this.isLoaded) this.emit('rootFolderChanged')
}
list (): Filelist {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment