codemirro 5.48.4

This commit is contained in:
zadam
2019-08-25 18:46:32 +02:00
parent 1f092c2656
commit 4e4beb26c6
16 changed files with 151 additions and 46 deletions

View File

@@ -24,11 +24,10 @@ class StandardWidget {
*/
constructor(ctx, options, state) {
this.ctx = ctx;
this.options = options;
this.state = state;
// construct in camelCase
this.widgetName = this.constructor.name.substr(0, 1).toLowerCase() + this.constructor.name.substr(1);
this.widgetOptions = options.getJson(this.widgetName) || {};
}
getWidgetTitle() { return "Untitled widget"; }
@@ -46,7 +45,7 @@ class StandardWidget {
this.$bodyWrapper = this.$widget.find('.body-wrapper');
this.$bodyWrapper.attr('id', widgetId);
if (this.state && this.state.expanded) {
if ((this.state && this.state.expanded) || (!this.state && this.widgetOptions.expanded)) {
this.$bodyWrapper.collapse("show");
}
@@ -86,9 +85,7 @@ class StandardWidget {
async doRenderBody() {}
async isEnabled() {
const option = this.options.getJson(this.widgetName + 'Widget');
return option ? option.enabled : true;
return this.widgetOptions.enabled;
}
isExpanded() {