TinyMCE: fix the "active" state of the Link button when an image wrapped in a link is selected, see #27847, for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@28185 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
77c156631a
commit
db22ae4e32
|
@ -15,8 +15,10 @@ tinymce.PluginManager.add( 'wplink', function( editor ) {
|
||||||
editor.addShortcut( 'ctrl+k', '', 'WP_Link' );
|
editor.addShortcut( 'ctrl+k', '', 'WP_Link' );
|
||||||
|
|
||||||
function setState( button, node ) {
|
function setState( button, node ) {
|
||||||
button.disabled( editor.selection.isCollapsed() && node.nodeName !== 'A' );
|
var parent = editor.dom.getParent( node, 'a' );
|
||||||
button.active( node.nodeName === 'A' && ! node.name );
|
|
||||||
|
button.disabled( ( editor.selection.isCollapsed() && ! parent ) || ( parent && ! parent.href ) );
|
||||||
|
button.active( parent && parent.href );
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.addButton( 'link', {
|
editor.addButton( 'link', {
|
||||||
|
|
Loading…
Reference in New Issue