filepanel activate

pull/1857/head
filip mertens 3 years ago
parent e1a5eca12f
commit c0a7c9b55e
  1. 4
      apps/remix-ide/src/app.js
  2. 39
      apps/remix-ide/src/app/panels/layout.ts
  3. 5
      apps/remix-ide/src/remixAppManager.js

@ -327,10 +327,6 @@ class AppComponent {
// activate solidity plugin
self.appManager.activatePlugin(['solidity', 'udapp'])
// Load and start the service who manager layout and frame
// const framingService = new FramingService(self.sidePanel, self.menuicons, self.mainview, null)
// if (params.embed) framingService.embed()
// framingService.start(params)
}
}

@ -1,8 +1,7 @@
import { Plugin } from '@remixproject/engine'
import { Profile } from '@remixproject/plugin-utils'
import { EventEmitter } from 'events'
import { TabProxy } from './tab-proxy'
const EventManager = require('../../lib/events')
import QueryParams from '../../lib/query-params'
const profile: Profile = {
name: 'layout',
@ -28,35 +27,57 @@ export class Layout extends Plugin {
this.event = new EventEmitter()
}
onActivation(): void {
async onActivation(): Promise<void> {
console.log('layout plugin activated')
this.on('fileManager', 'currentFileChanged', () => {
console.log('layout plugin currentFileChanged')
this.panels.editor.active = true
this.panels.main.active = false
this.event.emit('change', null)
})
this.on('tabs', 'openFile', () => {
console.log('layout plugin currentFileChanged')
this.panels.editor.active = true
this.panels.main.active = false
this.event.emit('change', null)
})
this.on('tabs', 'switchApp', (name: string) => {
console.log('layout plugin switchApp', name)
this.call('mainPanel', 'showContent', name)
this.panels.editor.active = false
this.panels.main.active = true
this.event.emit('change', null)
})
this.on('tabs', 'closeApp', (name: string) => {
console.log('layout plugin closeapp', name)
this.panels.editor.active = true
this.panels.main.active = false
this.event.emit('change', null)
})
this.on('tabs', 'tabCountChanged', (count) => {
// if (!count) this.editor.displayEmptyReadOnlySession()
this.on('tabs', 'tabCountChanged', async count => {
if (!count) await this.call('manager', 'activatePlugin', 'home')
})
this.on('manager', 'activate', (profile: Profile) => {
switch (profile.name) {
case 'filePanel':
this.call('menuicons', 'select', 'filePanel')
break
}
})
document.addEventListener('keypress', e => {
if (e.shiftKey && e.ctrlKey) {
if (e.code === 'KeyF') {
// Ctrl+Shift+F
this.call('menuicons', 'select', 'filePanel')
} else if (e.code === 'KeyA') {
// Ctrl+Shift+A
this.call('menuicons', 'select', 'pluginManager')
} else if (e.code === 'KeyS') {
// Ctrl+Shift+S
this.call('menuicons', 'select', 'settings')
}
e.preventDefault()
}
})
const queryParams = new QueryParams()
const params = queryParams.get()
// if (params.minimizeterminal) // this.mainView.minimizeTerminal()
// if (params.minimizesidepanel) // this.resizeFeature.hidePanel()
}
}

@ -10,12 +10,12 @@ const _paq = window._paq = window._paq || []
const requiredModules = [ // services + layout views + system views
'manager', 'config', 'compilerArtefacts', 'compilerMetadata', 'contextualListener', 'editor', 'offsetToLineColumnConverter', 'network', 'theme',
'fileManager', 'contentImport', 'blockchain', 'web3Provider', 'scriptRunner', 'fetchAndCompile', 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons',
'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity-logic']
'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity-logic', 'walkthrough']
const dependentModules = ['git', 'hardhat', 'slither'] // module which shouldn't be manually activated (e.g git is activated by remixd)
export function isNative (name) {
const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'hardhat-provider', 'solidityStaticAnalysis', 'solidityUnitTesting']
const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'hardhat-provider', 'solidityStaticAnalysis', 'solidityUnitTesting', 'layout']
return nativePlugins.includes(name) || requiredModules.includes(name)
}
@ -79,6 +79,7 @@ export class RemixAppManager extends PluginManager {
onPluginActivated (plugin) {
this.pluginLoader.set(plugin, this.actives)
this.event.emit('activate', plugin)
this.emit('activate', plugin)
if (!requiredModules.includes(plugin.name)) _paq.push(['trackEvent', 'pluginManager', 'activate', plugin.name])
}

Loading…
Cancel
Save