/* global deleteUserSetting, setUserSetting, switchEditors, tinymce, tinyMCEPreInit */
/**
- * Distraction Free Writing
+ * Distraction-Free Writing
* (wp-fullscreen)
*
* Access the API globally using the window.wp.editor.fullscreen variable.
}
});
- $document.on( 'keydown.wp-fullscreen', function( event ) {
- if ( 27 === event.which && s.visible ) { // Esc
+ $( window ).on( 'keydown.wp-fullscreen', function( event ) {
+ // Turn fullscreen off when Esc is pressed.
+ if ( 27 === event.keyCode && s.visible ) {
api.off();
event.stopImmediatePropagation();
}