emit an event after a mode is loaded
This commit is contained in:
parent
a6112a9128
commit
3ccb90ea54
4 changed files with 15 additions and 3 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -508,6 +508,10 @@ var EditSession = function(text, mode) {
|
|||
return callback(_self.$modes[mode]);
|
||||
|
||||
_self.$modes[mode] = new module.Mode();
|
||||
_self._emit("loadmode", {
|
||||
name: mode,
|
||||
mode: _self.$modes[mode]
|
||||
});
|
||||
callback(_self.$modes[mode]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ var Editor = function(renderer, session) {
|
|||
this.session.removeEventListener("changeOverwrite", this.$onCursorChange);
|
||||
this.session.removeEventListener("changeScrollTop", this.$onScrollTopChange);
|
||||
this.session.removeEventListener("changeLeftTop", this.$onScrollLeftChange);
|
||||
this.session.removeEventListener("loadmode", this.$onLoadMode);
|
||||
|
||||
var selection = this.session.getSelection();
|
||||
selection.removeEventListener("changeCursor", this.$onCursorChange);
|
||||
|
|
@ -166,6 +167,9 @@ var Editor = function(renderer, session) {
|
|||
this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
|
||||
this.session.addEventListener("changeScrollLeft", this.$onScrollLeftChange);
|
||||
|
||||
this.$onLoadMode = this.onLoadMode.bind(this);
|
||||
this.session.addEventListener("loadmode", this.$onLoadMode);
|
||||
|
||||
this.selection = session.getSelection();
|
||||
this.selection.addEventListener("changeCursor", this.$onCursorChange);
|
||||
|
||||
|
|
@ -311,6 +315,10 @@ var Editor = function(renderer, session) {
|
|||
this.onScrollLeftChange = function() {
|
||||
this.renderer.scrollToX(this.session.getScrollLeft());
|
||||
};
|
||||
|
||||
this.onLoadMode = function(e) {
|
||||
this._emit("loadmode", e);
|
||||
};
|
||||
|
||||
this.onCursorChange = function() {
|
||||
this.renderer.updateCursor();
|
||||
|
|
@ -1229,4 +1237,4 @@ var Editor = function(renderer, session) {
|
|||
|
||||
|
||||
exports.Editor = Editor;
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue