mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
Impl multiple codemirror event listener
This commit is contained in:
parent
fff7ebd1b5
commit
81666a726c
2 changed files with 22 additions and 9 deletions
|
@ -116,6 +116,19 @@ export default class Editor {
|
|||
utils.wrapTextWith(this.editor, cm, 'Backspace')
|
||||
}
|
||||
}
|
||||
this.eventListeners = {}
|
||||
}
|
||||
|
||||
on (event, cb) {
|
||||
if (!this.eventListeners[event]) {
|
||||
this.eventListeners[event] = [cb]
|
||||
} else {
|
||||
this.eventListeners[event].push(cb)
|
||||
}
|
||||
|
||||
this.editor.on(event, (...args) => {
|
||||
this.eventListeners[event].forEach(cb => cb(...args))
|
||||
})
|
||||
}
|
||||
|
||||
getStatusBarTemplate (callback) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue