diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js index 8367a18264..563acd4981 100644 --- a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js +++ b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js @@ -31,6 +31,8 @@ ve.ui.MWExtensionInspector.static.nodeView = null; ve.ui.MWExtensionInspector.static.nodeModel = null; +ve.ui.MWExtensionInspector.static.removeable = false; + /* Methods */ /** diff --git a/modules/ve/ui/ve.ui.Inspector.js b/modules/ve/ui/ve.ui.Inspector.js index e56dc06d40..93f208225a 100644 --- a/modules/ve/ui/ve.ui.Inspector.js +++ b/modules/ve/ui/ve.ui.Inspector.js @@ -35,6 +35,15 @@ ve.inheritClass( ve.ui.Inspector, ve.ui.Window ); ve.ui.Inspector.static.titleMessage = 've-ui-inspector-title'; +/** + * The inspector comes with a remove button + + * @static + * @inheritable + * @property {boolean} + */ +ve.ui.Inspector.static.removeable = true; + /* Methods */ /** @@ -52,9 +61,11 @@ ve.ui.Inspector.prototype.initialize = function () { this.closeButton = new ve.ui.IconButtonWidget( { '$$': this.$$, 'icon': 'previous', 'title': ve.msg( 'visualeditor-inspector-close-tooltip' ) } ); - this.removeButton = new ve.ui.IconButtonWidget( { - '$$': this.$$, 'icon': 'remove', 'title': ve.msg( 'visualeditor-inspector-remove-tooltip' ) - } ); + if ( this.constructor.static.removeable ) { + this.removeButton = new ve.ui.IconButtonWidget( { + '$$': this.$$, 'icon': 'remove', 'title': ve.msg( 'visualeditor-inspector-remove-tooltip' ) + } ); + } // Events this.$form.on( { @@ -62,12 +73,17 @@ ve.ui.Inspector.prototype.initialize = function () { 'keydown': ve.bind( this.onFormKeyDown, this ) } ); this.closeButton.connect( this, { 'click': 'onCloseButtonClick' } ); - this.removeButton.connect( this, { 'click': 'onRemoveButtonClick' } ); + if ( this.constructor.static.removeable ) { + this.removeButton.connect( this, { 'click': 'onRemoveButtonClick' } ); + } // Initialization this.closeButton.$.addClass( 've-ui-inspector-closeButton' ); - this.removeButton.$.addClass( 've-ui-inspector-removeButton' ); - this.$head.prepend( this.closeButton.$ ).append( this.removeButton.$ ); + this.$head.prepend( this.closeButton.$ ); + if ( this.constructor.static.removeable ) { + this.removeButton.$.addClass( 've-ui-inspector-removeButton' ); + this.$head.append( this.removeButton.$ ); + } this.$body.append( this.$form ); };