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:
Andrew Ozz 2014-04-22 21:10:14 +00:00
parent 77c156631a
commit db22ae4e32
1 changed files with 4 additions and 2 deletions

View File

@ -15,8 +15,10 @@ tinymce.PluginManager.add( 'wplink', function( editor ) {
editor.addShortcut( 'ctrl+k', '', 'WP_Link' );
function setState( button, node ) {
button.disabled( editor.selection.isCollapsed() && node.nodeName !== 'A' );
button.active( node.nodeName === 'A' && ! node.name );
var parent = editor.dom.getParent( node, 'a' );
button.disabled( ( editor.selection.isCollapsed() && ! parent ) || ( parent && ! parent.href ) );
button.active( parent && parent.href );
}
editor.addButton( 'link', {