Edit image updates from azaozz. see #6811
git-svn-id: http://svn.automattic.com/wordpress/trunk@8167 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dc6166785a
commit
16dbf2fb1e
|
@ -63,7 +63,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
|
|||
?>
|
||||
{
|
||||
"betaManifestVersion" : 1,
|
||||
"version" : "<?php echo $man_version; ?>_20080618",
|
||||
"version" : "<?php echo $man_version; ?>_20080622",
|
||||
"entries" : [
|
||||
<?php echo $defaults; ?>
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// escape text only if it needs translating
|
||||
function mce_escape($text) {
|
||||
global $language;
|
||||
|
||||
|
||||
if ( 'en' == $language ) return $text;
|
||||
else return js_escape($text);
|
||||
}
|
||||
|
@ -421,7 +421,15 @@ link_rel:"' . mce_escape( __('Link Rel') ) . '",
|
|||
height:"' . mce_escape( __('Height') ) . '",
|
||||
orig_size:"' . mce_escape( __('Original Size') ) . '",
|
||||
css:"' . mce_escape( __('CSS Class') ) . '",
|
||||
s60:"' . mce_escape( __('60%') ) . '",
|
||||
s70:"' . mce_escape( __('70%') ) . '",
|
||||
s80:"' . mce_escape( __('80%') ) . '",
|
||||
s90:"' . mce_escape( __('90%') ) . '",
|
||||
s100:"' . mce_escape( __('100%') ) . '",
|
||||
s110:"' . mce_escape( __('110%') ) . '",
|
||||
s120:"' . mce_escape( __('120%') ) . '",
|
||||
s130:"' . mce_escape( __('130%') ) . '",
|
||||
caption:"' . mce_escape( __('Caption') ) . '"
|
||||
});
|
||||
';
|
||||
';
|
||||
?>
|
|
@ -24,16 +24,16 @@
|
|||
t._resizeIframe(ed, tbId, 28);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('WP_More', function() {
|
||||
ed.execCommand('mceInsertContent', 0, moreHTML);
|
||||
});
|
||||
|
||||
|
||||
ed.addCommand('WP_Page', function() {
|
||||
ed.execCommand('mceInsertContent', 0, nextpageHTML);
|
||||
});
|
||||
|
||||
|
||||
ed.addCommand('WP_Help', function() {
|
||||
ed.windowManager.open({
|
||||
url : tinymce.baseURL + '/wp-mce-help.php',
|
||||
|
@ -80,7 +80,7 @@
|
|||
ed.addButton('wp_help', {
|
||||
title : 'wordpress.wp_help_desc',
|
||||
image : url + '/img/help.gif',
|
||||
cmd : 'WP_Help'
|
||||
cmd : 'WP_Help'
|
||||
});
|
||||
|
||||
ed.addButton('wp_adv', {
|
||||
|
@ -90,44 +90,46 @@
|
|||
});
|
||||
|
||||
// Add class "alignleft", "alignright" and "aligncenter" when selecting align for images.
|
||||
ed.onExecCommand.add(function( editor, cmd ) {
|
||||
var node, bl, dom = editor.dom;
|
||||
ed.onExecCommand.add(function( ed, cmd ) {
|
||||
var n, bl, dom = ed.dom;
|
||||
|
||||
if ( 'JustifyCenter' == cmd ) {
|
||||
if ( ( node = editor.selection.getNode() ) && node.nodeName == 'IMG' ) {
|
||||
if ( ! dom.hasClass( node, "aligncenter" ) && ( bl = editor.forceBlocks.getParentBlock(node) ) && bl.childNodes.length == 1 )
|
||||
dom.setStyle(bl, 'text-align', '');
|
||||
}
|
||||
editor.execCommand('mceRepaint');
|
||||
tinymce.each(dom.select('img'), function(n) {
|
||||
var v = n.className;
|
||||
|
||||
if (v.indexOf('aligncenter') == -1) {
|
||||
dom.getParent(n, function(P) {
|
||||
if (P && P.style && P.style.textAlign == 'center')
|
||||
dom.setStyle(P, 'textAlign', '');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
});
|
||||
|
||||
ed.onBeforeExecCommand.add(function( editor, cmd ) {
|
||||
var node, dir, xdir, bl, dom = editor.dom;
|
||||
ed.onBeforeExecCommand.add(function( ed, cmd ) {
|
||||
var n, dir, xdir, bl, dom = ed.dom;
|
||||
|
||||
if ( ( cmd.indexOf('Justify') != -1 ) && ( node = editor.selection.getNode() ) ) {
|
||||
if ( 'JustifyFull' == cmd || node.nodeName !== 'IMG' ) return;
|
||||
if ( ( cmd.indexOf('Justify') != -1 ) && ( n = ed.selection.getNode() ) ) {
|
||||
if ( 'JustifyFull' == cmd || n.nodeName !== 'IMG' ) return;
|
||||
dir = cmd.substring(7).toLowerCase();
|
||||
|
||||
if ( editor.queryCommandState( cmd ) ) {
|
||||
dom.removeClass( node, "alignleft" );
|
||||
dom.removeClass( node, "alignright" );
|
||||
dom.removeClass( node, "aligncenter" );
|
||||
if ( ed.queryCommandState( cmd ) ) {
|
||||
n.className = n.className.replace(/align[^ '"]+\s?/g, '');
|
||||
dom.addClass( n, "alignnone" );
|
||||
} else if ( 'JustifyCenter' == cmd ) {
|
||||
dom.removeClass( node, "alignleft" );
|
||||
dom.removeClass( node, "alignright" );
|
||||
|
||||
if ( dom.hasClass( node, "aligncenter" ) ) {
|
||||
dom.removeClass( node, "aligncenter" );
|
||||
if ( ( bl = editor.forceBlocks.getParentBlock(node) ) && bl.childNodes.length == 1 && tinymce.isGecko )
|
||||
editor.selection.select(bl.firstChild);
|
||||
} else dom.addClass( node, "aligncenter" );
|
||||
n.className = n.className.replace(/alignleft\s?|alignright\s?|alignnone\s?/g, '');
|
||||
if ( dom.hasClass( n, "aligncenter" ) ) {
|
||||
dom.removeClass( n, "aligncenter" );
|
||||
dom.addClass( n, "alignnone" );
|
||||
} else
|
||||
dom.addClass( n, "aligncenter" );
|
||||
|
||||
} else {
|
||||
xdir = ( dir == 'left' ) ? 'right' : 'left';
|
||||
dom.removeClass( node, "aligncenter" );
|
||||
dom.removeClass( node, "align"+xdir );
|
||||
dom.addClass( node, "align"+dir );
|
||||
n.className = n.className.replace(/align[^ '"]+\s?/g, '');
|
||||
dom.addClass( n, "align"+dir );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -4,10 +4,10 @@ body#media-upload ul#sidemenu {
|
|||
right: 0;
|
||||
}
|
||||
|
||||
.align .field label {
|
||||
#basic .align .field label {
|
||||
display: block;
|
||||
float: right;
|
||||
padding: 0 25px 0 0;
|
||||
padding: 0 24px 0 0;
|
||||
margin: 5px 3px 5px 5px;
|
||||
}
|
||||
|
||||
|
@ -36,12 +36,9 @@ tr.image-size input {
|
|||
text-align: right;
|
||||
}
|
||||
|
||||
.alignleft {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.show-align,
|
||||
.alignright {
|
||||
.alignright,
|
||||
#img_size {
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
@ -50,7 +47,9 @@ tr.image-size input,
|
|||
#img_dim label,
|
||||
#img_dim input,
|
||||
#img_prop label,
|
||||
#img_prop input {
|
||||
#img_prop input,
|
||||
#img_size_div,
|
||||
.alignleft {
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
@ -63,3 +62,7 @@ tr.image-size input,
|
|||
#img_prop input {
|
||||
margin: 0 5px 0 10px;
|
||||
}
|
||||
|
||||
#img_size_title {
|
||||
text-align: left;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ html, body {
|
|||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
textarea,
|
||||
|
@ -59,7 +59,7 @@ label {
|
|||
}
|
||||
|
||||
th.label {
|
||||
width: 128px;
|
||||
width: 107px;
|
||||
}
|
||||
|
||||
.show-align {
|
||||
|
@ -104,11 +104,9 @@ th.label {
|
|||
#sidemenu,
|
||||
#sidemenu li {
|
||||
list-style: none;
|
||||
|
||||
}
|
||||
|
||||
#sidemenu li {
|
||||
|
||||
display: inline;
|
||||
}
|
||||
|
||||
|
@ -128,8 +126,14 @@ th.label {
|
|||
}
|
||||
|
||||
#sidemenu a.current {
|
||||
-moz-border-radius-topleft:4px;
|
||||
-moz-border-radius-topright:4px;
|
||||
-moz-border-radius-topleft: 4px;
|
||||
-khtml-border-top-left-radius: 4px;
|
||||
-webkit-border-top-left-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
-moz-border-radius-topright: 4px;
|
||||
-khtml-border-top-right-radius: 4px;
|
||||
-webkit-border-top-right-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
border-style:solid;
|
||||
border-width:1px;
|
||||
font-weight:normal;
|
||||
|
@ -175,3 +179,57 @@ th.label {
|
|||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#basic .align .field label {
|
||||
padding: 0 0 0 24px;
|
||||
}
|
||||
|
||||
#basic {
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
#img_size {
|
||||
float: right;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background-color: #f1f1f1;
|
||||
padding: 5px 0;
|
||||
width: 45px;
|
||||
}
|
||||
|
||||
#img_size div {
|
||||
font-size: 10px;
|
||||
padding: 2px;
|
||||
border: 1px solid #f1f1f1;
|
||||
line-height: 15px;
|
||||
height: 15px;
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
color: #07273E;
|
||||
}
|
||||
|
||||
#img_size div#s100 {
|
||||
border-color: #A3A3A3;
|
||||
background-color: #E5E5E5;
|
||||
}
|
||||
|
||||
#img_size_div {
|
||||
width: 100px;
|
||||
float: left;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#img_size_title {
|
||||
margin: 0 7px 5px;
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#img_align_td {
|
||||
padding: 2px 0 8px;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<script type="text/javascript" src="../../utils/form_utils.js?ver=3101"></script>
|
||||
|
||||
<link rel="stylesheet" href="css/editimage.css?ver=3101" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6-bleeding2" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6-beta1" 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=3101" type="text/css" media="all" />');
|
||||
|
@ -26,10 +26,19 @@ if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
|
|||
|
||||
<div id="img-edit">
|
||||
<form class="media-upload-form" action="" onsubmit="wpImage.update();">
|
||||
|
||||
<label for="show_align">
|
||||
<span id="show_align_sp" class="alignleft">{#preview.preview_desc}</span>
|
||||
</label>
|
||||
<div id="img_size_div">
|
||||
<div id="img_size_title">{#wpeditimage.size}</div>
|
||||
<div id="img_size" onmouseout="wpImage.showSizeRem()">
|
||||
<div id="s130" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s130}</div>
|
||||
<div id="s120" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s120}</div>
|
||||
<div id="s110" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s110}</div>
|
||||
<div id="s100" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s100}</div>
|
||||
<div id="s90" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s90}</div>
|
||||
<div id="s80" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s80}</div>
|
||||
<div id="s70" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s70}</div>
|
||||
<div id="s60" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s60}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="show-align" id="show_align">
|
||||
<img id="img_demo" src="img/image.png" alt="" />
|
||||
<span id="img_demo_txt">
|
||||
|
@ -65,24 +74,6 @@ if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="image-size">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_size">
|
||||
<span class="alignleft">{#wpeditimage.size}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field" id="img_size">
|
||||
<input onclick="wpImage.imgEditSize('thumbnail')" type="radio" name="img_size" id="thumbnail" value="thumbnail" />
|
||||
<label for="thumbnail" id="lb_sizethumb">{#wpeditimage.thumbnail}</label>
|
||||
|
||||
<input onclick="wpImage.imgEditSize('medium')" type="radio" name="img_size" id="medium" value="medium" />
|
||||
<label for="medium" id="lb_sizemedium">{#wpeditimage.medium}</label>
|
||||
|
||||
<input onclick="wpImage.imgEditSize('full')" type="radio" name="img_size" id="full" value="full" />
|
||||
<label for="full" id="lb_sizefull">{#wpeditimage.full_size}</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_title">
|
||||
|
@ -114,7 +105,7 @@ if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
|
|||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_href" name="link_href" value="" /><br />
|
||||
<input type="text" id="link_href" name="link_href" value="" size="60" /><br />
|
||||
<input type="button" class="button" onclick="wpImage.I('link_href').value='';" value="{#wpeditimage.none}" />
|
||||
<input type="button" class="button" id="img_url_current" onclick="wpImage.img_seturl('current')" value="{#wpeditimage.current_link}" />
|
||||
<input type="button" class="button" id="img_url_img" onclick="wpImage.img_seturl('link')" value="{#wpeditimage.link_to_img}" />
|
||||
|
|
|
@ -25,9 +25,8 @@
|
|||
});
|
||||
});
|
||||
|
||||
ed.onExecCommand.add(function(ed, cmd, ui, val) {
|
||||
if ( 'mceFullScreen' == cmd )
|
||||
ed.plugins.wpeditimage.hideButtons();
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
|
||||
ed.plugins.wpeditimage.hideButtons();
|
||||
});
|
||||
|
||||
ed.onSaveContent.add(function(ed, o) {
|
||||
|
@ -43,6 +42,33 @@
|
|||
if ( tinymce.isOpera ) return;
|
||||
ed.plugins.wpeditimage.showButtons(e);
|
||||
});
|
||||
/*
|
||||
ed.onSetContent.add(function() {
|
||||
t._fixCenter(ed.getBody());
|
||||
});
|
||||
|
||||
ed.onPreProcess.add(function(ed, o) {
|
||||
if (o.set)
|
||||
t._fixCenter(o.node);
|
||||
|
||||
if (o.get)
|
||||
ed.dom.removeClass(ed.dom.select('p', o.node), 'mce_iecenter');
|
||||
});
|
||||
*/
|
||||
},
|
||||
|
||||
_fixCenter : function(c) {
|
||||
var ed = tinyMCE.activeEditor;
|
||||
|
||||
tinymce.each(ed.dom.select('img', c), function(n) {
|
||||
if ( ed.dom.hasClass(n, 'aligncenter') ) {
|
||||
var P = ed.dom.getParent(n, 'p');
|
||||
if ( tinymce.isIE )
|
||||
ed.dom.addClass(P, 'mce_iecenter');
|
||||
if ( P.style && P.style.textAlign == 'center' )
|
||||
ed.dom.setStyle(P, 'textAlign', '');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
showButtons : function(e) {
|
||||
|
@ -69,7 +95,7 @@
|
|||
t.btnsTout = window.setTimeout( function(){ed.plugins.wpeditimage.hideButtons();}, 5000 );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
hideButtons : function() {
|
||||
tinymce.DOM.hide('wp_editbtns');
|
||||
window.clearTimeout(this.btnsTout);
|
||||
|
|
|
@ -38,10 +38,11 @@ tinyMCEPopup = {
|
|||
close : function() {
|
||||
var t = this, win = t.getWin();
|
||||
|
||||
|
||||
// To avoid domain relaxing issue in Opera
|
||||
function close() {
|
||||
t.editor.execCommand('mceRepaint');
|
||||
win.tb_remove();
|
||||
t.editor.execCommand('mceRepaint');
|
||||
tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
|
||||
};
|
||||
|
||||
|
@ -80,10 +81,8 @@ var wpImage = {
|
|||
|
||||
for ( i = 0; i < styles.length; i++ ) {
|
||||
var url = styles.item(i).href;
|
||||
if ( url && url.indexOf('colors-') != -1 ) {
|
||||
if ( url && url.indexOf('colors-') != -1 )
|
||||
document.write( '<link rel="stylesheet" href="'+url+'" type="text/css" media="all" />' );
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -95,10 +94,13 @@ var wpImage = {
|
|||
link : '',
|
||||
link_rel : '',
|
||||
target_value : '',
|
||||
current_size_sel : 's100',
|
||||
width : '',
|
||||
height : '',
|
||||
|
||||
setTabs : function(tab) {
|
||||
var t = this;
|
||||
|
||||
|
||||
if ( 'current' == tab.className ) return false;
|
||||
t.I('div_advanced').style.display = ( 'tab_advanced' == tab.id ) ? 'block' : 'none';
|
||||
t.I('div_basic').style.display = ( 'tab_basic' == tab.id ) ? 'block' : 'none';
|
||||
|
@ -131,65 +133,64 @@ var wpImage = {
|
|||
cls += (' ' + v);
|
||||
cls = cls.replace( /\s+/g, ' ' ).replace( /^\s/, '' );
|
||||
|
||||
t.I('img_classes').value = cls;
|
||||
},
|
||||
|
||||
imgSizeCls : function(v) {
|
||||
var t = this, cls = t.I('img_classes').value;
|
||||
|
||||
if (v) {
|
||||
if ( cls.indexOf('size-') != -1 )
|
||||
cls = cls.replace( /size-[^ "']+/i, 'size-' + v );
|
||||
else cls += (' size-' + v);
|
||||
} else {
|
||||
cls = cls.replace( /size-[^ "']+/gi, '' );
|
||||
t.demoSetSize();
|
||||
t.I('thumbnail').checked = '';
|
||||
t.I('medium').checked = '';
|
||||
t.I('full').checked = '';
|
||||
if ( 'aligncenter' == v ) {
|
||||
t.I('hspace').value = '';
|
||||
t.updateStyle('hspace');
|
||||
}
|
||||
cls = cls.replace( /\s+/g, ' ' ).replace( /^\s|\s$/, '' );
|
||||
|
||||
|
||||
t.I('img_classes').value = cls;
|
||||
},
|
||||
|
||||
imgEditSize : function(size) {
|
||||
showSize : function(el) {
|
||||
var t = this, demo = t.I('img_demo'), w = t.width, h = t.height, id = el.id || 's100', size;
|
||||
|
||||
size = parseInt(id.substring(1)) / 200;
|
||||
demo.width = Math.round(w * size);
|
||||
demo.height = Math.round(h * size);
|
||||
|
||||
t.showSizeClear();
|
||||
el.style.borderColor = '#A3A3A3';
|
||||
el.style.backgroundColor = '#E5E5E5';
|
||||
},
|
||||
|
||||
showSizeRem : function() {
|
||||
var t = this, demo = t.I('img_demo'), f = document.forms[0];
|
||||
|
||||
demo.width = Math.round(f.width.value * 0.5);
|
||||
demo.height = Math.round(f.height.value * 0.5);
|
||||
t.showSizeClear();
|
||||
t.I(t.current_size_sel).style.borderColor = '#A3A3A3';
|
||||
t.I(t.current_size_sel).style.backgroundColor = '#E5E5E5';
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
showSizeClear : function() {
|
||||
var divs = this.I('img_size').getElementsByTagName('div');
|
||||
|
||||
for ( i = 0; i < divs.length; i++ ) {
|
||||
divs[i].style.borderColor = '#f1f1f1';
|
||||
divs[i].style.backgroundColor = '#f1f1f1';
|
||||
}
|
||||
},
|
||||
|
||||
imgEditSize : function(el) {
|
||||
var t = this, f = document.forms[0], sz, m = null;
|
||||
|
||||
var W = parseInt(t.preloadImg.width), H = parseInt(t.preloadImg.height);
|
||||
var W = parseInt(t.preloadImg.width), H = parseInt(t.preloadImg.height), w = t.width || W, h = t.height || H, id = el.id || 's100';
|
||||
|
||||
if ( ! t.preloadImg || W == "" || H == "" )
|
||||
return;
|
||||
|
||||
switch(size) {
|
||||
case 'thumbnail':
|
||||
m = 150;
|
||||
t.imgSizeCls('thumbnail');
|
||||
break;
|
||||
case 'medium':
|
||||
m = 300;
|
||||
t.imgSizeCls('medium');
|
||||
break;
|
||||
case 'full':
|
||||
m = 500;
|
||||
t.imgSizeCls('full');
|
||||
break;
|
||||
}
|
||||
size = parseInt(id.substring(1)) / 100;
|
||||
|
||||
if (m) {
|
||||
if ( W > H ) {
|
||||
m = Math.min(W, m);
|
||||
f.width.value = m;
|
||||
f.height.value = Math.round((m / W) * H);
|
||||
} else {
|
||||
m = Math.min(H, m);
|
||||
f.height.value = m;
|
||||
f.width.value = Math.round((m / H) * W);
|
||||
}
|
||||
w = Math.round(w * size);
|
||||
h = Math.round(h * size);
|
||||
|
||||
t.width = f.width.value;
|
||||
t.height = f.height.value;
|
||||
}
|
||||
f.width.value = Math.min(W, w);
|
||||
f.height.value = Math.min(H, h);
|
||||
|
||||
t.current_size_sel = id;
|
||||
t.demoSetSize();
|
||||
},
|
||||
|
||||
|
@ -199,21 +200,24 @@ var wpImage = {
|
|||
demo.width = f.width.value ? Math.floor(f.width.value * 0.5) : '';
|
||||
demo.height = f.height.value ? Math.floor(f.height.value * 0.5) : '';
|
||||
},
|
||||
|
||||
demoSetStyle : function() {
|
||||
var f = document.forms[0], demo = this.I('img_demo');
|
||||
|
||||
if (demo)
|
||||
tinyMCEPopup.editor.dom.setAttrib(demo, 'style', f.img_style.value);
|
||||
demoSetStyle : function() {
|
||||
var f = document.forms[0], demo = this.I('img_demo'), dom = tinyMCEPopup.editor.dom;
|
||||
|
||||
if (demo) {
|
||||
dom.setAttrib(demo, 'style', f.img_style.value);
|
||||
dom.setStyle(demo, 'width', '');
|
||||
dom.setStyle(demo, 'height', '');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
origSize : function() {
|
||||
var t = this, f = document.forms[0];
|
||||
|
||||
f.width.value = t.preloadImg.width;
|
||||
f.height.value = t.preloadImg.height;
|
||||
var t = this, f = document.forms[0], el = t.I('s100');
|
||||
|
||||
f.width.value = t.width = t.preloadImg.width;
|
||||
f.height.value = t.height = t.preloadImg.height;
|
||||
t.demoSetSize();
|
||||
t.imgSizeCls();
|
||||
t.showSize(el);
|
||||
},
|
||||
|
||||
init : function() {
|
||||
|
@ -231,12 +235,13 @@ 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;
|
||||
document.dir = tinyMCEPopup.editor.getParam('directionality','');
|
||||
document.dir = tinyMCEPopup.editor.getParam('directionality','');
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getNode();
|
||||
if (el.nodeName != 'IMG') return;
|
||||
|
||||
f.img_src.value = d.src = link = ed.dom.getAttrib(el, 'src');
|
||||
ed.dom.setStyle(el, 'float', '');
|
||||
|
||||
f.img_title.value = ed.dom.getAttrib(el, 'title');
|
||||
f.img_alt.value = ed.dom.getAttrib(el, 'alt');
|
||||
|
@ -248,11 +253,8 @@ var wpImage = {
|
|||
f.height.value = t.height = ed.dom.getAttrib(el, 'height');
|
||||
f.img_classes.value = c = ed.dom.getAttrib(el, 'class');
|
||||
f.img_style.value = ed.dom.getAttrib(el, 'style');
|
||||
|
||||
// Move attribs to styles
|
||||
if (dom.getAttrib(el, 'align'))
|
||||
t.updateStyle('align');
|
||||
|
||||
// Move attribs to styles
|
||||
if (dom.getAttrib(el, 'hspace'))
|
||||
t.updateStyle('hspace');
|
||||
|
||||
|
@ -272,18 +274,11 @@ var wpImage = {
|
|||
}
|
||||
|
||||
f.link_target.checked = ( t.target_value && t.target_value == '_blank' ) ? 'checked' : '';
|
||||
|
||||
|
||||
fname = link.substring( link.lastIndexOf('/') );
|
||||
fname = fname.replace(/-[0-9]{2,4}x[0-9]{2,4}/, '' );
|
||||
t.link = link.substring( 0, link.lastIndexOf('/') ) + fname;
|
||||
|
||||
if ( c.indexOf('size-thumbnail') != -1 )
|
||||
t.I('thumbnail').checked = "checked";
|
||||
else if ( c.indexOf('size-medium') != -1 )
|
||||
t.I('medium').checked = "checked";
|
||||
else if ( c.indexOf('size-full') != -1 )
|
||||
t.I('full').checked = "checked";
|
||||
|
||||
if ( c.indexOf('alignleft') != -1 ) {
|
||||
t.I('alignleft').checked = "checked";
|
||||
d.className = "alignleft";
|
||||
|
@ -298,15 +293,24 @@ var wpImage = {
|
|||
d.className = "alignnone";
|
||||
}
|
||||
|
||||
document.body.style.display = '';
|
||||
t.getImageData();
|
||||
t.demoSetStyle();
|
||||
|
||||
if ( (t.width * 1.3) > parseInt(t.preloadImg.width) ) {
|
||||
var s130 = t.I('s130'), s120 = t.I('s120'), s110 = t.I('s110');
|
||||
|
||||
s130.onclick = s120.onclick = s110.onclick = null;
|
||||
s130.onmouseover = s120.onmouseover = s110.onmouseover = null;
|
||||
s130.style.color = s120.style.color = s110.style.color = '#aaa';
|
||||
}
|
||||
|
||||
document.body.style.display = '';
|
||||
/*
|
||||
// Test if is attachment
|
||||
// if ( (id = c.match( /wp-image-([0-9]{1,6})/ )) && id[1] ) {
|
||||
// t.I('tab_attachment').href = tinymce.documentBaseURL + 'media.php?action=edit&attachment_id=' + id[1];
|
||||
// t.I('tab_attachment').style.display = 'inline';
|
||||
// }
|
||||
if ( (id = c.match( /wp-image-([0-9]{1,6})/ )) && id[1] ) {
|
||||
t.I('tab_attachment').href = tinymce.documentBaseURL + 'media.php?action=edit&attachment_id=' + id[1];
|
||||
t.I('tab_attachment').style.display = 'inline';
|
||||
}
|
||||
*/
|
||||
},
|
||||
|
||||
remove : function() {
|
||||
|
@ -327,13 +331,29 @@ var wpImage = {
|
|||
},
|
||||
|
||||
update : function() {
|
||||
var t = this, f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, p, el, b;
|
||||
var t = this, f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, el, P, v = f.img_classes.value;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getNode();
|
||||
|
||||
if (el.nodeName != 'IMG') return;
|
||||
if (f.img_src.value === '') t.remove();
|
||||
P = ed.dom.getParent(el, 'p');
|
||||
if ( P && P.style && P.style.textAlign == 'center' )
|
||||
ed.dom.setStyle(P, 'textAlign', '');
|
||||
/*
|
||||
if ( tinymce.isIE ) {
|
||||
if ( f.img_classes.value.indexOf('aligncenter') != -1 )
|
||||
ed.dom.addClass(P, 'mce_iecenter');
|
||||
else ed.dom.removeClass(P, 'mce_iecenter');
|
||||
}
|
||||
*/
|
||||
if ( v.indexOf('alignleft') != -1 )
|
||||
tinyMCEPopup.execCommand('JustifyLeft');
|
||||
else if ( v.indexOf('alignright') != -1 )
|
||||
tinyMCEPopup.execCommand('JustifyRight');
|
||||
else if ( v.indexOf('aligncenter') != -1 )
|
||||
tinyMCEPopup.execCommand('JustifyCenter');
|
||||
|
||||
ed.dom.setAttribs(el, {
|
||||
src : f.img_src.value,
|
||||
|
@ -392,7 +412,7 @@ var wpImage = {
|
|||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
|
||||
updateStyle : function(ty) {
|
||||
var dom = tinyMCEPopup.dom, st, v, f = document.forms[0], img = dom.create('img', {style : f.img_style.value});
|
||||
|
||||
|
@ -466,7 +486,7 @@ var wpImage = {
|
|||
resetImageData : function() {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.width.value = f.height.value = '';
|
||||
f.width.value = f.height.value = '';
|
||||
},
|
||||
|
||||
updateImageData : function() {
|
||||
|
|
|
@ -11,16 +11,13 @@ h6 {font-size: .75em}
|
|||
a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;}
|
||||
img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;}
|
||||
img {border:0;}
|
||||
table {cursor:default}
|
||||
table td, table th {cursor:text}
|
||||
ins {border-bottom:1px solid green; text-decoration: none; color:green}
|
||||
del {color:red; text-decoration:line-through}
|
||||
cite {border-bottom:1px dashed blue}
|
||||
acronym {border-bottom:1px dotted #CCC; cursor:help}
|
||||
|
||||
/* IE
|
||||
* html body {
|
||||
scrollbar-3dlight-color:#F0F0EE;
|
||||
scrollbar-arrow-color:#676662;
|
||||
scrollbar-base-color:#F0F0EE;
|
||||
scrollbar-darkshadow-color:#DDD;
|
||||
scrollbar-face-color:#E0E0DD;
|
||||
scrollbar-highlight-color:#F0F0EE;
|
||||
scrollbar-shadow-color:#F0F0EE;
|
||||
scrollbar-track-color:#F5F5F5;
|
||||
p.mce_iecenter {
|
||||
text-align: center;
|
||||
}
|
||||
*/
|
|
@ -226,7 +226,7 @@ if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
|
|||
// Setup cache info
|
||||
if ( $disk_cache ) {
|
||||
|
||||
$cacheKey = apply_filters('tiny_mce_version', '20080618');
|
||||
$cacheKey = apply_filters('tiny_mce_version', '20080622');
|
||||
|
||||
foreach ( $initArray as $v )
|
||||
$cacheKey .= $v;
|
||||
|
|
|
@ -35,7 +35,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
$scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080325' );
|
||||
|
||||
// Modify this version when tinyMCE plugins are changed.
|
||||
$mce_version = apply_filters('tiny_mce_version', '20080618');
|
||||
$mce_version = apply_filters('tiny_mce_version', '20080622');
|
||||
$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');
|
||||
|
|
Loading…
Reference in New Issue