Ticket #30696: 30696.patch
File 30696.patch, 2.5 KB (added by , 10 years ago) |
---|
-
src/wp-includes/js/tinymce/plugins/wpview/plugin.js
158 158 } 159 159 160 160 function adjustToolbarPosition( viewNode ) { 161 var delta = 0, 161 var viewNodeRect, iframeRect, toolbarWidth, bodyWidth, pageX, 162 delta = 0, 163 buffer = 5, // Used for keeping the toolbar a little bit (5px) on the inside of the editor. 164 toolbarTopOffset = 43, 165 body = editor.getBody(), 166 prop = 'left', 162 167 toolbar = editor.$( viewNode ).find( '.toolbar' ), 163 168 editorToolbar = tinymce.$( editor.editorContainer ).find( '.mce-toolbar-grp' )[0], 164 169 editorToolbarBottom = ( editorToolbar && editorToolbar.getBoundingClientRect().bottom ) || 0; 165 166 if ( toolbar.length && editor.iframeElement ) { 167 // 48 = 43 for the toolbar + 5 buffer 168 delta = viewNode.getBoundingClientRect().top + editor.iframeElement.getBoundingClientRect().top - editorToolbarBottom - 48; 170 171 if ( ! toolbar.length || ! editor.iframeElement ) { 172 return; 169 173 } 170 174 175 viewNodeRect = viewNode.getBoundingClientRect(); 176 iframeRect = editor.iframeElement.getBoundingClientRect(); 177 bodyWidth = body.clientWidth; 178 toolbarWidth = toolbar[0].clientWidth; 179 delta = viewNodeRect.top + iframeRect.top - editorToolbarBottom - toolbarTopOffset - buffer; 180 pageX = editor.getWin().pageXOffset || editor.getDoc().documentElement.scrollLeft || 0; 181 182 if ( editor.$( body ).hasClass( 'rtl' ) ) { 183 prop = 'right'; 184 pageX = pageX && pageX * -1; 185 } 186 171 187 if ( delta < 0 ) { 172 toolbar.removeClass( 'mce-arrow-down' ).css({ top: ( - 43+ delta * -1 ) });188 toolbar.removeClass( 'mce-arrow-down' ).css({ top: ( -toolbarTopOffset + delta * -1 ) }); 173 189 } else if ( delta > 0 && ! toolbar.hasClass( 'mce-arrow-down' ) ) { 174 190 toolbar.addClass( 'mce-arrow-down' ).css({ top: '' }); 175 191 } 192 193 if ( viewNode.clientWidth > bodyWidth ) { 194 toolbar.css( prop, ( bodyWidth - toolbarWidth ) / 2 + pageX ); 195 } 176 196 } 177 197 178 198 /** -
src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
340 340 margin-bottom: 8px; 341 341 } 342 342 343 .rtl .wpview-wrap .toolbar { 344 left: auto; 345 right: 45%; 346 right: calc(50% - 32px); 347 } 348 343 349 .wpview-wrap[data-mce-selected] .toolbar { 344 350 display: block; 345 351 }