WordPress.org

Make WordPress Core

Changeset 44257


Ignore:
Timestamp:
12/17/2018 01:48:05 AM (11 months ago)
Author:
SergeyBiryukov
Message:

TinyMCE: Fix the keyboard shortcut (Alt+Shift+H) to not open the default Block Editor help modal and change the title of the help modal to "Classic Block Keyboard Shortcuts" in the Classic BLock. Also remove Alt+Shift+Z in the Classic Block as it conflicts with the Block Editor.

Props azaozz.
Merges [43915] to trunk.
Fixes #45365.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js

    r44247 r44257  
    371371
    372372        dialog = editor.windowManager.open( {
    373             title: 'Keyboard Shortcuts',
     373            title: editor.settings.classic_block_editor ? 'Classic Block Keyboard Shortcuts' : 'Keyboard Shortcuts',
    374374            items: {
    375375                type: 'container',
     
    653653            o: 'InsertOrderedList',
    654654            m: 'WP_Medialib',
    655             z: 'WP_Adv',
    656655            t: 'WP_More',
    657656            d: 'Strikethrough',
    658             h: 'WP_Help',
    659657            p: 'WP_Page',
    660658            x: 'WP_Code'
     
    668666            }
    669667        } );
     668
     669        // Alt+Shift+Z removes a block in the Block Editor, don't add it to the Classic Block.
     670        if ( ! editor.settings.classic_block_editor ) {
     671            editor.addShortcut( 'access+z', '', 'WP_Adv' );
     672        }
     673
     674        // Workaround for not triggering the global help modal in the Block Editor by the Classic Block shortcut.
     675        editor.on( 'keydown', function( event ) {
     676            if ( event.shiftKey && event.altKey && event.code === 'KeyH' ) {
     677                editor.execCommand( 'WP_Help' );
     678                event.stopPropagation();
     679                event.stopImmediatePropagation();
     680                return false;
     681            }
     682
     683            return true;
     684        });
    670685
    671686        if ( window.getUserSetting( 'editor_plain_text_paste_warning' ) > 1 ) {
  • trunk/src/wp-includes/class-wp-editor.php

    r44120 r44257  
    12881288                // Shortcuts help modal
    12891289                'Keyboard Shortcuts'                   => array( __( 'Keyboard Shortcuts' ), 'accessH' ),
     1290                'Classic Block Keyboard Shortcuts'     => __( 'Classic Block Keyboard Shortcuts' ),
    12901291                'Default shortcuts,'                   => __( 'Default shortcuts,' ),
    12911292                'Additional shortcuts,'                => __( 'Additional shortcuts,' ),
Note: See TracChangeset for help on using the changeset viewer.