mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Rename wp_caption shortcode to caption. Allow themes to disable captioning. Use dashes instead of underscores in class names. Props azaozz. see #6812
git-svn-id: https://develop.svn.wordpress.org/trunk@8313 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title></title>
|
||||
|
||||
<script type="text/javascript" src="js/editimage.js?ver=311c"></script>
|
||||
<script type="text/javascript" src="js/editimage.js?ver=311d"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script>
|
||||
|
||||
<link rel="stylesheet" href="css/editimage.css?ver=311c" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="css/editimage.css?ver=311d" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6-beta3" type="text/css" media="all" />
|
||||
<script type="text/javascript">
|
||||
if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
|
||||
@@ -85,7 +85,7 @@ if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<tr id="cap_field">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_cap">
|
||||
<span class="alignleft">{#wpeditimage.caption}</span>
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
},
|
||||
|
||||
_do_shcode : function(co) {
|
||||
return co.replace(/\[wp_caption([^\]]+)\]([\s\S]+?)\[\/wp_caption\][\s\u00a0]*/g, function(a,b,c){
|
||||
return co.replace(/\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g, function(a,b,c){
|
||||
b = b.replace(/\\'|\\'|\\'/g, ''').replace(/\\"|\\"/g, '"');
|
||||
c = c.replace(/\\'|\\'/g, ''').replace(/\\"/g, '"');
|
||||
var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/align=['"]([^'"]+)/i);
|
||||
@@ -101,8 +101,8 @@
|
||||
|
||||
var div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
|
||||
|
||||
return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp_caption '+cls+'" style="width: '+(10+parseInt(w))+
|
||||
'px"><dt class="wp_caption_dt">'+c+'</dt><dd class="wp_caption_dd">'+cap+'</dd></dl></div>';
|
||||
return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+(10+parseInt(w))+
|
||||
'px"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>';
|
||||
});
|
||||
},
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
cls = cls.match(/align[^ '"]+/) || 'alignnone';
|
||||
cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, ''').replace(/"/g, '"');
|
||||
|
||||
return '[wp_caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/wp_caption]';
|
||||
return '[caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/caption]';
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -247,6 +247,10 @@ var wpImage = {
|
||||
setup : function() {
|
||||
var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption = null;
|
||||
document.dir = tinyMCEPopup.editor.getParam('directionality','');
|
||||
|
||||
if ( ! tinyMCEPopup.editor.getParam('wpeditimage_do_captions', true) )
|
||||
t.I('cap_field').style.display = 'none';
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getNode();
|
||||
if (el.nodeName != 'IMG') return;
|
||||
@@ -265,7 +269,7 @@ var wpImage = {
|
||||
}
|
||||
|
||||
tinymce.each(DL.childNodes, function(e) {
|
||||
if ( e.nodeName == 'DD' && dom.hasClass(e, 'wp_caption_dd') ) {
|
||||
if ( e.nodeName == 'DD' && dom.hasClass(e, 'wp-caption-dd') ) {
|
||||
caption = e.innerHTML;
|
||||
return;
|
||||
}
|
||||
@@ -423,14 +427,14 @@ var wpImage = {
|
||||
|
||||
if ( DL ) {
|
||||
ed.dom.setAttribs(DL, {
|
||||
'class' : 'wp_caption '+t.align,
|
||||
'class' : 'wp-caption '+t.align,
|
||||
style : 'width: '+cap_width+'px;'
|
||||
});
|
||||
|
||||
if ( DIV )
|
||||
ed.dom.setAttrib(DIV, 'class', div_cls);
|
||||
|
||||
if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp_caption_dd') )
|
||||
if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp-caption-dd') )
|
||||
ed.dom.setHTML(DD, f.img_cap.value);
|
||||
|
||||
} else {
|
||||
@@ -448,8 +452,8 @@ var wpImage = {
|
||||
}
|
||||
} else html = ed.dom.getOuterHTML(el);
|
||||
|
||||
html = '<dl id="'+cap_id+'" class="wp_caption '+t.align+'" style="width: '+cap_width+
|
||||
'px"><dt class="wp_caption_dt">'+html+'</dt><dd class="wp_caption_dd">'+f.img_cap.value+'</dd></dl>';
|
||||
html = '<dl id="'+cap_id+'" class="wp-caption '+t.align+'" style="width: '+cap_width+
|
||||
'px"><dt class="wp-caption-dt">'+html+'</dt><dd class="wp-caption-dd">'+f.img_cap.value+'</dd></dl>';
|
||||
|
||||
cap = ed.dom.create('div', {'class': div_cls}, html);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user