Changeset 8260
- Timestamp:
- 07/06/2008 04:38:37 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/editor.js
r8239 r8260 54 54 content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n'); 55 55 content = content.replace(new RegExp('\\s*\\[wp_caption([^\\[]+)\\[/wp_caption\\]\\s*', 'gi'), '\n\n[wp_caption$1[/wp_caption]\n\n'); 56 content = content.replace(new RegExp('wp_caption\\]\\n\\n+\\[wp_caption', 'g'), 'wp_caption]\n\n[wp_caption'); 56 57 57 58 var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre'; -
trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
r8248 r8260 128 128 129 129 // Add Media buttons to fullscreen 130 131 130 ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) { 131 if ( 'mceFullScreen' != cmd ) return; 132 132 if ( 'mce_fullscreen' != ed.id ) 133 133 ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media'; 134 134 }); 135 135 136 136 // Add class "alignleft", "alignright" and "aligncenter" when selecting align for images. 137 ed.onExecCommand.add(function( ed, cmd ) { 138 var n, bl, dom = ed.dom; 139 140 if ( 'JustifyCenter' == cmd ) { 141 tinymce.each(dom.select('img'), function(n) { 142 var v = n.className; 143 144 if (v.indexOf('aligncenter') == -1) { 145 dom.getParent(n, function(P) { 146 if (P && P.style && P.style.textAlign == 'center') 147 dom.setStyle(P, 'textAlign', ''); 148 }); 149 } 150 }); 151 152 ed.execCommand('mceRepaint'); 153 } 154 }); 155 156 ed.onBeforeExecCommand.add(function( ed, cmd ) { 157 var n, dir, xdir, bl, dom = ed.dom; 158 159 if ( ( cmd.indexOf('Justify') != -1 ) && ( n = ed.selection.getNode() ) ) { 160 if ( 'JustifyFull' == cmd || n.nodeName !== 'IMG' ) return; 161 dir = cmd.substring(7).toLowerCase(); 162 163 if ( ed.queryCommandState( cmd ) ) { 164 n.className = n.className.replace(/align[^ '"]+\s?/g, ''); 165 dom.addClass( n, "alignnone" ); 166 } else if ( 'JustifyCenter' == cmd ) { 167 n.className = n.className.replace(/alignleft\s?|alignright\s?|alignnone\s?/g, ''); 168 if ( dom.hasClass( n, "aligncenter" ) ) { 169 dom.removeClass( n, "aligncenter" ); 170 dom.addClass( n, "alignnone" ); 171 } else 172 dom.addClass( n, "aligncenter" ); 173 174 } else { 175 n.className = n.className.replace(/align[^ '"]+\s?/g, ''); 176 dom.addClass( n, "align"+dir ); 177 } 178 } 179 }); 180 181 // Word count if script is loaded 182 if ( 'undefined' != typeof wpWordCount ) { 183 var last = 0; 184 ed.onKeyUp.add(function(ed, e) { 185 if ( e.keyCode == last ) return; 186 if ( 13 == e.keyCode || 8 == last || 46 == last ) wpWordCount.wc( ed.getContent({format : 'raw'}) ); 187 last = e.keyCode; 188 }); 189 }; 190 191 // Add listeners to handle more break 137 ed.addCommand('JustifyLeft', function() { 138 var n = ed.selection.getNode(); 139 140 if ( n.nodeName != 'IMG' ) 141 ed.editorCommands.mceJustify('JustifyLeft', 'left'); 142 else ed.plugins.wordpress.do_align(n, 'alignleft'); 143 }); 144 145 ed.addCommand('JustifyRight', function() { 146 var n = ed.selection.getNode(); 147 148 if ( n.nodeName != 'IMG' ) 149 ed.editorCommands.mceJustify('JustifyRight', 'right'); 150 else ed.plugins.wordpress.do_align(n, 'alignright'); 151 }); 152 153 ed.addCommand('JustifyCenter', function() { 154 var n = ed.selection.getNode(), P = ed.dom.getParent(n, 'p'), DL = ed.dom.getParent(n, 'dl'); 155 156 if ( n.nodeName == 'IMG' && ( P || DL ) ) 157 ed.plugins.wordpress.do_align(n, 'aligncenter'); 158 else ed.editorCommands.mceJustify('JustifyCenter', 'center'); 159 }); 160 161 // Word count if script is loaded 162 if ( 'undefined' != typeof wpWordCount ) { 163 var last = 0; 164 ed.onKeyUp.add(function(ed, e) { 165 if ( e.keyCode == last ) return; 166 if ( 13 == e.keyCode || 8 == last || 46 == last ) wpWordCount.wc( ed.getContent({format : 'raw'}) ); 167 last = e.keyCode; 168 }); 169 }; 170 171 // Add listeners to handle more break 192 172 t._handleMoreBreak(ed, url); 193 173 … … 228 208 229 209 // Internal functions 210 do_align : function(n, a) { 211 var P, DL, DIV, cls, c, ed = tinyMCE.activeEditor; 212 213 P = ed.dom.getParent(n, 'p'); 214 DL = ed.dom.getParent(n, 'dl'); 215 DIV = ed.dom.getParent(n, 'div'); 216 217 if ( DL && DIV ) { 218 cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a; 219 DL.className = DL.className.replace(/align[^ '"]+\s?/g, ''); 220 ed.dom.addClass(DL, cls); 221 c = (cls == 'aligncenter') ? ed.dom.addClass(DIV, 'mceIEcenter') : ed.dom.removeClass(DIV, 'mceIEcenter'); 222 } else if ( P ) { 223 cls = ed.dom.hasClass(n, a) ? 'alignnone' : a; 224 n.className = n.className.replace(/align[^ '"]+\s?/g, ''); 225 ed.dom.addClass(n, cls); 226 if ( cls == 'aligncenter' ) 227 ed.dom.setStyle(P, 'textAlign', 'center'); 228 else if (P.style && P.style.textAlign == 'center') 229 ed.dom.setStyle(P, 'textAlign', ''); 230 } 231 232 ed.execCommand('mceRepaint'); 233 }, 230 234 231 235 // Resizes the iframe by a relative height value -
trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js
r8239 r8260 22 22 ed.onInit.add(function(ed) { 23 23 tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) { 24 24 ed.plugins.wpeditimage.hideButtons(); 25 25 }); 26 26 }); … … 28 28 ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) { 29 29 ed.plugins.wpeditimage.hideButtons(); 30 30 }); 31 31 32 32 ed.onSaveContent.add(function(ed, o) { 33 33 ed.plugins.wpeditimage.hideButtons(); 34 34 }); 35 35 … … 64 64 65 65 ed.onBeforeSetContent.add(function(ed, o) { 66 67 66 o.content = t._do_shcode(o.content); 67 }); 68 68 69 69 ed.onPostProcess.add(function(ed, o) { … … 75 75 _do_shcode : function(co) { 76 76 return co.replace(/\[wp_caption([^\]]+)\]([\s\S]+?)\[\/wp_caption\][\s\u00a0]*/g, function(a,b,c){ 77 var id = b.match(/id=['"]([^'"]+)/ ), cls = b.match(/align=['"]([^'"]+)/);78 var w = b.match(/width=['"]([0-9]+)/), cap = b.match(/caption=['"]([^'"]+)/ );77 var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/align=['"]([^'"]+)/i); 78 var w = b.match(/width=['"]([0-9]+)/), cap = b.match(/caption=['"]([^'"]+)/i); 79 79 80 80 id = ( id && id[1] ) ? id[1] : ''; … … 92 92 93 93 _get_shcode : function(co) { 94 return co.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>([^<]+)<\/dd>\s*<\/dl>\s*<\/div>\s*/g , function(a,b,c,cap){95 var id = b.match(/id=['"]([^'"]+)/ ), cls = b.match(/class=['"]([^'"]+)/);94 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){ 95 var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/class=['"]([^'"]+)/i); 96 96 var w = c.match(/width=['"]([0-9]+)/); 97 97 … … 101 101 102 102 if ( ! w || ! cap ) return c; 103 cls = cls ? cls.match(/align[^ '"]+/) : '';103 cls = cls.match(/align[^ '"]+/) || 'alignnone'; 104 104 105 105 return '[wp_caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/wp_caption]'; 106 });107 },108 109 _fixCenter : function(c) {110 var ed = tinyMCE.activeEditor;111 112 tinymce.each(ed.dom.select('img', c), function(n) {113 if ( ed.dom.hasClass(n, 'aligncenter') ) {114 var P = ed.dom.getParent(n, 'p');115 if ( tinymce.isIE )116 ed.dom.addClass(P, 'mce_iecenter');117 if ( P.style && P.style.textAlign == 'center' )118 ed.dom.setStyle(P, 'textAlign', '');119 }120 106 }); 121 107 }, … … 173 159 ed.execCommand("WP_EditImage"); 174 160 this.parentNode.style.display = 'none'; 175 } 161 }; 176 162 177 163 var wp_delimgbtn = DOM.add('wp_editbtns', 'img', { … … 197 183 return false; 198 184 } 199 } 185 }; 200 186 }, 201 187 -
trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js
r8245 r8260 261 261 var dlc = ed.dom.getAttrib(DL, 'class'); 262 262 dlc = dlc.match(/align[^ "']+/i); 263 if ( ! dom.hasClass(el, dlc) )263 if ( dlc && ! dom.hasClass(el, dlc) ) 264 264 c += ' '+dlc; 265 265 266 266 tinymce.each(DL.childNodes, function(e) { 267 if ( e.nodeName == 'DD' ) {267 if ( e.nodeName == 'DD' && dom.hasClass(e, 'wp_caption_dd') ) { 268 268 caption = e.innerHTML; 269 269 return; … … 378 378 }); 379 379 380 if ( ! f.link_href.value ) { 381 if ( A ) { 382 b = ed.selection.getBookmark(); 383 ed.dom.remove(A, 1); 384 ed.selection.moveToBookmark(b); 385 } 386 } else { 380 if ( f.link_href.value ) { 387 381 // Create new anchor elements 388 382 if ( A == null ) { 389 if ( ! f.link_href.value.match(/https?:\/\// ) )383 if ( ! f.link_href.value.match(/https?:\/\//i) ) 390 384 f.link_href.value = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.link_href.value); 391 385 … … 432 426 }); 433 427 434 if ( DIV ) 428 if ( DIV ) 435 429 ed.dom.setAttrib(DIV, 'class', div_cls); 436 430 … … 439 433 440 434 } else { 435 var lnk = '', pa; 441 436 if ( (id = f.img_classes.value.match( /wp-image-([0-9]{1,6})/ )) && id[1] ) 442 437 cap_id = 'attachment_'+id[1]; 443 438 444 if ( f.link_href.value ) html = ed.dom.getOuterHTML(ed.dom.getParent(el, 'a')); 445 else html = ed.dom.getOuterHTML(el); 439 if ( f.link_href.value && (lnk = ed.dom.getParent(el, 'a')) ) { 440 if ( lnk.childNodes.length == 1 ) 441 html = ed.dom.getOuterHTML(lnk); 442 else { 443 html = ed.dom.getOuterHTML(lnk); 444 html = html.match(/<a[^>]+>/i); 445 html = html+ed.dom.getOuterHTML(el)+'</a>'; 446 } 447 } else html = ed.dom.getOuterHTML(el); 446 448 447 449 html = '<dl id="'+cap_id+'" class="wp_caption '+t.align+'" style="width: '+cap_width+ … … 452 454 if ( P ) { 453 455 P.parentNode.insertBefore(cap, P); 454 ed.dom.remove(P); 456 if ( P.childNodes.length == 1 ) 457 ed.dom.remove(P); 458 else if ( lnk && lnk.childNodes.length == 1 ) 459 ed.dom.remove(lnk); 460 else ed.dom.remove(el); 461 } else if ( pa = ed.dom.getParent(el, 'TD,TH,LI') ) { 462 pa.appendChild(cap); 463 if ( lnk && lnk.childNodes.length == 1 ) 464 ed.dom.remove(lnk); 465 else ed.dom.remove(el); 455 466 } 456 467 } 457 468 458 tinyMCEPopup.execCommand("mceEndUndoLevel");459 ed.execCommand('mceRepaint');460 tinyMCEPopup.close();461 return;462 469 } else { 463 470 if ( DL && DIV ) { 464 if ( f.link_href.value ) html = ed.dom.getOuterHTML(ed.dom.getParent(el, 'a')); 471 var aa; 472 if ( f.link_href.value && (aa = ed.dom.getParent(el, 'a')) ) html = ed.dom.getOuterHTML(aa); 465 473 else html = ed.dom.getOuterHTML(el); 466 474 467 475 P = ed.dom.create('p', {}, html); 468 476 DIV.parentNode.insertBefore(P, DIV); … … 477 485 if ( P && P.style && P.style.textAlign == 'center' ) 478 486 ed.dom.setStyle(P, 'textAlign', ''); 487 } 488 489 if ( ! f.link_href.value && A ) { 490 b = ed.selection.getBookmark(); 491 ed.dom.remove(A, 1); 492 ed.selection.moveToBookmark(b); 479 493 } 480 494 -
trunk/wp-includes/js/tinymce/tiny_mce_config.php
r8248 r8260 223 223 if ( $disk_cache ) { 224 224 225 $cacheKey = apply_filters('tiny_mce_version', '2008070 3');225 $cacheKey = apply_filters('tiny_mce_version', '20080706'); 226 226 227 227 foreach ( $initArray as $v ) -
trunk/wp-includes/script-loader.php
r8256 r8260 35 35 $scripts->add( 'editor', false, $visual_editor, '20080321' ); 36 36 37 $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '2008070 2' );37 $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080706' ); 38 38 39 39 // Modify this version when tinyMCE plugins are changed. 40 $mce_version = apply_filters('tiny_mce_version', '2008070 3');40 $mce_version = apply_filters('tiny_mce_version', '20080706'); 41 41 $scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version ); 42 42
Note: See TracChangeset
for help on using the changeset viewer.