Make WordPress Core

Ticket #36781: 36781.1.diff

File 36781.1.diff, 2.2 KB (added by azaozz, 9 years ago)
  • src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

     
    540540                        q: 'mceBlockQuote',
    541541                        u: 'InsertUnorderedList',
    542542                        o: 'InsertOrderedList',
    543                         s: 'unlink',
    544543                        m: 'WP_Medialib',
    545544                        z: 'WP_Adv',
    546545                        t: 'WP_More',
  • src/wp-includes/js/tinymce/plugins/wplink/plugin.js

     
    300300                        if ( ! editToolbar.tempHide ) {
    301301                                inputInstance.reset();
    302302                                removePlaceholders();
    303                                 editor.focus();
    304                                 editToolbar.tempHide = false;
    305303                        }
    306304                } );
    307305
    308                 // WP default shortcut
     306                editor.addCommand( 'wp_unlink', function() {
     307                        editor.execCommand( 'unlink' );
     308                        editToolbar.tempHide = false;
     309                        editor.execCommand( 'wp_link_cancel' );
     310                } );
     311
     312                // WP default shortcuts
    309313                editor.addShortcut( 'access+a', '', 'WP_Link' );
     314                editor.addShortcut( 'access+s', '', 'wp_unlink' );
    310315                // The "de-facto standard" shortcut, see #27305
    311316                editor.addShortcut( 'meta+k', '', 'WP_Link' );
    312317
     
    367372                // When doing undo and redo with keyboard shortcuts (Ctrl|Cmd+Z, Ctrl|Cmd+Shift+Z, Ctrl|Cmd+Y),
    368373                // set a flag to not focus the inline dialog. The editor has to remain focused so the users can do consecutive undo/redo.
    369374                editor.on( 'keydown', function( event ) {
     375                        if ( event.keyCode === 27 ) { // Esc
     376                                editor.execCommand( 'wp_link_cancel' );
     377                        }
     378
    370379                        if ( event.altKey || ( tinymce.Env.mac && ( ! event.metaKey || event.ctrlKey ) ) ||
    371380                                ( ! tinymce.Env.mac && ! event.ctrlKey ) ) {
    372381
     
    560569                                                toolbar.$el.find( '.wp-link-preview a' ).removeClass( 'wplink-url-error' ).attr( 'title', null );
    561570                                        }
    562571                                }
     572                        } else {
     573                                editor.execCommand( 'wp_link_cancel' );
    563574                        }
    564575                } );
    565576
     
    572583                editor.addButton( 'wp_link_remove', {
    573584                        tooltip: 'Remove',
    574585                        icon: 'dashicon dashicons-no',
    575                         cmd: 'unlink'
     586                        cmd: 'wp_unlink'
    576587                } );
    577588
    578589                editor.addButton( 'wp_link_advanced', {