Make WordPress Core

Ticket #36781: 36781.diff

File 36781.diff, 2.0 KB (added by azaozz, 7 years ago)
  • src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

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

     
    305305                        }
    306306                } );
    307307
     308                editor.addCommand( 'wp_unlink', function() {
     309                        editor.execCommand( 'unlink' );
     310                        editor.execCommand( 'wp_link_cancel' );
     311
     312                } );
     313
    308314                // WP default shortcut
    309315                editor.addShortcut( 'access+a', '', 'WP_Link' );
    310316                // The "de-facto standard" shortcut, see #27305
     
    367373                // When doing undo and redo with keyboard shortcuts (Ctrl|Cmd+Z, Ctrl|Cmd+Shift+Z, Ctrl|Cmd+Y),
    368374                // set a flag to not focus the inline dialog. The editor has to remain focused so the users can do consecutive undo/redo.
    369375                editor.on( 'keydown', function( event ) {
     376                        if ( event.keyCode === 27 ) { // Esc
     377                                editor.execCommand( 'wp_link_cancel' );
     378                        }
     379
    370380                        if ( event.altKey || ( tinymce.Env.mac && ( ! event.metaKey || event.ctrlKey ) ) ||
    371381                                ( ! tinymce.Env.mac && ! event.ctrlKey ) ) {
    372382
     
    560570                                                toolbar.$el.find( '.wp-link-preview a' ).removeClass( 'wplink-url-error' ).attr( 'title', null );
    561571                                        }
    562572                                }
     573                        } else {
     574                                editor.execCommand( 'wp_link_cancel' );
     575
    563576                        }
    564577                } );
    565578
     
    572585                editor.addButton( 'wp_link_remove', {
    573586                        tooltip: 'Remove',
    574587                        icon: 'dashicon dashicons-no',
    575                         cmd: 'unlink'
     588                        cmd: 'wp_unlink'
    576589                } );
    577590
    578591                editor.addButton( 'wp_link_advanced', {