<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[19982] trunk: HTML in image captions, first run, see #18311</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/19982">19982</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2012-02-24 01:58:18 +0000 (Fri, 24 Feb 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>HTML in image captions, first run, see <a href="http://core.trac.wordpress.org/ticket/18311">#18311</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincsswpadmindevcss">trunk/wp-admin/css/wp-admin.dev.css</a></li>
<li><a href="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
<li><a href="#trunkwpadminjsmediauploaddevjs">trunk/wp-admin/js/media-upload.dev.js</a></li>
<li><a href="#trunkwpincludesformattingphp">trunk/wp-includes/formatting.php</a></li>
<li><a href="#trunkwpincludesjspluploadhandlersdevjs">trunk/wp-includes/js/plupload/handlers.dev.js</a></li>
<li><a href="#trunkwpincludesjstinymcelangswplangsenjs">trunk/wp-includes/js/tinymce/langs/wp-langs-en.js</a></li>
<li><a href="#trunkwpincludesjstinymcelangswplangsphp">trunk/wp-includes/js/tinymce/langs/wp-langs.php</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimagecsseditimagecss">trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimageeditimagehtml">trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimageeditor_plugin_srcjs">trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimagejseditimagedevjs">trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimagejseditimagejs">trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js</a></li>
<li><a href="#trunkwpincludesjstinymcethemesadvancedskinswp_themecontentcss">trunk/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimagecsseditimagertlcss">trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincsswpadmindevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.dev.css (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.dev.css        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-admin/css/wp-admin.dev.css        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -3873,6 +3873,43 @@
</span><span class="cx">         padding-left: 15px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.media-item .edit-caption-controls {
+        margin: 5px 0;
+        width: 460px;
+}
+
+.media-item .edit-caption-controls label {
+        margin: 5px 0;
+        display: block;
+}
+
+.media-item .edit-caption-controls label span {
+        width: 100px;
+        float: left;
+        line-height: 22px;
+}
+
+.media-item .edit-caption-controls input[type=&quot;text&quot;] {
+        width: 335px;
+}
+
+.media-item .caption-insert-link-buttons {
+        text-align: right;
+        margin: 5px 12px;
+}
+
+.media-item .caption-insert-link-wrap {
+        padding: 5px 0 5px 12px;
+        background-color: #f8f8f8;
+        border: 1px solid #eee;
+        -webkit-border-radius: 3px;
+        border-radius: 3px;
+}
+
+.media-item .post_excerpt textarea {
+    height: 60px;
+}
+
</ins><span class="cx"> /*------------------------------------------------------------------------------
</span><span class="cx">   14.1 - Media Library
</span><span class="cx"> ------------------------------------------------------------------------------*/
</span><span class="lines">@@ -7940,4 +7977,4 @@
</span><span class="cx"> }
</span><span class="cx"> .locale-ru-ru .pressthis a {
</span><span class="cx">         width: 143px; /* default 113px + 30px */
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-admin/includes/media.php        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -149,22 +149,28 @@
</span><span class="cx"> 
</span><span class="cx">         $width = $matches[1];
</span><span class="cx"> 
</span><del>-        $caption = str_replace(        array( '&gt;',    '&lt;',    '&quot;',      &quot;'&quot; ),
-                                                        array( '&amp;gt;', '&amp;lt;', '&amp;quot;', '&amp;#039;' ),
-                                                        $caption
-                                                  );
</del><ins>+        $caption = preg_replace_callback( '/&lt;[a-zA-Z][^&lt;&gt;]+&gt;/', '_cleanup_image_add_caption', $caption );
+        $caption = str_replace(        '&quot;', '&amp;quot;', $caption );
</ins><span class="cx"> 
</span><span class="cx">         $html = preg_replace( '/(class=[&quot;\'][^\'&quot;]*)align(none|left|right|center)\s?/', '$1', $html );
</span><span class="cx">         if ( empty($align) )
</span><span class="cx">                 $align = 'none';
</span><span class="cx"> 
</span><span class="cx">         $shcode = '[caption id=&quot;' . $id . '&quot; align=&quot;align' . $align
</span><del>-        . '&quot; width=&quot;' . $width . '&quot; caption=&quot;' . addslashes($caption) . '&quot;]' . $html . '[/caption]';
</del><ins>+        . '&quot; width=&quot;' . $width . '&quot; caption=&quot;' . $caption . '&quot;]' . $html . '[/caption]';
</ins><span class="cx"> 
</span><span class="cx">         return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
</span><span class="cx"> }
</span><span class="cx"> add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 );
</span><span class="cx"> 
</span><ins>+// Private, preg_replace callback used in image_add_caption()
+function _cleanup_image_add_caption($str) {
+        if ( isset($str[0]) )
+                return str_replace(        '&quot;', &quot;'&quot;, $str[0] );
+
+        return '';
+}
+
</ins><span class="cx"> /**
</span><span class="cx">  * {@internal Missing Short Description}}
</span><span class="cx">  *
</span><span class="lines">@@ -776,12 +782,33 @@
</span><span class="cx"> 
</span><span class="cx">         return &quot;
</span><span class="cx">         &lt;input type='text' class='text urlfield' name='attachments[$post-&gt;ID][url]' value='&quot; . esc_attr($url) . &quot;' /&gt;&lt;br /&gt;
</span><del>-        &lt;button type='button' class='button urlnone' title=''&gt;&quot; . __('None') . &quot;&lt;/button&gt;
-        &lt;button type='button' class='button urlfile' title='&quot; . esc_attr($file) . &quot;'&gt;&quot; . __('File URL') . &quot;&lt;/button&gt;
-        &lt;button type='button' class='button urlpost' title='&quot; . esc_attr($link) . &quot;'&gt;&quot; . __('Attachment Post URL') . &quot;&lt;/button&gt;
</del><ins>+        &lt;button type='button' class='button urlnone' data-link-url=''&gt;&quot; . __('None') . &quot;&lt;/button&gt;
+        &lt;button type='button' class='button urlfile' data-link-url='&quot; . esc_attr($file) . &quot;'&gt;&quot; . __('File URL') . &quot;&lt;/button&gt;
+        &lt;button type='button' class='button urlpost' data-link-url='&quot; . esc_attr($link) . &quot;'&gt;&quot; . __('Attachment Post URL') . &quot;&lt;/button&gt;
</ins><span class="cx"> &quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function wp_caption_input_textarea($edit_post) {
+        // post data is already escaped
+        $name = &quot;attachments[{$edit_post-&gt;ID}][post_excerpt]&quot;;
+
+        return '
+        &lt;textarea class=&quot;code&quot; name=&quot;' . $name . '&quot; id=&quot;' . $name . '&quot;&gt;' . $edit_post-&gt;post_excerpt . '&lt;/textarea&gt;
+        &lt;div class=&quot;edit-caption-controls hide-if-no-js&quot;&gt;
+        &lt;input type=&quot;button&quot; class=&quot;button caption-insert-link&quot; value=&quot;' . esc_attr__('Insert Link') . '&quot; /&gt;
+        &lt;div class=&quot;caption-insert-link-wrap hidden&quot;&gt;
+        &lt;label&gt;&lt;span&gt;' . __('Link URL') . '&lt;/span&gt;
+        &lt;input type=&quot;text&quot; value=&quot;&quot; class=&quot;caption-insert-link-url&quot; /&gt;&lt;/label&gt;
+        &lt;label&gt;&lt;span&gt;' . __('Linked text') . '&lt;/span&gt;
+        &lt;input type=&quot;text&quot; value=&quot;&quot; class=&quot;caption-insert-link-text&quot; /&gt;&lt;/label&gt;
+        &lt;div class=&quot;caption-insert-link-buttons&quot;&gt;
+        &lt;input type=&quot;button&quot; class=&quot;button caption-cancel&quot; value=&quot;' . esc_attr__('Cancel') . '&quot; /&gt;
+        &lt;input type=&quot;button&quot; class=&quot;button-primary caption-save&quot; value=&quot;' . esc_attr__('Insert') . '&quot; /&gt;
+        &lt;br class=&quot;clear&quot; /&gt;
+        &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
+        ';
+}
+
</ins><span class="cx"> /**
</span><span class="cx">  * {@internal Missing Short Description}}
</span><span class="cx">  *
</span><span class="lines">@@ -924,8 +951,9 @@
</span><span class="cx">                 ),
</span><span class="cx">                 'image_alt'   =&gt; array(),
</span><span class="cx">                 'post_excerpt' =&gt; array(
</span><del>-                        'label'      =&gt; __('Caption'),
-                        'value'      =&gt; $edit_post-&gt;post_excerpt
</del><ins>+                        'label'      =&gt; __('Default Caption'),
+                        'input'      =&gt; 'html',
+                        'html'       =&gt; wp_caption_input_textarea($edit_post)
</ins><span class="cx">                 ),
</span><span class="cx">                 'post_content' =&gt; array(
</span><span class="cx">                         'label'      =&gt; __('Description'),
</span><span class="lines">@@ -1202,9 +1230,11 @@
</span><span class="cx">                 if ( !empty( $field[ $field['input'] ] ) )
</span><span class="cx">                         $item .= $field[ $field['input'] ];
</span><span class="cx">                 elseif ( $field['input'] == 'textarea' ) {
</span><del>-                        if ( user_can_richedit() ) { // textarea_escaped when user_can_richedit() = false
-                                $field['value'] = esc_textarea( $field['value'] );
</del><ins>+                        if ( 'post_content' == $id &amp;&amp; user_can_richedit() ) {
+                                // sanitize_post() skips the post_content when user_can_richedit
+                                $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
</ins><span class="cx">                         }
</span><ins>+                        // post_excerpt is already escaped by sanitize_post() in get_attachment_fields_to_edit()
</ins><span class="cx">                         $item .= &quot;&lt;textarea id='$name' name='$name' $aria_required&gt;&quot; . $field['value'] . '&lt;/textarea&gt;';
</span><span class="cx">                 } else {
</span><span class="cx">                         $item .= &quot;&lt;input type='text' class='text' id='$name' name='$name' value='&quot; . esc_attr( $field['value'] ) . &quot;' $aria_required /&gt;&quot;;
</span><span class="lines">@@ -1513,8 +1543,13 @@
</span><span class="cx">                         alt = f.alt.value.replace(/'/g, '&amp;#039;').replace(/&quot;/g, '&amp;quot;').replace(/&lt;/g, '&amp;lt;').replace(/&gt;/g, '&amp;gt;');
</span><span class="cx"> 
</span><span class="cx"> &lt;?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?&gt;
</span><del>-                if ( f.caption.value )
-                        caption = f.caption.value.replace(/'/g, '&amp;#039;').replace(/&quot;/g, '&amp;quot;').replace(/&lt;/g, '&amp;lt;').replace(/&gt;/g, '&amp;gt;');
</del><ins>+                if ( f.caption.value ) {
+                        caption = f.caption.value.replace(/&lt;[a-z][^&lt;&gt;]+&gt;/g, function(a){
+                                return a.replace(/&quot;/g, &quot;'&quot;);
+                        });
+
+                        caption = caption.replace(/&quot;/g, '&amp;quot;');
+                }
</ins><span class="cx"> &lt;?php } ?&gt;
</span><span class="cx"> 
</span><span class="cx">                 cls = caption ? '' : ' class=&quot;'+t.align+'&quot;';
</span></span></pre></div>
<a id="trunkwpadminjsmediauploaddevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/media-upload.dev.js (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/media-upload.dev.js        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-admin/js/media-upload.dev.js        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -25,8 +25,8 @@
</span><span class="cx">                         ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark);
</span><span class="cx"> 
</span><span class="cx">                 if ( h.indexOf('[caption') === 0 ) {
</span><del>-                        if ( ed.plugins.wpeditimage )
-                                h = ed.plugins.wpeditimage._do_shcode(h);
</del><ins>+                        if ( ed.wpSetImgCaption )
+                                h = ed.wpSetImgCaption(h);
</ins><span class="cx">                 } else if ( h.indexOf('[gallery') === 0 ) {
</span><span class="cx">                         if ( ed.plugins.wpgallery )
</span><span class="cx">                                 h = ed.plugins.wpgallery._do_gallery(h);
</span></span></pre></div>
<a id="trunkwpincludesformattingphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/formatting.php (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/formatting.php        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-includes/formatting.php        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -1188,14 +1188,14 @@
</span><span class="cx"> /**
</span><span class="cx">  * Acts on text which is about to be edited.
</span><span class="cx">  *
</span><del>- * Unless $richedit is set, it is simply a holder for the 'format_to_edit'
- * filter. If $richedit is set true htmlspecialchars(), through esc_textarea(),
- * will be run on the content, converting special characters to HTML entities.
</del><ins>+ * The $content is run through esc_textarea(), which uses htmlspecialchars()
+ * to convert special characters to HTML entities. If $richedit is set to true,
+ * it is simply a holder for the 'format_to_edit' filter.
</ins><span class="cx">  *
</span><span class="cx">  * @since 0.71
</span><span class="cx">  *
</span><span class="cx">  * @param string $content The text about to be edited.
</span><del>- * @param bool $richedit Whether the $content should pass through htmlspecialchars(). Default false.
</del><ins>+ * @param bool $richedit Whether the $content should not pass through htmlspecialchars(). Default false (meaning it will be passed).
</ins><span class="cx">  * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
</span><span class="cx">  */
</span><span class="cx"> function format_to_edit( $content, $richedit = false ) {
</span></span></pre></div>
<a id="trunkwpincludesjspluploadhandlersdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/plupload/handlers.dev.js (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/plupload/handlers.dev.js        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-includes/js/plupload/handlers.dev.js        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -338,10 +338,43 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> jQuery(document).ready(function($){
</span><ins>+        var insert_link, bookmark;
+
</ins><span class="cx">         $('.media-upload-form').bind('click.uploader', function(e) {
</span><del>-                var target = $(e.target), tr, c;
</del><ins>+                var target = $(e.target), tr, c, el, textarea, sel, text, startPos, endPos;
</ins><span class="cx"> 
</span><del>-                if ( target.is('input[type=&quot;radio&quot;]') ) { // remember the last used image size and alignment
</del><ins>+                if ( target.hasClass('caption-insert-link') ) {
+                        el = target.siblings('div.caption-insert-link-wrap'), textarea = target.parent().siblings('textarea').get(0);
+
+                        if ( document.selection ) {
+                                textarea.focus();
+                                sel = document.selection.createRange();
+                                bookmark = sel.getBookmark();
+
+                                if ( sel.text )
+                                        el.find('.caption-insert-link-text').val(sel.text);
+
+                        } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
+                                text = textarea.value;
+                                startPos = textarea.selectionStart;
+                                endPos = textarea.selectionEnd;
+                                
+                                if ( startPos != endPos )
+                                        el.find('.caption-insert-link-text').val( text.substring(startPos, endPos) );
+                        }
+
+                        target.hide();
+                        el.show();
+                        el.find('.caption-insert-link-url').focus();
+                } else if ( target.hasClass('caption-cancel') || target.hasClass('caption-save') ) {
+                        el = target.closest('div.caption-insert-link-wrap');
+
+                        if ( target.hasClass('caption-save') )
+                                insert_link( el.closest('.edit-caption-controls').siblings('textarea'), el );
+                        
+                        el.hide();
+                        el.siblings('.caption-insert-link').show();
+                } else if ( target.is('input[type=&quot;radio&quot;]') ) { // remember the last used image size and alignment
</ins><span class="cx">                         tr = target.closest('tr');
</span><span class="cx"> 
</span><span class="cx">                         if ( $(tr).hasClass('align') )
</span><span class="lines">@@ -355,7 +388,7 @@
</span><span class="cx"> 
</span><span class="cx">                         if ( c &amp;&amp; c[1] ) {
</span><span class="cx">                                 setUserSetting('urlbutton', c[1]);
</span><del>-                                target.siblings('.urlfield').val( target.attr('title') );
</del><ins>+                                target.siblings('.urlfield').val( target.data('link-url') );
</ins><span class="cx">                         }
</span><span class="cx">                 } else if ( target.is('a.dismiss') ) {
</span><span class="cx">                         target.parents('.media-item').fadeOut(200, function(){
</span><span class="lines">@@ -364,11 +397,11 @@
</span><span class="cx">                 } else if ( target.is('.upload-flash-bypass a') || target.is('a.uploader-html') ) { // switch uploader to html4
</span><span class="cx">                         $('#media-items, p.submit, span.big-file-warning').css('display', 'none');
</span><span class="cx">                         switchUploader(0);
</span><del>-                        return false;
</del><ins>+                        e.preventDefault();
</ins><span class="cx">                 } else if ( target.is('.upload-html-bypass a') ) { // switch uploader to multi-file
</span><span class="cx">                         $('#media-items, p.submit, span.big-file-warning').css('display', '');
</span><span class="cx">                         switchUploader(1);
</span><del>-                        return false;
</del><ins>+                        e.preventDefault();
</ins><span class="cx">                 } else if ( target.is('a.describe-toggle-on') ) { // Show
</span><span class="cx">                         target.parent().addClass('open');
</span><span class="cx">                         target.siblings('.slidetoggle').fadeIn(250, function(){
</span><span class="lines">@@ -386,15 +419,54 @@
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx">                         });
</span><del>-                        return false;
</del><ins>+                        e.preventDefault();
</ins><span class="cx">                 } else if ( target.is('a.describe-toggle-off') ) { // Hide
</span><span class="cx">                         target.siblings('.slidetoggle').fadeOut(250, function(){
</span><span class="cx">                                 target.parent().removeClass('open');
</span><span class="cx">                         });
</span><del>-                        return false;
</del><ins>+                        e.preventDefault();
</ins><span class="cx">                 }
</span><span class="cx">         });
</span><ins>+        
+        insert_link = function(textarea, parent) {
+                var sel, content, startPos, endPos, scrollTop, text,
+                        url = parent.find('.caption-insert-link-url'), link_text = parent.find('.caption-insert-link-text');
</ins><span class="cx"> 
</span><ins>+                if ( !url.length || !link_text.length )
+                        return;
+
+                textarea = textarea.get(0);
+                content = &quot;&lt;a href='&quot;+url.val()+&quot;'&gt;&quot;+link_text.val()+&quot;&lt;/a&gt;&quot;;
+
+                if ( document.selection ) {
+                        textarea.focus();
+                        sel = document.selection.createRange();
+
+                        if ( bookmark ) {
+                                sel.moveToBookmark( bookmark );
+                                bookmark = '';
+                        }
+
+                        sel.text = content;
+                        textarea.focus();
+                } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
+                        text = textarea.value;
+                        startPos = textarea.selectionStart;
+                        endPos = textarea.selectionEnd;
+                        scrollTop = textarea.scrollTop;
+
+                        textarea.value = text.substring(0, startPos) + content + text.substring(endPos, text.length);
+
+                        textarea.focus();
+                        textarea.selectionStart = startPos + content.length;
+                        textarea.selectionEnd = startPos + content.length;
+                        textarea.scrollTop = scrollTop;
+                }
+
+                url.val('');
+                link_text.val('');
+        };
+
</ins><span class="cx">         // init and set the uploader
</span><span class="cx">         uploader_init = function() {
</span><span class="cx">                 uploader = new plupload.Uploader(wpUploaderInit);
</span></span></pre></div>
<a id="trunkwpincludesjstinymcelangswplangsenjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/langs/wp-langs-en.js (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/langs/wp-langs-en.js        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-includes/js/tinymce/langs/wp-langs-en.js        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx"> clipboard_msg:&quot;Copy/Cut/Paste is not available in Mozilla and Firefox.&quot;,
</span><span class="cx"> clipboard_no_support:&quot;Currently not supported by your browser, use keyboard shortcuts instead.&quot;,
</span><span class="cx"> popup_blocked:&quot;Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.&quot;,
</span><del>-invalid_data:&quot;Error: Invalid values entered, these are marked in red.&quot;,
</del><ins>+invalid_data:&quot;ERROR: Invalid values entered, these are marked in red.&quot;,
</ins><span class="cx"> invalid_data_number:&quot;{#field} must be a number&quot;,
</span><span class="cx"> invalid_data_min:&quot;{#field} must be a number greater than {#min}&quot;,
</span><span class="cx"> invalid_data_size:&quot;{#field} must be a number or percentage&quot;,
</span><span class="lines">@@ -240,8 +240,8 @@
</span><span class="cx"> samp:&quot;Code sample&quot;,
</span><span class="cx"> dt:&quot;Definition term &quot;,
</span><span class="cx"> dd:&quot;Definition description&quot;,
</span><del>-bold_desc:&quot;Bold (Ctrl / Alt + Shift + B)&quot;,
-italic_desc:&quot;Italic (Ctrl / Alt + Shift + I)&quot;,
</del><ins>+bold_desc:&quot;Bold (Ctrl + B)&quot;,
+italic_desc:&quot;Italic (Ctrl + I)&quot;,
</ins><span class="cx"> underline_desc:&quot;Underline&quot;,
</span><span class="cx"> striketrough_desc:&quot;Strikethrough (Alt + Shift + D)&quot;,
</span><span class="cx"> justifyleft_desc:&quot;Align Left (Alt + Shift + L)&quot;,
</span><span class="lines">@@ -266,6 +266,7 @@
</span><span class="cx"> forecolor_desc:&quot;Select text color&quot;,
</span><span class="cx"> backcolor_desc:&quot;Select background color&quot;,
</span><span class="cx"> charmap_desc:&quot;Insert custom character&quot;,
</span><ins>+charmap_usage:&quot;Use left and right arrows to navigate.&quot;,
</ins><span class="cx"> visualaid_desc:&quot;Toggle guidelines/invisible elements&quot;,
</span><span class="cx"> anchor_desc:&quot;Insert/edit anchor&quot;,
</span><span class="cx"> cut_desc:&quot;Cut&quot;,
</span><span class="lines">@@ -498,5 +499,7 @@
</span><span class="cx"> s130:&quot;130%&quot;,
</span><span class="cx"> img_title:&quot;Title&quot;,
</span><span class="cx"> caption:&quot;Caption&quot;,
</span><ins>+insert_link:&quot;Insert link&quot;,
+linked_text:&quot;Linked text&quot;,
</ins><span class="cx"> alt:&quot;Alternate Text&quot;
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkwpincludesjstinymcelangswplangsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/langs/wp-langs.php (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/langs/wp-langs.php        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-includes/js/tinymce/langs/wp-langs.php        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -275,6 +275,7 @@
</span><span class="cx"> forecolor_desc:&quot;' . mce_escape( __('Select text color') ) . '&quot;,
</span><span class="cx"> backcolor_desc:&quot;' . mce_escape( __('Select background color') ) . '&quot;,
</span><span class="cx"> charmap_desc:&quot;' . mce_escape( __('Insert custom character') ) . '&quot;,
</span><ins>+charmap_usage:&quot;' . mce_escape( __('Use left and right arrows to navigate.') ) . '&quot;,
</ins><span class="cx"> visualaid_desc:&quot;' . mce_escape( __('Toggle guidelines/invisible elements') ) . '&quot;,
</span><span class="cx"> anchor_desc:&quot;' . mce_escape( __('Insert/edit anchor') ) . '&quot;,
</span><span class="cx"> cut_desc:&quot;' . mce_escape( __('Cut') ) . '&quot;,
</span><span class="lines">@@ -507,6 +508,8 @@
</span><span class="cx"> s130:&quot;' . mce_escape( __('130%') ) . '&quot;,
</span><span class="cx"> img_title:&quot;' . mce_escape( __('Title') ) . '&quot;,
</span><span class="cx"> caption:&quot;' . mce_escape( __('Caption') ) . '&quot;,
</span><ins>+insert_link:&quot;' . mce_escape( __('Insert link') ) . '&quot;,
+linked_text:&quot;' . mce_escape( __('Linked text') ) . '&quot;,
</ins><span class="cx"> alt:&quot;' . mce_escape( __('Alternate Text') ) . '&quot;
</span><span class="cx"> });
</span><span class="cx"> ';
</span></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimagecsseditimagertlcss"></a>
<div class="delfile"><h4>Deleted: trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -1,68 +0,0 @@
</span><del>-
-body#media-upload ul#sidemenu {
-        left: auto;
-        right: 0;
-}
-
-#basic .align .field label {
-        display: block;
-        float: right;
-        padding: 0 24px 0 0;
-        margin: 5px 3px 5px 5px; 
-}
-
-.align .field input {
-        display: block;
-        float: right;
-        margin: 5px 15px 5px 0;
-}
-
-tr.image-size label {
-        margin: 0;
-}
-
-tr.image-size input {
-        margin: 3px 15px 0 5px;
-}
-
-.image-align-none-label,
-.image-align-left-label,
-.image-align-center-label,
-.image-align-right-label {
-        background-position: center right;
-}
-
-#media-upload .describe th.label {
-        text-align: right;
-}
-
-.show-align,
-.alignright,
-#img_size {
-        float: left;
-}
-
-tr.image-size label,
-tr.image-size input,
-#img_dim label,
-#img_dim input,
-#img_prop label,
-#img_prop input,
-#img_size_div,
-.alignleft {
-        float: right;
-}
-
-#img_dim label,
-#img_prop label {
-        margin: 5px 0pt;
-}
-
-#img_dim input,
-#img_prop input {
-        margin: 0 5px 0 10px;
-}
-
-#img_size_title {
-        text-align: left;
-}
</del></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimagecsseditimagecss"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -356,3 +356,112 @@
</span><span class="cx">         background-color: #222222;
</span><span class="cx">         color: #CFCFCF;
</span><span class="cx"> }
</span><ins>+
+#img-edit .edit-caption-controls {
+        margin: 5px 0;
+}
+
+#img-edit .edit-caption-controls label {
+        margin: 5px 0;
+        display: block;
+}
+
+#img-edit .edit-caption-controls label span {
+        width: 100px;
+        float: left;
+        line-height: 22px;
+}
+
+#img-edit .edit-caption-controls input[type=&quot;text&quot;] {
+        width: 335px;
+}
+
+#img-edit .caption-insert-link-buttons {
+        text-align: right;
+        margin: 5px 12px;
+}
+
+#img-edit .caption-insert-link-wrap {
+        padding: 5px 0 5px 12px;
+        background-color: #f8f8f8;
+        border: 1px solid #eee;
+        -webkit-border-radius: 3px;
+        border-radius: 3px;
+}
+
+#img-edit #img_cap_text {
+        font: normal 12px/18px monospace;
+}
+
+.hidden {
+        display: none;
+}
+
+/* RTL */
+body#media-upload.rtl ul#sidemenu {
+        left: auto;
+        right: 0;
+}
+
+.rtl #basic .align .field label {
+        display: block;
+        float: right;
+        padding: 0 24px 0 0;
+        margin: 5px 3px 5px 5px; 
+}
+
+.rtl .align .field input {
+        display: block;
+        float: right;
+        margin: 5px 15px 5px 0;
+}
+
+.rtl tr.image-size label {
+        margin: 0;
+}
+
+.rtl tr.image-size input {
+        margin: 3px 15px 0 5px;
+}
+
+.rtl .image-align-none-label,
+.rtl .image-align-left-label,
+.rtl .image-align-center-label,
+.rtl .image-align-right-label {
+        background-position: center right;
+}
+
+#media-upload.rtl .describe th.label {
+        text-align: right;
+}
+
+.rtl .show-align,
+.rtl .alignright,
+.rtl #img_size {
+        float: left;
+}
+
+.rtl tr.image-size label,
+.rtl tr.image-size input,
+.rtl #img_dim label,
+.rtl #img_dim input,
+.rtl #img_prop label,
+.rtl #img_prop input,
+.rtl #img_size_div,
+.rtl .alignleft {
+        float: right;
+}
+
+.rtl #img_dim label,
+.rtl #img_prop label {
+        margin: 5px 0pt;
+}
+
+.rtl #img_dim input,
+.rtl #img_prop input {
+        margin: 0 5px 0 10px;
+}
+
+.rtl #img_size_title {
+        text-align: left;
+}
</ins></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimageeditimagehtml"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -1,22 +1,20 @@
</span><del>-&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
</del><ins>+&lt;!DOCTYPE html&gt;
</ins><span class="cx"> &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;en-US&quot;&gt;
</span><span class="cx"> &lt;head&gt;
</span><span class="cx"> &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
</span><span class="cx"> &lt;title&gt;&lt;/title&gt;
</span><span class="cx"> 
</span><del>-&lt;script type=&quot;text/javascript&quot; src=&quot;js/editimage.js?ver=327&quot;&gt;&lt;/script&gt;
-&lt;script type=&quot;text/javascript&quot; src=&quot;../../utils/form_utils.js?ver=3223&quot;&gt;&lt;/script&gt;
</del><ins>+&lt;link rel=&quot;stylesheet&quot; href=&quot;css/editimage.css?ver=348&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;
+&lt;script type=&quot;text/javascript&quot; src=&quot;js/editimage.js?ver=348&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;text/javascript&quot; src=&quot;../../utils/form_utils.js?ver=348&quot;&gt;&lt;/script&gt;
+&lt;base target=&quot;_self&quot; /&gt;
+&lt;/head&gt;
</ins><span class="cx"> 
</span><del>-&lt;link rel=&quot;stylesheet&quot; href=&quot;css/editimage.css?ver=327&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;
-
</del><ins>+&lt;body id=&quot;media-upload&quot; style=&quot;display:none;&quot;&gt;
</ins><span class="cx"> &lt;script type=&quot;text/javascript&quot;&gt;
</span><span class="cx"> if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
</span><del>-        document.write('&lt;link rel=&quot;stylesheet&quot; href=&quot;css/editimage-rtl.css?ver=3223&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;');
</del><ins>+        document.body.className += ' rtl';
</ins><span class="cx"> &lt;/script&gt;
</span><del>-&lt;base target=&quot;_self&quot; /&gt;
-&lt;/head&gt;
-
-&lt;body id=&quot;media-upload&quot; style=&quot;display:none;&quot;&gt;
</del><span class="cx"> &lt;div id=&quot;media-upload-header&quot;&gt;
</span><span class="cx">         &lt;ul id=&quot;sidemenu&quot;&gt;
</span><span class="cx">         &lt;li&gt;&lt;a href=&quot;javascript:;&quot; id=&quot;tab_basic&quot; class=&quot;current&quot; onclick=&quot;wpImage.setTabs(this);&quot;&gt;{#wpeditimage.edit_img}&lt;/a&gt;&lt;/li&gt;
</span><span class="lines">@@ -103,7 +101,23 @@
</span><span class="cx">                                 &lt;/label&gt;
</span><span class="cx">                         &lt;/th&gt;
</span><span class="cx">                         &lt;td class=&quot;field&quot;&gt;
</span><del>-                                &lt;input type=&quot;text&quot; id=&quot;img_cap&quot; name=&quot;img_cap&quot; value=&quot;&quot; size=&quot;60&quot; /&gt;
</del><ins>+                                &lt;textarea id=&quot;img_cap_text&quot;&gt;&lt;/textarea&gt;
+
+                                &lt;div class=&quot;edit-caption-controls&quot;&gt;
+                                &lt;input type=&quot;button&quot; class=&quot;button caption-insert-link&quot; value=&quot;{#wpeditimage.insert_link}&quot; /&gt;
+
+                                &lt;div class=&quot;caption-insert-link-wrap hidden&quot;&gt;
+                                &lt;label&gt;&lt;span&gt;{#advanced_dlg.link_url}&lt;/span&gt;
+                                &lt;input type=&quot;text&quot; value=&quot;&quot; class=&quot;caption-insert-link-url&quot; /&gt;&lt;/label&gt;
+
+                                &lt;label&gt;&lt;span&gt;{#wpeditimage.linked_text}&lt;/span&gt;
+                                &lt;input type=&quot;text&quot; value=&quot;&quot; class=&quot;caption-insert-link-text&quot; /&gt;&lt;/label&gt;
+
+                                &lt;div class=&quot;caption-insert-link-buttons&quot;&gt;
+                                &lt;input type=&quot;button&quot; class=&quot;button caption-cancel&quot; value=&quot;{#cancel}&quot; /&gt;
+                                &lt;input type=&quot;button&quot; class=&quot;button-primary caption-save&quot; value=&quot;{#insert}&quot; /&gt;
+                                &lt;br class=&quot;clear&quot; /&gt;
+                                &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
</ins><span class="cx">                         &lt;/td&gt;
</span><span class="cx">                 &lt;/tr&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimageeditor_plugin_srcjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -1,11 +1,14 @@
</span><span class="cx"> 
</span><span class="cx"> (function() {
</span><span class="cx">         tinymce.create('tinymce.plugins.wpEditImage', {
</span><ins>+                url: '',
+                editor: {},
</ins><span class="cx"> 
</span><del>-                init : function(ed, url) {
</del><ins>+                init: function(ed, url) {
</ins><span class="cx">                         var t = this, mouse = {};
</span><span class="cx"> 
</span><span class="cx">                         t.url = url;
</span><ins>+                        t.editor = ed;
</ins><span class="cx">                         t._createButtons();
</span><span class="cx"> 
</span><span class="cx">                         // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
</span><span class="lines">@@ -28,9 +31,12 @@
</span><span class="cx">                         });
</span><span class="cx"> 
</span><span class="cx">                         ed.onInit.add(function(ed) {
</span><del>-                                tinymce.dom.Event.add(ed.getBody(), 'dragstart', function(e) {
-                                        if ( !tinymce.isGecko &amp;&amp; e.target.nodeName == 'IMG' &amp;&amp; ed.dom.getParent(e.target, 'dl.wp-caption') )
-                                                return tinymce.dom.Event.cancel(e);
</del><ins>+                                ed.dom.events.add(ed.getBody(), 'dragstart', function(e) {
+                                        var parent;
+
+                                        if ( e.target.nodeName == 'IMG' &amp;&amp; ( parent = ed.dom.getParent(e.target, 'div.mceTemp') ) ) {
+                                                ed.selection.select(parent);
+                                        }
</ins><span class="cx">                                 });
</span><span class="cx">                         });
</span><span class="cx"> 
</span><span class="lines">@@ -44,21 +50,16 @@
</span><span class="cx"> 
</span><span class="cx">                                         if ( 'IMG' == n.nodeName ) {
</span><span class="cx">                                                 window.setTimeout(function(){
</span><del>-                                                        var DL, width;
</del><ins>+                                                        var DL = ed.dom.getParent(n, 'dl.wp-caption'), width;
</ins><span class="cx"> 
</span><span class="cx">                                                         if ( n.width != mouse.img_w || n.height != mouse.img_h )
</span><span class="cx">                                                                 n.className = n.className.replace(/size-[^ &quot;']+/, '');
</span><span class="cx"> 
</span><del>-                                                        if ( ed.dom.getParent(n, 'div.mceTemp') ) {
-                                                                DL = ed.dom.getParent(n, 'dl.wp-caption');
-
-                                                                if ( DL ) {
-                                                                        width = ed.dom.getAttrib(n, 'width') || n.width;
-                                                                        width = parseInt(width, 10);
-                                                                        ed.dom.setStyle(DL, 'width', 10 + width);
-                                                                        ed.execCommand('mceRepaint');
-                                                                }
-
</del><ins>+                                                        if ( DL ) {
+                                                                width = ed.dom.getAttrib(n, 'width') || n.width;
+                                                                width = parseInt(width, 10);
+                                                                ed.dom.setStyle(DL, 'width', 10 + width);
+                                                                ed.execCommand('mceRepaint');
</ins><span class="cx">                                                         }
</span><span class="cx">                                                 }, 100);
</span><span class="cx">                                         }
</span><span class="lines">@@ -82,80 +83,105 @@
</span><span class="cx">                                 }
</span><span class="cx">                         });
</span><span class="cx"> 
</span><del>-                        // when pressing Return inside a caption move the cursor to a new parapraph under it
</del><ins>+                        // when pressing Return inside a caption move the caret to a new parapraph under it
</ins><span class="cx">                         ed.onKeyPress.add(function(ed, e) {
</span><span class="cx">                                 var n, DL, DIV, P;
</span><span class="cx"> 
</span><span class="cx">                                 if ( e.keyCode == 13 ) {
</span><span class="cx">                                         n = ed.selection.getNode();
</span><span class="cx">                                         DL = ed.dom.getParent(n, 'dl.wp-caption');
</span><del>-                                        DIV = ed.dom.getParent(DL, 'div.mceTemp');
</del><span class="cx"> 
</span><del>-                                        if ( DL &amp;&amp; DIV ) {
-                                                P = ed.dom.create('p', {}, '&amp;nbsp;');
</del><ins>+                                        if ( DL )
+                                                DIV = ed.dom.getParent(DL, 'div.mceTemp');
+
+                                        if ( DIV ) {
+                                                P = ed.dom.create('p', {}, '&lt;br&gt;');
</ins><span class="cx">                                                 ed.dom.insertAfter( P, DIV );
</span><del>-                                                
-                                                if ( P.firstChild )
-                                                        ed.selection.select(P.firstChild);
-                                                else
-                                                        ed.selection.select(P);
-                                                
-                                                tinymce.dom.Event.cancel(e);
</del><ins>+                                                ed.selection.select(P.firstChild);
+
+                                                if ( tinymce.isIE ) {
+                                                        ed.selection.setContent('');
+                                                } else {
+                                                        ed.selection.setContent('&lt;br _moz_dirty=&quot;&quot;&gt;');
+                                                        ed.selection.setCursorLocation(P, 0);
+                                                }
+
+                                                ed.dom.events.cancel(e);
</ins><span class="cx">                                                 return false;
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx">                         });
</span><span class="cx"> 
</span><span class="cx">                         ed.onBeforeSetContent.add(function(ed, o) {
</span><del>-                                o.content = t._do_shcode(o.content);
</del><ins>+                                o.content = ed.wpSetImgCaption(o.content);
</ins><span class="cx">                         });
</span><span class="cx"> 
</span><span class="cx">                         ed.onPostProcess.add(function(ed, o) {
</span><span class="cx">                                 if (o.get)
</span><del>-                                        o.content = t._get_shcode(o.content);
</del><ins>+                                        o.content = ed.wpGetImgCaption(o.content);
</ins><span class="cx">                         });
</span><ins>+
+                        ed.wpSetImgCaption = function(content) {
+                                return t._do_shcode(content);
+                        };
+
+                        ed.wpGetImgCaption = function(content) {
+                                return t._get_shcode(content);
+                        };
</ins><span class="cx">                 },
</span><span class="cx"> 
</span><del>-                _do_shcode : function(co) {
-                        return co.replace(/(?:&lt;p&gt;)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:&lt;\/p&gt;)?[\s\u00a0]*/g, function(a,b,c){
</del><ins>+                _do_shcode : function(content) {
+                        return content.replace(/(?:&lt;p&gt;)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:&lt;\/p&gt;)?/g, function(a,b,c){
</ins><span class="cx">                                 var id, cls, w, cap, div_cls;
</span><del>-                                
-                                b = b.replace(/\\'|\\&amp;#39;|\\&amp;#039;/g, '&amp;#39;').replace(/\\&quot;|\\&amp;quot;/g, '&amp;quot;');
-                                c = c.replace(/\\&amp;#39;|\\&amp;#039;/g, '&amp;#39;').replace(/\\&amp;quot;/g, '&amp;quot;');
-                                id = b.match(/id=['&quot;]([^'&quot;]+)/i);
-                                cls = b.match(/align=['&quot;]([^'&quot;]+)/i);
-                                w = b.match(/width=['&quot;]([0-9]+)/);
-                                cap = b.match(/caption=['&quot;]([^'&quot;]+)/i);
</del><span class="cx"> 
</span><ins>+                                id = b.match(/id=['&quot;]([^'&quot;]+)['&quot;] ?/);
+                                b = b.replace(id[0], '');
+
+                                cls = b.match(/align=['&quot;]([^'&quot;]+)['&quot;] ?/);
+                                b = b.replace(cls[0], '');
+
+                                w = b.match(/width=['&quot;]([0-9]+)['&quot;] ?/);
+                                b = b.replace(w[0], '');
+
+                                cap = tinymce.trim(b).replace(/caption=['&quot;]/, '').replace(/['&quot;]$/, '');
+
</ins><span class="cx">                                 id = ( id &amp;&amp; id[1] ) ? id[1] : '';
</span><span class="cx">                                 cls = ( cls &amp;&amp; cls[1] ) ? cls[1] : 'alignnone';
</span><span class="cx">                                 w = ( w &amp;&amp; w[1] ) ? w[1] : '';
</span><del>-                                cap = ( cap &amp;&amp; cap[1] ) ? cap[1] : '';
-                                if ( ! w || ! cap ) return c;
-                                
</del><ins>+
+                                if ( !w || !cap )
+                                        return c;
+
</ins><span class="cx">                                 div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
</span><span class="cx"> 
</span><del>-                                return '&lt;div class=&quot;'+div_cls+'&quot; draggable&gt;&lt;dl id=&quot;'+id+'&quot; class=&quot;wp-caption '+cls+'&quot; style=&quot;width: '+(10+parseInt(w))+
</del><ins>+                                return '&lt;div class=&quot;'+div_cls+'&quot; draggable=&quot;true&quot;&gt;&lt;dl id=&quot;'+id+'&quot; class=&quot;wp-caption '+cls+'&quot; style=&quot;width: '+( 10 + parseInt(w) )+
</ins><span class="cx">                                 'px&quot;&gt;&lt;dt class=&quot;wp-caption-dt&quot;&gt;'+c+'&lt;/dt&gt;&lt;dd class=&quot;wp-caption-dd&quot;&gt;'+cap+'&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;';
</span><span class="cx">                         });
</span><span class="cx">                 },
</span><span class="cx"> 
</span><del>-                _get_shcode : function(co) {
-                        return co.replace(/&lt;div class=&quot;mceTemp[^&quot;]*&quot;&gt;\s*&lt;dl([^&gt;]+)&gt;\s*&lt;dt[^&gt;]+&gt;([\s\S]+?)&lt;\/dt&gt;\s*&lt;dd[^&gt;]+&gt;(.+?)&lt;\/dd&gt;\s*&lt;\/dl&gt;\s*&lt;\/div&gt;\s*/gi, function(a,b,c,cap){
</del><ins>+                _get_shcode : function(content) {
+                        return content.replace(/&lt;div class=&quot;mceTemp[^&quot;]*&quot;&gt;\s*&lt;dl ([^&gt;]+)&gt;\s*&lt;dt [^&gt;]+&gt;([\s\S]+?)&lt;\/dt&gt;\s*&lt;dd [^&gt;]+&gt;([\s\S]+?)&lt;\/dd&gt;\s*&lt;\/dl&gt;\s*&lt;\/div&gt;/gi, function(a,b,c,cap){
</ins><span class="cx">                                 var id, cls, w;
</span><del>-                                
-                                id = b.match(/id=['&quot;]([^'&quot;]+)/i);
-                                cls = b.match(/class=['&quot;]([^'&quot;]+)/i);
-                                w = c.match(/width=['&quot;]([0-9]+)/);
</del><span class="cx"> 
</span><del>-                                id = ( id &amp;&amp; id[1] ) ? id[1] : '';
-                                cls = ( cls &amp;&amp; cls[1] ) ? cls[1] : 'alignnone';
</del><ins>+                                w = c.match(/width=&quot;([0-9]+)&quot;/);
</ins><span class="cx">                                 w = ( w &amp;&amp; w[1] ) ? w[1] : '';
</span><span class="cx"> 
</span><del>-                                if ( ! w || ! cap ) return c;
-                                cls = cls.match(/align[^ '&quot;]+/) || 'alignnone';
-                                cap = cap.replace(/&lt;\S[^&lt;&gt;]*&gt;/gi, '').replace(/'/g, '&amp;#39;').replace(/&quot;/g, '&amp;quot;');
</del><ins>+                                if ( !w || !cap )
+                                        return c;
</ins><span class="cx"> 
</span><ins>+                                id = b.match(/id=&quot;([^&quot;]+)&quot;/);
+                                id = ( id &amp;&amp; id[1] ) ? id[1] : '';
+
+                                cls = b.match(/class=&quot;([^&quot;]+)&quot;/);
+                                cls = ( cls &amp;&amp; cls[1] ) ? cls[1] : '';
+                                cls = cls.match(/align[a-z]+/) || 'alignnone';
+
+                                cap = cap.replace(/&lt;[a-z][^&lt;&gt;]+&gt;/g, function(a){
+                                        return a.replace(/&quot;/g, &quot;'&quot;);
+                                });
+
+                                cap = cap.replace(/&quot;/g, '&amp;quot;');
+
</ins><span class="cx">                                 return '[caption id=&quot;'+id+'&quot; align=&quot;'+cls+'&quot; width=&quot;'+w+'&quot; caption=&quot;'+cap+'&quot;]'+c+'[/caption]';
</span><span class="cx">                         });
</span><span class="cx">                 },
</span></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimagejseditimagedevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx">                 tinyMCE = w.tinyMCE;
</span><span class="cx">                 t.editor = tinymce.EditorManager.activeEditor;
</span><span class="cx">                 t.params = t.editor.windowManager.params;
</span><ins>+                t.events = new tinymce.dom.EventUtils();
</ins><span class="cx"> 
</span><span class="cx">                 // Setup local DOM
</span><span class="cx">                 t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
</span><span class="lines">@@ -36,16 +37,16 @@
</span><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         close : function() {
</span><del>-                var t = this, win = t.getWin();
</del><ins>+                var t = this;
</ins><span class="cx"> 
</span><span class="cx">                 // To avoid domain relaxing issue in Opera
</span><span class="cx">                 function close() {
</span><del>-                        win.tb_remove();
-                        tinymce = tinyMCE = t.editor = t.dom = t.dom.doc = null; // Cleanup
</del><ins>+                        t.editor.windowManager.close(window);
+                        tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
</ins><span class="cx">                 };
</span><span class="cx"> 
</span><span class="cx">                 if (tinymce.isOpera)
</span><del>-                        win.setTimeout(close, 0);
</del><ins>+                        t.getWin().setTimeout(close, 0);
</ins><span class="cx">                 else
</span><span class="cx">                         close();
</span><span class="cx">         },
</span><span class="lines">@@ -74,12 +75,14 @@
</span><span class="cx"> wpImage = {
</span><span class="cx">         preInit : function() {
</span><span class="cx">                 // import colors stylesheet from parent
</span><del>-                var win = tinyMCEPopup.getWin(), styles = win.document.styleSheets, url, i;
</del><ins>+                var ed = tinyMCEPopup.editor, win = tinyMCEPopup.getWin(), styles = win.document.styleSheets, url, i;
</ins><span class="cx"> 
</span><span class="cx">                 for ( i = 0; i &lt; styles.length; i++ ) {
</span><span class="cx">                         url = styles.item(i).href;
</span><del>-                        if ( url &amp;&amp; url.indexOf('colors') != -1 )
-                                document.write( '&lt;link rel=&quot;stylesheet&quot; href=&quot;'+url+'&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;' );
</del><ins>+                        if ( url &amp;&amp; url.indexOf('colors') != -1 ) {
+                                document.getElementsByTagName('head')[0].appendChild( ed.dom.create('link', {rel:'stylesheet', href: url}) );
+                                break;
+                        }
</ins><span class="cx">                 }
</span><span class="cx">         },
</span><span class="cx"> 
</span><span class="lines">@@ -242,7 +245,7 @@
</span><span class="cx"> 
</span><span class="cx">         setup : function() {
</span><span class="cx">                 var t = this, c, el, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor,
</span><del>-                        d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption = '', dlc, pa;
</del><ins>+                        d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, DD, caption = '', dlc, pa, bookmark, insert_link;
</ins><span class="cx"> 
</span><span class="cx">                 document.dir = tinyMCEPopup.editor.getParam('directionality','');
</span><span class="cx"> 
</span><span class="lines">@@ -267,15 +270,12 @@
</span><span class="cx">                                 tinymce.trim(c);
</span><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        tinymce.each(DL.childNodes, function(e) {
-                                if ( e.nodeName == 'DD' &amp;&amp; dom.hasClass(e, 'wp-caption-dd') ) {
-                                        caption = e.innerHTML;
-                                        return;
-                                }
-                        });
</del><ins>+                        DD = ed.dom.select('dd.wp-caption-dd', DL);
+                        if ( DD &amp;&amp; DD[0] )
+                                caption = ed.serializer.serialize(DD[0]).replace(/^&lt;p&gt;/, '').replace(/&lt;\/p&gt;$/, '');
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                f.img_cap.value = caption;
</del><ins>+                f.img_cap_text.value = caption;
</ins><span class="cx">                 f.img_title.value = ed.dom.getAttrib(el, 'title');
</span><span class="cx">                 f.img_alt.value = ed.dom.getAttrib(el, 'alt');
</span><span class="cx">                 f.border.value = ed.dom.getAttrib(el, 'border');
</span><span class="lines">@@ -326,8 +326,83 @@
</span><span class="cx">                         d.className = t.align = &quot;alignnone&quot;;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( t.width &amp;&amp; t.preloadImg.width ) t.showSizeSet();
</del><ins>+                if ( t.width &amp;&amp; t.preloadImg.width )
+                        t.showSizeSet();
+                
</ins><span class="cx">                 document.body.style.display = '';
</span><ins>+
+                tinyMCEPopup.events.add(document.body, 'click', function(e) {
+                        var target = e.target, parent = target.parentNode, tr, c, el, textarea, sel, text, startPos, endPos;
+
+                        if ( dom.hasClass(target, 'caption-insert-link') ) {
+                                el = dom.select('div.caption-insert-link-wrap', parent)[0], textarea = dom.select('#img_cap_text')[0];
+
+                                if ( document.selection ) {
+                                        textarea.focus();
+                                        sel = document.selection.createRange();
+                                        bookmark = sel.getBookmark();
+
+                                        if ( sel.text )
+                                                dom.select('.caption-insert-link-text', el)[0].value = sel.text;
+
+                                } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
+                                        text = textarea.value;
+                                        startPos = textarea.selectionStart;
+                                        endPos = textarea.selectionEnd;
+
+                                        if ( startPos != endPos )
+                                                dom.select('.caption-insert-link-text', el)[0].value = text.substring(startPos, endPos);
+                                }
+
+                                dom.hide(target);
+                                dom.show(el);
+                                dom.select('.caption-insert-link-url', el)[0].focus();
+                        } else if ( dom.hasClass(target, 'caption-cancel') || dom.hasClass(target, 'caption-save') ) {
+                                if ( dom.hasClass(target, 'caption-save') )
+                                        insert_link();
+
+                                dom.hide( dom.select('.caption-insert-link-wrap') );
+                                dom.show( dom.select('.caption-insert-link') );
+                        }
+                });
+
+                insert_link = function() {
+                        var sel, content, startPos, endPos, scrollTop, text, textarea = dom.select('#img_cap_text')[0],
+                                url = dom.select('.caption-insert-link-url')[0], link_text = dom.select('.caption-insert-link-text')[0];
+
+                        if ( !url || !link_text )
+                                return;
+
+                        content = &quot;&lt;a href='&quot;+url.value+&quot;'&gt;&quot;+link_text.value+&quot;&lt;/a&gt;&quot;;
+
+                        if ( document.selection ) {
+                                textarea.focus();
+                                sel = document.selection.createRange();
+
+                                if ( bookmark ) {
+                                        sel.moveToBookmark( bookmark );
+                                        bookmark = '';
+                                }
+
+                                sel.text = content;
+                                textarea.focus();
+                        } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
+                                text = textarea.value;
+                                startPos = textarea.selectionStart;
+                                endPos = textarea.selectionEnd;
+                                scrollTop = textarea.scrollTop;
+
+                                textarea.value = text.substring(0, startPos) + content + text.substring(endPos, text.length);
+
+                                textarea.focus();
+                                textarea.selectionStart = startPos + content.length;
+                                textarea.selectionEnd = startPos + content.length;
+                                textarea.scrollTop = scrollTop;
+                        }
+
+                        url.value = '';
+                        link_text.value = '';
+                };
</ins><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         remove : function() {
</span><span class="lines">@@ -362,7 +437,7 @@
</span><span class="cx">                         return;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( f.img_cap.value != '' &amp;&amp; f.width.value != '' ) {
</del><ins>+                if ( f.img_cap_text.value != '' &amp;&amp; f.width.value != '' ) {
</ins><span class="cx">                         do_caption = 1;
</span><span class="cx">                         img_class = img_class.replace( /align[^ &quot;']+\s?/gi, '' );
</span><span class="cx">                 }
</span><span class="lines">@@ -440,7 +515,7 @@
</span><span class="cx">                                         ed.dom.setAttrib(DIV, 'class', div_cls);
</span><span class="cx"> 
</span><span class="cx">                                 if ( (DT = ed.dom.getParent(el, 'dt')) &amp;&amp; (DD = DT.nextSibling) &amp;&amp; ed.dom.hasClass(DD, 'wp-caption-dd') )
</span><del>-                                        ed.dom.setHTML(DD, f.img_cap.value);
</del><ins>+                                        ed.dom.setHTML(DD, f.img_cap_text.value);
</ins><span class="cx"> 
</span><span class="cx">                         } else {
</span><span class="cx">                                 if ( (id = f.img_classes.value.match( /wp-image-([0-9]{1,6})/ )) &amp;&amp; id[1] )
</span><span class="lines">@@ -457,7 +532,7 @@
</span><span class="cx">                                 } else html = ed.dom.getOuterHTML(el);
</span><span class="cx"> 
</span><span class="cx">                                 html = '&lt;dl id=&quot;'+cap_id+'&quot; class=&quot;wp-caption '+t.align+'&quot; style=&quot;width: '+cap_width+
</span><del>-                                'px&quot;&gt;&lt;dt class=&quot;wp-caption-dt&quot;&gt;'+html+'&lt;/dt&gt;&lt;dd class=&quot;wp-caption-dd&quot;&gt;'+f.img_cap.value+'&lt;/dd&gt;&lt;/dl&gt;';
</del><ins>+                                'px&quot;&gt;&lt;dt class=&quot;wp-caption-dt&quot;&gt;'+html+'&lt;/dt&gt;&lt;dd class=&quot;wp-caption-dd&quot;&gt;'+f.img_cap_text.value+'&lt;/dd&gt;&lt;/dl&gt;';
</ins><span class="cx"> 
</span><span class="cx">                                 cap = ed.dom.create('div', {'class': div_cls}, html);
</span><span class="cx"> 
</span><span class="lines">@@ -614,3 +689,4 @@
</span><span class="cx"> 
</span><span class="cx"> window.onload = function(){wpImage.init();}
</span><span class="cx"> wpImage.preInit();
</span><ins>+
</ins></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimagejseditimagejs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var tinymce=null,tinyMCEPopup,tinyMCE,wpImage;tinyMCEPopup={init:function(){var d=this,b,a,f,c,e;a=(&quot;&quot;+document.location.search).replace(/^\?/,&quot;&quot;).split(&quot;&amp;&quot;);f={};for(c=0;c&lt;a.length;c++){e=a[c].split(&quot;=&quot;);f[unescape(e[0])]=unescape(e[1])}if(f.mce_rdomain){document.domain=f.mce_rdomain}b=d.getWin();tinymce=b.tinymce;tinyMCE=b.tinyMCE;d.editor=tinymce.EditorManager.activeEditor;d.params=d.editor.windowManager.params;d.dom=d.editor.windowManager.createInstance(&quot;tinymce.dom.DOMUtils&quot;,document);d.editor.windowManager.onOpen.dispatch(d.editor.windowManager,window)},getWin:function(){return window.dialogArguments||opener||parent||top},getParam:function(b,a){return this.editor.getParam(b,a)},close:function(){var a=this,b=a.getWin();function c(){b.tb_remove();tinymce=tinyMCE=a.editor=a.dom=a.dom.doc=null}if(tinymce.isOpera){b.setTimeout(c,0)}else{c()}},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restor
 eSelection();return this.editor.execCommand(d,c,e,b)},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(&quot;simple&quot;)},restoreSelection:function(){var a=tinyMCEPopup;if(tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}}};tinyMCEPopup.init();wpImage={preInit:function(){var d=tinyMCEPopup.getWin(),c=d.document.styleSheets,a,b;for(b=0;b&lt;c.length;b++){a=c.item(b).href;if(a&amp;&amp;a.indexOf(&quot;colors&quot;)!=-1){document.write('&lt;link rel=&quot;stylesheet&quot; href=&quot;'+a+'&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;')}}},I:function(a){return document.getElementById(a)},current:&quot;&quot;,link:&quot;&quot;,link_rel:&quot;&quot;,target_value:&quot;&quot;,current_size_sel:&quot;s100&quot;,width:&quot;&quot;,height:&quot;&quot;,align:&quot;&quot;,img_alt:&quot;&quot;,setTabs:function(b){var a=this;if(&quot;current&quot;==b.className){return false}a.I(&quot;div_a
 dvanced&quot;).style.display=(&quot;tab_advanced&quot;==b.id)?&quot;block&quot;:&quot;none&quot;;a.I(&quot;div_basic&quot;).style.display=(&quot;tab_basic&quot;==b.id)?&quot;block&quot;:&quot;none&quot;;a.I(&quot;tab_basic&quot;).className=a.I(&quot;tab_advanced&quot;).className=&quot;&quot;;b.className=&quot;current&quot;;return false},img_seturl:function(b){var c=this,a=c.I(&quot;link_rel&quot;).value;if(&quot;current&quot;==b){c.I(&quot;link_href&quot;).value=c.current;c.I(&quot;link_rel&quot;).value=c.link_rel}else{c.I(&quot;link_href&quot;).value=c.link;if(a){a=a.replace(/attachment|wp-att-[0-9]+/gi,&quot;&quot;);c.I(&quot;link_rel&quot;).value=tinymce.trim(a)}}},imgAlignCls:function(b){var c=this,a=c.I(&quot;img_classes&quot;).value;c.I(&quot;img_demo&quot;).className=c.align=b;a=a.replace(/align[^ &quot;']+/gi,&quot;&quot;);a+=(&quot; &quot;+b);a=a.replace(/\s+/g,&quot; &quot;).replace(/^\s/,&quot;&quot;);if(&quot;aligncenter&quot;==b){c.I(&quot;hspace&quot;).value=&q
 uot;&quot;;c.updateStyle(&quot;hspace&quot;)}c.I(&quot;img_classes&quot;).value=a},showSize:function(e){var c=this,f=c.I(&quot;img_demo&quot;),a=c.width,d=c.height,g=e.id||&quot;s100&quot;,b;b=parseInt(g.substring(1))/200;f.width=Math.round(a*b);f.height=Math.round(d*b);c.showSizeClear();e.style.borderColor=&quot;#A3A3A3&quot;;e.style.backgroundColor=&quot;#E5E5E5&quot;},showSizeSet:function(){var b=this,d,c,a;if((b.width*1.3)&gt;parseInt(b.preloadImg.width)){d=b.I(&quot;s130&quot;),c=b.I(&quot;s120&quot;),a=b.I(&quot;s110&quot;);d.onclick=c.onclick=a.onclick=null;d.onmouseover=c.onmouseover=a.onmouseover=null;d.style.color=c.style.color=a.style.color=&quot;#aaa&quot;}},showSizeRem:function(){var a=this,c=a.I(&quot;img_demo&quot;),b=document.forms[0];c.width=Math.round(b.width.value*0.5);c.height=Math.round(b.height.value*0.5);a.showSizeClear();a.I(a.current_size_sel).style.borderColor=&quot;#A3A3A3&quot;;a.I(a.current_size_sel).style.backgroundColor=&quot;#E5E5E5&quot;;retu
 rn false},showSizeClear:function(){var b=this.I(&quot;img_size&quot;).getElementsByTagName(&quot;div&quot;),a;for(a=0;a&lt;b.length;a++){b[a].style.borderColor=&quot;#f1f1f1&quot;;b[a].style.backgroundColor=&quot;#f1f1f1&quot;}},imgEditSize:function(g){var d=this,i=document.forms[0],a,c,b,e,j;if(!d.preloadImg||!d.preloadImg.width||!d.preloadImg.height){return}a=parseInt(d.preloadImg.width),c=parseInt(d.preloadImg.height),b=d.width||a,e=d.height||c,j=g.id||&quot;s100&quot;;size=parseInt(j.substring(1))/100;b=Math.round(b*size);e=Math.round(e*size);i.width.value=Math.min(a,b);i.height.value=Math.min(c,e);d.current_size_sel=j;d.demoSetSize()},demoSetSize:function(a){var c=this.I(&quot;img_demo&quot;),b=document.forms[0];c.width=b.width.value?Math.round(b.width.value*0.5):&quot;&quot;;c.height=b.height.value?Math.round(b.height.value*0.5):&quot;&quot;},demoSetStyle:function(){var b=document.forms[0],a=this.I(&quot;img_demo&quot;),c=tinyMCEPopup.editor.dom;if(a){c.setAttrib(a,&qu
 ot;style&quot;,b.img_style.value);c.setStyle(a,&quot;width&quot;,&quot;&quot;);c.setStyle(a,&quot;height&quot;,&quot;&quot;)}},origSize:function(){var a=this,c=document.forms[0],b=a.I(&quot;s100&quot;);c.width.value=a.width=a.preloadImg.width;c.height.value=a.height=a.preloadImg.height;a.showSizeSet();a.demoSetSize();a.showSize(b)},init:function(){var a=tinyMCEPopup.editor,b;b=document.body.innerHTML;document.body.innerHTML=a.translate(b);window.setTimeout(function(){wpImage.setup()},500)},setup:function(){var p=this,k,b,l,e,i=document.forms[0],h=tinyMCEPopup.editor,j=p.I(&quot;img_demo&quot;),g=tinyMCEPopup.dom,a,o=&quot;&quot;,n,m;document.dir=tinyMCEPopup.editor.getParam(&quot;directionality&quot;,&quot;&quot;);if(tinyMCEPopup.editor.getParam(&quot;wpeditimage_disable_captions&quot;,false)){p.I(&quot;cap_field&quot;).style.display=&quot;none&quot;}tinyMCEPopup.restoreSelection();b=h.selection.getNode();if(b.nodeName!=&quot;IMG&quot;){return}i.img_src.value=j.src=l=h.dom.g
 etAttrib(b,&quot;src&quot;);h.dom.setStyle(b,&quot;float&quot;,&quot;&quot;);p.getImageData();k=h.dom.getAttrib(b,&quot;class&quot;);if(a=g.getParent(b,&quot;dl&quot;)){n=h.dom.getAttrib(a,&quot;class&quot;);n=n.match(/align[^ &quot;']+/i);if(n&amp;&amp;!g.hasClass(b,n)){k+=&quot; &quot;+n;tinymce.trim(k)}tinymce.each(a.childNodes,function(c){if(c.nodeName==&quot;DD&quot;&amp;&amp;g.hasClass(c,&quot;wp-caption-dd&quot;)){o=c.innerHTML;return}})}i.img_cap.value=o;i.img_title.value=h.dom.getAttrib(b,&quot;title&quot;);i.img_alt.value=h.dom.getAttrib(b,&quot;alt&quot;);i.border.value=h.dom.getAttrib(b,&quot;border&quot;);i.vspace.value=h.dom.getAttrib(b,&quot;vspace&quot;);i.hspace.value=h.dom.getAttrib(b,&quot;hspace&quot;);i.align.value=h.dom.getAttrib(b,&quot;align&quot;);i.width.value=p.width=h.dom.getAttrib(b,&quot;width&quot;);i.height.value=p.height=h.dom.getAttrib(b,&quot;height&quot;);i.img_classes.value=k;i.img_style.value=h.dom.getAttrib(b,&quot;style&quot;);if(g.get
 Attrib(b,&quot;hspace&quot;)){p.updateStyle(&quot;hspace&quot;)}if(g.getAttrib(b,&quot;border&quot;)){p.updateStyle(&quot;border&quot;)}if(g.getAttrib(b,&quot;vspace&quot;)){p.updateStyle(&quot;vspace&quot;)}if(m=h.dom.getParent(b,&quot;A&quot;)){i.link_href.value=p.current=h.dom.getAttrib(m,&quot;href&quot;);i.link_title.value=h.dom.getAttrib(m,&quot;title&quot;);i.link_rel.value=p.link_rel=h.dom.getAttrib(m,&quot;rel&quot;);i.link_style.value=h.dom.getAttrib(m,&quot;style&quot;);p.target_value=h.dom.getAttrib(m,&quot;target&quot;);i.link_classes.value=h.dom.getAttrib(m,&quot;class&quot;)}i.link_target.checked=(p.target_value&amp;&amp;p.target_value==&quot;_blank&quot;)?&quot;checked&quot;:&quot;&quot;;e=l.substring(l.lastIndexOf(&quot;/&quot;));e=e.replace(/-[0-9]{2,4}x[0-9]{2,4}/,&quot;&quot;);p.link=l.substring(0,l.lastIndexOf(&quot;/&quot;))+e;if(k.indexOf(&quot;alignleft&quot;)!=-1){p.I(&quot;alignleft&quot;).checked=&quot;checked&quot;;j.className=p.align=&quot;alignl
 eft&quot;}else{if(k.indexOf(&quot;aligncenter&quot;)!=-1){p.I(&quot;aligncenter&quot;).checked=&quot;checked&quot;;j.className=p.align=&quot;aligncenter&quot;}else{if(k.indexOf(&quot;alignright&quot;)!=-1){p.I(&quot;alignright&quot;).checked=&quot;checked&quot;;j.className=p.align=&quot;alignright&quot;}else{if(k.indexOf(&quot;alignnone&quot;)!=-1){p.I(&quot;alignnone&quot;).checked=&quot;checked&quot;;j.className=p.align=&quot;alignnone&quot;}}}}if(p.width&amp;&amp;p.preloadImg.width){p.showSizeSet()}document.body.style.display=&quot;&quot;},remove:function(){var a=tinyMCEPopup.editor,c,b;tinyMCEPopup.restoreSelection();b=a.selection.getNode();if(b.nodeName!=&quot;IMG&quot;){return}if((c=a.dom.getParent(b,&quot;div&quot;))&amp;&amp;a.dom.hasClass(c,&quot;mceTemp&quot;)){a.dom.remove(c)}else{if((c=a.dom.getParent(b,&quot;A&quot;))&amp;&amp;c.childNodes.length==1){a.dom.remove(c)}else{a.dom.remove(b)}}a.execCommand(&quot;mceRepaint&quot;);tinyMCEPopup.close();return},update:f
 unction(){var m=this,v=document.forms[0],g=tinyMCEPopup.editor,e,x,d=null,n,h,p,r,o=null,k=v.img_classes.value,l,q,u=&quot;&quot;,j,i,s,a,z,w=&quot;&quot;,c,y;tinyMCEPopup.restoreSelection();e=g.selection.getNode();if(e.nodeName!=&quot;IMG&quot;){return}if(v.img_src.value===&quot;&quot;){m.remove();return}if(v.img_cap.value!=&quot;&quot;&amp;&amp;v.width.value!=&quot;&quot;){o=1;k=k.replace(/align[^ &quot;']+\s?/gi,&quot;&quot;)}p=g.dom.getParent(e,&quot;a&quot;);h=g.dom.getParent(e,&quot;p&quot;);n=g.dom.getParent(e,&quot;dl&quot;);r=g.dom.getParent(e,&quot;div&quot;);tinyMCEPopup.execCommand(&quot;mceBeginUndoLevel&quot;);if(v.width.value!=e.width||v.height.value!=e.height){k=k.replace(/size-[^ &quot;']+/,&quot;&quot;)}g.dom.setAttribs(e,{src:v.img_src.value,title:v.img_title.value,alt:v.img_alt.value,width:v.width.value,height:v.height.value,style:v.img_style.value,&quot;class&quot;:k});if(v.link_href.value){if(p==null){if(!v.link_href.value.match(/https?:\/\//i)){v.link_
 href.value=tinyMCEPopup.editor.documentBaseURI.toAbsolute(v.link_href.value)}if(tinymce.isWebKit&amp;&amp;g.dom.hasClass(e,&quot;aligncenter&quot;)){g.dom.removeClass(e,&quot;aligncenter&quot;);d=1}tinyMCEPopup.execCommand(&quot;CreateLink&quot;,false,&quot;#mce_temp_url#&quot;,{skip_undo:1});if(d){g.dom.addClass(e,&quot;aligncenter&quot;)}tinymce.each(g.dom.select(&quot;a&quot;),function(b){if(g.dom.getAttrib(b,&quot;href&quot;)==&quot;#mce_temp_url#&quot;){g.dom.setAttribs(b,{href:v.link_href.value,title:v.link_title.value,rel:v.link_rel.value,target:(v.link_target.checked==true)?&quot;_blank&quot;:&quot;&quot;,&quot;class&quot;:v.link_classes.value,style:v.link_style.value})}})}else{g.dom.setAttribs(p,{href:v.link_href.value,title:v.link_title.value,rel:v.link_rel.value,target:(v.link_target.checked==true)?&quot;_blank&quot;:&quot;&quot;,&quot;class&quot;:v.link_classes.value,style:v.link_style.value})}}if(o){a=10+parseInt(v.width.value);z=(m.align==&quot;aligncenter&quot
 ;)?&quot;mceTemp mceIEcenter&quot;:&quot;mceTemp&quot;;if(n){g.dom.setAttribs(n,{&quot;class&quot;:&quot;wp-caption &quot;+m.align,style:&quot;width: &quot;+a+&quot;px;&quot;});if(r){g.dom.setAttrib(r,&quot;class&quot;,z)}if((i=g.dom.getParent(e,&quot;dt&quot;))&amp;&amp;(s=i.nextSibling)&amp;&amp;g.dom.hasClass(s,&quot;wp-caption-dd&quot;)){g.dom.setHTML(s,v.img_cap.value)}}else{if((q=v.img_classes.value.match(/wp-image-([0-9]{1,6})/))&amp;&amp;q[1]){u=&quot;attachment_&quot;+q[1]}if(v.link_href.value&amp;&amp;(w=g.dom.getParent(e,&quot;a&quot;))){if(w.childNodes.length==1){l=g.dom.getOuterHTML(w)}else{l=g.dom.getOuterHTML(w);l=l.match(/&lt;a[^&gt;]+&gt;/i);l=l+g.dom.getOuterHTML(e)+&quot;&lt;/a&gt;&quot;}}else{l=g.dom.getOuterHTML(e)}l='&lt;dl id=&quot;'+u+'&quot; class=&quot;wp-caption '+m.align+'&quot; style=&quot;width: '+a+'px&quot;&gt;&lt;dt class=&quot;wp-caption-dt&quot;&gt;'+l+'&lt;/dt&gt;&lt;dd class=&quot;wp-caption-dd&quot;&gt;'+v.img_cap.value+&quot;&lt;/dd&gt;
 &lt;/dl&gt;&quot;;j=g.dom.create(&quot;div&quot;,{&quot;class&quot;:z},l);if(h){h.parentNode.insertBefore(j,h);if(h.childNodes.length==1){g.dom.remove(h)}else{if(w&amp;&amp;w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}else{if(c=g.dom.getParent(e,&quot;TD,TH,LI&quot;)){c.appendChild(j);if(w&amp;&amp;w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}}}else{if(n&amp;&amp;r){if(v.link_href.value&amp;&amp;(y=g.dom.getParent(e,&quot;a&quot;))){l=g.dom.getOuterHTML(y)}else{l=g.dom.getOuterHTML(e)}h=g.dom.create(&quot;p&quot;,{},l);r.parentNode.insertBefore(h,r);g.dom.remove(r)}}if(v.img_classes.value.indexOf(&quot;aligncenter&quot;)!=-1){if(h&amp;&amp;(!h.style||h.style.textAlign!=&quot;center&quot;)){g.dom.setStyle(h,&quot;textAlign&quot;,&quot;center&quot;)}}else{if(h&amp;&amp;h.style&amp;&amp;h.style.textAlign==&quot;center&quot;){g.dom.setStyle(h,&quot;textAlign&quot;,&quot;&quot;)}}if(!v.link_href.value&amp;&amp;p){x=g.selection.getBookmark();g.d
 om.remove(p,1);g.selection.moveToBookmark(x)}tinyMCEPopup.execCommand(&quot;mceEndUndoLevel&quot;);g.execCommand(&quot;mceRepaint&quot;);tinyMCEPopup.close()},updateStyle:function(a){var e=tinyMCEPopup.dom,c,d=document.forms[0],b=e.create(&quot;img&quot;,{style:d.img_style.value});if(tinyMCEPopup.editor.settings.inline_styles){if(a==&quot;align&quot;){e.setStyle(b,&quot;float&quot;,&quot;&quot;);e.setStyle(b,&quot;vertical-align&quot;,&quot;&quot;);c=d.align.value;if(c){if(c==&quot;left&quot;||c==&quot;right&quot;){e.setStyle(b,&quot;float&quot;,c)}else{b.style.verticalAlign=c}}}if(a==&quot;border&quot;){e.setStyle(b,&quot;border&quot;,&quot;&quot;);c=d.border.value;if(c||c==&quot;0&quot;){if(c==&quot;0&quot;){b.style.border=&quot;0&quot;}else{b.style.border=c+&quot;px solid black&quot;}}}if(a==&quot;hspace&quot;){e.setStyle(b,&quot;marginLeft&quot;,&quot;&quot;);e.setStyle(b,&quot;marginRight&quot;,&quot;&quot;);c=d.hspace.value;if(c){b.style.marginLeft=c+&quot;px&quot;;b.s
 tyle.marginRight=c+&quot;px&quot;}}if(a==&quot;vspace&quot;){e.setStyle(b,&quot;marginTop&quot;,&quot;&quot;);e.setStyle(b,&quot;marginBottom&quot;,&quot;&quot;);c=d.vspace.value;if(c){b.style.marginTop=c+&quot;px&quot;;b.style.marginBottom=c+&quot;px&quot;}}d.img_style.value=e.serializeStyle(e.parseStyle(b.style.cssText));this.demoSetStyle()}},checkVal:function(a){if(a.value==&quot;&quot;){if(a.id==&quot;img_src&quot;){a.value=this.I(&quot;img_demo&quot;).src||this.preloadImg.src}}},resetImageData:function(){var a=document.forms[0];a.width.value=a.height.value=&quot;&quot;},updateImageData:function(){var d=document.forms[0],b=wpImage,a=d.width.value,c=d.height.value;if(!a&amp;&amp;c){a=d.width.value=b.width=Math.round(b.preloadImg.width/(b.preloadImg.height/c))}else{if(a&amp;&amp;!c){c=d.height.value=b.height=Math.round(b.preloadImg.height/(b.preloadImg.width/a))}}if(!a){d.width.value=b.width=b.preloadImg.width}if(!c){d.height.value=b.height=b.preloadImg.height}b.showSizeSe
 t();b.demoSetSize();if(d.img_style.value){b.demoSetStyle()}},getImageData:function(){var a=wpImage,b=document.forms[0];a.preloadImg=new Image();a.preloadImg.onload=a.updateImageData;a.preloadImg.onerror=a.resetImageData;a.preloadImg.src=tinyMCEPopup.editor.documentBaseURI.toAbsolute(b.img_src.value)}};window.onload=function(){wpImage.init()};wpImage.preInit();
</del><span class="cx">\ No newline at end of file
</span><ins>+var tinymce=null,tinyMCEPopup,tinyMCE,wpImage;tinyMCEPopup={init:function(){var d=this,b,a,f,c,e;a=(&quot;&quot;+document.location.search).replace(/^\?/,&quot;&quot;).split(&quot;&amp;&quot;);f={};for(c=0;c&lt;a.length;c++){e=a[c].split(&quot;=&quot;);f[unescape(e[0])]=unescape(e[1])}if(f.mce_rdomain){document.domain=f.mce_rdomain}b=d.getWin();tinymce=b.tinymce;tinyMCE=b.tinyMCE;d.editor=tinymce.EditorManager.activeEditor;d.params=d.editor.windowManager.params;d.events=new tinymce.dom.EventUtils();d.dom=d.editor.windowManager.createInstance(&quot;tinymce.dom.DOMUtils&quot;,document);d.editor.windowManager.onOpen.dispatch(d.editor.windowManager,window)},getWin:function(){return window.dialogArguments||opener||parent||top},getParam:function(b,a){return this.editor.getParam(b,a)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}
 },execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(&quot;simple&quot;)},restoreSelection:function(){var a=tinyMCEPopup;if(tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}}};tinyMCEPopup.init();wpImage={preInit:function(){var a=tinyMCEPopup.editor,e=tinyMCEPopup.getWin(),d=e.document.styleSheets,b,c;for(c=0;c&lt;d.length;c++){b=d.item(c).href;if(b&amp;&amp;b.indexOf(&quot;colors&quot;)!=-1){document.getElementsByTagName(&quot;head&quot;)[0].appendChild(a.dom.create(&quot;link&quot;,{rel:&quot;stylesheet&quot;,href:b}));break}}},I:function(a){return document.getElementById(a)},current:&quot;&quot;,link:&quot;&quot;,link_rel:&quot;&quot;,target_value:&quot;&quot;,current_size_sel:&quot;s100&quot;,width:&quot;&quot;,height:&quot;&quot;,align:&quot;&quot;,img_alt:&quot;&quot;,se
 tTabs:function(b){var a=this;if(&quot;current&quot;==b.className){return false}a.I(&quot;div_advanced&quot;).style.display=(&quot;tab_advanced&quot;==b.id)?&quot;block&quot;:&quot;none&quot;;a.I(&quot;div_basic&quot;).style.display=(&quot;tab_basic&quot;==b.id)?&quot;block&quot;:&quot;none&quot;;a.I(&quot;tab_basic&quot;).className=a.I(&quot;tab_advanced&quot;).className=&quot;&quot;;b.className=&quot;current&quot;;return false},img_seturl:function(b){var c=this,a=c.I(&quot;link_rel&quot;).value;if(&quot;current&quot;==b){c.I(&quot;link_href&quot;).value=c.current;c.I(&quot;link_rel&quot;).value=c.link_rel}else{c.I(&quot;link_href&quot;).value=c.link;if(a){a=a.replace(/attachment|wp-att-[0-9]+/gi,&quot;&quot;);c.I(&quot;link_rel&quot;).value=tinymce.trim(a)}}},imgAlignCls:function(b){var c=this,a=c.I(&quot;img_classes&quot;).value;c.I(&quot;img_demo&quot;).className=c.align=b;a=a.replace(/align[^ &quot;']+/gi,&quot;&quot;);a+=(&quot; &quot;+b);a=a.replace(/\s+/g,&quot; &quot
 ;).replace(/^\s/,&quot;&quot;);if(&quot;aligncenter&quot;==b){c.I(&quot;hspace&quot;).value=&quot;&quot;;c.updateStyle(&quot;hspace&quot;)}c.I(&quot;img_classes&quot;).value=a},showSize:function(e){var c=this,f=c.I(&quot;img_demo&quot;),a=c.width,d=c.height,g=e.id||&quot;s100&quot;,b;b=parseInt(g.substring(1))/200;f.width=Math.round(a*b);f.height=Math.round(d*b);c.showSizeClear();e.style.borderColor=&quot;#A3A3A3&quot;;e.style.backgroundColor=&quot;#E5E5E5&quot;},showSizeSet:function(){var b=this,d,c,a;if((b.width*1.3)&gt;parseInt(b.preloadImg.width)){d=b.I(&quot;s130&quot;),c=b.I(&quot;s120&quot;),a=b.I(&quot;s110&quot;);d.onclick=c.onclick=a.onclick=null;d.onmouseover=c.onmouseover=a.onmouseover=null;d.style.color=c.style.color=a.style.color=&quot;#aaa&quot;}},showSizeRem:function(){var a=this,c=a.I(&quot;img_demo&quot;),b=document.forms[0];c.width=Math.round(b.width.value*0.5);c.height=Math.round(b.height.value*0.5);a.showSizeClear();a.I(a.current_size_sel).style.borderCo
 lor=&quot;#A3A3A3&quot;;a.I(a.current_size_sel).style.backgroundColor=&quot;#E5E5E5&quot;;return false},showSizeClear:function(){var b=this.I(&quot;img_size&quot;).getElementsByTagName(&quot;div&quot;),a;for(a=0;a&lt;b.length;a++){b[a].style.borderColor=&quot;#f1f1f1&quot;;b[a].style.backgroundColor=&quot;#f1f1f1&quot;}},imgEditSize:function(g){var d=this,i=document.forms[0],a,c,b,e,j;if(!d.preloadImg||!d.preloadImg.width||!d.preloadImg.height){return}a=parseInt(d.preloadImg.width),c=parseInt(d.preloadImg.height),b=d.width||a,e=d.height||c,j=g.id||&quot;s100&quot;;size=parseInt(j.substring(1))/100;b=Math.round(b*size);e=Math.round(e*size);i.width.value=Math.min(a,b);i.height.value=Math.min(c,e);d.current_size_sel=j;d.demoSetSize()},demoSetSize:function(a){var c=this.I(&quot;img_demo&quot;),b=document.forms[0];c.width=b.width.value?Math.round(b.width.value*0.5):&quot;&quot;;c.height=b.height.value?Math.round(b.height.value*0.5):&quot;&quot;},demoSetStyle:function(){var b=docu
 ment.forms[0],a=this.I(&quot;img_demo&quot;),c=tinyMCEPopup.editor.dom;if(a){c.setAttrib(a,&quot;style&quot;,b.img_style.value);c.setStyle(a,&quot;width&quot;,&quot;&quot;);c.setStyle(a,&quot;height&quot;,&quot;&quot;)}},origSize:function(){var a=this,c=document.forms[0],b=a.I(&quot;s100&quot;);c.width.value=a.width=a.preloadImg.width;c.height.value=a.height=a.preloadImg.height;a.showSizeSet();a.demoSetSize();a.showSize(b)},init:function(){var a=tinyMCEPopup.editor,b;b=document.body.innerHTML;document.body.innerHTML=a.translate(b);window.setTimeout(function(){wpImage.setup()},500)},setup:function(){var s=this,n,e,o,g,k=document.forms[0],j=tinyMCEPopup.editor,m=s.I(&quot;img_demo&quot;),i=tinyMCEPopup.dom,a,h,r=&quot;&quot;,q,p,l,b;document.dir=tinyMCEPopup.editor.getParam(&quot;directionality&quot;,&quot;&quot;);if(tinyMCEPopup.editor.getParam(&quot;wpeditimage_disable_captions&quot;,false)){s.I(&quot;cap_field&quot;).style.display=&quot;none&quot;}tinyMCEPopup.restoreSelect
 ion();e=j.selection.getNode();if(e.nodeName!=&quot;IMG&quot;){return}k.img_src.value=m.src=o=j.dom.getAttrib(e,&quot;src&quot;);j.dom.setStyle(e,&quot;float&quot;,&quot;&quot;);s.getImageData();n=j.dom.getAttrib(e,&quot;class&quot;);if(a=i.getParent(e,&quot;dl&quot;)){q=j.dom.getAttrib(a,&quot;class&quot;);q=q.match(/align[^ &quot;']+/i);if(q&amp;&amp;!i.hasClass(e,q)){n+=&quot; &quot;+q;tinymce.trim(n)}h=j.dom.select(&quot;dd.wp-caption-dd&quot;,a);if(h&amp;&amp;h[0]){r=j.serializer.serialize(h[0]).replace(/^&lt;p&gt;/,&quot;&quot;).replace(/&lt;\/p&gt;$/,&quot;&quot;)}}k.img_cap_text.value=r;k.img_title.value=j.dom.getAttrib(e,&quot;title&quot;);k.img_alt.value=j.dom.getAttrib(e,&quot;alt&quot;);k.border.value=j.dom.getAttrib(e,&quot;border&quot;);k.vspace.value=j.dom.getAttrib(e,&quot;vspace&quot;);k.hspace.value=j.dom.getAttrib(e,&quot;hspace&quot;);k.align.value=j.dom.getAttrib(e,&quot;align&quot;);k.width.value=s.width=j.dom.getAttrib(e,&quot;width&quot;);k.height.valu
 e=s.height=j.dom.getAttrib(e,&quot;height&quot;);k.img_classes.value=n;k.img_style.value=j.dom.getAttrib(e,&quot;style&quot;);if(i.getAttrib(e,&quot;hspace&quot;)){s.updateStyle(&quot;hspace&quot;)}if(i.getAttrib(e,&quot;border&quot;)){s.updateStyle(&quot;border&quot;)}if(i.getAttrib(e,&quot;vspace&quot;)){s.updateStyle(&quot;vspace&quot;)}if(p=j.dom.getParent(e,&quot;A&quot;)){k.link_href.value=s.current=j.dom.getAttrib(p,&quot;href&quot;);k.link_title.value=j.dom.getAttrib(p,&quot;title&quot;);k.link_rel.value=s.link_rel=j.dom.getAttrib(p,&quot;rel&quot;);k.link_style.value=j.dom.getAttrib(p,&quot;style&quot;);s.target_value=j.dom.getAttrib(p,&quot;target&quot;);k.link_classes.value=j.dom.getAttrib(p,&quot;class&quot;)}k.link_target.checked=(s.target_value&amp;&amp;s.target_value==&quot;_blank&quot;)?&quot;checked&quot;:&quot;&quot;;g=o.substring(o.lastIndexOf(&quot;/&quot;));g=g.replace(/-[0-9]{2,4}x[0-9]{2,4}/,&quot;&quot;);s.link=o.substring(0,o.lastIndexOf(&quot;/&quot
 ;))+g;if(n.indexOf(&quot;alignleft&quot;)!=-1){s.I(&quot;alignleft&quot;).checked=&quot;checked&quot;;m.className=s.align=&quot;alignleft&quot;}else{if(n.indexOf(&quot;aligncenter&quot;)!=-1){s.I(&quot;aligncenter&quot;).checked=&quot;checked&quot;;m.className=s.align=&quot;aligncenter&quot;}else{if(n.indexOf(&quot;alignright&quot;)!=-1){s.I(&quot;alignright&quot;).checked=&quot;checked&quot;;m.className=s.align=&quot;alignright&quot;}else{if(n.indexOf(&quot;alignnone&quot;)!=-1){s.I(&quot;alignnone&quot;).checked=&quot;checked&quot;;m.className=s.align=&quot;alignnone&quot;}}}}if(s.width&amp;&amp;s.preloadImg.width){s.showSizeSet()}document.body.style.display=&quot;&quot;;tinyMCEPopup.events.add(document.body,&quot;click&quot;,function(v){var w=v.target,z=w.parentNode,y,x,t,A,f,B,u,d;if(i.hasClass(w,&quot;caption-insert-link&quot;)){t=i.select(&quot;div.caption-insert-link-wrap&quot;,z)[0],A=i.select(&quot;#img_cap_text&quot;)[0];if(document.selection){A.focus();f=document.
 selection.createRange();l=f.getBookmark();if(f.text){i.select(&quot;.caption-insert-link-text&quot;,t)[0].value=f.text}}else{if(A.selectionStart||A.selectionStart==&quot;0&quot;){B=A.value;u=A.selectionStart;d=A.selectionEnd;if(u!=d){i.select(&quot;.caption-insert-link-text&quot;,t)[0].value=B.substring(u,d)}}}i.hide(w);i.show(t);i.select(&quot;.caption-insert-link-url&quot;,t)[0].focus()}else{if(i.hasClass(w,&quot;caption-cancel&quot;)||i.hasClass(w,&quot;caption-save&quot;)){if(i.hasClass(w,&quot;caption-save&quot;)){b()}i.hide(i.select(&quot;.caption-insert-link-wrap&quot;));i.show(i.select(&quot;.caption-insert-link&quot;))}}});b=function(){var u,v,w,f,t,y,x=i.select(&quot;#img_cap_text&quot;)[0],d=i.select(&quot;.caption-insert-link-url&quot;)[0],c=i.select(&quot;.caption-insert-link-text&quot;)[0];if(!d||!c){return}v=&quot;&lt;a href='&quot;+d.value+&quot;'&gt;&quot;+c.value+&quot;&lt;/a&gt;&quot;;if(document.selection){x.focus();u=document.selection.createRange();if(l
 ){u.moveToBookmark(l);l=&quot;&quot;}u.text=v;x.focus()}else{if(x.selectionStart||x.selectionStart==&quot;0&quot;){y=x.value;w=x.selectionStart;f=x.selectionEnd;t=x.scrollTop;x.value=y.substring(0,w)+v+y.substring(f,y.length);x.focus();x.selectionStart=w+v.length;x.selectionEnd=w+v.length;x.scrollTop=t}}d.value=&quot;&quot;;c.value=&quot;&quot;}},remove:function(){var a=tinyMCEPopup.editor,c,b;tinyMCEPopup.restoreSelection();b=a.selection.getNode();if(b.nodeName!=&quot;IMG&quot;){return}if((c=a.dom.getParent(b,&quot;div&quot;))&amp;&amp;a.dom.hasClass(c,&quot;mceTemp&quot;)){a.dom.remove(c)}else{if((c=a.dom.getParent(b,&quot;A&quot;))&amp;&amp;c.childNodes.length==1){a.dom.remove(c)}else{a.dom.remove(b)}}a.execCommand(&quot;mceRepaint&quot;);tinyMCEPopup.close();return},update:function(){var m=this,v=document.forms[0],g=tinyMCEPopup.editor,e,x,d=null,n,h,p,r,o=null,k=v.img_classes.value,l,q,u=&quot;&quot;,j,i,s,a,z,w=&quot;&quot;,c,y;tinyMCEPopup.restoreSelection();e=g.selec
 tion.getNode();if(e.nodeName!=&quot;IMG&quot;){return}if(v.img_src.value===&quot;&quot;){m.remove();return}if(v.img_cap_text.value!=&quot;&quot;&amp;&amp;v.width.value!=&quot;&quot;){o=1;k=k.replace(/align[^ &quot;']+\s?/gi,&quot;&quot;)}p=g.dom.getParent(e,&quot;a&quot;);h=g.dom.getParent(e,&quot;p&quot;);n=g.dom.getParent(e,&quot;dl&quot;);r=g.dom.getParent(e,&quot;div&quot;);tinyMCEPopup.execCommand(&quot;mceBeginUndoLevel&quot;);if(v.width.value!=e.width||v.height.value!=e.height){k=k.replace(/size-[^ &quot;']+/,&quot;&quot;)}g.dom.setAttribs(e,{src:v.img_src.value,title:v.img_title.value,alt:v.img_alt.value,width:v.width.value,height:v.height.value,style:v.img_style.value,&quot;class&quot;:k});if(v.link_href.value){if(p==null){if(!v.link_href.value.match(/https?:\/\//i)){v.link_href.value=tinyMCEPopup.editor.documentBaseURI.toAbsolute(v.link_href.value)}if(tinymce.isWebKit&amp;&amp;g.dom.hasClass(e,&quot;aligncenter&quot;)){g.dom.removeClass(e,&quot;aligncenter&quot;);d
 =1}tinyMCEPopup.execCommand(&quot;CreateLink&quot;,false,&quot;#mce_temp_url#&quot;,{skip_undo:1});if(d){g.dom.addClass(e,&quot;aligncenter&quot;)}tinymce.each(g.dom.select(&quot;a&quot;),function(b){if(g.dom.getAttrib(b,&quot;href&quot;)==&quot;#mce_temp_url#&quot;){g.dom.setAttribs(b,{href:v.link_href.value,title:v.link_title.value,rel:v.link_rel.value,target:(v.link_target.checked==true)?&quot;_blank&quot;:&quot;&quot;,&quot;class&quot;:v.link_classes.value,style:v.link_style.value})}})}else{g.dom.setAttribs(p,{href:v.link_href.value,title:v.link_title.value,rel:v.link_rel.value,target:(v.link_target.checked==true)?&quot;_blank&quot;:&quot;&quot;,&quot;class&quot;:v.link_classes.value,style:v.link_style.value})}}if(o){a=10+parseInt(v.width.value);z=(m.align==&quot;aligncenter&quot;)?&quot;mceTemp mceIEcenter&quot;:&quot;mceTemp&quot;;if(n){g.dom.setAttribs(n,{&quot;class&quot;:&quot;wp-caption &quot;+m.align,style:&quot;width: &quot;+a+&quot;px;&quot;});if(r){g.dom.setAtt
 rib(r,&quot;class&quot;,z)}if((i=g.dom.getParent(e,&quot;dt&quot;))&amp;&amp;(s=i.nextSibling)&amp;&amp;g.dom.hasClass(s,&quot;wp-caption-dd&quot;)){g.dom.setHTML(s,v.img_cap_text.value)}}else{if((q=v.img_classes.value.match(/wp-image-([0-9]{1,6})/))&amp;&amp;q[1]){u=&quot;attachment_&quot;+q[1]}if(v.link_href.value&amp;&amp;(w=g.dom.getParent(e,&quot;a&quot;))){if(w.childNodes.length==1){l=g.dom.getOuterHTML(w)}else{l=g.dom.getOuterHTML(w);l=l.match(/&lt;a[^&gt;]+&gt;/i);l=l+g.dom.getOuterHTML(e)+&quot;&lt;/a&gt;&quot;}}else{l=g.dom.getOuterHTML(e)}l='&lt;dl id=&quot;'+u+'&quot; class=&quot;wp-caption '+m.align+'&quot; style=&quot;width: '+a+'px&quot;&gt;&lt;dt class=&quot;wp-caption-dt&quot;&gt;'+l+'&lt;/dt&gt;&lt;dd class=&quot;wp-caption-dd&quot;&gt;'+v.img_cap_text.value+&quot;&lt;/dd&gt;&lt;/dl&gt;&quot;;j=g.dom.create(&quot;div&quot;,{&quot;class&quot;:z},l);if(h){h.parentNode.insertBefore(j,h);if(h.childNodes.length==1){g.dom.remove(h)}else{if(w&amp;&amp;w.childNodes
 .length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}else{if(c=g.dom.getParent(e,&quot;TD,TH,LI&quot;)){c.appendChild(j);if(w&amp;&amp;w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}}}else{if(n&amp;&amp;r){if(v.link_href.value&amp;&amp;(y=g.dom.getParent(e,&quot;a&quot;))){l=g.dom.getOuterHTML(y)}else{l=g.dom.getOuterHTML(e)}h=g.dom.create(&quot;p&quot;,{},l);r.parentNode.insertBefore(h,r);g.dom.remove(r)}}if(v.img_classes.value.indexOf(&quot;aligncenter&quot;)!=-1){if(h&amp;&amp;(!h.style||h.style.textAlign!=&quot;center&quot;)){g.dom.setStyle(h,&quot;textAlign&quot;,&quot;center&quot;)}}else{if(h&amp;&amp;h.style&amp;&amp;h.style.textAlign==&quot;center&quot;){g.dom.setStyle(h,&quot;textAlign&quot;,&quot;&quot;)}}if(!v.link_href.value&amp;&amp;p){x=g.selection.getBookmark();g.dom.remove(p,1);g.selection.moveToBookmark(x)}tinyMCEPopup.execCommand(&quot;mceEndUndoLevel&quot;);g.execCommand(&quot;mceRepaint&quot;);tinyMCEPopup.close()},updateStyle:function(a){va
 r e=tinyMCEPopup.dom,c,d=document.forms[0],b=e.create(&quot;img&quot;,{style:d.img_style.value});if(tinyMCEPopup.editor.settings.inline_styles){if(a==&quot;align&quot;){e.setStyle(b,&quot;float&quot;,&quot;&quot;);e.setStyle(b,&quot;vertical-align&quot;,&quot;&quot;);c=d.align.value;if(c){if(c==&quot;left&quot;||c==&quot;right&quot;){e.setStyle(b,&quot;float&quot;,c)}else{b.style.verticalAlign=c}}}if(a==&quot;border&quot;){e.setStyle(b,&quot;border&quot;,&quot;&quot;);c=d.border.value;if(c||c==&quot;0&quot;){if(c==&quot;0&quot;){b.style.border=&quot;0&quot;}else{b.style.border=c+&quot;px solid black&quot;}}}if(a==&quot;hspace&quot;){e.setStyle(b,&quot;marginLeft&quot;,&quot;&quot;);e.setStyle(b,&quot;marginRight&quot;,&quot;&quot;);c=d.hspace.value;if(c){b.style.marginLeft=c+&quot;px&quot;;b.style.marginRight=c+&quot;px&quot;}}if(a==&quot;vspace&quot;){e.setStyle(b,&quot;marginTop&quot;,&quot;&quot;);e.setStyle(b,&quot;marginBottom&quot;,&quot;&quot;);c=d.vspace.value;if(c){
 b.style.marginTop=c+&quot;px&quot;;b.style.marginBottom=c+&quot;px&quot;}}d.img_style.value=e.serializeStyle(e.parseStyle(b.style.cssText));this.demoSetStyle()}},checkVal:function(a){if(a.value==&quot;&quot;){if(a.id==&quot;img_src&quot;){a.value=this.I(&quot;img_demo&quot;).src||this.preloadImg.src}}},resetImageData:function(){var a=document.forms[0];a.width.value=a.height.value=&quot;&quot;},updateImageData:function(){var d=document.forms[0],b=wpImage,a=d.width.value,c=d.height.value;if(!a&amp;&amp;c){a=d.width.value=b.width=Math.round(b.preloadImg.width/(b.preloadImg.height/c))}else{if(a&amp;&amp;!c){c=d.height.value=b.height=Math.round(b.preloadImg.height/(b.preloadImg.width/a))}}if(!a){d.width.value=b.width=b.preloadImg.width}if(!c){d.height.value=b.height=b.preloadImg.height}b.showSizeSet();b.demoSetSize();if(d.img_style.value){b.demoSetStyle()}},getImageData:function(){var a=wpImage,b=document.forms[0];a.preloadImg=new Image();a.preloadImg.onload=a.updateImageData;a.p
 reloadImg.onerror=a.resetImageData;a.preloadImg.src=tinyMCEPopup.editor.documentBaseURI.toAbsolute(b.img_src.value)}};window.onload=function(){wpImage.init()};wpImage.preInit();
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjstinymcethemesadvancedskinswp_themecontentcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css (19981 => 19982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css        2012-02-23 18:16:46 UTC (rev 19981)
+++ trunk/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css        2012-02-24 01:58:18 UTC (rev 19982)
</span><span class="lines">@@ -1,8 +1,4 @@
</span><del>-body {
-        font: 13px/19px Georgia, &quot;Times New Roman&quot;, &quot;Bitstream Charter&quot;, Times, serif;
-        margin: 10px;
-        color: #000;
-}
</del><ins>+
</ins><span class="cx"> body.mceForceColors {background:#FFF; color:#000;}
</span><span class="cx"> body.mceBrowserDefaults {background:transparent; color:inherit; font-size:inherit; font-family:inherit;}
</span><span class="cx"> td {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
</span><span class="lines">@@ -41,7 +37,25 @@
</span><span class="cx"> .mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;}
</span><span class="cx"> 
</span><span class="cx"> /* WordPress styles */
</span><ins>+body {
+        font-family: sans-serif;
+        font-size: 13px;
+        line-height: 19px;
+        color: #333;
+        margin: 10px;
+        min-height: 100%;
+}
</ins><span class="cx"> 
</span><ins>+br[data-mce-bogus] {
+        line-height: 1em;
+        margin-top: -1em;
+}
+
+br[data-mce-bogus]:only-child {
+        line-height: inherit;
+        margin-top: inherit;
+}
+
</ins><span class="cx"> .aligncenter,
</span><span class="cx"> dl.aligncenter {
</span><span class="cx">         display: block;
</span><span class="lines">@@ -75,6 +89,7 @@
</span><span class="cx">         margin: 0;
</span><span class="cx">         padding: 0;
</span><span class="cx">         border: 0 none;
</span><ins>+        -webkit-user-drag: none;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .wp-caption-dd {
</span></span></pre>
</div>
</div>

</body>
</html>