Ticket #18311: 18311_qtags_ui.2.diff
File 18311_qtags_ui.2.diff, 10.6 KB (added by , 13 years ago) |
---|
-
wp-admin/css/wp-admin.dev.css
diff --git wp-admin/css/wp-admin.dev.css wp-admin/css/wp-admin.dev.css index 3b9dca7..c675425 100644
abbr.required { 3724 3724 } 3725 3725 3726 3726 .media-item .describe input[type="text"], 3727 .media-item .describe textarea { 3727 .media-item .describe textarea, 3728 .media-item .wp-editor-wrap { 3728 3729 width: 460px; 3729 3730 } 3730 3731 … … abbr.required { 3906 3907 border-radius: 3px; 3907 3908 } 3908 3909 3909 .media-item .post_excerpt textarea {3910 height: 60px;3911 }3912 3913 3910 /*------------------------------------------------------------------------------ 3914 3911 14.1 - Media Library 3915 3912 ------------------------------------------------------------------------------*/ -
wp-admin/includes/media.php
diff --git wp-admin/includes/media.php wp-admin/includes/media.php index 0ae2f10..9b35a8e 100644
function image_link_input_fields($post, $url_type = '') { 788 788 "; 789 789 } 790 790 791 /** 792 * Render an editor for image caption 793 * 794 * @see `get_attachment_fields_to_edit()` 795 * @since 3.4 796 * 797 * @param Object $edit_post, media item object 798 * @return String, the generated html 799 */ 791 800 function wp_caption_input_textarea($edit_post) { 792 801 // post data is already escaped 793 802 $name = "attachments[{$edit_post->ID}][post_excerpt]"; 794 795 return ' 796 <textarea class="code" 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 '; 803 $defaults = array( 804 'teeny' => true, 805 'tinymce' => false, 806 'media_buttons' => false, 807 'textarea_rows' => 10, 808 'quicktags' => array( 809 'buttons' => 'strong,em,link,del,ins,code,close' 810 ) 811 ); 812 $settings = apply_filters( 'caption_input_textarea', $defaults, $edit_post ); 813 814 // Do not load wpLink if tinymce is not present 815 // Just plain Quicktags link handler 816 if ( !$settings['tinymce'] ) 817 wp_deregister_script('wplink'); 818 819 // Use a buffer to get the output, otherway it will just echo everything 820 ob_start(); 821 wp_editor( $edit_post->post_excerpt, $name, $settings ); 822 return ob_get_clean(); 810 823 } 811 824 812 825 /** -
wp-includes/js/tinymce/langs/wp-langs-en.js
diff --git wp-includes/js/tinymce/langs/wp-langs-en.js wp-includes/js/tinymce/langs/wp-langs-en.js index 6921eab..53d784a 100644
s120:"120%", 499 499 s130:"130%", 500 500 img_title:"Title", 501 501 caption:"Caption", 502 insert_link:"Insert link",503 linked_text:"Linked text",504 502 alt:"Alternate Text" 505 503 }); -
wp-includes/js/tinymce/langs/wp-langs.php
diff --git wp-includes/js/tinymce/langs/wp-langs.php wp-includes/js/tinymce/langs/wp-langs.php index 625ef75..6100383 100644
function wp_mce_translation() { 542 542 's130' => __('130%'), 543 543 'img_title' => __('Title'), 544 544 'caption' => __('Caption'), 545 'insert_link' => __('Insert link'),546 'linked_text' => __('Linked text'),547 545 'alt' => __('Alternate Text') 548 546 ); 549 547 -
wp-includes/js/tinymce/plugins/wpeditimage/editimage.html
diff --git wp-includes/js/tinymce/plugins/wpeditimage/editimage.html wp-includes/js/tinymce/plugins/wpeditimage/editimage.html index 6437801..bddd108 100644
7 7 <link rel="stylesheet" href="css/editimage.css?ver=348" type="text/css" media="all" /> 8 8 <script type="text/javascript" src="js/editimage.js?ver=348"></script> 9 9 <script type="text/javascript" src="../../utils/form_utils.js?ver=348"></script> 10 <script type='text/javascript'> 11 /* <![CDATA[ */ 12 window.quicktagsL10n = parent.quicktagsL10n || {}; 13 /* ]]> */ 14 </script> 15 <script type="text/javascript" src="../../../quicktags.js?ver=3.4"></script> 10 16 <base target="_self" /> 11 17 </head> 12 18 … … if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') ) 101 107 </label> 102 108 </th> 103 109 <td class="field"> 104 <textarea id="img_cap_text"></textarea> 105 106 <div class="edit-caption-controls"> 107 <input type="button" class="button caption-insert-link" value="{#wpeditimage.insert_link}" /> 108 109 <div class="caption-insert-link-wrap hidden"> 110 <label><span>{#advanced_dlg.link_url}</span> 111 <input type="text" value="" class="caption-insert-link-url" /></label> 110 <textarea id="img_cap_text" rows="5" cols="40"></textarea> 112 111 113 <label><span>{#wpeditimage.linked_text}</span>114 <input type="text" value="" class="caption-insert-link-text" /></label>115 116 <div class="caption-insert-link-buttons">117 <input type="button" class="button caption-cancel" value="{#cancel}" />118 <input type="button" class="button-primary caption-save" value="{#insert}" />119 112 <br class="clear" /> 120 113 </div></div></div> 121 114 </td> … … if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') ) 285 278 </form> 286 279 </div> 287 280 281 <div id="quicktags"> 282 <textarea id="editor" rows="5" cols="40"></textarea> 283 <script type='text/javascript'> 284 /* <![CDATA[ */ 285 quicktags({ 286 id: 'editor', 287 buttons: 'strong,em,link,del,ins,code,close' 288 }); 289 /* ]]> */ 290 </script> 291 </div> 292 288 293 </body> 289 294 </html> -
wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js
diff --git wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js index 5a27d10..51c32ce 100644
wpImage = { 236 236 }, 237 237 238 238 init : function() { 239 var ed = tinyMCEPopup.editor, h; 239 var ed = tinyMCEPopup.editor, header, img_edit; 240 241 header = document.getElementById('media-upload-header'); 242 img_edit = document.getElementById('img-edit'); 243 header.innerHTML = ed.translate(header.innerHTML); 244 img_edit.innerHTML = ed.translate(img_edit.innerHTML); 240 245 241 h = document.body.innerHTML;242 document.body.innerHTML = ed.translate(h);243 246 window.setTimeout( function(){wpImage.setup();}, 500 ); 244 247 }, 245 248 246 249 setup : function() { 247 250 var t = this, c, el, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, 248 d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, DD, caption = '', dlc, pa , bookmark, insert_link;251 d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, DD, caption = '', dlc, pa; 249 252 250 253 document.dir = tinyMCEPopup.editor.getParam('directionality',''); 251 254 … … wpImage = { 329 332 if ( t.width && t.preloadImg.width ) 330 333 t.showSizeSet(); 331 334 332 document.body.style.display = ''; 333 334 tinyMCEPopup.events.add(document.body, 'click', function(e) { 335 var target = e.target, parent = target.parentNode, tr, c, el, textarea, sel, text, startPos, endPos; 336 337 if ( dom.hasClass(target, 'caption-insert-link') ) { 338 el = dom.select('div.caption-insert-link-wrap', parent)[0], textarea = dom.select('#img_cap_text')[0]; 339 340 if ( document.selection ) { 341 textarea.focus(); 342 sel = document.selection.createRange(); 343 bookmark = sel.getBookmark(); 344 345 if ( sel.text ) 346 dom.select('.caption-insert-link-text', el)[0].value = sel.text; 347 348 } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) { 349 text = textarea.value; 350 startPos = textarea.selectionStart; 351 endPos = textarea.selectionEnd; 352 353 if ( startPos != endPos ) 354 dom.select('.caption-insert-link-text', el)[0].value = text.substring(startPos, endPos); 355 } 356 357 dom.hide(target); 358 dom.show(el); 359 dom.select('.caption-insert-link-url', el)[0].focus(); 360 } else if ( dom.hasClass(target, 'caption-cancel') || dom.hasClass(target, 'caption-save') ) { 361 if ( dom.hasClass(target, 'caption-save') ) 362 insert_link(); 363 364 dom.hide( dom.select('.caption-insert-link-wrap') ); 365 dom.show( dom.select('.caption-insert-link') ); 366 } 367 }); 368 369 insert_link = function() { 370 var sel, content, startPos, endPos, scrollTop, text, textarea = dom.select('#img_cap_text')[0], 371 url = dom.select('.caption-insert-link-url')[0], link_text = dom.select('.caption-insert-link-text')[0]; 372 373 if ( !url || !link_text ) 374 return; 375 376 content = "<a href='"+url.value+"'>"+link_text.value+"</a>"; 335 // Setup the quicktags 336 wpImage.enableQTags(); 377 337 378 if ( document.selection ) { 379 textarea.focus(); 380 sel = document.selection.createRange(); 381 382 if ( bookmark ) { 383 sel.moveToBookmark( bookmark ); 384 bookmark = ''; 385 } 386 387 sel.text = content; 388 textarea.focus(); 389 } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) { 390 text = textarea.value; 391 startPos = textarea.selectionStart; 392 endPos = textarea.selectionEnd; 393 scrollTop = textarea.scrollTop; 394 395 textarea.value = text.substring(0, startPos) + content + text.substring(endPos, text.length); 396 397 textarea.focus(); 398 textarea.selectionStart = startPos + content.length; 399 textarea.selectionEnd = startPos + content.length; 400 textarea.scrollTop = scrollTop; 401 } 402 403 url.value = ''; 404 link_text.value = ''; 405 }; 338 document.body.style.display = ''; 406 339 }, 407 340 408 341 remove : function() { … … wpImage = { 684 617 t.preloadImg.onload = t.updateImageData; 685 618 t.preloadImg.onerror = t.resetImageData; 686 619 t.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.img_src.value); 620 }, 621 622 /** 623 * Enables a Quicktags editor for the caption textarea 624 */ 625 enableQTags : function() { 626 var old = document.getElementById('img_cap_text'); 627 var neu = document.getElementById('quicktags'); 628 var editor = document.getElementById('editor'); 629 var buttons = document.getElementById('qt_editor_toolbar').childNodes; 630 631 // Add button classes to quicktags buttons 632 for (var i=0; i<buttons.length; i++) { 633 buttons[i].className += ' button'; 634 } 635 636 // Move the new quicktags where old textarea used to be 637 // QTags breaks if you leave it inside an element that calls `ed.translate()` 638 old.parentNode.appendChild(neu); 639 // Hide old textarea, don't remove, it's still being used 640 old.style.display = 'none'; 641 642 // Map old textarea value to the new quicktags 643 editor.value = old.value; 644 // Replace double-quotes so tinyMCE caption don't break 645 editor.onblur = function() { 646 old.value = this.value.replace(/"/g, "'"); 647 } 687 648 } 688 649 }; 689 650 690 651 window.onload = function(){wpImage.init();} 691 652 wpImage.preInit(); 692