Make WordPress Core

Changeset 27449


Ignore:
Timestamp:
03/07/2014 03:09:00 AM (11 years ago)
Author:
azaozz
Message:

TinyMCE: add Ctrl+K, the "de-facto standard" shortcut to open wpLink, fixes #27305

Location:
trunk/src/wp-includes/js/tinymce/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

    r27372 r27449  
    421421    editor.addShortcut( modKey + '+o', '', 'InsertOrderedList' );
    422422    editor.addShortcut( modKey + '+n', '', 'mceSpellCheck' );
    423     editor.addShortcut( modKey + '+a', '', 'WP_Link' );
    424423    editor.addShortcut( modKey + '+s', '', 'unlink' );
    425424    editor.addShortcut( modKey + '+m', '', 'WP_Medialib' );
  • trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js

    r27447 r27449  
    11/* global tinymce */
    22tinymce.PluginManager.add( 'wplink', function( editor ) {
     3    var linkButton;
     4   
    35    // Register a command so that it can be invoked by using tinyMCE.activeEditor.execCommand( 'WP_Link' );
    46    editor.addCommand( 'WP_Link', function() {
    5         if ( typeof window.wpLink !== 'undefined' ) {
     7        if ( ( ! linkButton || ! linkButton.disabled() ) && typeof window.wpLink !== 'undefined' ) {
    68            window.wpLink.open( editor.id );
    79        }
    810    });
     11
     12    // WP default shortcut
     13    editor.addShortcut( 'alt+shift+a', '', 'WP_Link' );
     14    // The "de-facto standard" shortcut, see #27305
     15    editor.addShortcut( 'ctrl+k', '', 'WP_Link' );
    916
    1017    editor.addButton( 'link', {
     
    1522
    1623        onPostRender: function() {
    17             var ctrl = this;
     24            linkButton = this;
    1825
    1926            editor.on( 'nodechange', function( event ) {
    2027                var node = event.element;
    2128
    22                 ctrl.disabled( editor.selection.isCollapsed() && node.nodeName !== 'A' );
    23                 ctrl.active( node.nodeName === 'A' && ! node.name );
     29                linkButton.disabled( editor.selection.isCollapsed() && node.nodeName !== 'A' );
     30                linkButton.active( node.nodeName === 'A' && ! node.name );
    2431            });
    2532        }
Note: See TracChangeset for help on using the changeset viewer.