From d2f6b4559f543fc6d680c2be2f279d7268b15c25 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Wed, 22 Aug 2012 01:47:53 +0000 Subject: [PATCH] Disable the (fake) image resizing in WebKit and Opera in TinyMCE 3.5.6, fix dragging image with caption in Firefox, see #21173 git-svn-id: http://core.svn.wordpress.org/trunk@21576 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-editor.php | 1 + .../js/tinymce/plugins/wpeditimage/editor_plugin_src.js | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php index 3fd51c2313..e36b3fe583 100644 --- a/wp-includes/class-wp-editor.php +++ b/wp-includes/class-wp-editor.php @@ -317,6 +317,7 @@ final class _WP_Editors { 'paste_remove_spans' => true, 'paste_strip_class_attributes' => 'all', 'paste_text_use_dialog' => true, + 'webkit_fake_resize' => false, 'spellchecker_rpc_url' => self::$baseurl . '/plugins/spellchecker/rpc.php', 'extended_valid_elements' => 'article[*],aside[*],audio[*],canvas[*],command[*],datalist[*],details[*],embed[*],figcaption[*],figure[*],footer[*],header[*],hgroup[*],keygen[*],mark[*],meter[*],nav[*],output[*],progress[*],section[*],source[*],summary,time[*],video[*],wbr', 'wpeditimage_disable_captions' => $no_captions, diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js index 71819e25ec..c02a2ec0f0 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js +++ b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js @@ -14,11 +14,14 @@ ed.addCommand('WP_EditImage', t._editImage); ed.onInit.add(function(ed) { - ed.dom.events.add(ed.getBody(), 'dragstart', function(e) { + ed.dom.events.add(ed.getBody(), 'mousedown', function(e) { var parent; if ( e.target.nodeName == 'IMG' && ( parent = ed.dom.getParent(e.target, 'div.mceTemp') ) ) { - ed.selection.select(parent); + if ( tinymce.isGecko ) + ed.selection.select(parent); + else if ( tinymce.isWebKit ) + ed.dom.events.cancel(e); } }); @@ -44,7 +47,7 @@ }); }); - // resize the caption
when the image is soft-resized by the user (only possible in Firefox and IE) + // resize the caption
when the image is soft-resized by the user ed.onMouseUp.add(function(ed, e) { if ( tinymce.isWebKit || tinymce.isOpera ) return;