From a9812ad4c631f395d54d635a77e4307d6c3b53aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Inez=20Korczyn=CC=81ski?= Date: Tue, 4 Jun 2013 17:41:35 -0700 Subject: [PATCH] Proper support for frame images (do not display magnify icon). Change-Id: I94792760e6b1ff69ab13501939bf8d10e0558e5b --- .../ve/ce/nodes/ve.ce.MWImageCaptionNode.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/ve/ce/nodes/ve.ce.MWImageCaptionNode.js b/modules/ve/ce/nodes/ve.ce.MWImageCaptionNode.js index c9e4f3600c..28dd987f91 100644 --- a/modules/ve/ce/nodes/ve.ce.MWImageCaptionNode.js +++ b/modules/ve/ce/nodes/ve.ce.MWImageCaptionNode.js @@ -37,19 +37,26 @@ ve.ce.MWImageCaptionNode.static.tagName = 'div'; /* Methods */ /** - * TODO: Magnify should not be built nor appended if this is a caption of frame (vs. thumb) image. + * TODO: Magnify should appear/disappear based on the changes/updates to the parent (switching to + * and from thumb or frame). */ ve.ce.MWImageCaptionNode.prototype.onSplice = function () { - if ( this.$magnify ) { - this.$magnify.detach(); - } else { - this.buildMagnify(); + var parentType = this.model.getParent().getAttribute( 'type' ); + + if ( parentType === 'thumb' ) { + if ( this.$magnify ) { + this.$magnify.detach(); + } else { + this.buildMagnify(); + } } // Call parent implementation ve.ce.BranchNode.prototype.onSplice.apply( this, arguments ); - this.$magnify.prependTo( this.$ ); + if ( parentType === 'thumb' ) { + this.$magnify.prependTo( this.$ ); + } }; ve.ce.MWImageCaptionNode.prototype.buildMagnify = function() {