Make WordPress Core

Changeset 27447


Ignore:
Timestamp:
03/07/2014 02:01:07 AM (10 years ago)
Author:
azaozz
Message:

TinyMCE:

  • Restore the "link" button state to disabled by default and enabled when text or image is selected.
  • Remove the (recently added) default link plugin, not needed for wpLink.

See #27309

Location:
trunk/src/wp-includes
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-editor.php

    r27428 r27447  
    212212
    213213                if ( $set['teeny'] ) {
    214                     self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'fullscreen', 'link', 'image', 'wordpress', 'wpeditimage', 'wplink' ), $editor_id );
     214                    self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink' ), $editor_id );
    215215                } else {
    216216                    /**
     
    233233                        'charmap',
    234234                        'hr',
    235                         'link',
    236235                        'media',
    237236                        'paste',
  • trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js

    r26876 r27447  
    1313        shortcut: 'Alt+Shift+A',
    1414        cmd: 'WP_Link',
     15
     16        onPostRender: function() {
     17            var ctrl = this;
     18
     19            editor.on( 'nodechange', function( event ) {
     20                var node = event.element;
     21
     22                ctrl.disabled( editor.selection.isCollapsed() && node.nodeName !== 'A' );
     23                ctrl.active( node.nodeName === 'A' && ! node.name );
     24            });
     25        }
     26    });
     27
     28    editor.addButton( 'unlink', {
     29        icon: 'unlink',
     30        tooltip: 'Remove link',
     31        cmd: 'unlink',
    1532        stateSelector: 'a[href]'
    1633    });
Note: See TracChangeset for help on using the changeset viewer.