Fix image resizing inside captions, add edit alt field to the advanced tab. Props azaozz. see #6812

git-svn-id: http://svn.automattic.com/wordpress/trunk@8307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-07-10 16:39:14 +00:00
parent 1527357b5e
commit 0022c2c510
7 changed files with 55 additions and 29 deletions

View File

@ -64,7 +64,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
?>
{
"betaManifestVersion" : 1,
"version" : "<?php echo $man_version; ?>_20080709",
"version" : "<?php echo $man_version; ?>_20080710",
"entries" : [
<?php echo $defaults; ?>
@ -131,7 +131,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?ver=311" },
{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=311" },
{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311c" },
{ "url" : "../wp-includes/js/tinymce/tiny_mce.js?ver=311" },
{ "url" : "../wp-includes/js/tinymce/themes/advanced/editor_template.js?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js?ver=311" },
@ -148,7 +148,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
{ "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311b" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311c" },
{ "url" : "../wp-includes/js/tinymce/wp-mce-help.php?ver=311" },
{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?ver=311" },
@ -161,7 +161,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
{ "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311b" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311c" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css?ver=311" },
{ "url" : "../wp-includes/js/tinymce/wordpress.css?ver=311" },

View File

@ -411,7 +411,6 @@ size:"' . mce_escape( __('Size') ) . '",
thumbnail:"' . mce_escape( __('Thumbnail') ) . '",
medium:"' . mce_escape( __('Medium') ) . '",
full_size:"' . mce_escape( __('Full Size') ) . '",
alt_help:"' . js_escape( __('Alternate text, e.g. "The Mona Lisa"') ) . '",
current_link:"' . mce_escape( __('Current Link') ) . '",
link_to_img:"' . mce_escape( __('Link to Image') ) . '",
link_help:"' . mce_escape( __('Enter a link URL or click above for presets.') ) . '",
@ -435,7 +434,8 @@ s110:"' . mce_escape( __('110%') ) . '",
s120:"' . mce_escape( __('120%') ) . '",
s130:"' . mce_escape( __('130%') ) . '",
img_title:"' . mce_escape( __('Edit Image Title') ) . '",
caption:"' . mce_escape( __('Edit Image Caption') ) . '"
caption:"' . mce_escape( __('Edit Image Caption') ) . '",
alt:"' . mce_escape( __('Edit Alternate Text') ) . '"
});
';
?>

View File

@ -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=311c"></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=311c" 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>
<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">

View File

@ -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) {

View File

@ -245,7 +245,7 @@ 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','');
tinyMCEPopup.restoreSelection();
el = ed.selection.getNode();
@ -255,13 +255,14 @@ 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') ) {
@ -271,8 +272,9 @@ var wpImage = {
});
}
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 +357,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 +372,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,
@ -429,7 +431,7 @@ var wpImage = {
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);
ed.dom.setHTML(DD, f.img_cap.value);
} else {
var lnk = '', pa;
@ -447,7 +449,7 @@ 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>';
'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);

View File

@ -222,7 +222,7 @@ if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
// Setup cache info
if ( $disk_cache ) {
$cacheKey = apply_filters('tiny_mce_version', '20080708');
$cacheKey = apply_filters('tiny_mce_version', '20080709');
foreach ( $initArray as $v )
$cacheKey .= $v;

View File

@ -37,7 +37,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080706' );
// Modify this version when tinyMCE plugins are changed.
$mce_version = apply_filters('tiny_mce_version', '20080708');
$mce_version = apply_filters('tiny_mce_version', '20080709');
$scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version );
$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');