TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
/* global tinymce */
|
|
|
|
/**
|
|
|
|
* WP Fullscreen (Distraction Free Writing) TinyMCE plugin
|
|
|
|
*/
|
|
|
|
tinymce.PluginManager.add( 'wpfullscreen', function( editor ) {
|
2014-07-10 00:06:15 +02:00
|
|
|
var settings = editor.settings;
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
|
|
|
|
function fullscreenOn() {
|
|
|
|
settings.wp_fullscreen = true;
|
|
|
|
editor.dom.addClass( editor.getDoc().documentElement, 'wp-fullscreen' );
|
2014-07-10 00:06:15 +02:00
|
|
|
// Start auto-resizing
|
|
|
|
editor.execCommand( 'wpAutoResizeOn' );
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function fullscreenOff() {
|
|
|
|
settings.wp_fullscreen = false;
|
|
|
|
editor.dom.removeClass( editor.getDoc().documentElement, 'wp-fullscreen' );
|
2014-07-10 00:06:15 +02:00
|
|
|
// Stop auto-resizing
|
|
|
|
editor.execCommand( 'wpAutoResizeOff' );
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// For use from outside the editor.
|
|
|
|
editor.addCommand( 'wpFullScreenOn', fullscreenOn );
|
|
|
|
editor.addCommand( 'wpFullScreenOff', fullscreenOff );
|
|
|
|
|
2014-05-16 20:17:14 +02:00
|
|
|
function getExtAPI() {
|
|
|
|
return ( typeof wp !== 'undefined' && wp.editor && wp.editor.fullscreen );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Toggle DFW mode. For use from inside the editor.
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
function toggleFullscreen() {
|
2014-05-16 20:17:14 +02:00
|
|
|
var fullscreen = getExtAPI();
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
|
2014-05-16 20:17:14 +02:00
|
|
|
if ( fullscreen ) {
|
|
|
|
if ( editor.getParam('wp_fullscreen') ) {
|
|
|
|
fullscreen.off();
|
|
|
|
} else {
|
|
|
|
fullscreen.on();
|
|
|
|
}
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
editor.addCommand( 'wpFullScreen', toggleFullscreen );
|
|
|
|
|
2014-05-16 20:17:14 +02:00
|
|
|
editor.on( 'keydown', function( event ) {
|
|
|
|
var fullscreen;
|
|
|
|
|
2014-05-16 12:43:14 +02:00
|
|
|
// Turn fullscreen off when Esc is pressed.
|
2014-05-16 20:17:14 +02:00
|
|
|
if ( event.keyCode === 27 && ( fullscreen = getExtAPI() ) && fullscreen.settings.visible ) {
|
|
|
|
fullscreen.off();
|
2014-05-16 12:43:14 +02:00
|
|
|
}
|
2014-05-16 20:17:14 +02:00
|
|
|
});
|
2014-05-16 12:43:14 +02:00
|
|
|
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
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',
|
2014-03-30 00:58:14 +01:00
|
|
|
onclick: toggleFullscreen,
|
|
|
|
classes: 'wp-fullscreen btn widget' // This overwrites all classes on the container!
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
editor.addMenuItem( 'wp_fullscreen', {
|
|
|
|
text: 'Distraction Free Writing',
|
2014-03-12 09:19:14 +01:00
|
|
|
icon: 'wp_fullscreen',
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-29 00:53:15 +01:00
|
|
|
shortcut: 'Alt+Shift+W',
|
|
|
|
context: 'view',
|
|
|
|
onclick: toggleFullscreen
|
|
|
|
});
|
|
|
|
});
|