Commit 113d4474 authored by yann300's avatar yann300

remove registry dependency

parent 3df4c9b9
...@@ -7,8 +7,6 @@ import * as packageJson from '../../../../../package.json' ...@@ -7,8 +7,6 @@ import * as packageJson from '../../../../../package.json'
const EventManager = require('../../lib/events') const EventManager = require('../../lib/events')
const globalRegistry = require('../../global/registry')
const profile = { const profile = {
displayName: 'Editor', displayName: 'Editor',
name: 'editor', name: 'editor',
...@@ -20,13 +18,6 @@ const profile = { ...@@ -20,13 +18,6 @@ const profile = {
class Editor extends Plugin { class Editor extends Plugin {
constructor () { constructor () {
super(profile) super(profile)
// Dependancies
this._components = {}
this._components.registry = globalRegistry
this._deps = {
config: this._components.registry.get('config').api,
themeModule: this._components.registry.get('themeModule').api
}
this._themes = { this._themes = {
light: 'light', light: 'light',
...@@ -35,11 +26,12 @@ class Editor extends Plugin { ...@@ -35,11 +26,12 @@ class Editor extends Plugin {
} }
const translateTheme = (theme) => this._themes[theme.name === 'Dark' ? 'remixDark' : theme.quality] const translateTheme = (theme) => this._themes[theme.name === 'Dark' ? 'remixDark' : theme.quality]
this._deps.themeModule.events.on('themeChanged', (theme) => { this.on('themeModule', 'themeChanged', (theme) => {
this.currentTheme = translateTheme(theme) this.currentTheme = translateTheme(theme)
this.renderComponent() this.renderComponent()
}) })
this.currentTheme = translateTheme(this._deps.themeModule.currentTheme()) this.call('themeModule', 'currentTheme', (theme) => this.currentTheme = translateTheme(theme))
// Init // Init
this.event = new EventManager() this.event = new EventManager()
this.sessions = {} this.sessions = {}
...@@ -130,8 +122,8 @@ class Editor extends Plugin { ...@@ -130,8 +122,8 @@ class Editor extends Plugin {
this.off('sidePanel', 'pluginDisabled') this.off('sidePanel', 'pluginDisabled')
} }
_onChange (file) { async _onChange (file) {
const currentFile = this._deps.config.get('currentFile') const currentFile = await this.call('fileManager', 'file')
if (!currentFile) { if (!currentFile) {
return return
} }
......
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