gzuncompress
|
Server IP : 172.19.0.3 / Your IP : 216.73.216.178 Web Server : Apache/2.4 System : Linux 880f91b28fd7 5.15.0-117-generic #127~20.04.1-Ubuntu SMP Thu Jul 11 15:36:12 UTC 2024 x86_64 User : tomlinde ( 155017) PHP Version : 5.6.40 Disable Function : dl, syslog, opcache_get_status MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/webpages/lima-city/tomlinde/html/biblog/wp-includes/js/tinymce/plugins/wpfullscreen/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] | [ Lock Shell ] | [ Logout ] |
|---|
/* global tinymce */
/**
* WP Fullscreen (Distraction Free Writing) TinyMCE plugin
*/
tinymce.PluginManager.add( 'wpfullscreen', function( editor ) {
var settings = editor.settings;
function fullscreenOn() {
settings.wp_fullscreen = true;
editor.dom.addClass( editor.getDoc().documentElement, 'wp-fullscreen' );
// Start auto-resizing
editor.execCommand( 'wpAutoResizeOn' );
}
function fullscreenOff() {
settings.wp_fullscreen = false;
editor.dom.removeClass( editor.getDoc().documentElement, 'wp-fullscreen' );
// Stop auto-resizing
editor.execCommand( 'wpAutoResizeOff' );
}
// For use from outside the editor.
editor.addCommand( 'wpFullScreenOn', fullscreenOn );
editor.addCommand( 'wpFullScreenOff', fullscreenOff );
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') ) {
fullscreen.off();
} else {
fullscreen.on();
}
}
}
editor.addCommand( 'wpFullScreen', toggleFullscreen );
editor.on( 'keydown', function( event ) {
var fullscreen;
// Turn fullscreen off when Esc is pressed.
if ( event.keyCode === 27 && ( fullscreen = getExtAPI() ) && fullscreen.settings.visible ) {
fullscreen.off();
}
});
editor.on( 'init', function() {
// Set the editor when initializing from whitin DFW
if ( editor.getParam('wp_fullscreen') ) {
fullscreenOn();
}
editor.addShortcut( 'alt+shift+w', '', 'wpFullScreen' );
});
// Register buttons
editor.addButton( 'wp_fullscreen', {
tooltip: 'Distraction Free Writing',
shortcut: 'Alt+Shift+W',
onclick: toggleFullscreen,
classes: 'wp-fullscreen btn widget' // This overwrites all classes on the container!
});
editor.addMenuItem( 'wp_fullscreen', {
text: 'Distraction Free Writing',
icon: 'wp_fullscreen',
shortcut: 'Alt+Shift+W',
context: 'view',
onclick: toggleFullscreen
});
});