tinymce.PluginManager.add('fullscreen', function(editor) {
var fullscreenState = false, DOM = tinymce.DOM, iframeWidth, iframeHeight, resizeHandler;
- var containerWidth, containerHeight;
+ var containerWidth, containerHeight, scrollPos;
if (editor.settings.inline) {
return;
return {w: w, h: h};
}
+ function getScrollPos() {
+ var vp = tinymce.DOM.getViewPort();
+
+ return {
+ x: vp.x,
+ y: vp.y
+ };
+ }
+
+ function setScrollPos(pos) {
+ scrollTo(pos.x, pos.y);
+ }
+
function toggleFullscreen() {
var body = document.body, documentElement = document.documentElement, editorContainerStyle;
var editorContainer, iframe, iframeStyle;
iframeStyle = iframe.style;
if (fullscreenState) {
+ scrollPos = getScrollPos();
iframeWidth = iframeStyle.width;
iframeHeight = iframeStyle.height;
iframeStyle.width = iframeStyle.height = '100%';
DOM.removeClass(documentElement, 'mce-fullscreen');
DOM.removeClass(editorContainer, 'mce-fullscreen');
DOM.unbind(window, 'resize', resizeHandler);
+ setScrollPos(scrollPos);
}
editor.fire('FullscreenStateChanged', {state: fullscreenState});
}
editor.on('init', function() {
- editor.addShortcut('Meta+Alt+F', '', toggleFullscreen);
+ editor.addShortcut('Ctrl+Shift+F', '', toggleFullscreen);
});
editor.on('remove', function() {
editor.addMenuItem('fullscreen', {
text: 'Fullscreen',
- shortcut: 'Meta+Alt+F',
+ shortcut: 'Ctrl+Shift+F',
selectable: true,
- onClick: toggleFullscreen,
+ onClick: function() {
+ toggleFullscreen();
+ editor.focus();
+ },
onPostRender: function() {
var self = this;
editor.addButton('fullscreen', {
tooltip: 'Fullscreen',
- shortcut: 'Meta+Alt+F',
+ shortcut: 'Ctrl+Shift+F',
onClick: toggleFullscreen,
onPostRender: function() {
var self = this;
return fullscreenState;
}
};
-});
\ No newline at end of file
+});