X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/53f4633144ed68c8b8fb5861f992b5489894a940..a9fa37e08fa731c7bd108a175c24876823bc071b:/wp-includes/js/tinymce/plugins/fullscreen/plugin.js diff --git a/wp-includes/js/tinymce/plugins/fullscreen/plugin.js b/wp-includes/js/tinymce/plugins/fullscreen/plugin.js index ad379382..80ebcb74 100644 --- a/wp-includes/js/tinymce/plugins/fullscreen/plugin.js +++ b/wp-includes/js/tinymce/plugins/fullscreen/plugin.js @@ -12,7 +12,7 @@ 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; @@ -37,6 +37,19 @@ tinymce.PluginManager.add('fullscreen', function(editor) { 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; @@ -53,6 +66,7 @@ tinymce.PluginManager.add('fullscreen', function(editor) { iframeStyle = iframe.style; if (fullscreenState) { + scrollPos = getScrollPos(); iframeWidth = iframeStyle.width; iframeHeight = iframeStyle.height; iframeStyle.width = iframeStyle.height = '100%'; @@ -83,13 +97,14 @@ tinymce.PluginManager.add('fullscreen', function(editor) { 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() { @@ -104,7 +119,10 @@ tinymce.PluginManager.add('fullscreen', function(editor) { text: 'Fullscreen', shortcut: 'Meta+Alt+F', selectable: true, - onClick: toggleFullscreen, + onClick: function() { + toggleFullscreen(); + editor.focus(); + }, onPostRender: function() { var self = this; @@ -133,4 +151,4 @@ tinymce.PluginManager.add('fullscreen', function(editor) { return fullscreenState; } }; -}); \ No newline at end of file +});