Ticket #14380: 14380.diff
File 14380.diff, 5.0 KB (added by , 14 years ago) |
---|
-
wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js
113 113 114 114 _do_shcode : function(co) { 115 115 return co.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?[\s\u00a0]*/g, function(a,b,c){ 116 var id, cls, w,cap, div_cls;116 var id, cls, cap, div_cls; 117 117 118 118 b = b.replace(/\\'|\\'|\\'/g, ''').replace(/\\"|\\"/g, '"'); 119 119 c = c.replace(/\\'|\\'/g, ''').replace(/\\"/g, '"'); 120 120 id = b.match(/id=['"]([^'"]+)/i); 121 121 cls = b.match(/align=['"]([^'"]+)/i); 122 w = b.match(/width=['"]([0-9]+)/);123 122 cap = b.match(/caption=['"]([^'"]+)/i); 124 123 125 124 id = ( id && id[1] ) ? id[1] : ''; 126 125 cls = ( cls && cls[1] ) ? cls[1] : 'alignnone'; 127 w = ( w && w[1] ) ? w[1] : '';128 126 cap = ( cap && cap[1] ) ? cap[1] : ''; 129 if ( ! w || !cap ) return c;127 if ( ! cap ) return c; 130 128 131 129 div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp'; 132 130 133 return '<div class="'+div_cls+'" draggable><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+(10+parseInt(w))+ 134 'px"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>'; 131 return '<div class="'+div_cls+'" draggable><dl id="'+id+'" class="wp-caption '+cls+'"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>'; 135 132 }); 136 133 }, 137 134 138 135 _get_shcode : function(co) { 139 136 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){ 140 var id, cls , w;137 var id, cls; 141 138 142 139 id = b.match(/id=['"]([^'"]+)/i); 143 140 cls = b.match(/class=['"]([^'"]+)/i); 144 w = c.match(/width=['"]([0-9]+)/);145 141 146 142 id = ( id && id[1] ) ? id[1] : ''; 147 143 cls = ( cls && cls[1] ) ? cls[1] : 'alignnone'; 148 w = ( w && w[1] ) ? w[1] : '';149 144 150 if ( ! w || !cap ) return c;145 if ( ! cap ) return c; 151 146 cls = cls.match(/align[^ '"]+/) || 'alignnone'; 152 147 cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, ''').replace(/"/g, '"'); 153 148 154 return '[caption id="'+id+'" align="'+cls+'" width="'+w+'"caption="'+cap+'"]'+c+'[/caption]';149 return '[caption id="'+id+'" align="'+cls+'" caption="'+cap+'"]'+c+'[/caption]'; 155 150 }); 156 151 }, 157 152 -
wp-includes/media.php
729 729 extract(shortcode_atts(array( 730 730 'id' => '', 731 731 'align' => 'alignnone', 732 'width' => '',733 732 'caption' => '' 734 733 ), $attr)); 735 734 736 if ( 1 > (int) $width ||empty($caption) )735 if ( empty($caption) ) 737 736 return $content; 738 737 739 738 if ( $id ) $id = 'id="' . esc_attr($id) . '" '; 740 739 741 return '<div ' . $id . 'class="wp-caption ' . esc_attr($align) . '" style="width: ' . (10 + (int) $width) . 'px">'740 return '<div ' . $id . 'class="wp-caption ' . esc_attr($align) . '">' 742 741 . do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>'; 743 742 } 744 743 -
wp-content/themes/twentyten/style.css
811 811 } 812 812 .wp-caption { 813 813 background: #f1f1f1; 814 display: inline-block; 814 815 line-height: 18px; 815 816 margin-bottom: 20px; 816 817 max-width: 632px !important; /* prevent too-wide images from breaking layout */ -
wp-content/themes/twentyten/editor-style.css
274 274 -webkit-border-radius: 0; 275 275 border-radius: 0; 276 276 color: #888; 277 display: inline-block; 277 278 font-size: 12px; 278 279 line-height: 18px; 279 280 margin-bottom: 20px; -
wp-admin/includes/media.php
150 150 $align = 'none'; 151 151 152 152 $shcode = '[caption id="' . $id . '" align="align' . $align 153 . '" width="' . $width . '"caption="' . addslashes($caption) . '"]' . $html . '[/caption]';153 . '" caption="' . addslashes($caption) . '"]' . $html . '[/caption]'; 154 154 155 155 return apply_filters( 'image_add_caption_shortcode', $shcode, $html ); 156 156 } … … 1687 1687 html = '<a href="'+f.url.value+'">'+html+'</a>'; 1688 1688 1689 1689 if ( caption ) 1690 html = '[caption id="" align="'+t.align+'" width="'+t.width+'"caption="'+caption+'"]'+html+'[/caption]';1690 html = '[caption id="" align="'+t.align+'" caption="'+caption+'"]'+html+'[/caption]'; 1691 1691 1692 1692 var win = window.dialogArguments || opener || parent || top; 1693 1693 win.send_to_editor(html);