Editor: use the Alt+Shift+W keyboard shortcut for new DFW from both the Visual and Text editors. Props afercia, fixes #30450.
Built from https://develop.svn.wordpress.org/trunk@30593 git-svn-id: http://core.svn.wordpress.org/trunk@30583 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8f219ed949
commit
9e8f2c7794
|
@ -808,6 +808,7 @@
|
|||
_isActive = true;
|
||||
|
||||
$document.trigger( 'dfw-activate' );
|
||||
$content.on( 'keydown.focus-shortcut', toggleViaKeyboard );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -818,6 +819,7 @@
|
|||
_isActive = false;
|
||||
|
||||
$document.trigger( 'dfw-deactivate' );
|
||||
$content.off( 'keydown.focus-shortcut' );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -858,7 +860,11 @@
|
|||
}
|
||||
|
||||
function toggle() {
|
||||
( _isOn ? off : on )();
|
||||
if ( _isOn ) {
|
||||
off();
|
||||
} else {
|
||||
on();
|
||||
}
|
||||
}
|
||||
|
||||
function isOn() {
|
||||
|
@ -868,7 +874,8 @@
|
|||
function fadeOut( event ) {
|
||||
var key = event && event.keyCode;
|
||||
|
||||
if ( key === 27 ) {
|
||||
// fadeIn and return on Escape and keyboard shortcut Alt+Shift+W.
|
||||
if ( key === 27 || ( key === 87 && event.altKey && event.shiftKey ) ) {
|
||||
fadeIn();
|
||||
return;
|
||||
}
|
||||
|
@ -1027,7 +1034,7 @@
|
|||
return $.contains( $el.get( 0 ), document.activeElement );
|
||||
}
|
||||
|
||||
// The focussed node is before or behind the editor area, and not ouside the wrap.
|
||||
// The focused node is before or behind the editor area, and not outside the wrap.
|
||||
if ( ( position === 2 || position === 4 ) && ( hasFocus( $menuWrap ) || hasFocus( $wrap ) || hasFocus( $footer ) ) ) {
|
||||
fadeIn();
|
||||
}
|
||||
|
@ -1076,6 +1083,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
function toggleViaKeyboard( event ) {
|
||||
if ( event.altKey && event.shiftKey && 87 === event.keyCode ) {
|
||||
toggle();
|
||||
}
|
||||
}
|
||||
|
||||
if ( $( '#postdivrich' ).hasClass( 'wp-editor-expand' ) ) {
|
||||
$content.on( 'keydown.focus-shortcut', toggleViaKeyboard );
|
||||
}
|
||||
|
||||
$document.on( 'tinymce-editor-setup.focus', function( event, editor ) {
|
||||
editor.addButton( 'dfw', {
|
||||
active: _isOn,
|
||||
|
@ -1099,8 +1116,12 @@
|
|||
button.active( false );
|
||||
} );
|
||||
},
|
||||
tooltip: 'Distraction Free Writing'
|
||||
tooltip: 'Distraction Free Writing',
|
||||
shortcut: 'Alt+Shift+W'
|
||||
} );
|
||||
|
||||
editor.addCommand( 'wpToggleDFW', toggle );
|
||||
editor.addShortcut( 'alt+shift+w', '', 'wpToggleDFW' );
|
||||
} );
|
||||
|
||||
$document.on( 'tinymce-editor-init.focus', function( event, editor ) {
|
||||
|
@ -1138,7 +1159,7 @@
|
|||
|
||||
$document.on( 'dfw-on.focus', mceBind ).on( 'dfw-off.focus', mceUnbind );
|
||||
|
||||
// Make sure the body focusses when clicking outside it.
|
||||
// Make sure the body focuses when clicking outside it.
|
||||
editor.on( 'click', function( event ) {
|
||||
if ( event.target === editor.getDoc().documentElement ) {
|
||||
editor.focus();
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -56,8 +56,6 @@ tinymce.PluginManager.add( 'wpfullscreen', function( editor ) {
|
|||
if ( editor.getParam('wp_fullscreen') ) {
|
||||
fullscreenOn();
|
||||
}
|
||||
|
||||
editor.addShortcut( 'alt+shift+w', '', 'wpFullScreen' );
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
|
|
|
@ -1 +1 @@
|
|||
tinymce.PluginManager.add("wpfullscreen",function(a){function b(){f.wp_fullscreen=!0,a.dom.addClass(a.getDoc().documentElement,"wp-fullscreen"),a.execCommand("wpAutoResizeOn")}function c(){f.wp_fullscreen=!1,a.dom.removeClass(a.getDoc().documentElement,"wp-fullscreen"),a.execCommand("wpAutoResizeOff")}function d(){return"undefined"!=typeof wp&&wp.editor&&wp.editor.fullscreen}function e(){var b=d();b&&(a.getParam("wp_fullscreen")?b.off():b.on())}var f=a.settings;a.addCommand("wpFullScreenOn",b),a.addCommand("wpFullScreenOff",c),a.addCommand("wpFullScreen",e),a.on("keydown",function(a){var b;27===a.keyCode&&(b=d())&&b.settings.visible&&b.off()}),a.on("init",function(){a.getParam("wp_fullscreen")&&b(),a.addShortcut("alt+shift+w","","wpFullScreen")}),a.addButton("wp_fullscreen",{tooltip:"Distraction Free Writing",shortcut:"Alt+Shift+W",onclick:e,classes:"wp-fullscreen btn widget"}),a.addMenuItem("wp_fullscreen",{text:"Distraction Free Writing",icon:"wp_fullscreen",shortcut:"Alt+Shift+W",context:"view",onclick:e})});
|
||||
tinymce.PluginManager.add("wpfullscreen",function(a){function b(){f.wp_fullscreen=!0,a.dom.addClass(a.getDoc().documentElement,"wp-fullscreen"),a.execCommand("wpAutoResizeOn")}function c(){f.wp_fullscreen=!1,a.dom.removeClass(a.getDoc().documentElement,"wp-fullscreen"),a.execCommand("wpAutoResizeOff")}function d(){return"undefined"!=typeof wp&&wp.editor&&wp.editor.fullscreen}function e(){var b=d();b&&(a.getParam("wp_fullscreen")?b.off():b.on())}var f=a.settings;a.addCommand("wpFullScreenOn",b),a.addCommand("wpFullScreenOff",c),a.addCommand("wpFullScreen",e),a.on("keydown",function(a){var b;27===a.keyCode&&(b=d())&&b.settings.visible&&b.off()}),a.on("init",function(){a.getParam("wp_fullscreen")&&b()}),a.addButton("wp_fullscreen",{tooltip:"Distraction Free Writing",shortcut:"Alt+Shift+W",onclick:e,classes:"wp-fullscreen btn widget"}),a.addMenuItem("wp_fullscreen",{text:"Distraction Free Writing",icon:"wp_fullscreen",shortcut:"Alt+Shift+W",context:"view",onclick:e})});
|
Binary file not shown.
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.1-beta2-30592';
|
||||
$wp_version = '4.1-beta2-30593';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue