always call the callback form setMode

This commit is contained in:
nightwing 2015-01-05 00:02:41 +04:00
commit f4ea1ccb6a

View file

@ -893,17 +893,17 @@ var EditSession = function(text, mode) {
config.loadModule(["mode", path], function(m) {
if (this.$modeId !== path)
return cb && cb();
if (this.$modes[path] && !options)
return this.$onChangeMode(this.$modes[path]);
if (m && m.Mode) {
if (this.$modes[path] && !options) {
this.$onChangeMode(this.$modes[path]);
} else if (m && m.Mode) {
m = new m.Mode(options);
if (!options) {
this.$modes[path] = m;
m.$id = path;
}
this.$onChangeMode(m);
cb && cb();
}
cb && cb();
}.bind(this));
// set mode to text until loading is finished