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-28 18:53:15 -05:00
|
|
|
/**
|
|
|
|
* plugin.js
|
|
|
|
*
|
|
|
|
* Released under LGPL License.
|
2015-06-30 20:52:25 -04:00
|
|
|
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
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-28 18:53:15 -05:00
|
|
|
*
|
|
|
|
* License: http://www.tinymce.com/license
|
|
|
|
* Contributing: http://www.tinymce.com/contributing
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*global tinymce:true */
|
|
|
|
|
|
|
|
tinymce.PluginManager.add('fullscreen', function(editor) {
|
|
|
|
var fullscreenState = false, DOM = tinymce.DOM, iframeWidth, iframeHeight, resizeHandler;
|
2016-01-19 23:18:33 -05:00
|
|
|
var containerWidth, containerHeight, scrollPos;
|
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-28 18:53:15 -05:00
|
|
|
|
|
|
|
if (editor.settings.inline) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getWindowSize() {
|
|
|
|
var w, h, win = window, doc = document;
|
|
|
|
var body = doc.body;
|
|
|
|
|
|
|
|
// Old IE
|
|
|
|
if (body.offsetWidth) {
|
|
|
|
w = body.offsetWidth;
|
|
|
|
h = body.offsetHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Modern browsers
|
|
|
|
if (win.innerWidth && win.innerHeight) {
|
|
|
|
w = win.innerWidth;
|
|
|
|
h = win.innerHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
return {w: w, h: h};
|
|
|
|
}
|
|
|
|
|
2016-01-19 23:18:33 -05:00
|
|
|
function getScrollPos() {
|
|
|
|
var vp = tinymce.DOM.getViewPort();
|
|
|
|
|
|
|
|
return {
|
|
|
|
x: vp.x,
|
|
|
|
y: vp.y
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function setScrollPos(pos) {
|
|
|
|
scrollTo(pos.x, pos.y);
|
|
|
|
}
|
|
|
|
|
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-28 18:53:15 -05:00
|
|
|
function toggleFullscreen() {
|
|
|
|
var body = document.body, documentElement = document.documentElement, editorContainerStyle;
|
|
|
|
var editorContainer, iframe, iframeStyle;
|
|
|
|
|
|
|
|
function resize() {
|
|
|
|
DOM.setStyle(iframe, 'height', getWindowSize().h - (editorContainer.clientHeight - iframe.clientHeight));
|
|
|
|
}
|
|
|
|
|
|
|
|
fullscreenState = !fullscreenState;
|
|
|
|
|
|
|
|
editorContainer = editor.getContainer();
|
|
|
|
editorContainerStyle = editorContainer.style;
|
|
|
|
iframe = editor.getContentAreaContainer().firstChild;
|
|
|
|
iframeStyle = iframe.style;
|
|
|
|
|
|
|
|
if (fullscreenState) {
|
2016-01-19 23:18:33 -05:00
|
|
|
scrollPos = getScrollPos();
|
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-28 18:53:15 -05:00
|
|
|
iframeWidth = iframeStyle.width;
|
|
|
|
iframeHeight = iframeStyle.height;
|
|
|
|
iframeStyle.width = iframeStyle.height = '100%';
|
|
|
|
containerWidth = editorContainerStyle.width;
|
|
|
|
containerHeight = editorContainerStyle.height;
|
|
|
|
editorContainerStyle.width = editorContainerStyle.height = '';
|
|
|
|
|
|
|
|
DOM.addClass(body, 'mce-fullscreen');
|
|
|
|
DOM.addClass(documentElement, 'mce-fullscreen');
|
|
|
|
DOM.addClass(editorContainer, 'mce-fullscreen');
|
|
|
|
|
|
|
|
DOM.bind(window, 'resize', resize);
|
|
|
|
resize();
|
|
|
|
resizeHandler = resize;
|
|
|
|
} else {
|
|
|
|
iframeStyle.width = iframeWidth;
|
|
|
|
iframeStyle.height = iframeHeight;
|
|
|
|
|
|
|
|
if (containerWidth) {
|
|
|
|
editorContainerStyle.width = containerWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (containerHeight) {
|
|
|
|
editorContainerStyle.height = containerHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
DOM.removeClass(body, 'mce-fullscreen');
|
|
|
|
DOM.removeClass(documentElement, 'mce-fullscreen');
|
|
|
|
DOM.removeClass(editorContainer, 'mce-fullscreen');
|
|
|
|
DOM.unbind(window, 'resize', resizeHandler);
|
2016-01-19 23:18:33 -05:00
|
|
|
setScrollPos(scrollPos);
|
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-28 18:53:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
editor.fire('FullscreenStateChanged', {state: fullscreenState});
|
|
|
|
}
|
|
|
|
|
|
|
|
editor.on('init', function() {
|
2016-04-18 17:46:29 -04:00
|
|
|
editor.addShortcut('Ctrl+Shift+F', '', toggleFullscreen);
|
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-28 18:53:15 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
editor.on('remove', function() {
|
|
|
|
if (resizeHandler) {
|
|
|
|
DOM.unbind(window, 'resize', resizeHandler);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
editor.addCommand('mceFullScreen', toggleFullscreen);
|
|
|
|
|
|
|
|
editor.addMenuItem('fullscreen', {
|
|
|
|
text: 'Fullscreen',
|
2016-07-26 17:47:28 -04:00
|
|
|
shortcut: 'Ctrl+Shift+F',
|
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-28 18:53:15 -05:00
|
|
|
selectable: true,
|
2016-03-01 18:13:31 -05:00
|
|
|
onClick: function() {
|
|
|
|
toggleFullscreen();
|
|
|
|
editor.focus();
|
|
|
|
},
|
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-28 18:53:15 -05:00
|
|
|
onPostRender: function() {
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
editor.on('FullscreenStateChanged', function(e) {
|
|
|
|
self.active(e.state);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
context: 'view'
|
|
|
|
});
|
|
|
|
|
|
|
|
editor.addButton('fullscreen', {
|
|
|
|
tooltip: 'Fullscreen',
|
2016-07-26 17:47:28 -04:00
|
|
|
shortcut: 'Ctrl+Alt+F',
|
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-28 18:53:15 -05:00
|
|
|
onClick: toggleFullscreen,
|
|
|
|
onPostRender: function() {
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
editor.on('FullscreenStateChanged', function(e) {
|
|
|
|
self.active(e.state);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
|
|
|
isFullscreen: function() {
|
|
|
|
return fullscreenState;
|
|
|
|
}
|
|
|
|
};
|
2016-01-19 23:18:33 -05:00
|
|
|
});
|