From f79638378a7d27ed992fb16e691f31f7e9295e5c Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 3 Jul 2008 05:11:00 +0000 Subject: [PATCH] Image caption fixes from azaozz. see #6812 git-svn-id: http://svn.automattic.com/wordpress/trunk@8245 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/media-upload.js | 4 +++- wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js | 7 +++---- wp-includes/js/tinymce/tiny_mce_config.php | 2 +- wp-includes/script-loader.php | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/wp-admin/js/media-upload.js b/wp-admin/js/media-upload.js index 2b9681517f..3a034ac9fc 100644 --- a/wp-admin/js/media-upload.js +++ b/wp-admin/js/media-upload.js @@ -5,8 +5,10 @@ function send_to_editor(h) { if (tinymce.isIE) ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark); + if ( h.indexOf('[wp_caption') != -1 ) + h = ed.plugins.wpeditimage._do_shcode(h); + ed.execCommand('mceInsertContent', false, h); - ed.execCommand('mceCleanup'); } else edInsertContent(edCanvas, h); diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js b/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js index adad1a35f9..89b4d71715 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js +++ b/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js @@ -460,14 +460,13 @@ var wpImage = { tinyMCEPopup.close(); return; } else { - if ( DL ) { + if ( DL && DIV ) { if ( f.link_href.value ) html = ed.dom.getOuterHTML(ed.dom.getParent(el, 'a')); else html = ed.dom.getOuterHTML(el); P = ed.dom.create('p', {}, html); - DL.parentNode.insertBefore(P,DL); - ed.dom.remove(DL.childNodes); - ed.dom.remove(DL); + DIV.parentNode.insertBefore(P, DIV); + ed.dom.remove(DIV); } } diff --git a/wp-includes/js/tinymce/tiny_mce_config.php b/wp-includes/js/tinymce/tiny_mce_config.php index 8a2ff725a7..5959c87587 100644 --- a/wp-includes/js/tinymce/tiny_mce_config.php +++ b/wp-includes/js/tinymce/tiny_mce_config.php @@ -222,7 +222,7 @@ if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) { // Setup cache info if ( $disk_cache ) { - $cacheKey = apply_filters('tiny_mce_version', '20080626'); + $cacheKey = apply_filters('tiny_mce_version', '20080702'); foreach ( $initArray as $v ) $cacheKey .= $v; diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 8312842d6b..b9bb7150ac 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -34,7 +34,7 @@ function wp_default_scripts( &$scripts ) { $visual_editor = apply_filters('visual_editor', array('tiny_mce')); $scripts->add( 'editor', false, $visual_editor, '20080321' ); - $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080701' ); + $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080702' ); // Modify this version when tinyMCE plugins are changed. $mce_version = apply_filters('tiny_mce_version', '20080701'); @@ -159,7 +159,7 @@ function wp_default_scripts( &$scripts ) { 'edit' => __('Edit'), ) ); $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20080520' ); - $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20080701' ); + $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20080702' ); $scripts->localize( 'upload', 'uploadL10n', array( 'browseTitle' => attribute_escape(__('Browse your files')), 'back' => __('« Back'),