Editor: utilize the new "formats" option in TinyMCE, fix errors in IE when pressing Enter inside a caption box, fix resizing of the caption box when the user soft-resizes the image in the editor, fixes #12574

git-svn-id: http://svn.automattic.com/wordpress/trunk@16090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2010-10-29 20:06:00 +00:00
parent b0641c55c9
commit 28466e59f1
10 changed files with 131 additions and 106 deletions

File diff suppressed because one or more lines are too long

View File

@ -848,7 +848,7 @@ table.widefat .spam a:hover,
.wp_themeSkin a.mceButtonEnabled:hover,
.wp_themeSkin a.mceButtonActive,
.wp_themeSkin a.mceButtonSelected {
background-color: #d5d5d5;
background: #d5d5d5;
border-color: #777 !important;
}

File diff suppressed because one or more lines are too long

View File

@ -840,7 +840,7 @@ table.widefat .spam a:hover,
.wp_themeSkin a.mceButtonEnabled:hover,
.wp_themeSkin a.mceButtonActive,
.wp_themeSkin a.mceButtonSelected {
background-color: #d5d5d5;
background: #d5d5d5;
border-color: #777 !important;
}

View File

@ -1442,6 +1442,21 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
'theme_advanced_resizing' => true,
'theme_advanced_resize_horizontal' => false,
'dialog_type' => 'modal',
'formats' => "{
alignleft : [
{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'left'}},
{selector : 'img,table', classes : 'alignleft'}
],
aligncenter : [
{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'center'}},
{selector : 'img,table', classes : 'aligncenter'}
],
alignright : [
{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'right'}},
{selector : 'img,table', classes : 'alignright'}
],
strikethrough : {inline : 'del'}
}",
'relative_urls' => false,
'remove_script_host' => false,
'convert_urls' => false,
@ -1526,8 +1541,18 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php');
$mce_options = '';
foreach ( $initArray as $k => $v )
$mce_options .= $k . ':"' . $v . '", ';
foreach ( $initArray as $k => $v ) {
if ( is_bool($v) ) {
$val = $v ? 'true' : 'false';
$mce_options .= $k . ':' . $val . ', ';
continue;
} elseif ( is_string($v) && ( '{' == $v{0} || '[' == $v{0} ) ) {
$mce_options .= $k . ':' . $v . ', ';
continue;
}
$mce_options .= $k . ':"' . $v . '", ';
}
$mce_options = rtrim( trim($mce_options), '\n\r,' ); ?>

View File

@ -35,13 +35,13 @@
});
ed.addCommand('WP_Help', function() {
ed.windowManager.open({
url : tinymce.baseURL + '/wp-mce-help.php',
width : 450,
height : 420,
inline : 1
});
ed.windowManager.open({
url : tinymce.baseURL + '/wp-mce-help.php',
width : 450,
height : 420,
inline : 1
});
});
ed.addCommand('WP_Adv', function() {
var cm = ed.controlManager, id = cm.get(tbId).id;
@ -126,41 +126,67 @@
}
});
// Add Media buttons to fullscreen
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
var DOM = tinymce.DOM;
if ( 'mceFullScreen' != cmd ) return;
if ( 'mce_fullscreen' != ed.id && DOM.get('add_audio') && DOM.get('add_video') && DOM.get('add_image') && DOM.get('add_media') )
ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media';
// Add Media buttons to fullscreen and handle align buttons for image captions
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val, o) {
var DOM = tinymce.DOM, n, DL, DIV, cls, a, align;
if ( 'mceFullScreen' == cmd ) {
if ( 'mce_fullscreen' != ed.id && DOM.get('add_audio') && DOM.get('add_video') && DOM.get('add_image') && DOM.get('add_media') )
ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media';
}
if ( 'JustifyLeft' == cmd || 'JustifyRight' == cmd || 'JustifyCenter' == cmd ) {
n = ed.selection.getNode();
if ( n.nodeName == 'IMG' ) {
align = cmd.substr(7).toLowerCase();
a = 'align' + align;
DL = ed.dom.getParent(n, 'dl.wp-caption');
DIV = ed.dom.getParent(n, 'div.mceTemp');
if ( DL && DIV ) {
cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a;
DL.className = DL.className.replace(/align[^ '"]+\s?/g, '');
ed.dom.addClass(DL, cls);
if (cls == 'aligncenter')
ed.dom.addClass(DIV, 'mceIEcenter');
else
ed.dom.removeClass(DIV, 'mceIEcenter');
o.terminate = true;
ed.execCommand('mceRepaint');
} else {
if ( ed.dom.hasClass(n, a) )
ed.dom.addClass(n, 'alignnone');
else
ed.dom.removeClass(n, 'alignnone');
}
}
}
});
ed.onInit.add(function(ed) {
ed.onNodeChange.add( function(ed, cm, e) {
var DL;
if ( e.nodeName == 'IMG' ) {
DL = ed.dom.getParent(e, 'dl.wp-caption');
} else if ( e.nodeName == 'DIV' && ed.dom.hasClass(e, 'mceTemp') ) {
DL = e.firstChild;
// Add class "alignleft", "alignright" and "aligncenter" when selecting align for images.
ed.addCommand('JustifyLeft', function() {
var n = ed.selection.getNode();
if ( ! ed.dom.hasClass(DL, 'wp-caption') )
DL = false;
}
if ( n.nodeName != 'IMG' )
ed.plugins.wordpress.wpAlign('left');
else
ed.plugins.wordpress.do_align(n, 'alignleft');
});
ed.addCommand('JustifyRight', function() {
var n = ed.selection.getNode();
if ( n.nodeName != 'IMG' )
ed.plugins.wordpress.wpAlign('right');
else
ed.plugins.wordpress.do_align(n, 'alignright');
});
ed.addCommand('JustifyCenter', function() {
var n = ed.selection.getNode(), P = ed.dom.getParent(n, 'p'), DL = ed.dom.getParent(n, 'dl');
if ( n.nodeName == 'IMG' && ( P || DL ) )
ed.plugins.wordpress.do_align(n, 'aligncenter');
else
ed.plugins.wordpress.wpAlign('center');
if ( DL ) {
if ( ed.dom.hasClass(DL, 'alignleft') )
cm.setActive('justifyleft', 1);
else if ( ed.dom.hasClass(DL, 'alignright') )
cm.setActive('justifyright', 1);
else if ( ed.dom.hasClass(DL, 'aligncenter') )
cm.setActive('justifycenter', 1);
}
});
});
// Word count if script is loaded
@ -306,46 +332,6 @@
clearTimeout(this.mceTout);
this.mceTout = 0;
},
wpAlign : function(value) {
var ed = tinyMCE.activeEditor;
// Remove all other alignments first
tinyMCE.each('left,center,right,full'.split(','), function(name) {
if (value != name)
ed.formatter.remove('align' + name);
});
ed.formatter.toggle('align' + value);
},
do_align : function(n, a) {
var P, DL, DIV, cls, c, ed = tinyMCE.activeEditor;
if ( /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className) )
return;
P = ed.dom.getParent(n, 'p');
DL = ed.dom.getParent(n, 'dl');
DIV = ed.dom.getParent(n, 'div');
if ( DL && DIV ) {
cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a;
DL.className = DL.className.replace(/align[^ '"]+\s?/g, '');
ed.dom.addClass(DL, cls);
c = (cls == 'aligncenter') ? ed.dom.addClass(DIV, 'mceIEcenter') : ed.dom.removeClass(DIV, 'mceIEcenter');
} else if ( P ) {
cls = ed.dom.hasClass(n, a) ? 'alignnone' : a;
n.className = n.className.replace(/align[^ '"]+\s?/g, '');
ed.dom.addClass(n, cls);
if ( cls == 'aligncenter' )
ed.dom.setStyle(P, 'textAlign', 'center');
else if (P.style && P.style.textAlign == 'center')
ed.dom.setStyle(P, 'textAlign', '');
}
ed.execCommand('mceRepaint');
},
// Resizes the iframe by a relative height value
_resizeIframe : function(ed, tb_id, dy) {
@ -383,8 +369,10 @@
// Replace morebreak with images
ed.onBeforeSetContent.add(function(ed, o) {
o.content = o.content.replace(/<!--more(.*?)-->/g, moreHTML);
o.content = o.content.replace(/<!--nextpage-->/g, nextpageHTML);
if ( o.content ) {
o.content = o.content.replace(/<!--more(.*?)-->/g, moreHTML);
o.content = o.content.replace(/<!--nextpage-->/g, nextpageHTML);
}
});
// Replace images with morebreak

File diff suppressed because one or more lines are too long

View File

@ -43,22 +43,30 @@
});
});
// resize the caption <dl> when the image is soft-resized by the user (only possible in Firefox and IE)
ed.onMouseUp.add(function(ed, e) {
if ( tinymce.isWebKit || tinymce.isOpera )
return;
if ( ed.dom.getParent(e.target, 'div.mceTemp') || ed.dom.is(e.target, 'div.mceTemp') ) {
if ( ed.dom.getParent(e.target, 'div.mceTemp') || ed.dom.is(e.target, 'div.mceTemp') ) {
window.setTimeout(function(){
var ed = tinyMCE.activeEditor, n = ed.selection.getNode(), DL = ed.dom.getParent(n, 'dl.wp-caption');
var ed = tinyMCE.activeEditor, n = ed.selection.getNode(), DL, width;
if ( DL && n.width != ( parseInt(ed.dom.getStyle(DL, 'width'), 10) - 10 ) ) {
ed.dom.setStyle(DL, 'width', parseInt(n.width, 10) + 10);
ed.execCommand('mceRepaint');
if ( 'IMG' == n.nodeName ) {
DL = ed.dom.getParent(n, 'dl.wp-caption');
width = ed.dom.getAttrib(n, 'width') || n.width;
width = parseInt(width, 10);
if ( DL && width != ( parseInt(ed.dom.getStyle(DL, 'width'), 10) - 10 ) ) {
ed.dom.setStyle(DL, 'width', 10 + width);
ed.execCommand('mceRepaint');
}
}
}, 100);
}
});
// show editimage buttons
ed.onMouseDown.add(function(ed, e) {
var p;
@ -69,23 +77,27 @@
}
});
// when pressing Return inside a caption move the cursor to a new parapraph under it
ed.onKeyPress.add(function(ed, e) {
var DL, DIV, P;
var n, DL, DIV, P;
if ( e.keyCode == 13 && (DL = ed.dom.getParent(ed.selection.getNode(), 'DL')) && ed.dom.hasClass(DL, 'wp-caption') ) {
P = ed.dom.create('p', {}, '&nbsp;');
if ( (DIV = DL.parentNode) && DIV.nodeName == 'DIV' )
if ( e.keyCode == 13 ) {
n = ed.selection.getNode();
DL = ed.dom.getParent(n, 'dl.wp-caption');
DIV = ed.dom.getParent(DL, 'div.mceTemp');
if ( DL && DIV ) {
P = ed.dom.create('p', {}, '&nbsp;');
ed.dom.insertAfter( P, DIV );
else
ed.dom.insertAfter( P, DL );
if ( P.firstChild )
ed.selection.select(P.firstChild);
else
ed.selection.select(P);
tinymce.dom.Event.cancel(e);
return false;
if ( P.firstChild )
ed.selection.select(P.firstChild);
else
ed.selection.select(P);
tinymce.dom.Event.cancel(e);
return false;
}
}
});

View File

@ -1 +1 @@
(function(){tinymce.create("tinymce.plugins.wpEditImage",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_EditImage",function(){var h=a.selection.getNode(),f=tinymce.DOM.getViewPort(),g=f.h,d=(720<f.w)?720:f.w,e=a.dom.getAttrib(h,"class");if(e.indexOf("mceItem")!=-1||e.indexOf("wpGallery")!=-1||h.nodeName!="IMG"){return}tb_show("",b+"/editimage.html?ver=321&TB_iframe=true");tinymce.DOM.setStyles("TB_window",{width:(d-50)+"px",height:(g-45)+"px","margin-left":"-"+parseInt(((d-50)/2),10)+"px"});if(!tinymce.isIE6){tinymce.DOM.setStyles("TB_window",{top:"20px",marginTop:"0"})}tinymce.DOM.setStyles("TB_iframeContent",{width:(d-50)+"px",height:(g-75)+"px"});tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onInit.add(function(d){tinymce.dom.Event.add(d.getBody(),"dragstart",function(f){if(!tinymce.isGecko&&f.target.nodeName=="IMG"&&d.dom.getParent(f.target,"dl.wp-caption")){return tinymce.dom.Event.cancel(f)}})});a.onMouseUp.add(function(d,f){if(tinymce.isWebKit||tinymce.isOpera){return}if(d.dom.getParent(f.target,"div.mceTemp")||d.dom.is(f.target,"div.mceTemp")){window.setTimeout(function(){var e=tinyMCE.activeEditor,h=e.selection.getNode(),g=e.dom.getParent(h,"dl.wp-caption");if(g&&h.width!=(parseInt(e.dom.getStyle(g,"width"),10)-10)){e.dom.setStyle(g,"width",parseInt(h.width,10)+10);e.execCommand("mceRepaint")}},100)}});a.onMouseDown.add(function(d,g){var f;if(g.target.nodeName=="IMG"&&d.dom.getAttrib(g.target,"class").indexOf("mceItem")==-1){d.plugins.wordpress._showButtons(g.target,"wp_editbtns");if(tinymce.isGecko&&(f=d.dom.getParent(g.target,"dl.wp-caption"))&&d.dom.hasClass(f.parentNode,"mceTemp")){d.selection.select(f.parentNode)}}});a.onKeyPress.add(function(d,i){var f,h,g;if(i.keyCode==13&&(f=d.dom.getParent(d.selection.getNode(),"DL"))&&d.dom.hasClass(f,"wp-caption")){g=d.dom.create("p",{},"&nbsp;");if((h=f.parentNode)&&h.nodeName=="DIV"){d.dom.insertAfter(g,h)}else{d.dom.insertAfter(g,f)}if(g.firstChild){d.selection.select(g.firstChild)}else{d.selection.select(g)}tinymce.dom.Event.cancel(i);return false}});a.onBeforeSetContent.add(function(d,e){e.content=c._do_shcode(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_shcode(e.content)}})},_do_shcode:function(a){return a.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?[\s\u00a0]*/g,function(g,d,k){var j,f,e,h,i;d=d.replace(/\\'|\\&#39;|\\&#039;/g,"&#39;").replace(/\\"|\\&quot;/g,"&quot;");k=k.replace(/\\&#39;|\\&#039;/g,"&#39;").replace(/\\&quot;/g,"&quot;");j=d.match(/id=['"]([^'"]+)/i);f=d.match(/align=['"]([^'"]+)/i);e=d.match(/width=['"]([0-9]+)/);h=d.match(/caption=['"]([^'"]+)/i);j=(j&&j[1])?j[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";h=(h&&h[1])?h[1]:"";if(!e||!h){return k}i=(f=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";return'<div class="'+i+'" draggable><dl id="'+j+'" class="wp-caption '+f+'" style="width: '+(10+parseInt(e))+'px"><dt class="wp-caption-dt">'+k+'</dt><dd class="wp-caption-dd">'+h+"</dd></dl></div>"})},_get_shcode:function(a){return a.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi,function(g,d,j,h){var i,f,e;i=d.match(/id=['"]([^'"]+)/i);f=d.match(/class=['"]([^'"]+)/i);e=j.match(/width=['"]([0-9]+)/);i=(i&&i[1])?i[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";if(!e||!h){return j}f=f.match(/align[^ '"]+/)||"alignnone";h=h.replace(/<\S[^<>]*>/gi,"").replace(/'/g,"&#39;").replace(/"/g,"&quot;");return'[caption id="'+i+'" align="'+f+'" width="'+e+'" caption="'+h+'"]'+j+"[/caption]"})},_createButtons:function(){var b=this,a=tinyMCE.activeEditor,d=tinymce.DOM,e,c;d.remove("wp_editbtns");d.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"});e=d.add("wp_editbtns","img",{src:b.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.edit_img")});tinymce.dom.Event.add(e,"mousedown",function(g){var f=tinyMCE.activeEditor;f.windowManager.bookmark=f.selection.getBookmark("simple");f.execCommand("WP_EditImage")});c=d.add("wp_editbtns","img",{src:b.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.del_img")});tinymce.dom.Event.add(c,"mousedown",function(i){var f=tinyMCE.activeEditor,g=f.selection.getNode(),h;if(g.nodeName=="IMG"&&f.dom.getAttrib(g,"class").indexOf("mceItem")==-1){if((h=f.dom.getParent(g,"div"))&&f.dom.hasClass(h,"mceTemp")){f.dom.remove(h)}else{if((h=f.dom.getParent(g,"A"))&&h.childNodes.length==1){f.dom.remove(h)}else{f.dom.remove(g)}}f.execCommand("mceRepaint");return false}})},getInfo:function(){return{longname:"Edit Image",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpeditimage",tinymce.plugins.wpEditImage)})();
(function(){tinymce.create("tinymce.plugins.wpEditImage",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_EditImage",function(){var h=a.selection.getNode(),f=tinymce.DOM.getViewPort(),g=f.h,d=(720<f.w)?720:f.w,e=a.dom.getAttrib(h,"class");if(e.indexOf("mceItem")!=-1||e.indexOf("wpGallery")!=-1||h.nodeName!="IMG"){return}tb_show("",b+"/editimage.html?ver=321&TB_iframe=true");tinymce.DOM.setStyles("TB_window",{width:(d-50)+"px",height:(g-45)+"px","margin-left":"-"+parseInt(((d-50)/2),10)+"px"});if(!tinymce.isIE6){tinymce.DOM.setStyles("TB_window",{top:"20px",marginTop:"0"})}tinymce.DOM.setStyles("TB_iframeContent",{width:(d-50)+"px",height:(g-75)+"px"});tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onInit.add(function(d){tinymce.dom.Event.add(d.getBody(),"dragstart",function(f){if(!tinymce.isGecko&&f.target.nodeName=="IMG"&&d.dom.getParent(f.target,"dl.wp-caption")){return tinymce.dom.Event.cancel(f)}})});a.onMouseUp.add(function(d,f){if(tinymce.isWebKit||tinymce.isOpera){return}if(d.dom.getParent(f.target,"div.mceTemp")||d.dom.is(f.target,"div.mceTemp")){window.setTimeout(function(){var e=tinyMCE.activeEditor,i=e.selection.getNode(),g,h;if("IMG"==i.nodeName){g=e.dom.getParent(i,"dl.wp-caption");h=e.dom.getAttrib(i,"width")||i.width;h=parseInt(h,10);if(g&&h!=(parseInt(e.dom.getStyle(g,"width"),10)-10)){e.dom.setStyle(g,"width",10+h);e.execCommand("mceRepaint")}}},100)}});a.onMouseDown.add(function(d,g){var f;if(g.target.nodeName=="IMG"&&d.dom.getAttrib(g.target,"class").indexOf("mceItem")==-1){d.plugins.wordpress._showButtons(g.target,"wp_editbtns");if(tinymce.isGecko&&(f=d.dom.getParent(g.target,"dl.wp-caption"))&&d.dom.hasClass(f.parentNode,"mceTemp")){d.selection.select(f.parentNode)}}});a.onKeyPress.add(function(d,i){var j,f,h,g;if(i.keyCode==13){j=d.selection.getNode();f=d.dom.getParent(j,"dl.wp-caption");h=d.dom.getParent(f,"div.mceTemp");if(f&&h){g=d.dom.create("p",{},"&nbsp;");d.dom.insertAfter(g,h);if(g.firstChild){d.selection.select(g.firstChild)}else{d.selection.select(g)}tinymce.dom.Event.cancel(i);return false}}});a.onBeforeSetContent.add(function(d,e){e.content=c._do_shcode(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_shcode(e.content)}})},_do_shcode:function(a){return a.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?[\s\u00a0]*/g,function(g,d,k){var j,f,e,h,i;d=d.replace(/\\'|\\&#39;|\\&#039;/g,"&#39;").replace(/\\"|\\&quot;/g,"&quot;");k=k.replace(/\\&#39;|\\&#039;/g,"&#39;").replace(/\\&quot;/g,"&quot;");j=d.match(/id=['"]([^'"]+)/i);f=d.match(/align=['"]([^'"]+)/i);e=d.match(/width=['"]([0-9]+)/);h=d.match(/caption=['"]([^'"]+)/i);j=(j&&j[1])?j[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";h=(h&&h[1])?h[1]:"";if(!e||!h){return k}i=(f=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";return'<div class="'+i+'" draggable><dl id="'+j+'" class="wp-caption '+f+'" style="width: '+(10+parseInt(e))+'px"><dt class="wp-caption-dt">'+k+'</dt><dd class="wp-caption-dd">'+h+"</dd></dl></div>"})},_get_shcode:function(a){return a.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi,function(g,d,j,h){var i,f,e;i=d.match(/id=['"]([^'"]+)/i);f=d.match(/class=['"]([^'"]+)/i);e=j.match(/width=['"]([0-9]+)/);i=(i&&i[1])?i[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";if(!e||!h){return j}f=f.match(/align[^ '"]+/)||"alignnone";h=h.replace(/<\S[^<>]*>/gi,"").replace(/'/g,"&#39;").replace(/"/g,"&quot;");return'[caption id="'+i+'" align="'+f+'" width="'+e+'" caption="'+h+'"]'+j+"[/caption]"})},_createButtons:function(){var b=this,a=tinyMCE.activeEditor,d=tinymce.DOM,e,c;d.remove("wp_editbtns");d.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"});e=d.add("wp_editbtns","img",{src:b.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.edit_img")});tinymce.dom.Event.add(e,"mousedown",function(g){var f=tinyMCE.activeEditor;f.windowManager.bookmark=f.selection.getBookmark("simple");f.execCommand("WP_EditImage")});c=d.add("wp_editbtns","img",{src:b.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.del_img")});tinymce.dom.Event.add(c,"mousedown",function(i){var f=tinyMCE.activeEditor,g=f.selection.getNode(),h;if(g.nodeName=="IMG"&&f.dom.getAttrib(g,"class").indexOf("mceItem")==-1){if((h=f.dom.getParent(g,"div"))&&f.dom.hasClass(h,"mceTemp")){f.dom.remove(h)}else{if((h=f.dom.getParent(g,"A"))&&h.childNodes.length==1){f.dom.remove(h)}else{f.dom.remove(g)}}f.execCommand("mceRepaint");return false}})},getInfo:function(){return{longname:"Edit Image",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpeditimage",tinymce.plugins.wpEditImage)})();