Skip to content

Commit 53f341e

Browse files
committed
Merge branch 't/11814'
2 parents 1c28d47 + 05d0613 commit 53f341e

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Fixed Issues:
1212
* [#11626](http://dev.ckeditor.com/ticket/11626): Fixed: [Table Resize](http://ckeditor.com/addon/tableresize) sets invalid width.
1313
* [#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).
1414
* [#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)).
15+
* [#11814](http://dev.ckeditor.com/ticket/11814): Fixed: _Link_ and _Unlink_ entries persistently displayed in [Enhanced Image](http://ckeditor.com/addon/image2) context menu.
1516

1617
Other changes:
1718

plugins/image2/plugin.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,10 @@
432432
evt.data.image = CKEDITOR.TRISTATE_OFF;
433433

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

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

1406-
if ( !widget )
1407+
// Override unlink only when link truly belongs to the widget.
1408+
// If wrapped inline widget in a link, let default unlink work (#11814).
1409+
if ( !widget || !widget.parts.link )
14071410
return;
14081411

14091412
widget.setData( 'link', null );
@@ -1422,7 +1425,10 @@
14221425
if ( !widget )
14231426
return;
14241427

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

14271433
evt.cancel();
14281434
} );

0 commit comments

Comments
 (0)