WordPress.org

Make WordPress Core

Ticket #27847: 27847.patch

File 27847.patch, 754 bytes (added by azaozz, 6 years ago)
  • src/wp-includes/js/tinymce/plugins/wplink/plugin.js

     
    1515        editor.addShortcut( 'ctrl+k', '', 'WP_Link' );
    1616
    1717        function setState( button, node ) {
    18                 button.disabled( editor.selection.isCollapsed() && node.nodeName !== 'A' );
    19                 button.active( node.nodeName === 'A' && ! node.name );
     18                var parent = editor.dom.getParent( node, 'a' );
     19
     20                button.disabled( ( editor.selection.isCollapsed() && ! parent ) || ( parent && ! parent.href ) );
     21                button.active( parent && parent.href );
    2022        }
    2123
    2224        editor.addButton( 'link', {