summaryrefslogtreecommitdiff
path: root/public/js/lib/editor/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/lib/editor/index.js')
-rw-r--r--public/js/lib/editor/index.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/public/js/lib/editor/index.js b/public/js/lib/editor/index.js
index 6ae40d82..8d617247 100644
--- a/public/js/lib/editor/index.js
+++ b/public/js/lib/editor/index.js
@@ -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) {