diff -r f507feede89a -r 09a1c134465b web/wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin_src.js --- a/web/wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin_src.js Wed Dec 19 12:35:13 2012 -0800 +++ b/web/wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin_src.js Wed Dec 19 17:46:52 2012 -0800 @@ -6,6 +6,7 @@ (function() { tinymce.create('tinymce.plugins.wpFullscreenPlugin', { + resize_timeout: false, init : function(ed, url) { var t = this, oldHeight = 0, s = {}, DOM = tinymce.DOM; @@ -93,13 +94,21 @@ } }); + ed.addCommand('wpFullScreen', function() { + if ( typeof(fullscreen) == 'undefined' ) + return; + + if ( 'wp_mce_fullscreen' == ed.id ) + fullscreen.off(); + else + fullscreen.on(); + }); + // Register buttons - if ( 'undefined' != fullscreen ) { - ed.addButton('wp_fullscreen', { - title : 'fullscreen.desc', - onclick : function(){ fullscreen.on(); } - }); - } + ed.addButton('wp_fullscreen', { + title : 'wordpress.wp_fullscreen_desc', + cmd : 'wpFullScreen' + }); // END fullscreen //---------------------------------------------------------------- @@ -111,23 +120,30 @@ /** * This method gets executed each time the editor needs to resize. */ - function resize() { - var d = ed.getDoc(), DOM = tinymce.DOM, resizeHeight, myHeight; + function resize(editor, e) { + var DOM = tinymce.DOM, body = ed.getBody(), ifr = DOM.get(ed.id + '_ifr'), height, y = ed.dom.win.scrollY; + + if ( t.resize_timeout ) + return; - // Get height differently depending on the browser used - if ( tinymce.isWebKit ) - myHeight = d.body.offsetHeight; - else - myHeight = d.body.scrollHeight; + // sometimes several events are fired few ms apart, trottle down resizing a little + t.resize_timeout = true; + setTimeout(function(){ + t.resize_timeout = false; + }, 500); - // Don't make it smaller than 300px - resizeHeight = (myHeight > 300) ? myHeight : 300; + height = body.scrollHeight > 300 ? body.scrollHeight : 300; - // Resize content element - if ( oldHeight != resizeHeight ) { - DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px'); - oldHeight = resizeHeight; - ed.getWin().scrollTo(0,0); + if ( height != ifr.scrollHeight ) { + DOM.setStyle(ifr, 'height', height + 'px'); + ed.getWin().scrollTo(0, 0); // iframe window object, make sure there's no scrolling + } + + // WebKit scrolls to top on paste... + if ( e && e.type == 'paste' && tinymce.isWebKit ) { + setTimeout(function(){ + ed.dom.win.scrollTo(0, y); + }, 40); } }; @@ -142,7 +158,7 @@ ed.getBody().style.overflowY = "hidden"; }); - if (ed.getParam('autoresize_on_init', true)) { + if ( ed.getParam('autoresize_on_init', true) ) { ed.onLoadContent.add(function(ed, l) { // Because the content area resizes when its content CSS loads, // and we can't easily add a listener to its onload event,