Ticket #18311: 18311-4.patch
File 18311-4.patch, 57.0 KB (added by , 13 years ago) |
---|
-
wp-admin/css/wp-admin.dev.css
3873 3873 padding-left: 15px; 3874 3874 } 3875 3875 3876 .media-item .edit-caption-controls { 3877 margin: 5px 0; 3878 width: 460px; 3879 } 3880 3881 .media-item .edit-caption-controls label { 3882 margin: 5px 0; 3883 display: block; 3884 } 3885 3886 .media-item .edit-caption-controls label span { 3887 width: 100px; 3888 float: left; 3889 line-height: 22px; 3890 } 3891 3892 .media-item .edit-caption-controls input[type="text"] { 3893 width: 335px; 3894 } 3895 3896 .media-item .caption-insert-link-buttons { 3897 text-align: right; 3898 margin: 5px 12px; 3899 } 3900 3901 .media-item .caption-insert-link-wrap { 3902 padding: 5px 0 5px 12px; 3903 background-color: #f8f8f8; 3904 border: 1px solid #eee; 3905 -webkit-border-radius: 3px; 3906 border-radius: 3px; 3907 } 3908 3876 3909 /*------------------------------------------------------------------------------ 3877 3910 14.1 - Media Library 3878 3911 ------------------------------------------------------------------------------*/ … … 7940 7973 } 7941 7974 .locale-ru-ru .pressthis a { 7942 7975 width: 143px; /* default 113px + 30px */ 7943 } 7944 No newline at end of file 7976 } -
wp-admin/includes/media.php
149 149 150 150 $width = $matches[1]; 151 151 152 $caption = str_replace( array( '>', '<', '"', "'" ), 153 array( '>', '<', '"', ''' ), 154 $caption 155 ); 152 $caption = preg_replace_callback( '/<[a-zA-Z][^<>]+>/', '_cleanup_image_add_caption', $caption ); 153 $caption = str_replace( '"', '"', $caption ); 156 154 157 155 $html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html ); 158 156 if ( empty($align) ) 159 157 $align = 'none'; 160 158 161 159 $shcode = '[caption id="' . $id . '" align="align' . $align 162 . '" width="' . $width . '" caption="' . addslashes($caption). '"]' . $html . '[/caption]';160 . '" width="' . $width . '" caption="' . $caption . '"]' . $html . '[/caption]'; 163 161 164 162 return apply_filters( 'image_add_caption_shortcode', $shcode, $html ); 165 163 } 166 164 add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 ); 167 165 166 // Private, preg_replace callback used in image_add_caption() 167 function _cleanup_image_add_caption($str) { 168 if ( isset($str[0]) ) 169 return str_replace( '"', "'", $str[0] ); 170 171 return ''; 172 } 173 168 174 /** 169 175 * {@internal Missing Short Description}} 170 176 * … … 776 782 777 783 return " 778 784 <input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br /> 779 <button type='button' class='button urlnone' title=''>" . __('None') . "</button>780 <button type='button' class='button urlfile' title='" . esc_attr($file) . "'>" . __('File URL') . "</button>781 <button type='button' class='button urlpost' title='" . esc_attr($link) . "'>" . __('Attachment Post URL') . "</button>785 <button type='button' class='button urlnone' data-link-url=''>" . __('None') . "</button> 786 <button type='button' class='button urlfile' data-link-url='" . esc_attr($file) . "'>" . __('File URL') . "</button> 787 <button type='button' class='button urlpost' data-link-url='" . esc_attr($link) . "'>" . __('Attachment Post URL') . "</button> 782 788 "; 783 789 } 784 790 791 function wp_caption_input_textarea($edit_post) { 792 // post data is already escaped 793 $name = "attachments[{$edit_post->ID}][post_excerpt]"; 794 795 return ' 796 <textarea name="' . $name . '" id="' . $name . '">' . $edit_post->post_excerpt . '</textarea> 797 <div class="edit-caption-controls hide-if-no-js"> 798 <input type="button" class="button caption-insert-link" value="' . esc_attr__('Insert Link') . '" /> 799 <div class="caption-insert-link-wrap hidden"> 800 <label><span>' . __('Link URL') . '</span> 801 <input type="text" value="" class="caption-insert-link-url" /></label> 802 <label><span>' . __('Linked text') . '</span> 803 <input type="text" value="" class="caption-insert-link-text" /></label> 804 <div class="caption-insert-link-buttons"> 805 <input type="button" class="button caption-cancel" value="' . esc_attr__('Cancel') . '" /> 806 <input type="button" class="button-primary caption-save" value="' . esc_attr__('Insert') . '" /> 807 <br class="clear" /> 808 </div></div></div> 809 '; 810 } 811 785 812 /** 786 813 * {@internal Missing Short Description}} 787 814 * … … 924 951 ), 925 952 'image_alt' => array(), 926 953 'post_excerpt' => array( 927 'label' => __('Caption'), 928 'value' => $edit_post->post_excerpt 954 'label' => __('Default Caption'), 955 'input' => 'html', 956 'html' => wp_caption_input_textarea($edit_post) 929 957 ), 930 958 'post_content' => array( 931 959 'label' => __('Description'), … … 1202 1230 if ( !empty( $field[ $field['input'] ] ) ) 1203 1231 $item .= $field[ $field['input'] ]; 1204 1232 elseif ( $field['input'] == 'textarea' ) { 1205 if ( user_can_richedit() ) { // textarea_escaped when user_can_richedit() = false 1206 $field['value'] = esc_textarea( $field['value'] ); 1233 if ( 'post_content' == $id && user_can_richedit() ) { 1234 // sanitize_post() skips the post_content when user_can_richedit 1235 $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES ); 1207 1236 } 1237 // post_excerpt is already escaped by sanitize_post() in get_attachment_fields_to_edit() 1208 1238 $item .= "<textarea id='$name' name='$name' $aria_required>" . $field['value'] . '</textarea>'; 1209 1239 } else { 1210 1240 $item .= "<input type='text' class='text' id='$name' name='$name' value='" . esc_attr( $field['value'] ) . "' $aria_required />"; … … 1513 1543 alt = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); 1514 1544 1515 1545 <?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?> 1516 if ( f.caption.value ) 1517 caption = f.caption.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); 1546 if ( f.caption.value ) { 1547 caption = f.caption.value.replace(/<[a-z][^<>]+>/g, function(a){ 1548 return a.replace(/"/g, "'"); 1549 }); 1550 1551 caption = caption.replace(/"/g, '"'); 1552 } 1518 1553 <?php } ?> 1519 1554 1520 1555 cls = caption ? '' : ' class="'+t.align+'"'; -
wp-admin/js/media-upload.dev.js
25 25 ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark); 26 26 27 27 if ( h.indexOf('[caption') === 0 ) { 28 if ( ed. plugins.wpeditimage)29 h = ed. plugins.wpeditimage._do_shcode(h);28 if ( ed.wpSetImgCaption ) 29 h = ed.wpSetImgCaption(h); 30 30 } else if ( h.indexOf('[gallery') === 0 ) { 31 31 if ( ed.plugins.wpgallery ) 32 32 h = ed.plugins.wpgallery._do_gallery(h); -
wp-includes/formatting.php
1188 1188 /** 1189 1189 * Acts on text which is about to be edited. 1190 1190 * 1191 * Unless $richedit is set, it is simply a holder for the 'format_to_edit'1192 * filter. If $richedit is set true htmlspecialchars(), through esc_textarea(),1193 * will be run on the content, converting special characters to HTML entities.1191 * The $content is run through esc_textarea(), which uses htmlspecialchars() 1192 * to convert special characters to HTML entities. If $richedit is set to true, 1193 * it is simply a holder for the 'format_to_edit' filter. 1194 1194 * 1195 1195 * @since 0.71 1196 1196 * 1197 1197 * @param string $content The text about to be edited. 1198 * @param bool $richedit Whether the $content should pass through htmlspecialchars(). Default false.1198 * @param bool $richedit Whether the $content should not pass through htmlspecialchars(). Default false (meaning it will be passed). 1199 1199 * @return string The text after the filter (and possibly htmlspecialchars()) has been run. 1200 1200 */ 1201 1201 function format_to_edit( $content, $richedit = false ) { -
wp-includes/js/plupload/handlers.dev.js
338 338 } 339 339 340 340 jQuery(document).ready(function($){ 341 var insert_link, bookmark; 342 341 343 $('.media-upload-form').bind('click.uploader', function(e) { 342 var target = $(e.target), tr, c ;344 var target = $(e.target), tr, c, el, textarea, sel, text, startPos, endPos; 343 345 344 if ( target.is('input[type="radio"]') ) { // remember the last used image size and alignment 346 if ( target.hasClass('caption-insert-link') ) { 347 el = target.siblings('div.caption-insert-link-wrap'), textarea = target.parent().siblings('textarea').get(0); 348 349 if ( document.selection ) { 350 textarea.focus(); 351 sel = document.selection.createRange(); 352 bookmark = sel.getBookmark(); 353 354 if ( sel.text ) 355 el.find('.caption-insert-link-text').val(sel.text); 356 357 } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) { 358 text = textarea.value; 359 startPos = textarea.selectionStart; 360 endPos = textarea.selectionEnd; 361 362 if ( startPos != endPos ) 363 el.find('.caption-insert-link-text').val( text.substring(startPos, endPos) ); 364 } 365 366 target.hide(); 367 el.show(); 368 el.find('.caption-insert-link-url').focus(); 369 } else if ( target.hasClass('caption-cancel') || target.hasClass('caption-save') ) { 370 el = target.closest('div.caption-insert-link-wrap'); 371 372 if ( target.hasClass('caption-save') ) 373 insert_link( el.closest('.edit-caption-controls').siblings('textarea'), el ); 374 375 el.hide(); 376 el.siblings('.caption-insert-link').show(); 377 } else if ( target.is('input[type="radio"]') ) { // remember the last used image size and alignment 345 378 tr = target.closest('tr'); 346 379 347 380 if ( $(tr).hasClass('align') ) … … 355 388 356 389 if ( c && c[1] ) { 357 390 setUserSetting('urlbutton', c[1]); 358 target.siblings('.urlfield').val( target. attr('title') );391 target.siblings('.urlfield').val( target.data('link-url') ); 359 392 } 360 393 } else if ( target.is('a.dismiss') ) { 361 394 target.parents('.media-item').fadeOut(200, function(){ … … 364 397 } else if ( target.is('.upload-flash-bypass a') || target.is('a.uploader-html') ) { // switch uploader to html4 365 398 $('#media-items, p.submit, span.big-file-warning').css('display', 'none'); 366 399 switchUploader(0); 367 return false;400 e.preventDefault(); 368 401 } else if ( target.is('.upload-html-bypass a') ) { // switch uploader to multi-file 369 402 $('#media-items, p.submit, span.big-file-warning').css('display', ''); 370 403 switchUploader(1); 371 return false;404 e.preventDefault(); 372 405 } else if ( target.is('a.describe-toggle-on') ) { // Show 373 406 target.parent().addClass('open'); 374 407 target.siblings('.slidetoggle').fadeIn(250, function(){ … … 386 419 } 387 420 } 388 421 }); 389 return false;422 e.preventDefault(); 390 423 } else if ( target.is('a.describe-toggle-off') ) { // Hide 391 424 target.siblings('.slidetoggle').fadeOut(250, function(){ 392 425 target.parent().removeClass('open'); 393 426 }); 394 return false;427 e.preventDefault(); 395 428 } 396 429 }); 430 431 insert_link = function(textarea, parent) { 432 var sel, content, startPos, endPos, scrollTop, text, 433 url = parent.find('.caption-insert-link-url'), link_text = parent.find('.caption-insert-link-text'); 397 434 435 if ( !url.length || !link_text.length ) 436 return; 437 438 textarea = textarea.get(0); 439 content = "<a href='"+url.val()+"'>"+link_text.val()+"</a>"; 440 441 if ( document.selection ) { 442 textarea.focus(); 443 sel = document.selection.createRange(); 444 445 if ( bookmark ) { 446 sel.moveToBookmark( bookmark ); 447 bookmark = ''; 448 } 449 450 sel.text = content; 451 textarea.focus(); 452 } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) { 453 text = textarea.value; 454 startPos = textarea.selectionStart; 455 endPos = textarea.selectionEnd; 456 scrollTop = textarea.scrollTop; 457 458 textarea.value = text.substring(0, startPos) + content + text.substring(endPos, text.length); 459 460 textarea.focus(); 461 textarea.selectionStart = startPos + content.length; 462 textarea.selectionEnd = startPos + content.length; 463 textarea.scrollTop = scrollTop; 464 } 465 466 url.val(''); 467 link_text.val(''); 468 }; 469 398 470 // init and set the uploader 399 471 uploader_init = function() { 400 472 uploader = new plupload.Uploader(wpUploaderInit); -
wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js
1 1 2 2 (function() { 3 3 tinymce.create('tinymce.plugins.wpEditImage', { 4 url: '', 5 editor: {}, 4 6 5 init 7 init: function(ed, url) { 6 8 var t = this, mouse = {}; 7 9 8 10 t.url = url; 11 t.editor = ed; 9 12 t._createButtons(); 10 13 11 14 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...'); 12 15 ed.addCommand('WP_EditImage', function() { 13 var el = ed.selection.getNode(), vp = tinymce.DOM.getViewPort(), H = vp.h, W = ( 720 < vp.w ) ? 720 : vp.w, cls = ed.dom.getAttrib(el, 'class');16 var el = ed.selection.getNode(), vp, H, W, cls = ed.dom.getAttrib(el, 'class'); 14 17 15 18 if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 || el.nodeName != 'IMG' ) 16 19 return; 17 20 18 tb_show('', url + '/editimage.html?ver=321&TB_iframe=true'); 19 tinymce.DOM.setStyles('TB_window', { 20 'width':( W - 50 )+'px', 21 'height':( H - 45 )+'px', 22 'margin-left':'-'+parseInt((( W - 50 ) / 2),10) + 'px' 23 }); 21 vp = tinymce.DOM.getViewPort(); 22 H = 680 < (vp.h - 70) ? 680 : vp.h - 70; 23 W = 650 < vp.w ? 650 : vp.w; 24 24 25 if ( ! tinymce.isIE6 ) { 26 tinymce.DOM.setStyles('TB_window', { 27 'top':'20px', 28 'marginTop':'0' 29 }); 30 } 31 32 tinymce.DOM.setStyles('TB_iframeContent', { 33 'width':( W - 50 )+'px', 34 'height':( H - 75 )+'px' 25 ed.windowManager.open({ 26 title: 'Edit Image', 27 file: url + '/editimage.html?ver=321', 28 width: W+'px', 29 height: H+'px', 30 inline: true, 31 scrollbars: true 35 32 }); 36 tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );37 33 }); 38 34 39 35 ed.onInit.add(function(ed) { 40 tinymce.dom.Event.add(ed.getBody(), 'dragstart', function(e) { 41 if ( !tinymce.isGecko && e.target.nodeName == 'IMG' && ed.dom.getParent(e.target, 'dl.wp-caption') ) 42 return tinymce.dom.Event.cancel(e); 36 ed.dom.events.add(ed.getBody(), 'dragstart', function(e) { 37 var parent; 38 39 if ( e.target.nodeName == 'IMG' && ( parent = ed.dom.getParent(e.target, 'div.mceTemp') ) ) { 40 ed.selection.select(parent); 41 } 43 42 }); 44 43 }); 45 44 … … 53 52 54 53 if ( 'IMG' == n.nodeName ) { 55 54 window.setTimeout(function(){ 56 var DL , width;55 var DL = ed.dom.getParent(n, 'dl.wp-caption'), width; 57 56 58 57 if ( n.width != mouse.img_w || n.height != mouse.img_h ) 59 58 n.className = n.className.replace(/size-[^ "']+/, ''); 60 59 61 if ( ed.dom.getParent(n, 'div.mceTemp') ) { 62 DL = ed.dom.getParent(n, 'dl.wp-caption'); 63 64 if ( DL ) { 65 width = ed.dom.getAttrib(n, 'width') || n.width; 66 width = parseInt(width, 10); 67 ed.dom.setStyle(DL, 'width', 10 + width); 68 ed.execCommand('mceRepaint'); 69 } 70 60 if ( DL ) { 61 width = ed.dom.getAttrib(n, 'width') || n.width; 62 width = parseInt(width, 10); 63 ed.dom.setStyle(DL, 'width', 10 + width); 64 ed.execCommand('mceRepaint'); 71 65 } 72 66 }, 100); 73 67 } … … 91 85 } 92 86 }); 93 87 94 // when pressing Return inside a caption move the c ursorto a new parapraph under it88 // when pressing Return inside a caption move the caret to a new parapraph under it 95 89 ed.onKeyPress.add(function(ed, e) { 96 90 var n, DL, DIV, P; 97 91 98 92 if ( e.keyCode == 13 ) { 99 93 n = ed.selection.getNode(); 100 94 DL = ed.dom.getParent(n, 'dl.wp-caption'); 101 DIV = ed.dom.getParent(DL, 'div.mceTemp');102 95 103 if ( DL && DIV ) { 104 P = ed.dom.create('p', {}, ' '); 96 if ( DL ) 97 DIV = ed.dom.getParent(DL, 'div.mceTemp'); 98 99 if ( DIV ) { 100 P = ed.dom.create('p', {}, '<br>'); 105 101 ed.dom.insertAfter( P, DIV ); 106 107 if ( P.firstChild ) 108 ed.selection.select(P.firstChild); 109 else 110 ed.selection.select(P); 111 112 tinymce.dom.Event.cancel(e); 102 ed.selection.select(P.firstChild); 103 104 if ( tinymce.isIE ) { 105 ed.selection.setContent(''); 106 } else { 107 ed.selection.setContent('<br _moz_dirty="">'); 108 ed.selection.setCursorLocation(P, 0); 109 } 110 111 ed.dom.events.cancel(e); 113 112 return false; 114 113 } 115 114 } 116 115 }); 117 116 118 117 ed.onBeforeSetContent.add(function(ed, o) { 119 o.content = t._do_shcode(o.content);118 o.content = ed.wpSetImgCaption(o.content); 120 119 }); 121 120 122 121 ed.onPostProcess.add(function(ed, o) { 123 122 if (o.get) 124 o.content = t._get_shcode(o.content);123 o.content = ed.wpGetImgCaption(o.content); 125 124 }); 125 126 ed.wpSetImgCaption = function(content) { 127 return t._do_shcode(content); 128 }; 129 130 ed.wpGetImgCaption = function(content) { 131 return t._get_shcode(content); 132 }; 126 133 }, 127 134 128 _do_shcode : function(co ) {129 return co .replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?[\s\u00a0]*/g, function(a,b,c){135 _do_shcode : function(content) { 136 return content.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g, function(a,b,c){ 130 137 var id, cls, w, cap, div_cls; 131 132 b = b.replace(/\\'|\\'|\\'/g, ''').replace(/\\"|\\"/g, '"');133 c = c.replace(/\\'|\\'/g, ''').replace(/\\"/g, '"');134 id = b.match(/id=['"]([^'"]+)/i);135 cls = b.match(/align=['"]([^'"]+)/i);136 w = b.match(/width=['"]([0-9]+)/);137 cap = b.match(/caption=['"]([^'"]+)/i);138 138 139 id = b.match(/id=['"]([^'"]+)['"] ?/); 140 b = b.replace(id[0], ''); 141 142 cls = b.match(/align=['"]([^'"]+)['"] ?/); 143 b = b.replace(cls[0], ''); 144 145 w = b.match(/width=['"]([0-9]+)['"] ?/); 146 b = b.replace(w[0], ''); 147 148 cap = tinymce.trim(b).replace(/caption=['"]/, '').replace(/['"]$/, ''); 149 139 150 id = ( id && id[1] ) ? id[1] : ''; 140 151 cls = ( cls && cls[1] ) ? cls[1] : 'alignnone'; 141 152 w = ( w && w[1] ) ? w[1] : ''; 142 cap = ( cap && cap[1] ) ? cap[1] : ''; 143 if ( ! w || ! cap ) return c; 144 153 154 if ( !w || !cap ) 155 return c; 156 145 157 div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp'; 146 158 147 return '<div class="'+div_cls+'" draggable ><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+(10+parseInt(w))+159 return '<div class="'+div_cls+'" draggable="true"><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+( 10 + parseInt(w) )+ 148 160 'px"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>'; 149 161 }); 150 162 }, 151 163 152 _get_shcode : function(co ) {153 return co .replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi, function(a,b,c,cap){164 _get_shcode : function(content) { 165 return content.replace(/<div class="mceTemp[^"]*">\s*<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]+?)<\/dd>\s*<\/dl>\s*<\/div>/gi, function(a,b,c,cap){ 154 166 var id, cls, w; 155 156 id = b.match(/id=['"]([^'"]+)/i);157 cls = b.match(/class=['"]([^'"]+)/i);158 w = c.match(/width=['"]([0-9]+)/);159 167 160 id = ( id && id[1] ) ? id[1] : ''; 161 cls = ( cls && cls[1] ) ? cls[1] : 'alignnone'; 168 w = c.match(/width="([0-9]+)"/); 162 169 w = ( w && w[1] ) ? w[1] : ''; 163 170 164 if ( ! w || ! cap ) return c; 165 cls = cls.match(/align[^ '"]+/) || 'alignnone'; 166 cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, ''').replace(/"/g, '"'); 171 if ( !w || !cap ) 172 return c; 167 173 174 id = b.match(/id="([^"]+)"/); 175 id = ( id && id[1] ) ? id[1] : ''; 176 177 cls = b.match(/class="([^"]+)"/); 178 cls = ( cls && cls[1] ) ? cls[1] : ''; 179 cls = cls.match(/align[a-z]+/) || 'alignnone'; 180 181 cap = cap.replace(/<[a-z][^<>]+>/g, function(a){ 182 return a.replace(/"/g, "'"); 183 }); 184 185 cap = cap.replace(/"/g, '"'); 186 168 187 return '[caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/caption]'; 169 188 }); 170 189 }, -
wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js
1 (function(){tinymce.create("tinymce.plugins.wpEditImage",{ init:function(a,c){var d=this,b={};d.url=c;d._createButtons();a.addCommand("WP_EditImage",function(){var i=a.selection.getNode(),g=tinymce.DOM.getViewPort(),h=g.h,e=(720<g.w)?720:g.w,f=a.dom.getAttrib(i,"class");if(f.indexOf("mceItem")!=-1||f.indexOf("wpGallery")!=-1||i.nodeName!="IMG"){return}tb_show("",c+"/editimage.html?ver=321&TB_iframe=true");tinymce.DOM.setStyles("TB_window",{width:(e-50)+"px",height:(h-45)+"px","margin-left":"-"+parseInt(((e-50)/2),10)+"px"});if(!tinymce.isIE6){tinymce.DOM.setStyles("TB_window",{top:"20px",marginTop:"0"})}tinymce.DOM.setStyles("TB_iframeContent",{width:(e-50)+"px",height:(h-75)+"px"});tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onInit.add(function(e){tinymce.dom.Event.add(e.getBody(),"dragstart",function(f){if(!tinymce.isGecko&&f.target.nodeName=="IMG"&&e.dom.getParent(f.target,"dl.wp-caption")){return tinymce.dom.Event.cancel(f)}})});a.onMouseUp.add(function(f,g){if(tinymce.isWebKit||tinymce.isOpera){return}if(b.x&&(g.clientX!=b.x||g.clientY!=b.y)){var h=f.selection.getNode();if("IMG"==h.nodeName){window.setTimeout(function(){var e,i;if(h.width!=b.img_w||h.height!=b.img_h){h.className=h.className.replace(/size-[^ "']+/,"")}if(f.dom.getParent(h,"div.mceTemp")){e=f.dom.getParent(h,"dl.wp-caption");if(e){i=f.dom.getAttrib(h,"width")||h.width;i=parseInt(i,10);f.dom.setStyle(e,"width",10+i);f.execCommand("mceRepaint")}}},100)}}b={}});a.onMouseDown.add(function(f,g){if(g.target&&(g.target.nodeName=="IMG"||(g.target.firstChild&&g.target.firstChild.nodeName=="IMG"))){b={x:g.clientX,y:g.clientY,img_w:g.target.clientWidth,img_h:g.target.clientHeight};if(f.dom.getAttrib(g.target,"class").indexOf("mceItem")==-1){f.plugins.wordpress._showButtons(g.target,"wp_editbtns")}}});a.onKeyPress.add(function(f,j){var k,g,i,h;if(j.keyCode==13){k=f.selection.getNode();g=f.dom.getParent(k,"dl.wp-caption");i=f.dom.getParent(g,"div.mceTemp");if(g&&i){h=f.dom.create("p",{}," ");f.dom.insertAfter(h,i);if(h.firstChild){f.selection.select(h.firstChild)}else{f.selection.select(h)}tinymce.dom.Event.cancel(j);return false}}});a.onBeforeSetContent.add(function(e,f){f.content=d._do_shcode(f.content)});a.onPostProcess.add(function(e,f){if(f.get){f.content=d._get_shcode(f.content)}})},_do_shcode:function(a){return a.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?[\s\u00a0]*/g,function(g,d,k){var j,f,e,h,i;d=d.replace(/\\'|\\'|\\'/g,"'").replace(/\\"|\\"/g,""");k=k.replace(/\\'|\\'/g,"'").replace(/\\"/g,""");j=d.match(/id=['"]([^'"]+)/i);f=d.match(/align=['"]([^'"]+)/i);e=d.match(/width=['"]([0-9]+)/);h=d.match(/caption=['"]([^'"]+)/i);j=(j&&j[1])?j[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";h=(h&&h[1])?h[1]:"";if(!e||!h){return k}i=(f=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";return'<div class="'+i+'" draggable><dl id="'+j+'" class="wp-caption '+f+'" style="width: '+(10+parseInt(e))+'px"><dt class="wp-caption-dt">'+k+'</dt><dd class="wp-caption-dd">'+h+"</dd></dl></div>"})},_get_shcode:function(a){return a.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi,function(g,d,j,h){var i,f,e;i=d.match(/id=['"]([^'"]+)/i);f=d.match(/class=['"]([^'"]+)/i);e=j.match(/width=['"]([0-9]+)/);i=(i&&i[1])?i[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";if(!e||!h){return j}f=f.match(/align[^ '"]+/)||"alignnone";h=h.replace(/<\S[^<>]*>/gi,"").replace(/'/g,"'").replace(/"/g,""");return'[caption id="'+i+'" align="'+f+'" width="'+e+'" caption="'+h+'"]'+j+"[/caption]"})},_createButtons:function(){var b=this,a=tinyMCE.activeEditor,d=tinymce.DOM,e,c;d.remove("wp_editbtns");d.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"});e=d.add("wp_editbtns","img",{src:b.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.edit_img")});tinymce.dom.Event.add(e,"mousedown",function(g){var f=tinyMCE.activeEditor;f.windowManager.bookmark=f.selection.getBookmark("simple");f.execCommand("WP_EditImage")});c=d.add("wp_editbtns","img",{src:b.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.del_img")});tinymce.dom.Event.add(c,"mousedown",function(i){var f=tinyMCE.activeEditor,g=f.selection.getNode(),h;if(g.nodeName=="IMG"&&f.dom.getAttrib(g,"class").indexOf("mceItem")==-1){if((h=f.dom.getParent(g,"div"))&&f.dom.hasClass(h,"mceTemp")){f.dom.remove(h)}else{if((h=f.dom.getParent(g,"A"))&&h.childNodes.length==1){f.dom.remove(h)}else{f.dom.remove(g)}}f.execCommand("mceRepaint");return false}})},getInfo:function(){return{longname:"Edit Image",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpeditimage",tinymce.plugins.wpEditImage)})();2 No newline at end of file 1 (function(){tinymce.create("tinymce.plugins.wpEditImage",{url:"",editor:{},init:function(a,c){var d=this,b={};d.url=c;d.editor=a;d._createButtons();a.addCommand("WP_EditImage",function(){var i=a.selection.getNode(),g,h,e,f=a.dom.getAttrib(i,"class");if(f.indexOf("mceItem")!=-1||f.indexOf("wpGallery")!=-1||i.nodeName!="IMG"){return}g=tinymce.DOM.getViewPort();h=680<(g.h-70)?680:g.h-70;e=650<g.w?650:g.w;a.windowManager.open({title:"Edit Image",file:c+"/editimage.html?ver=321",width:e+"px",height:h+"px",inline:true,scrollbars:true})});a.onInit.add(function(e){e.dom.events.add(e.getBody(),"dragstart",function(g){var f;if(g.target.nodeName=="IMG"&&(f=e.dom.getParent(g.target,"div.mceTemp"))){e.selection.select(f)}})});a.onMouseUp.add(function(f,g){if(tinymce.isWebKit||tinymce.isOpera){return}if(b.x&&(g.clientX!=b.x||g.clientY!=b.y)){var h=f.selection.getNode();if("IMG"==h.nodeName){window.setTimeout(function(){var e=f.dom.getParent(h,"dl.wp-caption"),i;if(h.width!=b.img_w||h.height!=b.img_h){h.className=h.className.replace(/size-[^ "']+/,"")}if(e){i=f.dom.getAttrib(h,"width")||h.width;i=parseInt(i,10);f.dom.setStyle(e,"width",10+i);f.execCommand("mceRepaint")}},100)}}b={}});a.onMouseDown.add(function(f,g){if(g.target&&(g.target.nodeName=="IMG"||(g.target.firstChild&&g.target.firstChild.nodeName=="IMG"))){b={x:g.clientX,y:g.clientY,img_w:g.target.clientWidth,img_h:g.target.clientHeight};if(f.dom.getAttrib(g.target,"class").indexOf("mceItem")==-1){f.plugins.wordpress._showButtons(g.target,"wp_editbtns")}}});a.onKeyPress.add(function(f,j){var k,g,i,h;if(j.keyCode==13){k=f.selection.getNode();g=f.dom.getParent(k,"dl.wp-caption");if(g){i=f.dom.getParent(g,"div.mceTemp")}if(i){h=f.dom.create("p",{},"<br>");f.dom.insertAfter(h,i);f.selection.select(h.firstChild);if(tinymce.isIE){f.selection.setContent("")}else{f.selection.setContent('<br _moz_dirty="">');f.selection.setCursorLocation(h,0)}f.dom.events.cancel(j);return false}}});a.onBeforeSetContent.add(function(e,f){f.content=e.wpSetImgCaption(f.content)});a.onPostProcess.add(function(e,f){if(f.get){f.content=e.wpGetImgCaption(f.content)}});a.wpSetImgCaption=function(e){return d._do_shcode(e)};a.wpGetImgCaption=function(e){return d._get_shcode(e)}},_do_shcode:function(a){return a.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g,function(g,d,k){var j,f,e,h,i;j=d.match(/id=['"]([^'"]+)['"] ?/);d=d.replace(j[0],"");f=d.match(/align=['"]([^'"]+)['"] ?/);d=d.replace(f[0],"");e=d.match(/width=['"]([0-9]+)['"] ?/);d=d.replace(e[0],"");h=tinymce.trim(d).replace(/caption=['"]/,"").replace(/['"]$/,"");j=(j&&j[1])?j[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";if(!e||!h){return k}i=(f=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";return'<div class="'+i+'" draggable="true"><dl id="'+j+'" class="wp-caption '+f+'" style="width: '+(10+parseInt(e))+'px"><dt class="wp-caption-dt">'+k+'</dt><dd class="wp-caption-dd">'+h+"</dd></dl></div>"})},_get_shcode:function(a){return a.replace(/<div class="mceTemp[^"]*">\s*<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]+?)<\/dd>\s*<\/dl>\s*<\/div>/gi,function(g,d,j,h){var i,f,e;e=j.match(/width="([0-9]+)"/);e=(e&&e[1])?e[1]:"";if(!e||!h){return j}i=d.match(/id="([^"]+)"/);i=(i&&i[1])?i[1]:"";f=d.match(/class="([^"]+)"/);f=(f&&f[1])?f[1]:"";f=f.match(/align[a-z]+/)||"alignnone";h=h.replace(/<[a-z][^<>]+>/g,function(b){return b.replace(/"/g,"'")});h=h.replace(/"/g,""");return'[caption id="'+i+'" align="'+f+'" width="'+e+'" caption="'+h+'"]'+j+"[/caption]"})},_createButtons:function(){var b=this,a=tinyMCE.activeEditor,d=tinymce.DOM,e,c;d.remove("wp_editbtns");d.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"});e=d.add("wp_editbtns","img",{src:b.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.edit_img")});tinymce.dom.Event.add(e,"mousedown",function(g){var f=tinyMCE.activeEditor;f.windowManager.bookmark=f.selection.getBookmark("simple");f.execCommand("WP_EditImage")});c=d.add("wp_editbtns","img",{src:b.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.del_img")});tinymce.dom.Event.add(c,"mousedown",function(i){var f=tinyMCE.activeEditor,g=f.selection.getNode(),h;if(g.nodeName=="IMG"&&f.dom.getAttrib(g,"class").indexOf("mceItem")==-1){if((h=f.dom.getParent(g,"div"))&&f.dom.hasClass(h,"mceTemp")){f.dom.remove(h)}else{if((h=f.dom.getParent(g,"A"))&&h.childNodes.length==1){f.dom.remove(h)}else{f.dom.remove(g)}}f.execCommand("mceRepaint");return false}})},getInfo:function(){return{longname:"Edit Image",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpeditimage",tinymce.plugins.wpEditImage)})(); 2 No newline at end of file -
wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js
36 36 }, 37 37 38 38 close : function() { 39 var t = this , win = t.getWin();39 var t = this; 40 40 41 41 // To avoid domain relaxing issue in Opera 42 42 function close() { 43 win.tb_remove();44 tinymce = tinyMCE = t.editor = t. dom = t.dom.doc = null; // Cleanup43 t.editor.windowManager.close(window); 44 tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup 45 45 }; 46 46 47 47 if (tinymce.isOpera) 48 win.setTimeout(close, 0);48 t.getWin().setTimeout(close, 0); 49 49 else 50 50 close(); 51 51 }, -
wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js
1 var tinymce=null,tinyMCEPopup,tinyMCE,wpImage;tinyMCEPopup={init:function(){var d=this,b,a,f,c,e;a=(""+document.location.search).replace(/^\?/,"").split("&");f={};for(c=0;c<a.length;c++){e=a[c].split("=");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("tinymce.dom.DOMUtils",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.restoreSelection();return this.editor.execCommand(d,c,e,b)},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark("simple")},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<c.length;b++){a=c.item(b).href;if(a&&a.indexOf("colors")!=-1){document.write('<link rel="stylesheet" href="'+a+'" type="text/css" media="all" />')}}},I:function(a){return document.getElementById(a)},current:"",link:"",link_rel:"",target_value:"",current_size_sel:"s100",width:"",height:"",align:"",img_alt:"",setTabs:function(b){var a=this;if("current"==b.className){return false}a.I("div_advanced").style.display=("tab_advanced"==b.id)?"block":"none";a.I("div_basic").style.display=("tab_basic"==b.id)?"block":"none";a.I("tab_basic").className=a.I("tab_advanced").className="";b.className="current";return false},img_seturl:function(b){var c=this,a=c.I("link_rel").value;if("current"==b){c.I("link_href").value=c.current;c.I("link_rel").value=c.link_rel}else{c.I("link_href").value=c.link;if(a){a=a.replace(/attachment|wp-att-[0-9]+/gi,"");c.I("link_rel").value=tinymce.trim(a)}}},imgAlignCls:function(b){var c=this,a=c.I("img_classes").value;c.I("img_demo").className=c.align=b;a=a.replace(/align[^ "']+/gi,"");a+=(" "+b);a=a.replace(/\s+/g," ").replace(/^\s/,"");if("aligncenter"==b){c.I("hspace").value="";c.updateStyle("hspace")}c.I("img_classes").value=a},showSize:function(e){var c=this,f=c.I("img_demo"),a=c.width,d=c.height,g=e.id||"s100",b;b=parseInt(g.substring(1))/200;f.width=Math.round(a*b);f.height=Math.round(d*b);c.showSizeClear();e.style.borderColor="#A3A3A3";e.style.backgroundColor="#E5E5E5"},showSizeSet:function(){var b=this,d,c,a;if((b.width*1.3)>parseInt(b.preloadImg.width)){d=b.I("s130"),c=b.I("s120"),a=b.I("s110");d.onclick=c.onclick=a.onclick=null;d.onmouseover=c.onmouseover=a.onmouseover=null;d.style.color=c.style.color=a.style.color="#aaa"}},showSizeRem:function(){var a=this,c=a.I("img_demo"),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="#A3A3A3";a.I(a.current_size_sel).style.backgroundColor="#E5E5E5";return false},showSizeClear:function(){var b=this.I("img_size").getElementsByTagName("div"),a;for(a=0;a<b.length;a++){b[a].style.borderColor="#f1f1f1";b[a].style.backgroundColor="#f1f1f1"}},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||"s100";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("img_demo"),b=document.forms[0];c.width=b.width.value?Math.round(b.width.value*0.5):"";c.height=b.height.value?Math.round(b.height.value*0.5):""},demoSetStyle:function(){var b=document.forms[0],a=this.I("img_demo"),c=tinyMCEPopup.editor.dom;if(a){c.setAttrib(a,"style",b.img_style.value);c.setStyle(a,"width","");c.setStyle(a,"height","")}},origSize:function(){var a=this,c=document.forms[0],b=a.I("s100");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("img_demo"),g=tinyMCEPopup.dom,a,o="",n,m;document.dir=tinyMCEPopup.editor.getParam("directionality","");if(tinyMCEPopup.editor.getParam("wpeditimage_disable_captions",false)){p.I("cap_field").style.display="none"}tinyMCEPopup.restoreSelection();b=h.selection.getNode();if(b.nodeName!="IMG"){return}i.img_src.value=j.src=l=h.dom.getAttrib(b,"src");h.dom.setStyle(b,"float","");p.getImageData();k=h.dom.getAttrib(b,"class");if(a=g.getParent(b,"dl")){n=h.dom.getAttrib(a,"class");n=n.match(/align[^ "']+/i);if(n&&!g.hasClass(b,n)){k+=" "+n;tinymce.trim(k)}tinymce.each(a.childNodes,function(c){if(c.nodeName=="DD"&&g.hasClass(c,"wp-caption-dd")){o=c.innerHTML;return}})}i.img_cap.value=o;i.img_title.value=h.dom.getAttrib(b,"title");i.img_alt.value=h.dom.getAttrib(b,"alt");i.border.value=h.dom.getAttrib(b,"border");i.vspace.value=h.dom.getAttrib(b,"vspace");i.hspace.value=h.dom.getAttrib(b,"hspace");i.align.value=h.dom.getAttrib(b,"align");i.width.value=p.width=h.dom.getAttrib(b,"width");i.height.value=p.height=h.dom.getAttrib(b,"height");i.img_classes.value=k;i.img_style.value=h.dom.getAttrib(b,"style");if(g.getAttrib(b,"hspace")){p.updateStyle("hspace")}if(g.getAttrib(b,"border")){p.updateStyle("border")}if(g.getAttrib(b,"vspace")){p.updateStyle("vspace")}if(m=h.dom.getParent(b,"A")){i.link_href.value=p.current=h.dom.getAttrib(m,"href");i.link_title.value=h.dom.getAttrib(m,"title");i.link_rel.value=p.link_rel=h.dom.getAttrib(m,"rel");i.link_style.value=h.dom.getAttrib(m,"style");p.target_value=h.dom.getAttrib(m,"target");i.link_classes.value=h.dom.getAttrib(m,"class")}i.link_target.checked=(p.target_value&&p.target_value=="_blank")?"checked":"";e=l.substring(l.lastIndexOf("/"));e=e.replace(/-[0-9]{2,4}x[0-9]{2,4}/,"");p.link=l.substring(0,l.lastIndexOf("/"))+e;if(k.indexOf("alignleft")!=-1){p.I("alignleft").checked="checked";j.className=p.align="alignleft"}else{if(k.indexOf("aligncenter")!=-1){p.I("aligncenter").checked="checked";j.className=p.align="aligncenter"}else{if(k.indexOf("alignright")!=-1){p.I("alignright").checked="checked";j.className=p.align="alignright"}else{if(k.indexOf("alignnone")!=-1){p.I("alignnone").checked="checked";j.className=p.align="alignnone"}}}}if(p.width&&p.preloadImg.width){p.showSizeSet()}document.body.style.display=""},remove:function(){var a=tinyMCEPopup.editor,c,b;tinyMCEPopup.restoreSelection();b=a.selection.getNode();if(b.nodeName!="IMG"){return}if((c=a.dom.getParent(b,"div"))&&a.dom.hasClass(c,"mceTemp")){a.dom.remove(c)}else{if((c=a.dom.getParent(b,"A"))&&c.childNodes.length==1){a.dom.remove(c)}else{a.dom.remove(b)}}a.execCommand("mceRepaint");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="",j,i,s,a,z,w="",c,y;tinyMCEPopup.restoreSelection();e=g.selection.getNode();if(e.nodeName!="IMG"){return}if(v.img_src.value===""){m.remove();return}if(v.img_cap.value!=""&&v.width.value!=""){o=1;k=k.replace(/align[^ "']+\s?/gi,"")}p=g.dom.getParent(e,"a");h=g.dom.getParent(e,"p");n=g.dom.getParent(e,"dl");r=g.dom.getParent(e,"div");tinyMCEPopup.execCommand("mceBeginUndoLevel");if(v.width.value!=e.width||v.height.value!=e.height){k=k.replace(/size-[^ "']+/,"")}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,"class":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&&g.dom.hasClass(e,"aligncenter")){g.dom.removeClass(e,"aligncenter");d=1}tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});if(d){g.dom.addClass(e,"aligncenter")}tinymce.each(g.dom.select("a"),function(b){if(g.dom.getAttrib(b,"href")=="#mce_temp_url#"){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)?"_blank":"","class":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)?"_blank":"","class":v.link_classes.value,style:v.link_style.value})}}if(o){a=10+parseInt(v.width.value);z=(m.align=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";if(n){g.dom.setAttribs(n,{"class":"wp-caption "+m.align,style:"width: "+a+"px;"});if(r){g.dom.setAttrib(r,"class",z)}if((i=g.dom.getParent(e,"dt"))&&(s=i.nextSibling)&&g.dom.hasClass(s,"wp-caption-dd")){g.dom.setHTML(s,v.img_cap.value)}}else{if((q=v.img_classes.value.match(/wp-image-([0-9]{1,6})/))&&q[1]){u="attachment_"+q[1]}if(v.link_href.value&&(w=g.dom.getParent(e,"a"))){if(w.childNodes.length==1){l=g.dom.getOuterHTML(w)}else{l=g.dom.getOuterHTML(w);l=l.match(/<a[^>]+>/i);l=l+g.dom.getOuterHTML(e)+"</a>"}}else{l=g.dom.getOuterHTML(e)}l='<dl id="'+u+'" class="wp-caption '+m.align+'" style="width: '+a+'px"><dt class="wp-caption-dt">'+l+'</dt><dd class="wp-caption-dd">'+v.img_cap.value+"</dd></dl>";j=g.dom.create("div",{"class":z},l);if(h){h.parentNode.insertBefore(j,h);if(h.childNodes.length==1){g.dom.remove(h)}else{if(w&&w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}else{if(c=g.dom.getParent(e,"TD,TH,LI")){c.appendChild(j);if(w&&w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}}}else{if(n&&r){if(v.link_href.value&&(y=g.dom.getParent(e,"a"))){l=g.dom.getOuterHTML(y)}else{l=g.dom.getOuterHTML(e)}h=g.dom.create("p",{},l);r.parentNode.insertBefore(h,r);g.dom.remove(r)}}if(v.img_classes.value.indexOf("aligncenter")!=-1){if(h&&(!h.style||h.style.textAlign!="center")){g.dom.setStyle(h,"textAlign","center")}}else{if(h&&h.style&&h.style.textAlign=="center"){g.dom.setStyle(h,"textAlign","")}}if(!v.link_href.value&&p){x=g.selection.getBookmark();g.dom.remove(p,1);g.selection.moveToBookmark(x)}tinyMCEPopup.execCommand("mceEndUndoLevel");g.execCommand("mceRepaint");tinyMCEPopup.close()},updateStyle:function(a){var e=tinyMCEPopup.dom,c,d=document.forms[0],b=e.create("img",{style:d.img_style.value});if(tinyMCEPopup.editor.settings.inline_styles){if(a=="align"){e.setStyle(b,"float","");e.setStyle(b,"vertical-align","");c=d.align.value;if(c){if(c=="left"||c=="right"){e.setStyle(b,"float",c)}else{b.style.verticalAlign=c}}}if(a=="border"){e.setStyle(b,"border","");c=d.border.value;if(c||c=="0"){if(c=="0"){b.style.border="0"}else{b.style.border=c+"px solid black"}}}if(a=="hspace"){e.setStyle(b,"marginLeft","");e.setStyle(b,"marginRight","");c=d.hspace.value;if(c){b.style.marginLeft=c+"px";b.style.marginRight=c+"px"}}if(a=="vspace"){e.setStyle(b,"marginTop","");e.setStyle(b,"marginBottom","");c=d.vspace.value;if(c){b.style.marginTop=c+"px";b.style.marginBottom=c+"px"}}d.img_style.value=e.serializeStyle(e.parseStyle(b.style.cssText));this.demoSetStyle()}},checkVal:function(a){if(a.value==""){if(a.id=="img_src"){a.value=this.I("img_demo").src||this.preloadImg.src}}},resetImageData:function(){var a=document.forms[0];a.width.value=a.height.value=""},updateImageData:function(){var d=document.forms[0],b=wpImage,a=d.width.value,c=d.height.value;if(!a&&c){a=d.width.value=b.width=Math.round(b.preloadImg.width/(b.preloadImg.height/c))}else{if(a&&!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.preloadImg.onerror=a.resetImageData;a.preloadImg.src=tinyMCEPopup.editor.documentBaseURI.toAbsolute(b.img_src.value)}};window.onload=function(){wpImage.init()};wpImage.preInit();2 No newline at end of file 1 var tinymce=null,tinyMCEPopup,tinyMCE,wpImage;tinyMCEPopup={init:function(){var d=this,b,a,f,c,e;a=(""+document.location.search).replace(/^\?/,"").split("&");f={};for(c=0;c<a.length;c++){e=a[c].split("=");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("tinymce.dom.DOMUtils",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("simple")},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<c.length;b++){a=c.item(b).href;if(a&&a.indexOf("colors")!=-1){document.write('<link rel="stylesheet" href="'+a+'" type="text/css" media="all" />')}}},I:function(a){return document.getElementById(a)},current:"",link:"",link_rel:"",target_value:"",current_size_sel:"s100",width:"",height:"",align:"",img_alt:"",setTabs:function(b){var a=this;if("current"==b.className){return false}a.I("div_advanced").style.display=("tab_advanced"==b.id)?"block":"none";a.I("div_basic").style.display=("tab_basic"==b.id)?"block":"none";a.I("tab_basic").className=a.I("tab_advanced").className="";b.className="current";return false},img_seturl:function(b){var c=this,a=c.I("link_rel").value;if("current"==b){c.I("link_href").value=c.current;c.I("link_rel").value=c.link_rel}else{c.I("link_href").value=c.link;if(a){a=a.replace(/attachment|wp-att-[0-9]+/gi,"");c.I("link_rel").value=tinymce.trim(a)}}},imgAlignCls:function(b){var c=this,a=c.I("img_classes").value;c.I("img_demo").className=c.align=b;a=a.replace(/align[^ "']+/gi,"");a+=(" "+b);a=a.replace(/\s+/g," ").replace(/^\s/,"");if("aligncenter"==b){c.I("hspace").value="";c.updateStyle("hspace")}c.I("img_classes").value=a},showSize:function(e){var c=this,f=c.I("img_demo"),a=c.width,d=c.height,g=e.id||"s100",b;b=parseInt(g.substring(1))/200;f.width=Math.round(a*b);f.height=Math.round(d*b);c.showSizeClear();e.style.borderColor="#A3A3A3";e.style.backgroundColor="#E5E5E5"},showSizeSet:function(){var b=this,d,c,a;if((b.width*1.3)>parseInt(b.preloadImg.width)){d=b.I("s130"),c=b.I("s120"),a=b.I("s110");d.onclick=c.onclick=a.onclick=null;d.onmouseover=c.onmouseover=a.onmouseover=null;d.style.color=c.style.color=a.style.color="#aaa"}},showSizeRem:function(){var a=this,c=a.I("img_demo"),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="#A3A3A3";a.I(a.current_size_sel).style.backgroundColor="#E5E5E5";return false},showSizeClear:function(){var b=this.I("img_size").getElementsByTagName("div"),a;for(a=0;a<b.length;a++){b[a].style.borderColor="#f1f1f1";b[a].style.backgroundColor="#f1f1f1"}},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||"s100";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("img_demo"),b=document.forms[0];c.width=b.width.value?Math.round(b.width.value*0.5):"";c.height=b.height.value?Math.round(b.height.value*0.5):""},demoSetStyle:function(){var b=document.forms[0],a=this.I("img_demo"),c=tinyMCEPopup.editor.dom;if(a){c.setAttrib(a,"style",b.img_style.value);c.setStyle(a,"width","");c.setStyle(a,"height","")}},origSize:function(){var a=this,c=document.forms[0],b=a.I("s100");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("img_demo"),g=tinyMCEPopup.dom,a,o="",n,m;document.dir=tinyMCEPopup.editor.getParam("directionality","");if(tinyMCEPopup.editor.getParam("wpeditimage_disable_captions",false)){p.I("cap_field").style.display="none"}tinyMCEPopup.restoreSelection();b=h.selection.getNode();if(b.nodeName!="IMG"){return}i.img_src.value=j.src=l=h.dom.getAttrib(b,"src");h.dom.setStyle(b,"float","");p.getImageData();k=h.dom.getAttrib(b,"class");if(a=g.getParent(b,"dl")){n=h.dom.getAttrib(a,"class");n=n.match(/align[^ "']+/i);if(n&&!g.hasClass(b,n)){k+=" "+n;tinymce.trim(k)}tinymce.each(a.childNodes,function(c){if(c.nodeName=="DD"&&g.hasClass(c,"wp-caption-dd")){o=c.innerHTML;return}})}i.img_cap.value=o;i.img_title.value=h.dom.getAttrib(b,"title");i.img_alt.value=h.dom.getAttrib(b,"alt");i.border.value=h.dom.getAttrib(b,"border");i.vspace.value=h.dom.getAttrib(b,"vspace");i.hspace.value=h.dom.getAttrib(b,"hspace");i.align.value=h.dom.getAttrib(b,"align");i.width.value=p.width=h.dom.getAttrib(b,"width");i.height.value=p.height=h.dom.getAttrib(b,"height");i.img_classes.value=k;i.img_style.value=h.dom.getAttrib(b,"style");if(g.getAttrib(b,"hspace")){p.updateStyle("hspace")}if(g.getAttrib(b,"border")){p.updateStyle("border")}if(g.getAttrib(b,"vspace")){p.updateStyle("vspace")}if(m=h.dom.getParent(b,"A")){i.link_href.value=p.current=h.dom.getAttrib(m,"href");i.link_title.value=h.dom.getAttrib(m,"title");i.link_rel.value=p.link_rel=h.dom.getAttrib(m,"rel");i.link_style.value=h.dom.getAttrib(m,"style");p.target_value=h.dom.getAttrib(m,"target");i.link_classes.value=h.dom.getAttrib(m,"class")}i.link_target.checked=(p.target_value&&p.target_value=="_blank")?"checked":"";e=l.substring(l.lastIndexOf("/"));e=e.replace(/-[0-9]{2,4}x[0-9]{2,4}/,"");p.link=l.substring(0,l.lastIndexOf("/"))+e;if(k.indexOf("alignleft")!=-1){p.I("alignleft").checked="checked";j.className=p.align="alignleft"}else{if(k.indexOf("aligncenter")!=-1){p.I("aligncenter").checked="checked";j.className=p.align="aligncenter"}else{if(k.indexOf("alignright")!=-1){p.I("alignright").checked="checked";j.className=p.align="alignright"}else{if(k.indexOf("alignnone")!=-1){p.I("alignnone").checked="checked";j.className=p.align="alignnone"}}}}if(p.width&&p.preloadImg.width){p.showSizeSet()}document.body.style.display=""},remove:function(){var a=tinyMCEPopup.editor,c,b;tinyMCEPopup.restoreSelection();b=a.selection.getNode();if(b.nodeName!="IMG"){return}if((c=a.dom.getParent(b,"div"))&&a.dom.hasClass(c,"mceTemp")){a.dom.remove(c)}else{if((c=a.dom.getParent(b,"A"))&&c.childNodes.length==1){a.dom.remove(c)}else{a.dom.remove(b)}}a.execCommand("mceRepaint");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="",j,i,s,a,z,w="",c,y;tinyMCEPopup.restoreSelection();e=g.selection.getNode();if(e.nodeName!="IMG"){return}if(v.img_src.value===""){m.remove();return}if(v.img_cap.value!=""&&v.width.value!=""){o=1;k=k.replace(/align[^ "']+\s?/gi,"")}p=g.dom.getParent(e,"a");h=g.dom.getParent(e,"p");n=g.dom.getParent(e,"dl");r=g.dom.getParent(e,"div");tinyMCEPopup.execCommand("mceBeginUndoLevel");if(v.width.value!=e.width||v.height.value!=e.height){k=k.replace(/size-[^ "']+/,"")}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,"class":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&&g.dom.hasClass(e,"aligncenter")){g.dom.removeClass(e,"aligncenter");d=1}tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});if(d){g.dom.addClass(e,"aligncenter")}tinymce.each(g.dom.select("a"),function(b){if(g.dom.getAttrib(b,"href")=="#mce_temp_url#"){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)?"_blank":"","class":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)?"_blank":"","class":v.link_classes.value,style:v.link_style.value})}}if(o){a=10+parseInt(v.width.value);z=(m.align=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";if(n){g.dom.setAttribs(n,{"class":"wp-caption "+m.align,style:"width: "+a+"px;"});if(r){g.dom.setAttrib(r,"class",z)}if((i=g.dom.getParent(e,"dt"))&&(s=i.nextSibling)&&g.dom.hasClass(s,"wp-caption-dd")){g.dom.setHTML(s,v.img_cap.value)}}else{if((q=v.img_classes.value.match(/wp-image-([0-9]{1,6})/))&&q[1]){u="attachment_"+q[1]}if(v.link_href.value&&(w=g.dom.getParent(e,"a"))){if(w.childNodes.length==1){l=g.dom.getOuterHTML(w)}else{l=g.dom.getOuterHTML(w);l=l.match(/<a[^>]+>/i);l=l+g.dom.getOuterHTML(e)+"</a>"}}else{l=g.dom.getOuterHTML(e)}l='<dl id="'+u+'" class="wp-caption '+m.align+'" style="width: '+a+'px"><dt class="wp-caption-dt">'+l+'</dt><dd class="wp-caption-dd">'+v.img_cap.value+"</dd></dl>";j=g.dom.create("div",{"class":z},l);if(h){h.parentNode.insertBefore(j,h);if(h.childNodes.length==1){g.dom.remove(h)}else{if(w&&w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}else{if(c=g.dom.getParent(e,"TD,TH,LI")){c.appendChild(j);if(w&&w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}}}else{if(n&&r){if(v.link_href.value&&(y=g.dom.getParent(e,"a"))){l=g.dom.getOuterHTML(y)}else{l=g.dom.getOuterHTML(e)}h=g.dom.create("p",{},l);r.parentNode.insertBefore(h,r);g.dom.remove(r)}}if(v.img_classes.value.indexOf("aligncenter")!=-1){if(h&&(!h.style||h.style.textAlign!="center")){g.dom.setStyle(h,"textAlign","center")}}else{if(h&&h.style&&h.style.textAlign=="center"){g.dom.setStyle(h,"textAlign","")}}if(!v.link_href.value&&p){x=g.selection.getBookmark();g.dom.remove(p,1);g.selection.moveToBookmark(x)}tinyMCEPopup.execCommand("mceEndUndoLevel");g.execCommand("mceRepaint");tinyMCEPopup.close()},updateStyle:function(a){var e=tinyMCEPopup.dom,c,d=document.forms[0],b=e.create("img",{style:d.img_style.value});if(tinyMCEPopup.editor.settings.inline_styles){if(a=="align"){e.setStyle(b,"float","");e.setStyle(b,"vertical-align","");c=d.align.value;if(c){if(c=="left"||c=="right"){e.setStyle(b,"float",c)}else{b.style.verticalAlign=c}}}if(a=="border"){e.setStyle(b,"border","");c=d.border.value;if(c||c=="0"){if(c=="0"){b.style.border="0"}else{b.style.border=c+"px solid black"}}}if(a=="hspace"){e.setStyle(b,"marginLeft","");e.setStyle(b,"marginRight","");c=d.hspace.value;if(c){b.style.marginLeft=c+"px";b.style.marginRight=c+"px"}}if(a=="vspace"){e.setStyle(b,"marginTop","");e.setStyle(b,"marginBottom","");c=d.vspace.value;if(c){b.style.marginTop=c+"px";b.style.marginBottom=c+"px"}}d.img_style.value=e.serializeStyle(e.parseStyle(b.style.cssText));this.demoSetStyle()}},checkVal:function(a){if(a.value==""){if(a.id=="img_src"){a.value=this.I("img_demo").src||this.preloadImg.src}}},resetImageData:function(){var a=document.forms[0];a.width.value=a.height.value=""},updateImageData:function(){var d=document.forms[0],b=wpImage,a=d.width.value,c=d.height.value;if(!a&&c){a=d.width.value=b.width=Math.round(b.preloadImg.width/(b.preloadImg.height/c))}else{if(a&&!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.preloadImg.onerror=a.resetImageData;a.preloadImg.src=tinyMCEPopup.editor.documentBaseURI.toAbsolute(b.img_src.value)}};window.onload=function(){wpImage.init()};wpImage.preInit(); 2 No newline at end of file -
wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css
1 body { 2 font: 13px/19px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; 3 margin: 10px; 4 color: #000; 5 } 1 6 2 body.mceForceColors {background:#FFF; color:#000;} 7 3 body.mceBrowserDefaults {background:transparent; color:inherit; font-size:inherit; font-family:inherit;} 8 4 td {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} … … 41 37 .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;} 42 38 43 39 /* WordPress styles */ 40 body { 41 font-family: sans-serif; 42 font-size: 13px; 43 line-height: 19px; 44 color: #333; 45 margin: 10px; 46 min-height: 100%; 47 } 44 48 49 br[data-mce-bogus] { 50 line-height: 1em; 51 margin-top: -1em; 52 } 53 54 br[data-mce-bogus]:only-child { 55 line-height: inherit; 56 margin-top: inherit; 57 } 58 45 59 .aligncenter, 46 60 dl.aligncenter { 47 61 display: block; … … 75 89 margin: 0; 76 90 padding: 0; 77 91 border: 0 none; 92 -webkit-user-drag: none; 78 93 } 79 94 80 95 .wp-caption-dd {