add callback to setTheme as well
This commit is contained in:
parent
855853139a
commit
3667a15e8d
1 changed files with 5 additions and 4 deletions
|
|
@ -1257,10 +1257,10 @@ var VirtualRenderer = function(container, theme) {
|
||||||
/**
|
/**
|
||||||
* [Sets a new theme for the editor. `theme` should exist, and be a directory path, like `ace/theme/textmate`.]{: #VirtualRenderer.setTheme}
|
* [Sets a new theme for the editor. `theme` should exist, and be a directory path, like `ace/theme/textmate`.]{: #VirtualRenderer.setTheme}
|
||||||
* @param {String} theme The path to a theme
|
* @param {String} theme The path to a theme
|
||||||
*
|
* @param {Function} cb optional callback
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setTheme = function(theme) {
|
this.setTheme = function(theme, cb) {
|
||||||
var _self = this;
|
var _self = this;
|
||||||
this.$themeValue = theme;
|
this.$themeValue = theme;
|
||||||
_self._dispatchEvent('themeChange',{theme:theme});
|
_self._dispatchEvent('themeChange',{theme:theme});
|
||||||
|
|
@ -1274,7 +1274,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
|
|
||||||
function afterLoad(module) {
|
function afterLoad(module) {
|
||||||
if (_self.$themeValue != theme)
|
if (_self.$themeValue != theme)
|
||||||
return;
|
return cb && cb();
|
||||||
if (!module.cssClass)
|
if (!module.cssClass)
|
||||||
return;
|
return;
|
||||||
dom.importCssString(
|
dom.importCssString(
|
||||||
|
|
@ -1303,7 +1303,8 @@ var VirtualRenderer = function(container, theme) {
|
||||||
_self.onResize();
|
_self.onResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
_self._dispatchEvent('themeLoaded',{theme:module});
|
_self._dispatchEvent('themeLoaded', {theme:module});
|
||||||
|
cb && cb();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue