Make WordPress Core

Ticket #30450: 30450.2.patch

File 30450.2.patch, 3.0 KB (added by azaozz, 10 years ago)
  • src/wp-admin/js/editor-expand.js

     
    808808                                _isActive = true;
    809809
    810810                                $document.trigger( 'dfw-activate' );
     811                                $content.on( 'keydown.focus-shortcut', toggleViaKeyboard );
    811812                        }
    812813                }
    813814
     
    818819                                _isActive = false;
    819820
    820821                                $document.trigger( 'dfw-deactivate' );
     822                                $content.off( 'keydown.focus-shortcut' );
    821823                        }
    822824                }
    823825
     
    858860                }
    859861
    860862                function toggle() {
    861                         ( _isOn ? off : on )();
     863                        if ( _isOn ) {
     864                                off();
     865                        } else {
     866                                on();
     867                        }
    862868                }
    863869
    864870                function isOn() {
     
    868874                function fadeOut( event ) {
    869875                        var key = event && event.keyCode;
    870876
    871                         if ( key === 27 ) {
     877                        // fadeIn and return on Escape and keyboard shortcut Alt+Shift+F.
     878                        if ( key === 27 || ( key === 87 && event.altKey && event.shiftKey ) ) {
    872879                                fadeIn();
    873880                                return;
    874881                        }
     
    10271034                                        return $.contains( $el.get( 0 ), document.activeElement );
    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();
    10331040                                }
     
    10761083                        }
    10771084                }
    10781085
     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 );
     1094                }
     1095
    10791096                $document.on( 'tinymce-editor-setup.focus', function( event, editor ) {
    10801097                        editor.addButton( 'dfw', {
    10811098                                active: _isOn,
     
    10991116                                                button.active( false );
    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
    11061127                $document.on( 'tinymce-editor-init.focus', function( event, editor ) {
     
    11381159
    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 ) {
    11441165                                                editor.focus();
  • src/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js

     
    5656                if ( editor.getParam('wp_fullscreen') ) {
    5757                        fullscreenOn();
    5858                }
    59 
    60                 editor.addShortcut( 'alt+shift+w', '', 'wpFullScreen' );
    6159        });
    6260
    6361        // Register buttons