Ticket #30450: 30450.2.patch
File 30450.2.patch, 3.0 KB (added by , 10 years ago) |
---|
-
src/wp-admin/js/editor-expand.js
808 808 _isActive = true; 809 809 810 810 $document.trigger( 'dfw-activate' ); 811 $content.on( 'keydown.focus-shortcut', toggleViaKeyboard ); 811 812 } 812 813 } 813 814 … … 818 819 _isActive = false; 819 820 820 821 $document.trigger( 'dfw-deactivate' ); 822 $content.off( 'keydown.focus-shortcut' ); 821 823 } 822 824 } 823 825 … … 858 860 } 859 861 860 862 function toggle() { 861 ( _isOn ? off : on )(); 863 if ( _isOn ) { 864 off(); 865 } else { 866 on(); 867 } 862 868 } 863 869 864 870 function isOn() { … … 868 874 function fadeOut( event ) { 869 875 var key = event && event.keyCode; 870 876 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 ) ) { 872 879 fadeIn(); 873 880 return; 874 881 } … … 1027 1034 return $.contains( $el.get( 0 ), document.activeElement ); 1028 1035 } 1029 1036 1030 // The focus sed 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. 1031 1038 if ( ( position === 2 || position === 4 ) && ( hasFocus( $menuWrap ) || hasFocus( $wrap ) || hasFocus( $footer ) ) ) { 1032 1039 fadeIn(); 1033 1040 } … … 1076 1083 } 1077 1084 } 1078 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 ); 1094 } 1095 1079 1096 $document.on( 'tinymce-editor-setup.focus', function( event, editor ) { 1080 1097 editor.addButton( 'dfw', { 1081 1098 active: _isOn, … … 1099 1116 button.active( false ); 1100 1117 } ); 1101 1118 }, 1102 tooltip: 'Distraction Free Writing' 1119 tooltip: 'Distraction Free Writing', 1120 shortcut: 'Alt+Shift+W' 1103 1121 } ); 1122 1123 editor.addCommand( 'wpToggleDFW', toggle ); 1124 editor.addShortcut( 'alt+shift+w', '', 'wpToggleDFW' ); 1104 1125 } ); 1105 1126 1106 1127 $document.on( 'tinymce-editor-init.focus', function( event, editor ) { … … 1138 1159 1139 1160 $document.on( 'dfw-on.focus', mceBind ).on( 'dfw-off.focus', mceUnbind ); 1140 1161 1141 // Make sure the body focus ses when clicking outside it.1162 // Make sure the body focuses when clicking outside it. 1142 1163 editor.on( 'click', function( event ) { 1143 1164 if ( event.target === editor.getDoc().documentElement ) { 1144 1165 editor.focus(); -
src/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js
56 56 if ( editor.getParam('wp_fullscreen') ) { 57 57 fullscreenOn(); 58 58 } 59 60 editor.addShortcut( 'alt+shift+w', '', 'wpFullScreen' );61 59 }); 62 60 63 61 // Register buttons