mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-24 10:48:42 +00:00
Merge "Use iconWhenInvisible for alien extension nodes"
This commit is contained in:
commit
fe19bfb0af
|
@ -1669,8 +1669,7 @@
|
||||||
"modules/ve-mw/ui/contextitems/ve.ui.MWAlienExtensionContextItem.js"
|
"modules/ve-mw/ui/contextitems/ve.ui.MWAlienExtensionContextItem.js"
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
"modules/ve-mw/ui/styles/inspectors/ve.ui.MWAlienExtensionInspector.css",
|
"modules/ve-mw/ui/styles/inspectors/ve.ui.MWAlienExtensionInspector.css"
|
||||||
"modules/ve-mw/ce/styles/nodes/ve.ce.MWAlienExtensionNode.css"
|
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"ext.visualEditor.mwcore"
|
"ext.visualEditor.mwcore"
|
||||||
|
|
|
@ -10,60 +10,24 @@
|
||||||
*
|
*
|
||||||
* @class
|
* @class
|
||||||
* @abstract
|
* @abstract
|
||||||
* @mixins OO.ui.mixin.IconElement
|
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Object} [config] Configuration options
|
|
||||||
*/
|
*/
|
||||||
ve.ce.MWAlienExtensionNode = function VeCeMWAlienExtensionNode( config ) {
|
ve.ce.MWAlienExtensionNode = function VeCeMWAlienExtensionNode() {
|
||||||
// Mixin constructors
|
|
||||||
OO.ui.mixin.IconElement.call( this, config );
|
|
||||||
|
|
||||||
// Events
|
|
||||||
this.connect( this, { setup: 'onAlienSetup' } );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Inheritance */
|
/* Inheritance */
|
||||||
|
|
||||||
OO.initClass( ve.ce.MWAlienExtensionNode );
|
OO.initClass( ve.ce.MWAlienExtensionNode );
|
||||||
|
|
||||||
OO.mixinClass( ve.ce.MWAlienExtensionNode, OO.ui.mixin.IconElement );
|
|
||||||
|
|
||||||
/* Static members */
|
/* Static members */
|
||||||
|
|
||||||
ve.ce.MWAlienExtensionNode.static.primaryCommandName = 'alienExtension';
|
ve.ce.MWAlienExtensionNode.static.primaryCommandName = 'alienExtension';
|
||||||
|
|
||||||
|
ve.ce.MWAlienExtensionNode.static.iconWhenInvisible = 'alienextension';
|
||||||
|
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle setup events
|
|
||||||
*/
|
|
||||||
ve.ce.MWAlienExtensionNode.prototype.onAlienSetup = function () {
|
|
||||||
if ( !this.isVisible() ) {
|
|
||||||
this.setIcon( 'alienextension' );
|
|
||||||
this.$element.first().prepend( this.$icon );
|
|
||||||
} else {
|
|
||||||
this.setIcon( null );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritdoc ve.ce.MWExtensionNode
|
|
||||||
*/
|
|
||||||
ve.ce.MWAlienExtensionNode.prototype.render = function ( generatedContents ) {
|
|
||||||
// Since render is triggered before onSetup, we need to make sure that the
|
|
||||||
// icon is detached only when it is defined and is not null
|
|
||||||
if ( this.$icon ) {
|
|
||||||
this.$icon.detach();
|
|
||||||
}
|
|
||||||
// Call parent mixin
|
|
||||||
ve.ce.GeneratedContentNode.prototype.render.call( this, generatedContents );
|
|
||||||
|
|
||||||
// Since render replaces this.$element with a new node, we need to make sure
|
|
||||||
// our iconElement is defined again to be this.$element
|
|
||||||
this.$element.addClass( 've-ce-mwAlienExtensionNode' );
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Static methods */
|
/* Static methods */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
/*!
|
|
||||||
* VisualEditor ContentEditable MediaWiki MWAlienExtensionNode styles.
|
|
||||||
*
|
|
||||||
* @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
|
|
||||||
* @license The MIT License (MIT); see LICENSE.txt
|
|
||||||
*/
|
|
||||||
|
|
||||||
.ve-ce-mwAlienExtensionNode.oo-ui-iconElement {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
padding: 0.2em;
|
|
||||||
margin: -0.25em 0.15em 0 0.15em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ve-ce-mwAlienExtensionNode.oo-ui-iconElement .oo-ui-iconElement-icon {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
width: 1.25em;
|
|
||||||
height: 1.25em;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center center;
|
|
||||||
background-size: 24px 24px;
|
|
||||||
opacity: 0.5;
|
|
||||||
}
|
|
Loading…
Reference in a new issue