From 24a33d8181a350fce73431222d114e356ffef432 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 6 Feb 2015 22:59:35 +0000 Subject: [PATCH] TinyMCE: ensure the image toolbar stays visible when the image is much wider than the editor. Props iseulde, fixes #20696 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@31362 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js index 3b1667d425..d8b735fb9d 100644 --- a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js @@ -238,7 +238,9 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { left = boundaryMiddle - toolbarHalf; left += iframePos.x; - if ( toolbarWidth >= windowWidth ) { + if ( boundary.left < 0 || boundary.right > iframeWidth ) { + left = iframePos.x + ( iframeWidth - toolbarWidth ) / 2; + } else if ( toolbarWidth >= windowWidth ) { className += ' mce-arrow-full'; left = 0; } else if ( ( left < 0 && boundary.left + toolbarWidth > windowWidth ) ||