summaryrefslogtreecommitdiffstats
path: root/wp-includes/js/tinymce/plugins/wpeditimage
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-07-15 17:22:59 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-07-15 17:22:59 +0000
commit1d6b7c9a990f68f0f9b599d61678c71d40251704 (patch)
tree8f6f5206f365be2062ff98c3be887d47899b1a2a /wp-includes/js/tinymce/plugins/wpeditimage
parenta8a5dc5214b92fc26003983f599dd25e88660084 (diff)
downloadwordpress-mu-1d6b7c9a990f68f0f9b599d61678c71d40251704.tar.gz
wordpress-mu-1d6b7c9a990f68f0f9b599d61678c71d40251704.tar.xz
wordpress-mu-1d6b7c9a990f68f0f9b599d61678c71d40251704.zip
WP Merge with rev 8339
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1374 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/js/tinymce/plugins/wpeditimage')
-rw-r--r--wp-includes/js/tinymce/plugins/wpeditimage/editimage.html28
-rw-r--r--wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js30
-rw-r--r--wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js30
3 files changed, 59 insertions, 29 deletions
diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html b/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html
index d6adbfc..a9f1c15 100644
--- a/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html
+++ b/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html
@@ -4,11 +4,11 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
-<script type="text/javascript" src="js/editimage.js?ver=311"></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=311b" type="text/css" media="all" />
-<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6-beta1" 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','') )
document.write('<link rel="stylesheet" href="css/editimage-rtl.css?ver=311" type="text/css" media="all" />');
@@ -74,7 +74,7 @@ if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
</td>
</tr>
- <tr class="">
+ <tr>
<th valign="top" scope="row" class="label">
<label for="img_title">
<span class="alignleft">{#wpeditimage.img_title}</span>
@@ -85,19 +85,18 @@ if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
</td>
</tr>
- <tr class="post_excerpt">
+ <tr id="cap_field">
<th valign="top" scope="row" class="label">
- <label for="img_alt">
+ <label for="img_cap">
<span class="alignleft">{#wpeditimage.caption}</span>
</label>
</th>
<td class="field">
- <input type="text" id="img_alt" name="img_alt" value="" size="60" />
- <p class="help">{#wpeditimage.alt_help}</p>
+ <input type="text" id="img_cap" name="img_cap" value="" size="60" />
</td>
</tr>
- <tr class="url">
+ <tr>
<th valign="top" scope="row" class="label">
<label for="link_href">
<span class="alignleft" id="lb_link_href">{#advanced_dlg.link_url}</span>
@@ -129,6 +128,17 @@ if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
<input type="text" id="img_src" name="img_src" value="" onblur="wpImage.checkVal(this)" aria-required="true" size="60" />
</td>
</tr>
+
+ <tr>
+ <th valign="top" scope="row" class="label">
+ <label for="img_alt">
+ <span class="alignleft">{#wpeditimage.alt}</span>
+ </label>
+ </th>
+ <td class="field">
+ <input type="text" id="img_alt" name="img_alt" value="" size="60" />
+ </td>
+ </tr>
<tr id="img_dim">
<th valign="top" scope="row" class="label">
diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js
index de3a972..7dfeca2 100644
--- a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js
@@ -15,7 +15,7 @@
if ( ed.dom.getAttrib(el, 'class').indexOf('mceItem') != -1 || el.nodeName != 'IMG' )
return;
- tb_show('', url + '/editimage.html?ver=311b&TB_iframe=true');
+ tb_show('', url + '/editimage.html?ver=311c&TB_iframe=true');
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
});
@@ -34,9 +34,23 @@
});
ed.onMouseUp.add(function(ed, e) {
- if ( ! tinymce.isOpera ) return;
- if ( e.target.nodeName == 'IMG' )
- ed.plugins.wpeditimage.showButtons(e.target);
+ if ( tinymce.isOpera ) {
+ if ( e.target.nodeName == 'IMG' )
+ ed.plugins.wpeditimage.showButtons(e.target);
+ } else if ( ! tinymce.isWebKit ) {
+ var n = ed.selection.getNode(), DL;
+
+ if ( n.nodeName == 'IMG' && (DL = ed.dom.getParent(n, 'DL')) ) {
+ window.setTimeout(function(){
+ var ed = tinyMCE.activeEditor, n = ed.selection.getNode(), DL = ed.dom.getParent(n, 'DL');
+
+ if ( n.width != (parseInt(ed.dom.getStyle(DL, 'width')) - 10) ) {
+ ed.dom.setStyle(DL, 'width', parseInt(n.width)+10);
+ ed.execCommand('mceRepaint');
+ }
+ }, 100);
+ }
+ }
});
ed.onMouseDown.add(function(ed, e) {
@@ -73,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(/\\'|\\&#39;|\\&#039;/g, '&#39;').replace(/\\"|\\&quot;/g, '&quot;');
c = c.replace(/\\&#39;|\\&#039;/g, '&#39;').replace(/\\&quot;/g, '&quot;');
var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/align=['"]([^'"]+)/i);
@@ -87,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>';
});
},
@@ -105,7 +119,7 @@
cls = cls.match(/align[^ '"]+/) || 'alignnone';
cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, '&#39;').replace(/"/g, '&quot;');
- 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]';
});
},
diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js b/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js
index fb1d2d8..1986a13 100644
--- a/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js
+++ b/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js
@@ -245,8 +245,12 @@ 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;
+ 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;
@@ -255,24 +259,26 @@ var wpImage = {
ed.dom.setStyle(el, 'float', '');
t.getImageData();
c = ed.dom.getAttrib(el, 'class');
- caption = t.img_alt = ed.dom.getAttrib(el, 'alt');
if ( DL = dom.getParent(el, 'dl') ) {
var dlc = ed.dom.getAttrib(DL, 'class');
dlc = dlc.match(/align[^ "']+/i);
- if ( dlc && ! dom.hasClass(el, dlc) )
+ if ( dlc && ! dom.hasClass(el, dlc) ) {
c += ' '+dlc;
+ tinymce.trim(c);
+ }
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;
}
});
}
+ f.img_cap.value = caption;
f.img_title.value = ed.dom.getAttrib(el, 'title');
- f.img_alt.value = caption;
+ f.img_alt.value = ed.dom.getAttrib(el, 'alt');
f.border.value = ed.dom.getAttrib(el, 'border');
f.vspace.value = ed.dom.getAttrib(el, 'vspace');
f.hspace.value = ed.dom.getAttrib(el, 'hspace');
@@ -355,7 +361,7 @@ var wpImage = {
return;
}
- if ( f.img_alt.value != '' && f.width.value != '' ) {
+ if ( f.img_cap.value != '' && f.width.value != '' ) {
do_caption = 1;
img_class = img_class.replace( /align[^ "']+\s?/gi, '' );
}
@@ -370,7 +376,7 @@ var wpImage = {
ed.dom.setAttribs(el, {
src : f.img_src.value,
title : f.img_title.value,
- alt : t.img_alt,
+ alt : f.img_alt.value,
width : f.width.value,
height : f.height.value,
style : f.img_style.value,
@@ -421,15 +427,15 @@ 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') )
- ed.dom.setHTML(DD, f.img_alt.value);
+ 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 {
var lnk = '', pa;
@@ -446,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_alt.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);