Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framing with parameters url #2878

Merged
merged 1 commit into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/framingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand All @@ -33,6 +33,9 @@ export class FramingService {
e.preventDefault()
}
})

if (params.minimizeterminal) this.mainView.minimizeTerminal()
if (params.minimizesidepanel) this.resizeFeature.hidePanel()
}

embed () {
Expand Down