Commit 5f05fb2a authored by Grandschtroumpf's avatar Grandschtroumpf

Use emit function from plugin

parent 4abd9f35
......@@ -73,16 +73,22 @@ export class SidePanel extends AbstractPanel {
verticalIcons.events.on('toggleContent', (name) => {
if (!this.contents[name]) return
if (this.active === name) {
// TODO: Only keep `this.emit` (issue#2210)
this.emit('toggle', name)
this.events.emit('toggle', name)
return
}
this.showContent(name)
// TODO: Only keep `this.emit` (issue#2210)
this.emit('showing', name)
this.events.emit('showing', name)
})
// Force opening
verticalIcons.events.on('showContent', (name) => {
if (!this.contents[name]) return
this.showContent(name)
// TODO: Only keep `this.emit` (issue#2210)
this.emit('showing', name)
this.events.emit('showing', name)
})
}
......
......@@ -187,6 +187,8 @@ export class VerticalIcons extends Plugin {
*/
select (name) {
this.updateActivations(name)
// TODO: Only keep `this.emit` (issue#2210)
this.emit('showContent', name)
this.events.emit('showContent', name)
}
......@@ -196,6 +198,8 @@ export class VerticalIcons extends Plugin {
*/
toggle (name) {
this.updateActivations(name)
// TODO: Only keep `this.emit` (issue#2210)
this.emit('toggleContent', name)
this.events.emit('toggleContent', name)
}
......
......@@ -85,6 +85,8 @@ class FileManager extends Plugin {
this.switchFile(newFocus)
}
}
// TODO: Only keep `this.emit` (issue#2210)
this.emit('fileRenamed', oldName, newName)
this.events.emit('fileRenamed', oldName, newName)
}
......@@ -104,8 +106,12 @@ class FileManager extends Plugin {
delete this.openedFiles[name]
if (!Object.keys(this.openedFiles).length) {
this._deps.config.set('currentFile', '')
// TODO: Only keep `this.emit` (issue#2210)
this.emit('noFileSelected')
this.events.emit('noFileSelected')
}
// TODO: Only keep `this.emit` (issue#2210)
this.emit('fileClosed', name)
this.events.emit('fileClosed', name)
}
......@@ -234,6 +240,8 @@ class FileManager extends Plugin {
}
this.editor.discard(path)
delete this.openedFiles[path]
// TODO: Only keep `this.emit` (issue#2210)
this.emit('fileRemoved', path)
this.events.emit('fileRemoved', path)
this.switchFile()
}
......@@ -241,6 +249,8 @@ class FileManager extends Plugin {
unselectCurrentFile () {
this.saveCurrentFile()
this._deps.config.set('currentFile', '')
// TODO: Only keep `this.emit` (issue#2210)
this.emit('noFileSelected')
this.events.emit('noFileSelected')
}
......@@ -258,6 +268,8 @@ class FileManager extends Plugin {
} else {
this.editor.open(file, content)
}
// TODO: Only keep `this.emit` (issue#2210)
this.emit('currentFileChanged', file)
this.events.emit('currentFileChanged', file)
}
})
......@@ -271,6 +283,8 @@ class FileManager extends Plugin {
if (fileList.length) {
_switchFile(browserProvider.type + '/' + fileList[0])
} else {
// TODO: Only keep `this.emit` (issue#2210)
this.emit('noFileSelected')
this.events.emit('noFileSelected')
}
})
......
......@@ -60,6 +60,8 @@ export class ThemeModule extends Plugin {
document.getElementById('theme-link').setAttribute('href', nextTheme.url)
document.documentElement.style.setProperty('--theme', nextTheme.quality)
if (themeName) this.active = themeName
// TODO: Only keep `this.emit` (issue#2210)
this.emit('themeChanged', nextTheme)
this.events.emit('themeChanged', nextTheme)
}
}
......@@ -10,6 +10,7 @@ export class FramingService {
start () {
this.sidePanel.events.on('toggle', () => {
console.log('Toggled')
this.resizeFeature.panel1.clientWidth !== 0 ? this.resizeFeature.minimize() : this.resizeFeature.maximise()
})
this.sidePanel.events.on('showing', () => {
......
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