Skip to content

Commit

Permalink
Merge branch 't/11814'
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Apr 30, 2014
2 parents 1c28d47 + 05d0613 commit 53f341e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Fixed Issues:
* [#11626](http://dev.ckeditor.com/ticket/11626): Fixed: [Table Resize](http://ckeditor.com/addon/tableresize) sets invalid width.
* [#11872](http://dev.ckeditor.com/ticket/11872): Made [`element.addClass()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-addClass) chainable symmetrically to [`element.removeClass()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-removeClass).
* [#11813](http://dev.ckeditor.com/ticket/11813): Fixed: Link lost while pasting captioned image and restoring undo snapshot ([Enhanced Image](http://ckeditor.com/addon/image2)).
* [#11814](http://dev.ckeditor.com/ticket/11814): Fixed: _Link_ and _Unlink_ entries persistently displayed in [Enhanced Image](http://ckeditor.com/addon/image2) context menu.

Other changes:

Expand Down
16 changes: 11 additions & 5 deletions plugins/image2/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,10 @@
evt.data.image = CKEDITOR.TRISTATE_OFF;

// Integrate context menu items for link.
evt.data.link = CKEDITOR.TRISTATE_OFF;
evt.data.unlink = this.parts.link ?
CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED;
// Note that widget may be wrapped in a link, which
// does not belong to that widget (#11814).
if ( this.parts.link || this.wrapper.getAscendant( 'a' ) )
evt.data.link = evt.data.unlink = CKEDITOR.TRISTATE_OFF;
} );

// Pass the reference to this widget to the dialog.
Expand Down Expand Up @@ -1403,7 +1404,9 @@
editor.getCommand( 'unlink' ).on( 'exec', function( evt ) {
var widget = getFocusedWidget( editor );

if ( !widget )
// Override unlink only when link truly belongs to the widget.
// If wrapped inline widget in a link, let default unlink work (#11814).
if ( !widget || !widget.parts.link )
return;

widget.setData( 'link', null );
Expand All @@ -1422,7 +1425,10 @@
if ( !widget )
return;

this.setState( widget.data.link ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );
// Note that widget may be wrapped in a link, which
// does not belong to that widget (#11814).
this.setState( widget.data.link || widget.wrapper.getAscendant( 'a' ) ?
CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );

evt.cancel();
} );
Expand Down

0 comments on commit 53f341e

Please sign in to comment.