Changeset 21963
- Timestamp:
- 09/24/2012 03:08:31 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin_src.js
r21266 r21963 7 7 (function() { 8 8 tinymce.create('tinymce.plugins.wpFullscreenPlugin', { 9 resize_timeout: false, 9 10 10 11 init : function(ed, url) { … … 120 121 * This method gets executed each time the editor needs to resize. 121 122 */ 122 function resize( ) {123 var d = ed.getDoc(), DOM = tinymce.DOM, resizeHeight, myHeight;123 function resize(editor, e) { 124 var DOM = tinymce.DOM, body = ed.getBody(), ifr = DOM.get(ed.id + '_ifr'), height, y = ed.dom.win.scrollY; 124 125 125 // Get height differently depending on the browser used 126 if ( tinymce.isWebKit ) 127 myHeight = d.body.offsetHeight; 128 else 129 myHeight = d.body.scrollHeight; 126 if ( t.resize_timeout ) 127 return; 130 128 131 // Don't make it smaller than 300px 132 resizeHeight = (myHeight > 300) ? myHeight : 300; 129 // sometimes several events are fired few ms apart, trottle down resizing a little 130 t.resize_timeout = true; 131 setTimeout(function(){ 132 t.resize_timeout = false; 133 }, 500); 133 134 134 // Resize content element 135 if ( oldHeight != resizeHeight ) { 136 DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px'); 137 oldHeight = resizeHeight; 138 ed.getWin().scrollTo(0,0); 135 height = body.scrollHeight > 300 ? body.scrollHeight : 300; 136 137 if ( height != ifr.scrollHeight ) { 138 DOM.setStyle(ifr, 'height', height + 'px'); 139 ed.getWin().scrollTo(0, 0); // iframe window object, make sure there's no scrolling 140 } 141 142 // WebKit scrolls to top on paste... 143 if ( e && e.type == 'paste' && tinymce.isWebKit ) { 144 setTimeout(function(){ 145 ed.dom.win.scrollTo(0, y); 146 }, 40); 139 147 } 140 148 }; … … 151 159 }); 152 160 153 if ( ed.getParam('autoresize_on_init', true)) {161 if ( ed.getParam('autoresize_on_init', true) ) { 154 162 ed.onLoadContent.add(function(ed, l) { 155 163 // Because the content area resizes when its content CSS loads,
Note: See TracChangeset
for help on using the changeset viewer.