setting mode to same string shouldn't reset it
This commit is contained in:
parent
9ae7bc0c04
commit
51f8f87a98
1 changed files with 19 additions and 16 deletions
|
|
@ -524,14 +524,17 @@ var EditSession = function(text, mode) {
|
|||
};
|
||||
|
||||
this.$mode = null;
|
||||
this.$origMode = null;
|
||||
this.$modeId = null;
|
||||
this.setMode = function(mode) {
|
||||
// load on demand
|
||||
if (typeof mode === "string") {
|
||||
this.$origMode = mode;
|
||||
if (this.$modeId == mode)
|
||||
return;
|
||||
|
||||
this.$modeId = mode;
|
||||
var _self = this;
|
||||
this._loadMode(mode, function(module) {
|
||||
if (_self.$origMode !== mode)
|
||||
if (_self.$modeId !== mode)
|
||||
return;
|
||||
|
||||
_self.setMode(module);
|
||||
|
|
@ -539,7 +542,7 @@ var EditSession = function(text, mode) {
|
|||
return;
|
||||
} else if (mode == null) {
|
||||
mode = "ace/mode/text"
|
||||
this.$origMode = mode;
|
||||
this.$modeId = mode;
|
||||
this.$modes[mode] = this.$modes[mode] || (new TextMode());
|
||||
this.setMode(this.$modes[mode]);
|
||||
return;
|
||||
|
|
@ -547,7 +550,7 @@ var EditSession = function(text, mode) {
|
|||
|
||||
if (this.$mode === mode) return;
|
||||
this.$mode = mode;
|
||||
|
||||
this.$modeId = mode.$id;
|
||||
|
||||
this.$stopWorker();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue