Commit 99196493 authored by yann300's avatar yann300

rearangement

parent 3bd07e9a
...@@ -58,14 +58,23 @@ module.exports = class Filepanel extends ViewPlugin { ...@@ -58,14 +58,23 @@ module.exports = class Filepanel extends ViewPlugin {
this.remixdHandle = new RemixdHandle(this.remixdExplorer, this._deps.fileProviders.localhost, appManager) this.remixdHandle = new RemixdHandle(this.remixdExplorer, this._deps.fileProviders.localhost, appManager)
this.gitHandle = new GitHandle() this.gitHandle = new GitHandle()
this.registeredMenuItems = []
this.request = {} this.request = {}
this.renderComponent()
}
render () {
return this.el
}
renderComponent() {
ReactDOM.render( ReactDOM.render(
<Workspace <Workspace
setWorkspace={this.setWorkspace.bind(this)} setWorkspace={this.setWorkspace.bind(this)}
renameWorkspace={this.renameWorkspace.bind(this)} workspaceRenamed={this.workspaceRenamed.bind(this)}
deleteWorkspace={this.deleteWorkspace.bind(this)} workspaceDeleted={this.workspaceDeleted.bind(this)}
createWorkspace={this.createWorkspace.bind(this)} workspaceCreated={this.workspaceCreated.bind(this)}
workspace={this._deps.fileProviders.workspace} workspace={this._deps.fileProviders.workspace}
browser={this._deps.fileProviders.browser} browser={this._deps.fileProviders.browser}
localhost={this._deps.fileProviders.localhost} localhost={this._deps.fileProviders.localhost}
...@@ -76,12 +85,22 @@ module.exports = class Filepanel extends ViewPlugin { ...@@ -76,12 +85,22 @@ module.exports = class Filepanel extends ViewPlugin {
registry={this._components.registry} registry={this._components.registry}
plugin={this} plugin={this}
request={this.request} request={this.request}
registeredMenuItems={this.registeredMenuItems}
/> />
, this.el) , this.el)
} }
render () { /**
return this.el * @param item { id: string, name: string, type?: string[], path?: string[], extension?: string[], pattern?: string[] }
* @param callback (...args) => void
*/
registerContextMenuItem (item) {
if (!item) throw new Error('Invalid register context menu argument')
if (!item.name || !item.id) throw new Error('Item name and id is mandatory')
if (!item.type && !item.path && !item.extension && !item.pattern) throw new Error('Invalid file matching criteria provided')
this.registeredMenuItems = [...this.registeredMenuItems, item]
this.renderComponent()
} }
async getCurrentWorkspace () { async getCurrentWorkspace () {
...@@ -115,15 +134,15 @@ module.exports = class Filepanel extends ViewPlugin { ...@@ -115,15 +134,15 @@ module.exports = class Filepanel extends ViewPlugin {
this.emit('setWorkspace', workspace) this.emit('setWorkspace', workspace)
} }
renameWorkspace (workspace) { workspaceRenamed (workspace) {
this.emit('renameWorkspace', workspace) this.emit('renameWorkspace', workspace)
} }
deleteWorkspace (workspace) { workspaceDeleted (workspace) {
this.emit('deleteWorkspace', workspace) this.emit('deleteWorkspace', workspace)
} }
createWorkspace (workspace) { workspaceCreated (workspace) {
this.emit('createWorkspace', workspace) this.emit('createWorkspace', workspace)
} }
/** end section */ /** end section */
......
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