Mooeypoo has uploaded a new change for review. https://gerrit.wikimedia.org/r/117928
Change subject: Show/hide the magnify button on type change ...................................................................... Show/hide the magnify button on type change Make sure the magnify button in the caption is properly shown or hidden when image type changes. The magnify icon will always be built, but will be shown and hidden using CSS rules. Bug: 62139 Change-Id: Ib9a4569239ed70d16a153fb0823e283203fba1d4 --- M .docs/eg-iframe.html M modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js M modules/ve-mw/ce/styles/ve.ce.MWBlockImageNode.css 3 files changed, 16 insertions(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/28/117928/1 diff --git a/.docs/eg-iframe.html b/.docs/eg-iframe.html index e1d4211..f6ea85b 100644 --- a/.docs/eg-iframe.html +++ b/.docs/eg-iframe.html @@ -6,6 +6,7 @@ <!-- oojs-ui --> <link rel=stylesheet href="lib/ve/lib/oojs-ui/oojs-ui.svg.css"> + <link rel=stylesheet href="lib/ve/lib/oojs-ui/oojs-ui-apex.css"> <!-- visualEditor.standalone --> <link rel=stylesheet href="lib/ve/modules/ve/init/sa/styles/ve.init.sa.css"> diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js index 1eb99cb..c612964 100644 --- a/modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js +++ b/modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js @@ -37,26 +37,24 @@ /* Methods */ /** - * TODO: Magnify should appear/disappear based on the changes/updates to the parent (switching to - * and from thumb or frame). + * Reset the magnify button if the structure of the caption changed, + * so it is always rendered in the right place. + * + * The magnify icon will always be attached to the caption; we + * handle hiding and showing it per block image type in the CSS rules. */ ve.ce.MWImageCaptionNode.prototype.onSplice = function () { - var parentType = this.model.getParent().getAttribute( 'type' ); - - if ( parentType === 'thumb' ) { - if ( this.$magnify ) { - this.$magnify.detach(); - } else { - this.buildMagnify(); - } + if ( this.$magnify ) { + this.$magnify.detach(); + } else { + this.buildMagnify(); } // Parent method ve.ce.BranchNode.prototype.onSplice.apply( this, arguments ); - if ( parentType === 'thumb' ) { - this.$magnify.prependTo( this.$element ); - } + // Reset the magnify icon, prepend it to the caption + this.$magnify.prependTo( this.$element ); }; /** */ diff --git a/modules/ve-mw/ce/styles/ve.ce.MWBlockImageNode.css b/modules/ve-mw/ce/styles/ve.ce.MWBlockImageNode.css index b139054..52cce17 100644 --- a/modules/ve-mw/ce/styles/ve.ce.MWBlockImageNode.css +++ b/modules/ve-mw/ce/styles/ve.ce.MWBlockImageNode.css @@ -41,6 +41,10 @@ float: left; } +figure:not([typeof='mw:Image/Thumb']) figcaption .magnify { + display:none; +} + /* TODO: Merge with div.thumbinner styles */ figure[typeof='mw:Image/Thumb'], figure[typeof='mw:Image/Frame'] { overflow: hidden; -- To view, visit https://gerrit.wikimedia.org/r/117928 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib9a4569239ed70d16a153fb0823e283203fba1d4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Mooeypoo <mor...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits