Make WordPress Core

Changeset 30593


Ignore:
Timestamp:
11/28/2014 01:43:56 AM (10 years ago)
Author:
azaozz
Message:

Editor: use the Alt+Shift+W keyboard shortcut for new DFW from both the Visual and Text editors. Props afercia, fixes #30450.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/editor-expand.js

    r30586 r30593  
    809809
    810810                $document.trigger( 'dfw-activate' );
     811                $content.on( 'keydown.focus-shortcut', toggleViaKeyboard );
    811812            }
    812813        }
     
    819820
    820821                $document.trigger( 'dfw-deactivate' );
     822                $content.off( 'keydown.focus-shortcut' );
    821823            }
    822824        }
     
    859861
    860862        function toggle() {
    861             ( _isOn ? off : on )();
     863            if ( _isOn ) {
     864                off();
     865            } else {
     866                on();
     867            }
    862868        }
    863869
     
    869875            var key = event && event.keyCode;
    870876
    871             if ( key === 27 ) {
     877            // fadeIn and return on Escape and keyboard shortcut Alt+Shift+W.
     878            if ( key === 27 || ( key === 87 && event.altKey && event.shiftKey ) ) {
    872879                fadeIn();
    873880                return;
     
    10281035                }
    10291036
    1030                 // The focussed node is before or behind the editor area, and not ouside the wrap.
     1037                // The focused node is before or behind the editor area, and not outside the wrap.
    10311038                if ( ( position === 2 || position === 4 ) && ( hasFocus( $menuWrap ) || hasFocus( $wrap ) || hasFocus( $footer ) ) ) {
    10321039                    fadeIn();
     
    10751082                $slugFocusEl.on( 'blur.focus', fadeOutSlug ).off( 'focus.focus' );
    10761083            }
     1084        }
     1085
     1086        function toggleViaKeyboard( event ) {
     1087            if ( event.altKey && event.shiftKey && 87 === event.keyCode ) {
     1088                toggle();
     1089            }
     1090        }
     1091
     1092        if ( $( '#postdivrich' ).hasClass( 'wp-editor-expand' ) ) {
     1093            $content.on( 'keydown.focus-shortcut', toggleViaKeyboard );
    10771094        }
    10781095
     
    11001117                    } );
    11011118                },
    1102                 tooltip: 'Distraction Free Writing'
     1119                tooltip: 'Distraction Free Writing',
     1120                shortcut: 'Alt+Shift+W'
    11031121            } );
     1122
     1123            editor.addCommand( 'wpToggleDFW', toggle );
     1124            editor.addShortcut( 'alt+shift+w', '', 'wpToggleDFW' );
    11041125        } );
    11051126
     
    11391160                $document.on( 'dfw-on.focus', mceBind ).on( 'dfw-off.focus', mceUnbind );
    11401161
    1141                 // Make sure the body focusses when clicking outside it.
     1162                // Make sure the body focuses when clicking outside it.
    11421163                editor.on( 'click', function( event ) {
    11431164                    if ( event.target === editor.getDoc().documentElement ) {
  • trunk/src/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js

    r30573 r30593  
    5757            fullscreenOn();
    5858        }
    59 
    60         editor.addShortcut( 'alt+shift+w', '', 'wpFullScreen' );
    6159    });
    6260
Note: See TracChangeset for help on using the changeset viewer.