Mooeypoo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/195332

Change subject: Use a detached icon in transclusion node
......................................................................

Use a detached icon in transclusion node

In the case the node is empty and we need an icon, use a separate
icon element that is detached and reattached as needed.

Change-Id: I5bcbe531cb1db1a4ac25ed4a2f462dde08513b7b
---
M modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
M modules/ve-mw/ce/styles/nodes/ve.ce.MWTransclusionNode.css
2 files changed, 12 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/32/195332/1

diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
index 04ad557..9eb9a34 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
@@ -24,7 +24,7 @@
 
        // Mixin constructors
        ve.ce.FocusableNode.call( this );
-       OO.ui.IconElement.call( this, $.extend( {}, config, { $icon: 
this.$element } ) );
+       OO.ui.IconElement.call( this, config );
        ve.ce.GeneratedContentNode.call( this );
 };
 
@@ -126,6 +126,8 @@
  * @see ve.ce.GeneratedContentNode#render
  */
 ve.ce.MWTransclusionNode.prototype.render = function ( generatedContents ) {
+       // Detach the icon
+       this.$icon.detach();
        // Call parent mixin
        ve.ce.GeneratedContentNode.prototype.render.call( this, 
generatedContents );
 
@@ -140,9 +142,9 @@
                        this.$element.height() < 8
                )
        ) {
-               this.setIconElement( this.$element );
-               // The template is empty or hidden
                this.setIcon( 'template' );
+               // Reattach icon
+               this.$element.prepend( this.$icon );
        } else {
                this.setIcon( null );
        }
diff --git a/modules/ve-mw/ce/styles/nodes/ve.ce.MWTransclusionNode.css 
b/modules/ve-mw/ce/styles/nodes/ve.ce.MWTransclusionNode.css
index b9fe6c8..b8d8600 100644
--- a/modules/ve-mw/ce/styles/nodes/ve.ce.MWTransclusionNode.css
+++ b/modules/ve-mw/ce/styles/nodes/ve.ce.MWTransclusionNode.css
@@ -10,8 +10,13 @@
        vertical-align: middle;
        padding: 0.2em;
        margin: -0.25em 0.15em 0 0.15em;
-       width: 1em;
-       height: 1em;
+}
+
+.ve-ce-mwTransclusionNode.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;

-- 
To view, visit https://gerrit.wikimedia.org/r/195332
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5bcbe531cb1db1a4ac25ed4a2f462dde08513b7b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to