From e743677ab6d345d9bc59071ea97fc3d8c71d213d Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 3 Jun 2020 15:21:57 +0200 Subject: [PATCH] url parameters: minimizeterminal, minimizesidepanel, focus the last plugin --- apps/remix-ide/src/app.js | 13 +++++++++---- apps/remix-ide/src/framingService.js | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 24af4856ae..2a8629079e 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -236,7 +236,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org // APP_MANAGER const appManager = new RemixAppManager({}) - const workspace = appManager.pluginLoader.get() + const pluginLoader = appManager.pluginLoader + const workspace = pluginLoader.get() const engine = new Engine(appManager) await engine.onload() @@ -399,6 +400,9 @@ Please make a backup of your contracts and start using http://remix.ethereum.org await appManager.activatePlugin(['mainPanel', 'menuicons']) await appManager.activatePlugin(['home', 'sidePanel', 'hiddenPanel', 'pluginManager', 'fileExplorers', 'settings', 'contextualListener', 'scriptRunner', 'terminal', 'fetchAndCompile']) + const queryParams = new QueryParams() + const params = queryParams.get() + // Set workspace after initial activation if (Array.isArray(workspace)) { await appManager.activatePlugin(workspace) @@ -410,15 +414,16 @@ Please make a backup of your contracts and start using http://remix.ethereum.org // Load and start the service who manager layout and frame const framingService = new FramingService(sidePanel, menuicons, mainview, this._components.resizeFeature) - framingService.start() + framingService.start(params) + + // If plugins are loaded from the URL params, we focus on the last one. + if (pluginLoader.current === 'queryParams' && Array.isArray(workspace) && workspace.length > 0) menuicons.select(workspace[workspace.length - 1]) // get the file list from the parent iframe loadFileFromParent(fileManager) // get the file from gist const gistHandler = new GistHandler() - const queryParams = new QueryParams() - const params = queryParams.get() const loadedFromGist = gistHandler.loadFromGist(params, fileManager) if (!loadedFromGist) { // insert example contracts if there are no files to show diff --git a/apps/remix-ide/src/framingService.js b/apps/remix-ide/src/framingService.js index 1d59cf822b..5f77d1298d 100644 --- a/apps/remix-ide/src/framingService.js +++ b/apps/remix-ide/src/framingService.js @@ -8,7 +8,7 @@ export class FramingService { this.resizeFeature = resizeFeature } - start () { + start (params) { this.sidePanel.events.on('toggle', () => { this.resizeFeature.panel.clientWidth !== 0 ? this.resizeFeature.hidePanel() : this.resizeFeature.showPanel() }) @@ -33,6 +33,9 @@ export class FramingService { e.preventDefault() } }) + + if (params.minimizeterminal) this.mainView.minimizeTerminal() + if (params.minimizesidepanel) this.resizeFeature.hidePanel() } embed () {