DFW: fix closing only the wpLink or media modal when pressing Esc.
Built from https://develop.svn.wordpress.org/trunk@28455 git-svn-id: http://core.svn.wordpress.org/trunk@28282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
877fad9f38
commit
f184243aa3
|
@ -510,10 +510,11 @@
|
|||
}
|
||||
});
|
||||
|
||||
$( window ).on( 'keyup', function( event ) {
|
||||
$( window ).on( 'keydown.wp-fullscreen', function( event ) {
|
||||
// Turn fullscreen off when Esc is pressed.
|
||||
if ( 27 === event.keyCode && s.visible ) {
|
||||
api.off();
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -63,27 +63,33 @@ tinymce.PluginManager.add( 'wpfullscreen', function( editor ) {
|
|||
editor.addCommand( 'wpFullScreenOn', fullscreenOn );
|
||||
editor.addCommand( 'wpFullScreenOff', fullscreenOff );
|
||||
|
||||
function toggleFullscreen() {
|
||||
// Toggle DFW mode. For use from inside the editor.
|
||||
if ( typeof wp === 'undefined' || ! wp.editor || ! wp.editor.fullscreen ) {
|
||||
return;
|
||||
function getExtAPI() {
|
||||
return ( typeof wp !== 'undefined' && wp.editor && wp.editor.fullscreen );
|
||||
}
|
||||
|
||||
// Toggle DFW mode. For use from inside the editor.
|
||||
function toggleFullscreen() {
|
||||
var fullscreen = getExtAPI();
|
||||
|
||||
if ( fullscreen ) {
|
||||
if ( editor.getParam('wp_fullscreen') ) {
|
||||
wp.editor.fullscreen.off();
|
||||
fullscreen.off();
|
||||
} else {
|
||||
wp.editor.fullscreen.on();
|
||||
fullscreen.on();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
editor.addCommand( 'wpFullScreen', toggleFullscreen );
|
||||
|
||||
editor.on( 'keyup', function( event ) {
|
||||
editor.on( 'keydown', function( event ) {
|
||||
var fullscreen;
|
||||
|
||||
// Turn fullscreen off when Esc is pressed.
|
||||
if ( event.keyCode === 27 && wp.editor.fullscreen.settings.visible ) {
|
||||
wp.editor.fullscreen.off();
|
||||
if ( event.keyCode === 27 && ( fullscreen = getExtAPI() ) && fullscreen.settings.visible ) {
|
||||
fullscreen.off();
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
||||
editor.on( 'init', function() {
|
||||
// Set the editor when initializing from whitin DFW
|
||||
|
|
|
@ -1 +1 @@
|
|||
tinymce.PluginManager.add("wpfullscreen",function(a){function b(c){var d,e,f=a.getDoc(),h=f.body,i=tinymce.DOM,j=250;c&&"setcontent"===c.type&&c.initial||a.settings.inline||(e=tinymce.Env.ie?h.scrollHeight:tinymce.Env.webkit&&0===h.clientHeight?0:h.offsetHeight,e>250&&(j=e),h.scrollTop=0,j!==g&&(d=j-g,i.setStyle(i.get(a.id+"_ifr"),"height",j+"px"),g=j,tinymce.isWebKit&&0>d&&b(c)))}function c(){f.wp_fullscreen=!0,a.dom.addClass(a.getDoc().documentElement,"wp-fullscreen"),a.on("change setcontent paste keyup",b)}function d(){f.wp_fullscreen=!1,a.dom.removeClass(a.getDoc().documentElement,"wp-fullscreen"),a.off("change setcontent paste keyup",b),g=0}function e(){"undefined"!=typeof wp&&wp.editor&&wp.editor.fullscreen&&(a.getParam("wp_fullscreen")?wp.editor.fullscreen.off():wp.editor.fullscreen.on())}var f=a.settings,g=0;a.addCommand("wpAutoResize",b),a.addCommand("wpFullScreenOn",c),a.addCommand("wpFullScreenOff",d),a.addCommand("wpFullScreen",e),a.on("keyup",function(a){27===a.keyCode&&wp.editor.fullscreen.settings.visible&&wp.editor.fullscreen.off()}),a.on("init",function(){a.getParam("wp_fullscreen")&&c(),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(c){var d,e,f=a.getDoc(),g=f.body,i=tinymce.DOM,j=250;c&&"setcontent"===c.type&&c.initial||a.settings.inline||(e=tinymce.Env.ie?g.scrollHeight:tinymce.Env.webkit&&0===g.clientHeight?0:g.offsetHeight,e>250&&(j=e),g.scrollTop=0,j!==h&&(d=j-h,i.setStyle(i.get(a.id+"_ifr"),"height",j+"px"),h=j,tinymce.isWebKit&&0>d&&b(c)))}function c(){g.wp_fullscreen=!0,a.dom.addClass(a.getDoc().documentElement,"wp-fullscreen"),a.on("change setcontent paste keyup",b)}function d(){g.wp_fullscreen=!1,a.dom.removeClass(a.getDoc().documentElement,"wp-fullscreen"),a.off("change setcontent paste keyup",b),h=0}function e(){return"undefined"!=typeof wp&&wp.editor&&wp.editor.fullscreen}function f(){var b=e();b&&(a.getParam("wp_fullscreen")?b.off():b.on())}var g=a.settings,h=0;a.addCommand("wpAutoResize",b),a.addCommand("wpFullScreenOn",c),a.addCommand("wpFullScreenOff",d),a.addCommand("wpFullScreen",f),a.on("keydown",function(a){var b;27===a.keyCode&&(b=e())&&b.settings.visible&&b.off()}),a.on("init",function(){a.getParam("wp_fullscreen")&&c(),a.addShortcut("alt+shift+w","","wpFullScreen")}),a.addButton("wp_fullscreen",{tooltip:"Distraction Free Writing",shortcut:"Alt+Shift+W",onclick:f,classes:"wp-fullscreen btn widget"}),a.addMenuItem("wp_fullscreen",{text:"Distraction Free Writing",icon:"wp_fullscreen",shortcut:"Alt+Shift+W",context:"view",onclick:f})});
|
Binary file not shown.
Loading…
Reference in New Issue