From 6041cd04104ecc409a620486b1e9c0ad42ed36c4 Mon Sep 17 00:00:00 2001 From: azaozz Date: Sat, 20 Aug 2011 19:55:51 +0000 Subject: [PATCH] Fix QTags.closeAllTags(), replace 'tb' with 'ed' in quicktags,js to make it clear it is the editor instance not the toolbar, small comments quick edit fixes, see #16695, fixes #15911 git-svn-id: http://svn.automattic.com/wordpress/trunk@18576 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/edit-comments.dev.js | 21 ++-- wp-admin/js/edit-comments.js | 2 +- wp-admin/js/editor.dev.js | 3 + wp-admin/js/editor.js | 2 +- wp-includes/js/quicktags.dev.js | 161 +++++++++++++++---------------- wp-includes/js/quicktags.js | 2 +- wp-includes/script-loader.php | 6 +- 7 files changed, 95 insertions(+), 102 deletions(-) diff --git a/wp-admin/js/edit-comments.dev.js b/wp-admin/js/edit-comments.dev.js index cbc589fa96..b3488b92bd 100644 --- a/wp-admin/js/edit-comments.dev.js +++ b/wp-admin/js/edit-comments.dev.js @@ -356,6 +356,9 @@ commentReply = { if ( this.cid ) { c = $('#comment-' + this.cid); + if ( typeof QTags != 'undefined' ) + QTags.closeAllTags('replycontent'); + if ( this.act == 'edit-comment' ) c.fadeIn(300, function(){ c.show() }).css('backgroundColor', ''); @@ -365,18 +368,14 @@ commentReply = { $('input', '#edithead').val(''); $('.error', '#replysubmit').html('').hide(); $('.waiting', '#replysubmit').hide(); - - if ( $.browser.msie ) - $('#replycontainer, #replycontent').css('height', '120px'); - else - $('#replycontainer').resizable('destroy').css('height', '120px'); + $('#replycontainer, #replycontent').height(120); this.cid = ''; } }, open : function(id, p, a) { - var t = this, editRow, rowData, act, h, c = $('#comment-' + id), replyButton; + var t = this, editRow, rowData, act, c = $('#comment-' + id), h = c.height(), replyButton; t.close(); t.cid = id; @@ -389,6 +388,9 @@ commentReply = { $('#comment_post_ID', editRow).val(p); $('#comment_ID', editRow).val(id); + if ( h > 220 ) + $('#replycontainer, #replycontent', editRow).height(h-104); + if ( a == 'edit' ) { $('#author', editRow).val( $('div.author', rowData).text() ); $('#author-email', editRow).val( $('div.author-email', rowData).text() ); @@ -398,13 +400,6 @@ commentReply = { $('#edithead, #savebtn', editRow).show(); $('#replyhead, #replybtn', editRow).hide(); - h = c.height(); - if ( h > 220 ) - if ( $.browser.msie ) - $('#replycontainer, #replycontent', editRow).height(h-105); - else - $('#replycontainer', editRow).height(h-105); - c.after( editRow ).fadeOut('fast', function(){ $('#replyrow').fadeIn(300, function(){ $(this).show() }); }); diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js index 59e2258250..af0aae9348 100644 --- a/wp-admin/js/edit-comments.js +++ b/wp-admin/js/edit-comments.js @@ -1 +1 @@ -var theList,theExtraList,toggleWithKeyboard=false,getCount,updateCount,updatePending,dashboardTotals;(function(a){setCommentsList=function(){var c,e,g,j=0,f,h,d,i,b;c=a('input[name="_total"]',"#comments-form");e=a('input[name="_per_page"]',"#comments-form");g=a('input[name="_page"]',"#comments-form");f=function(n,l){var p=a("#"+l.element),k,o,m;k=a("#replyrow");o=a("#comment_ID",k).val();m=a("#replybtn",k);if(p.is(".unapproved")){if(l.data.id==o){m.text(adminCommentsL10n.replyApprove)}p.find("div.comment_status").html("0")}else{if(l.data.id==o){m.text(adminCommentsL10n.reply)}p.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var q=a(this),s,r;s=q.html().replace(/[^0-9]+/g,"");s=parseInt(s,10);if(isNaN(s)){return}r=a("#"+l.element).is("."+l.dimClass)?1:-1;s=s+r;if(s<0){s=0}q.closest(".awaiting-mod")[0==s?"addClass":"removeClass"]("count-0");updateCount(q,s);dashboardTotals()})};h=function(o,s){var u=a(o.target).attr("class"),k,l,m,r,t,q,p=false;o.data._total=c.val()||0;o.data._per_page=e.val()||0;o.data._page=g.val()||0;o.data._url=document.location.href;o.data.comment_status=a('input[name="comment_status"]',"#comments-form").val();if(u.indexOf(":trash=1")!=-1){p="trash"}else{if(u.indexOf(":spam=1")!=-1){p="spam"}}if(p){k=u.replace(/.*?comment-([0-9]+).*/,"$1");l=a("#comment-"+k);note=a("#"+p+"-undo-holder").html();l.find(".check-column :checkbox").prop("checked",false);if(l.siblings("#replyrow").length&&commentReply.cid==k){commentReply.close()}if(l.is("tr")){m=l.children(":visible").length;q=a(".author strong",l).text();r=a(''+note+"")}else{q=a(".comment-author",l).text();r=a('")}l.before(r);a("strong","#undo-"+k).text(q+" ");t=a(".undo a","#undo-"+k);t.attr("href","comment.php?action=un"+p+"comment&c="+k+"&_wpnonce="+o.data._ajax_nonce);t.attr("class","delete:the-comment-list:comment-"+k+"::un"+p+"=1 vim-z vim-destructive");a(".avatar",l).clone().prependTo("#undo-"+k+" ."+p+"-undo-inside");t.click(function(){s.wpList.del(this);a("#undo-"+k).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove();a("#comment-"+k).css("backgroundColor","").fadeIn(300,function(){a(this).show()})});return false})}return o};d=function(k,l,m){if(l3){while(m.length>3){k=thousandsSeparator+m.substr(m.length-3)+k;m=m.substr(0,m.length-3)}m=m+k}l.html(m)};updatePending=function(k){a("span.pending-count").each(function(){var l=a(this);if(k<0){k=0}l.closest(".awaiting-mod")[0==k?"addClass":"removeClass"]("count-0");updateCount(l,k);dashboardTotals()})};i=function(k,n){var q,o,u=a(n.target).parent().is("span.untrash"),m=a(n.target).parent().is("span.unspam"),t,s,l,p=a("#"+n.element).is(".unapproved");function v(r){if(a(n.target).parent().is("span."+r)){return 1}else{if(a("#"+n.element).is("."+r)){return -1}}return 0}t=v("spam");s=v("trash");if(u){s=-1}if(m){t=-1}l=getCount(a("span.pending-count").eq(0));if(a(n.target).parent().is("span.unapprove")||((u||m)&&p)){l=l+1}else{if(p){l=l-1}}updatePending(l);a("span.spam-count").each(function(){var r=a(this),w=getCount(r)+t;updateCount(r,w)});a("span.trash-count").each(function(){var r=a(this),w=getCount(r)+s;updateCount(r,w)});if(a("#dashboard_right_now").length){o=s?-1*s:0;dashboardTotals(o)}else{q=c.val()?parseInt(c.val(),10):0;q=q-t-s;if(q<0){q=0}if(("object"==typeof k)&&jk){return}if(n){theExtraList.empty();l.number=Math.min(8,m)}else{l.number=1;l.offset=Math.min(8,m)-1}l.no_placeholder=true;l.paged++;if(true===l.comment_type){l.comment_type=""}l=a.extend(l,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:a("#_ajax_fetch_list_nonce").val()});a.ajax({url:ajaxurl,global:false,dataType:"json",data:l,success:function(o){theExtraList.get(0).wpList.add(o.rows)}})};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:h,dimAfter:f,delAfter:i,addColor:"none"}).bind("wpListDelEnd",function(l,k){var m=k.element.replace(/[^0-9]+/g,"");if(k.target.className.indexOf(":trash=1")!=-1||k.target.className.indexOf(":spam=1")!=-1){a("#undo-"+m).fadeIn(300,function(){a(this).show()})}})};commentReply={cid:"",act:"",init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){var b;if(this.cid){b=a("#comment-"+this.cid);if(this.act=="edit-comment"){b.fadeIn(300,function(){b.show()}).css("backgroundColor","")}a("#replyrow").hide();a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("input","#edithead").val("");a(".error","#replysubmit").html("").hide();a(".waiting","#replysubmit").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}this.cid=""}},open:function(b,d,k){var m=this,e,f,i,g,j=a("#comment-"+b),l;m.close();m.cid=b;e=a("#replyrow");f=a("#inline-"+b);i=m.act=(k=="edit")?"edit-comment":"replyto-comment";a("#action",e).val(i);a("#comment_post_ID",e).val(d);a("#comment_ID",e).val(b);if(k=="edit"){a("#author",e).val(a("div.author",f).text());a("#author-email",e).val(a("div.author-email",f).text());a("#author-url",e).val(a("div.author-url",f).text());a("#status",e).val(a("div.comment_status",f).text());a("#replycontent",e).val(a("textarea.comment",f).val());a("#edithead, #savebtn",e).show();a("#replyhead, #replybtn",e).hide();g=j.height();if(g>220){if(a.browser.msie){a("#replycontainer, #replycontent",e).height(g-105)}else{a("#replycontainer",e).height(g-105)}}j.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})}else{l=a("#replybtn",e);a("#edithead, #savebtn",e).hide();a("#replyhead, #replybtn",e).show();j.after(e);if(j.hasClass("unapproved")){l.text(adminCommentsL10n.replyApprove)}else{l.text(adminCommentsL10n.reply)}a("#replyrow").fadeIn(300,function(){a(this).show()})}setTimeout(function(){var o,h,p,c,n;o=a("#replyrow").offset().top;h=o+a("#replyrow").height();p=window.pageYOffset||document.documentElement.scrollTop;c=document.documentElement.clientHeight||self.innerHeight||0;n=p+c;if(n-20]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a(document).delegate("span.delete a.delete","click",function(){return false});if(typeof QTags!="undefined"){quicktags({id:"replycontent",buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close"})}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a(".tablenav-pages ."+f+"-page:not(.disabled)");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("input:checkbox","#cb").click().prop("checked",false);toggleWithKeyboard=false};d=function(f){return function(){var g=a('select[name="action"]');a('option[value="'+f+'"]',g).prop("selected",true);a("#doaction").click()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",b],["shift+x",c],["shift+a",d("approve")],["shift+s",d("spam")],["shift+d",d("delete")],["shift+t",d("trash")],["shift+z",d("untrash")],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery); \ No newline at end of file +var theList,theExtraList,toggleWithKeyboard=false,getCount,updateCount,updatePending,dashboardTotals;(function(a){setCommentsList=function(){var c,e,g,j=0,f,h,d,i,b;c=a('input[name="_total"]',"#comments-form");e=a('input[name="_per_page"]',"#comments-form");g=a('input[name="_page"]',"#comments-form");f=function(n,l){var p=a("#"+l.element),k,o,m;k=a("#replyrow");o=a("#comment_ID",k).val();m=a("#replybtn",k);if(p.is(".unapproved")){if(l.data.id==o){m.text(adminCommentsL10n.replyApprove)}p.find("div.comment_status").html("0")}else{if(l.data.id==o){m.text(adminCommentsL10n.reply)}p.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var q=a(this),s,r;s=q.html().replace(/[^0-9]+/g,"");s=parseInt(s,10);if(isNaN(s)){return}r=a("#"+l.element).is("."+l.dimClass)?1:-1;s=s+r;if(s<0){s=0}q.closest(".awaiting-mod")[0==s?"addClass":"removeClass"]("count-0");updateCount(q,s);dashboardTotals()})};h=function(o,s){var u=a(o.target).attr("class"),k,l,m,r,t,q,p=false;o.data._total=c.val()||0;o.data._per_page=e.val()||0;o.data._page=g.val()||0;o.data._url=document.location.href;o.data.comment_status=a('input[name="comment_status"]',"#comments-form").val();if(u.indexOf(":trash=1")!=-1){p="trash"}else{if(u.indexOf(":spam=1")!=-1){p="spam"}}if(p){k=u.replace(/.*?comment-([0-9]+).*/,"$1");l=a("#comment-"+k);note=a("#"+p+"-undo-holder").html();l.find(".check-column :checkbox").prop("checked",false);if(l.siblings("#replyrow").length&&commentReply.cid==k){commentReply.close()}if(l.is("tr")){m=l.children(":visible").length;q=a(".author strong",l).text();r=a(''+note+"")}else{q=a(".comment-author",l).text();r=a('")}l.before(r);a("strong","#undo-"+k).text(q+" ");t=a(".undo a","#undo-"+k);t.attr("href","comment.php?action=un"+p+"comment&c="+k+"&_wpnonce="+o.data._ajax_nonce);t.attr("class","delete:the-comment-list:comment-"+k+"::un"+p+"=1 vim-z vim-destructive");a(".avatar",l).clone().prependTo("#undo-"+k+" ."+p+"-undo-inside");t.click(function(){s.wpList.del(this);a("#undo-"+k).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove();a("#comment-"+k).css("backgroundColor","").fadeIn(300,function(){a(this).show()})});return false})}return o};d=function(k,l,m){if(l3){while(m.length>3){k=thousandsSeparator+m.substr(m.length-3)+k;m=m.substr(0,m.length-3)}m=m+k}l.html(m)};updatePending=function(k){a("span.pending-count").each(function(){var l=a(this);if(k<0){k=0}l.closest(".awaiting-mod")[0==k?"addClass":"removeClass"]("count-0");updateCount(l,k);dashboardTotals()})};i=function(k,n){var q,o,u=a(n.target).parent().is("span.untrash"),m=a(n.target).parent().is("span.unspam"),t,s,l,p=a("#"+n.element).is(".unapproved");function v(r){if(a(n.target).parent().is("span."+r)){return 1}else{if(a("#"+n.element).is("."+r)){return -1}}return 0}t=v("spam");s=v("trash");if(u){s=-1}if(m){t=-1}l=getCount(a("span.pending-count").eq(0));if(a(n.target).parent().is("span.unapprove")||((u||m)&&p)){l=l+1}else{if(p){l=l-1}}updatePending(l);a("span.spam-count").each(function(){var r=a(this),w=getCount(r)+t;updateCount(r,w)});a("span.trash-count").each(function(){var r=a(this),w=getCount(r)+s;updateCount(r,w)});if(a("#dashboard_right_now").length){o=s?-1*s:0;dashboardTotals(o)}else{q=c.val()?parseInt(c.val(),10):0;q=q-t-s;if(q<0){q=0}if(("object"==typeof k)&&jk){return}if(n){theExtraList.empty();l.number=Math.min(8,m)}else{l.number=1;l.offset=Math.min(8,m)-1}l.no_placeholder=true;l.paged++;if(true===l.comment_type){l.comment_type=""}l=a.extend(l,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:a("#_ajax_fetch_list_nonce").val()});a.ajax({url:ajaxurl,global:false,dataType:"json",data:l,success:function(o){theExtraList.get(0).wpList.add(o.rows)}})};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:h,dimAfter:f,delAfter:i,addColor:"none"}).bind("wpListDelEnd",function(l,k){var m=k.element.replace(/[^0-9]+/g,"");if(k.target.className.indexOf(":trash=1")!=-1||k.target.className.indexOf(":spam=1")!=-1){a("#undo-"+m).fadeIn(300,function(){a(this).show()})}})};commentReply={cid:"",act:"",init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){var b;if(this.cid){b=a("#comment-"+this.cid);if(typeof QTags!="undefined"){QTags.closeAllTags("replycontent")}if(this.act=="edit-comment"){b.fadeIn(300,function(){b.show()}).css("backgroundColor","")}a("#replyrow").hide();a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("input","#edithead").val("");a(".error","#replysubmit").html("").hide();a(".waiting","#replysubmit").hide();a("#replycontainer, #replycontent").height(120);this.cid=""}},open:function(b,d,k){var m=this,e,f,i,j=a("#comment-"+b),g=j.height(),l;m.close();m.cid=b;e=a("#replyrow");f=a("#inline-"+b);i=m.act=(k=="edit")?"edit-comment":"replyto-comment";a("#action",e).val(i);a("#comment_post_ID",e).val(d);a("#comment_ID",e).val(b);if(g>220){a("#replycontainer, #replycontent",e).height(g-104)}if(k=="edit"){a("#author",e).val(a("div.author",f).text());a("#author-email",e).val(a("div.author-email",f).text());a("#author-url",e).val(a("div.author-url",f).text());a("#status",e).val(a("div.comment_status",f).text());a("#replycontent",e).val(a("textarea.comment",f).val());a("#edithead, #savebtn",e).show();a("#replyhead, #replybtn",e).hide();j.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})}else{l=a("#replybtn",e);a("#edithead, #savebtn",e).hide();a("#replyhead, #replybtn",e).show();j.after(e);if(j.hasClass("unapproved")){l.text(adminCommentsL10n.replyApprove)}else{l.text(adminCommentsL10n.reply)}a("#replyrow").fadeIn(300,function(){a(this).show()})}setTimeout(function(){var o,h,p,c,n;o=a("#replyrow").offset().top;h=o+a("#replyrow").height();p=window.pageYOffset||document.documentElement.scrollTop;c=document.documentElement.clientHeight||self.innerHeight||0;n=p+c;if(n-20]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a(document).delegate("span.delete a.delete","click",function(){return false});if(typeof QTags!="undefined"){quicktags({id:"replycontent",buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close"})}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a(".tablenav-pages ."+f+"-page:not(.disabled)");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("input:checkbox","#cb").click().prop("checked",false);toggleWithKeyboard=false};d=function(f){return function(){var g=a('select[name="action"]');a('option[value="'+f+'"]',g).prop("selected",true);a("#doaction").click()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",b],["shift+x",c],["shift+a",d("approve")],["shift+s",d("spam")],["shift+d",d("delete")],["shift+t",d("trash")],["shift+z",d("untrash")],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery); \ No newline at end of file diff --git a/wp-admin/js/editor.dev.js b/wp-admin/js/editor.dev.js index 35b2bf725d..34ce30b689 100644 --- a/wp-admin/js/editor.dev.js +++ b/wp-admin/js/editor.dev.js @@ -9,6 +9,9 @@ var switchEditors = { if ( ed && ! ed.isHidden() ) return false; + if ( typeof(QTags) != 'undefined' ) + QTags.closeAllTags(id); + if ( tinyMCEPreInit.mceInit[id] && tinyMCEPreInit.mceInit[id].wpautop ) txtarea_el.value = t.wpautop( txtarea_el.value ); diff --git a/wp-admin/js/editor.js b/wp-admin/js/editor.js index 0992f67b0e..835b7bf53a 100644 --- a/wp-admin/js/editor.js +++ b/wp-admin/js/editor.js @@ -1 +1 @@ -var switchEditors={go:function(j){var k=this,d=j.id,e=d.length,b=d.substr(0,e-5),g=d.substr(e-4),h=tinyMCE.get(b),i="wp-"+b+"-wrap",f=tinymce.DOM,c=f.get(b);if("tmce"==g){if(h&&!h.isHidden()){return false}if(tinyMCEPreInit.mceInit[b]&&tinyMCEPreInit.mceInit[b].wpautop){c.value=k.wpautop(c.value)}if(h){h.show()}else{h=new tinymce.Editor(b,tinyMCEPreInit.mceInit[b]);h.render()}f.removeClass(i,"html-active");f.addClass(i,"tmce-active");setUserSetting("editor","tinymce")}else{if("html"==g){if(h&&h.isHidden()){return false}if(h){c.style.height=h.getContentAreaContainer().offsetHeight+20+"px";h.hide()}f.removeClass(i,"tmce-active");f.addClass(i,"html-active");setUserSetting("editor","html")}}return false},_wp_Nop:function(b){var c,a;if(b.indexOf("]*>[\s\S]+?<\/\1>/g,function(d){d=d.replace(/
(\r\n|\n)?/g,"");return d.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,"")})}c="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset";b=b.replace(new RegExp("\\s*\\s*","g"),"\n");b=b.replace(new RegExp("\\s*<((?:"+c+")(?: [^>]*)?)>","g"),"\n<$1>");b=b.replace(/(

]+>.*?)<\/p>/g,"$1");b=b.replace(/]*)?>\s*

/gi,"\n\n");b=b.replace(/\s*

/gi,"");b=b.replace(/\s*<\/p>\s*/gi,"\n\n");b=b.replace(/\n[\s\u00a0]+\n/g,"\n\n");b=b.replace(/\s*
\s*/gi,"\n");b=b.replace(/\s*

\s*/g,"
\n");b=b.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n");b=b.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption");a="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset";b=b.replace(new RegExp("\\s*<((?:"+a+")(?: [^>]*)?)\\s*>","g"),"\n<$1>");b=b.replace(new RegExp("\\s*\\s*","g"),"\n");b=b.replace(/]*)>/g,"\t");if(b.indexOf("]*)?>\s*/g,"\n\n\n\n")}if(b.indexOf("/g,function(d){return d.replace(/[\r\n]+/g,"")})}b=b.replace(/<\/p#>/g,"

\n");b=b.replace(/\s*(

]+>[\s\S]*?<\/p>)/g,"\n$1");b=b.replace(/^\s+/,"");b=b.replace(/[\s\u00a0]+$/,"");b=b.replace(//g,"\n");return b},_wp_Autop:function(a){var b="table|thead|tfoot|tbody|tr|td|th|caption|col|colgroup|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|fieldset|legend|hr|noscript|menu|samp|header|footer|article|section|hgroup|nav|aside|details|summary";if(a.indexOf("/g,function(c){return c.replace(/[\r\n]+/g,"")})}a=a.replace(/<[^<>]+>/g,function(c){return c.replace(/[\r\n]+/g," ")});if(a.indexOf("]*>[\s\S]+?<\/\1>/g,function(c){return c.replace(/(\r\n|\n)/g,"")})}a=a+"\n\n";a=a.replace(/
\s*
/gi,"\n\n");a=a.replace(new RegExp("(<(?:"+b+")(?: [^>]*)?>)","gi"),"\n$1");a=a.replace(new RegExp("()","gi"),"$1\n\n");a=a.replace(/]*)?>/gi,"\n\n");a=a.replace(/\r\n|\r/g,"\n");a=a.replace(/\n\s*\n+/g,"\n\n");a=a.replace(/([\s\S]+?)\n\n/g,"

$1

\n");a=a.replace(/

\s*?<\/p>/gi,"");a=a.replace(new RegExp("

\\s*(]*)?>)\\s*

","gi"),"$1");a=a.replace(/

(/gi,"$1");a=a.replace(/

\s*]*)>/gi,"

");a=a.replace(/<\/blockquote>\s*<\/p>/gi,"

");a=a.replace(new RegExp("

\\s*(]*)?>)","gi"),"$1");a=a.replace(new RegExp("(]*)?>)\\s*

","gi"),"$1");a=a.replace(/\s*\n/gi,"
\n");a=a.replace(new RegExp("(]*>)\\s*
","gi"),"$1");a=a.replace(/
(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1");a=a.replace(/(?:

|
)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|
)*/gi,"[caption$1[/caption]");a=a.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g,function(e,d,f){if(f.match(/]*)?>/)){return e}return d+"

"+f+"

"});a=a.replace(//g,"\n");return a},pre_wpautop:function(b){var a=this,d={o:a,data:b,unfiltered:b},c=typeof(jQuery)!="undefined";if(c){jQuery("body").trigger("beforePreWpautop",[d])}d.data=a._wp_Nop(d.data);if(c){jQuery("body").trigger("afterPreWpautop",[d])}return d.data},wpautop:function(b){var a=this,d={o:a,data:b,unfiltered:b},c=typeof(jQuery)!="undefined";if(c){jQuery("body").trigger("beforeWpautop",[d])}d.data=a._wp_Autop(d.data);if(c){jQuery("body").trigger("afterWpautop",[d])}return d.data}}; \ No newline at end of file +var switchEditors={go:function(j){var k=this,d=j.id,e=d.length,b=d.substr(0,e-5),g=d.substr(e-4),h=tinyMCE.get(b),i="wp-"+b+"-wrap",f=tinymce.DOM,c=f.get(b);if("tmce"==g){if(h&&!h.isHidden()){return false}if(typeof(QTags)!="undefined"){QTags.closeAllTags(b)}if(tinyMCEPreInit.mceInit[b]&&tinyMCEPreInit.mceInit[b].wpautop){c.value=k.wpautop(c.value)}if(h){h.show()}else{h=new tinymce.Editor(b,tinyMCEPreInit.mceInit[b]);h.render()}f.removeClass(i,"html-active");f.addClass(i,"tmce-active");setUserSetting("editor","tinymce")}else{if("html"==g){if(h&&h.isHidden()){return false}if(h){c.style.height=h.getContentAreaContainer().offsetHeight+20+"px";h.hide()}f.removeClass(i,"tmce-active");f.addClass(i,"html-active");setUserSetting("editor","html")}}return false},_wp_Nop:function(b){var c,a;if(b.indexOf("]*>[\s\S]+?<\/\1>/g,function(d){d=d.replace(/
(\r\n|\n)?/g,"");return d.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,"")})}c="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset";b=b.replace(new RegExp("\\s*\\s*","g"),"\n");b=b.replace(new RegExp("\\s*<((?:"+c+")(?: [^>]*)?)>","g"),"\n<$1>");b=b.replace(/(

]+>.*?)<\/p>/g,"$1");b=b.replace(/]*)?>\s*

/gi,"\n\n");b=b.replace(/\s*

/gi,"");b=b.replace(/\s*<\/p>\s*/gi,"\n\n");b=b.replace(/\n[\s\u00a0]+\n/g,"\n\n");b=b.replace(/\s*
\s*/gi,"\n");b=b.replace(/\s*

\s*/g,"
\n");b=b.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n");b=b.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption");a="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset";b=b.replace(new RegExp("\\s*<((?:"+a+")(?: [^>]*)?)\\s*>","g"),"\n<$1>");b=b.replace(new RegExp("\\s*\\s*","g"),"\n");b=b.replace(/]*)>/g,"\t");if(b.indexOf("]*)?>\s*/g,"\n\n\n\n")}if(b.indexOf("/g,function(d){return d.replace(/[\r\n]+/g,"")})}b=b.replace(/<\/p#>/g,"

\n");b=b.replace(/\s*(

]+>[\s\S]*?<\/p>)/g,"\n$1");b=b.replace(/^\s+/,"");b=b.replace(/[\s\u00a0]+$/,"");b=b.replace(//g,"\n");return b},_wp_Autop:function(a){var b="table|thead|tfoot|tbody|tr|td|th|caption|col|colgroup|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|fieldset|legend|hr|noscript|menu|samp|header|footer|article|section|hgroup|nav|aside|details|summary";if(a.indexOf("/g,function(c){return c.replace(/[\r\n]+/g,"")})}a=a.replace(/<[^<>]+>/g,function(c){return c.replace(/[\r\n]+/g," ")});if(a.indexOf("]*>[\s\S]+?<\/\1>/g,function(c){return c.replace(/(\r\n|\n)/g,"")})}a=a+"\n\n";a=a.replace(/
\s*
/gi,"\n\n");a=a.replace(new RegExp("(<(?:"+b+")(?: [^>]*)?>)","gi"),"\n$1");a=a.replace(new RegExp("()","gi"),"$1\n\n");a=a.replace(/]*)?>/gi,"\n\n");a=a.replace(/\r\n|\r/g,"\n");a=a.replace(/\n\s*\n+/g,"\n\n");a=a.replace(/([\s\S]+?)\n\n/g,"

$1

\n");a=a.replace(/

\s*?<\/p>/gi,"");a=a.replace(new RegExp("

\\s*(]*)?>)\\s*

","gi"),"$1");a=a.replace(/

(/gi,"$1");a=a.replace(/

\s*]*)>/gi,"

");a=a.replace(/<\/blockquote>\s*<\/p>/gi,"

");a=a.replace(new RegExp("

\\s*(]*)?>)","gi"),"$1");a=a.replace(new RegExp("(]*)?>)\\s*

","gi"),"$1");a=a.replace(/\s*\n/gi,"
\n");a=a.replace(new RegExp("(]*>)\\s*
","gi"),"$1");a=a.replace(/
(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1");a=a.replace(/(?:

|
)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|
)*/gi,"[caption$1[/caption]");a=a.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g,function(e,d,f){if(f.match(/]*)?>/)){return e}return d+"

"+f+"

"});a=a.replace(//g,"\n");return a},pre_wpautop:function(b){var a=this,d={o:a,data:b,unfiltered:b},c=typeof(jQuery)!="undefined";if(c){jQuery("body").trigger("beforePreWpautop",[d])}d.data=a._wp_Nop(d.data);if(c){jQuery("body").trigger("afterPreWpautop",[d])}return d.data},wpautop:function(b){var a=this,d={o:a,data:b,unfiltered:b},c=typeof(jQuery)!="undefined";if(c){jQuery("body").trigger("beforeWpautop",[d])}d.data=a._wp_Autop(d.data);if(c){jQuery("body").trigger("afterWpautop",[d])}return d.data}}; \ No newline at end of file diff --git a/wp-includes/js/quicktags.dev.js b/wp-includes/js/quicktags.dev.js index 6a36385135..169aeb06dd 100644 --- a/wp-includes/js/quicktags.dev.js +++ b/wp-includes/js/quicktags.dev.js @@ -152,6 +152,7 @@ function edButton(id, display, tagStart, tagEnd, access, open) { t.name = name; t.id = id; + t.canvas = canvas; // default buttons for ( i in edButtons ) { @@ -161,8 +162,14 @@ function edButton(id, display, tagStart, tagEnd, access, open) { buttons[edButtons[i].id] = edButtons[i]; } - if ( id == 'content' && adminpage && ( adminpage == 'post-new-php' || adminpage == 'post-php' ) ) + if ( id == 'content' && adminpage && ( adminpage == 'post-new-php' || adminpage == 'post-php' ) ) { buttons['fullscreen'] = new qt.FullscreenButton(); + // back compat hack :-( + edCanvas = canvas; + toolbar_id = 'ed_toolbar'; + } else { + toolbar_id = name + '_toolbar'; + } // add custom buttons for ( i in t._customButtons ) { @@ -194,13 +201,6 @@ function edButton(id, display, tagStart, tagEnd, access, open) { for ( i in theButtons ) html += theButtons[i].html(name + '_'); - if ( id == 'content' && !qt.instances[0] ) { // back compat hack :-( - edCanvas = canvas; - toolbar_id = 'ed_toolbar'; - } else { - toolbar_id = name + '_toolbar'; - } - tb = document.createElement('div'); tb.id = toolbar_id; tb.className = 'quicktags-toolbar'; @@ -236,10 +236,10 @@ function edButton(id, display, tagStart, tagEnd, access, open) { return buttons[id]; }; - if ( !qt.instances[0] ) - qt.instances[0] = t; - qt.instances[id] = t; + + if ( !qt.instances[0] ) + qt.instances[0] = qt.instances[id]; }; qt.instances = {}; @@ -304,31 +304,31 @@ function edButton(id, display, tagStart, tagEnd, access, open) { }; qt.insertContent = function(content) { - var sel, startPos, endPos, scrollTop, text, ed = document.getElementById(wpActiveEditor); + var sel, startPos, endPos, scrollTop, text, canvas = document.getElementById(wpActiveEditor); - if ( !ed ) + if ( !canvas ) return false; if ( document.selection ) { //IE - ed.focus(); + canvas.focus(); sel = document.selection.createRange(); sel.text = content; - ed.focus(); - } else if ( ed.selectionStart || ed.selectionStart == '0' ) { // all other - text = ed.value; - startPos = ed.selectionStart; - endPos = ed.selectionEnd; - scrollTop = ed.scrollTop; + canvas.focus(); + } else if ( canvas.selectionStart || canvas.selectionStart == '0' ) { // FF, WebKit, Opera + text = canvas.value; + startPos = canvas.selectionStart; + endPos = canvas.selectionEnd; + scrollTop = canvas.scrollTop; - ed.value = text.substring(0, startPos) + content + text.substring(endPos, text.length); + canvas.value = text.substring(0, startPos) + content + text.substring(endPos, text.length); - ed.focus(); - ed.selectionStart = startPos + content.length; - ed.selectionEnd = startPos + content.length; - ed.scrollTop = scrollTop; + canvas.focus(); + canvas.selectionStart = startPos + content.length; + canvas.selectionEnd = startPos + content.length; + canvas.scrollTop = scrollTop; } else { - ed.value += content; - ed.focus(); + canvas.value += content; + canvas.focus(); } return true; }; @@ -356,32 +356,32 @@ function edButton(id, display, tagStart, tagEnd, access, open) { t.open = open; }; qt.TagButton.prototype = new qt.Button(); - qt.TagButton.prototype.openTag = function(e, tb) { + qt.TagButton.prototype.openTag = function(e, ed) { var t = this; - if ( ! tb.openTags ) { - tb.openTags = []; + + if ( ! ed.openTags ) { + ed.openTags = []; } if ( t.tagEnd ) { - tb.openTags.push(t.id); + ed.openTags.push(t.id); e.value = '/' + e.value; } }; - qt.TagButton.prototype.closeTag = function(e, tb) { - var t = this, - i = t.isOpen(tb); + qt.TagButton.prototype.closeTag = function(e, ed) { + var t = this, i = t.isOpen(ed); if ( i !== false ) { - tb.openTags.splice(i, 1); + ed.openTags.splice(i, 1); } e.value = t.display; }; // whether a tag is open or not. Returns false if not open, or current open depth of the tag - qt.TagButton.prototype.isOpen = function (tb) { + qt.TagButton.prototype.isOpen = function (ed) { var t = this, i = 0, ret = false; - if ( tb.openTags ) { - while ( ret === false && i < tb.openTags.length ) { - ret = tb.openTags[i] == t.id ? i : false; + if ( ed.openTags ) { + while ( ret === false && i < ed.openTags.length ) { + ret = ed.openTags[i] == t.id ? i : false; i ++; } } else { @@ -389,30 +389,25 @@ function edButton(id, display, tagStart, tagEnd, access, open) { } return ret; }; - qt.TagButton.prototype.callback = function(element, canvas, toolbar) { - var t = this, startPos, endPos, cursorPos, scrollTop, v, l, r, i, sel; + qt.TagButton.prototype.callback = function(element, canvas, ed) { + var t = this, startPos, endPos, cursorPos, scrollTop, v = canvas.value, l, r, i, sel, endTag = v ? t.tagEnd : ''; - v = canvas.value; - - // IE support - if ( document.selection ) { + if ( document.selection ) { // IE canvas.focus(); sel = document.selection.createRange(); if ( sel.text.length > 0 ) { - sel.text = t.tagStart + sel.text + t.tagEnd; + sel.text = t.tagStart + sel.text + endTag; } else { - if ( t.isOpen(toolbar) === false || t.tagEnd === '' ) { + if ( t.isOpen(ed) === false || t.tagEnd === '' ) { sel.text = t.tagStart; - t.openTag(element, toolbar); + t.openTag(element, ed); } else { - sel.text = t.tagEnd; - t.closeTag(element, toolbar); + sel.text = endTag; + t.closeTag(element, ed); } } canvas.focus(); - } - // moz, webkit, opera - else if ( canvas.selectionStart || canvas.selectionStart == '0' ) { + } else if ( canvas.selectionStart || canvas.selectionStart == '0' ) { // FF, WebKit, Opera startPos = canvas.selectionStart; endPos = canvas.selectionEnd; cursorPos = endPos; @@ -421,20 +416,20 @@ function edButton(id, display, tagStart, tagEnd, access, open) { r = v.substring(endPos, v.length); // right of the selection i = v.substring(startPos, endPos); // inside the selection if ( startPos != endPos ) { - canvas.value = l + t.tagStart + i + t.tagEnd + r; - if ( t.tagEnd === '' ) { + canvas.value = l + t.tagStart + i + endTag + r; + if ( endTag === '' ) { cursorPos = startPos; } - cursorPos += t.tagStart.length + t.tagEnd.length; + cursorPos += t.tagStart.length + endTag.length; } else { - if ( t.isOpen(toolbar) === false || t.tagEnd === '' ) { + if ( t.isOpen(ed) === false || t.tagEnd === '' ) { canvas.value = l + t.tagStart + r; - t.openTag(element, toolbar); + t.openTag(element, ed); cursorPos = startPos + t.tagStart.length; } else { - canvas.value = l + t.tagEnd + r; - cursorPos = startPos + t.tagEnd.length; - t.closeTag(element, toolbar); + canvas.value = l + endTag + r; + cursorPos = startPos + endTag.length; + t.closeTag(element, ed); } } @@ -445,12 +440,12 @@ function edButton(id, display, tagStart, tagEnd, access, open) { } // other browsers else { - if ( t.isOpen(toolbar) !== false || t.tagEnd === '' ) { + if ( t.isOpen(ed) !== false || t.tagEnd === '' ) { canvas.value += t.tagStart; - t.openTag(element, toolbar); + t.openTag(element, ed); } else { - canvas.value += t.tagEnd; - t.closeTag(element, toolbar); + canvas.value += endTag; + t.closeTag(element, ed); } canvas.focus(); } @@ -461,7 +456,7 @@ function edButton(id, display, tagStart, tagEnd, access, open) { qt.Button.call(this, 'spell', quicktagsL10n.lookup, '', quicktagsL10n.dictionaryLookup); }; qt.SpellButton.prototype = new qt.Button(); - qt.SpellButton.prototype.callback = function(element, canvas, toolbar) { + qt.SpellButton.prototype.callback = function(element, canvas, ed) { var word = '', sel, startPos, endPos; if ( document.selection ) { @@ -470,8 +465,7 @@ function edButton(id, display, tagStart, tagEnd, access, open) { if ( sel.text.length > 0 ) { word = sel.text; } - } - else if ( canvas.selectionStart || canvas.selectionStart == '0' ) { + } else if ( canvas.selectionStart || canvas.selectionStart == '0' ) { startPos = canvas.selectionStart; endPos = canvas.selectionEnd; if ( startPos != endPos ) { @@ -488,25 +482,26 @@ function edButton(id, display, tagStart, tagEnd, access, open) { } }; - // the close button + // the close tags button qt.CloseButton = function() { qt.Button.call(this, 'close', quicktagsL10n.closeTags, '', quicktagsL10n.closeAllOpenTags); }; qt.CloseButton.prototype = new qt.Button(); - qt.CloseButton.prototype.callback = function(e, c, tb) { - var button, element, tbo = tb.openTags; + qt.CloseButton.prototype.callback = function(e, c, ed) { + var button, element, tbo = ed.openTags; + if ( tbo ) { while ( tbo.length > 0 ) { - button = tb.getButton(tbo[tbo.length - 1]); - element = document.getElementById(tb.name + '_' + button.id); - button.callback.call(button, element, c, tb); + button = ed.getButton(tbo[tbo.length - 1]); + element = document.getElementById(ed.name + '_' + button.id); + button.callback.call(button, element, c, ed); } } }; - qt.prototype.closeAllTags = function() { - var btn = this.getButton('close'); - btn.callback.call(btn, '', this.canvas, this.toolbar); + qt.closeAllTags = function(editor_id) { + var ed = this.getInstance(editor_id), btn = ed.getButton('close'); + btn.callback.call(btn, '', ed.canvas, ed); }; // the link button @@ -514,7 +509,7 @@ function edButton(id, display, tagStart, tagEnd, access, open) { qt.TagButton.call(this, 'link', 'link', '', '', 'a'); }; qt.LinkButton.prototype = new qt.TagButton(); - qt.LinkButton.prototype.callback = function(e, c, tb, defaultValue) { + qt.LinkButton.prototype.callback = function(e, c, ed, defaultValue) { var URL, t = this; if ( typeof(wpLink) != 'undefined' ) { @@ -525,14 +520,14 @@ function edButton(id, display, tagStart, tagEnd, access, open) { if ( ! defaultValue ) defaultValue = 'http://'; - if ( t.isOpen(tb) === false ) { + if ( t.isOpen(ed) === false ) { URL = prompt(quicktagsL10n.enterURL, defaultValue); if ( URL ) { t.tagStart = ''; - qt.TagButton.prototype.callback.call(t, e, c, tb); + qt.TagButton.prototype.callback.call(t, e, c, ed); } } else { - qt.TagButton.prototype.callback.call(t, e, c, tb); + qt.TagButton.prototype.callback.call(t, e, c, ed); } }; @@ -541,7 +536,7 @@ function edButton(id, display, tagStart, tagEnd, access, open) { qt.TagButton.call(this, 'img', 'img', '', '', 'm', -1); }; qt.ImgButton.prototype = new qt.TagButton(); - qt.ImgButton.prototype.callback = function(e, c, tb, defaultValue) { + qt.ImgButton.prototype.callback = function(e, c, ed, defaultValue) { if ( ! defaultValue ) { defaultValue = 'http://'; } @@ -549,7 +544,7 @@ function edButton(id, display, tagStart, tagEnd, access, open) { if ( src ) { alt = prompt(quicktagsL10n.enterImageDescription, ''); this.tagStart = '' + alt + ''; - qt.TagButton.prototype.callback.call(this, e, c, tb); + qt.TagButton.prototype.callback.call(this, e, c, ed); } }; diff --git a/wp-includes/js/quicktags.js b/wp-includes/js/quicktags.js index c6e5268b1b..6744cbd80c 100644 --- a/wp-includes/js/quicktags.js +++ b/wp-includes/js/quicktags.js @@ -1 +1 @@ -var QTags,edButtons=[],edCanvas;function quicktags(a){return new QTags(a)}function edInsertContent(b,a){return QTags.insertContent(a)}function edButton(f,e,c,b,a,d){return QTags.addButton(f,e,c,b,d,a)}(function(){var c=function(h){var g,f,e;if(typeof jQuery!="undefined"){jQuery(document).ready(h)}else{g=c;g.funcs=[];g.ready=function(){if(!g.isReady){g.isReady=true;for(f=0;f'};d.Button.prototype.callback=function(){};d.TagButton=function(l,j,g,f,e,h,k){var i=this;d.Button.call(i,l,j,e,k);i.tagStart=g;i.tagEnd=f;i.open=h};d.TagButton.prototype=new d.Button();d.TagButton.prototype.openTag=function(h,f){var g=this;if(!f.openTags){f.openTags=[]}if(g.tagEnd){f.openTags.push(g.id);h.value="/"+h.value}};d.TagButton.prototype.closeTag=function(j,f){var h=this,g=h.isOpen(f);if(g!==false){f.openTags.splice(g,1)}j.value=h.display};d.TagButton.prototype.isOpen=function(e){var h=this,g=0,f=false;if(e.openTags){while(f===false&&g0){g.text=u.tagStart+g.text+u.tagEnd}else{if(u.isOpen(q)===false||u.tagEnd===""){g.text=u.tagStart;u.openTag(o,q)}else{g.text=u.tagEnd;u.closeTag(o,q)}}j.focus()}else{if(j.selectionStart||j.selectionStart=="0"){p=j.selectionStart;f=j.selectionEnd;m=f;h=j.scrollTop;k=s.substring(0,p);e=s.substring(f,s.length);n=s.substring(p,f);if(p!=f){j.value=k+u.tagStart+n+u.tagEnd+e;if(u.tagEnd===""){m=p}m+=u.tagStart.length+u.tagEnd.length}else{if(u.isOpen(q)===false||u.tagEnd===""){j.value=k+u.tagStart+e;u.openTag(o,q);m=p+u.tagStart.length}else{j.value=k+u.tagEnd+e;m=p+u.tagEnd.length;u.closeTag(o,q)}}j.focus();j.selectionStart=m;j.selectionEnd=m;j.scrollTop=h}else{if(u.isOpen(q)!==false||u.tagEnd===""){j.value+=u.tagStart;u.openTag(o,q)}else{j.value+=u.tagEnd;u.closeTag(o,q)}j.focus()}}};d.SpellButton=function(){d.Button.call(this,"spell",quicktagsL10n.lookup,"",quicktagsL10n.dictionaryLookup)};d.SpellButton.prototype=new d.Button();d.SpellButton.prototype.callback=function(h,g,i){var k="",j,f,e;if(document.selection){g.focus();j=document.selection.createRange();if(j.text.length>0){k=j.text}}else{if(g.selectionStart||g.selectionStart=="0"){f=g.selectionStart;e=g.selectionEnd;if(f!=e){k=g.value.substring(f,e)}}}if(k===""){k=prompt(quicktagsL10n.wordLookup,"")}if(k!==null&&/^\w[\w ]*$/.test(k)){window.open("http://www.answers.com/"+encodeURIComponent(k))}};d.CloseButton=function(){d.Button.call(this,"close",quicktagsL10n.closeTags,"",quicktagsL10n.closeAllOpenTags)};d.CloseButton.prototype=new d.Button();d.CloseButton.prototype.callback=function(j,k,f){var h,g,i=f.openTags;if(i){while(i.length>0){h=f.getButton(i[i.length-1]);g=document.getElementById(f.name+"_"+h.id);h.callback.call(h,g,k,f)}}};d.prototype.closeAllTags=function(){var e=this.getButton("close");e.callback.call(e,"",this.canvas,this.toolbar)};d.LinkButton=function(){d.TagButton.call(this,"link","link","","","a")};d.LinkButton.prototype=new d.TagButton();d.LinkButton.prototype.callback=function(j,k,h,g){var f,i=this;if(typeof(wpLink)!="undefined"){wpLink.open();return}if(!g){g="http://"}if(i.isOpen(h)===false){f=prompt(quicktagsL10n.enterURL,g);if(f){i.tagStart='';d.TagButton.prototype.callback.call(i,j,k,h)}}else{d.TagButton.prototype.callback.call(i,j,k,h)}};d.ImgButton=function(){d.TagButton.call(this,"img","img","","","m",-1)};d.ImgButton.prototype=new d.TagButton();d.ImgButton.prototype.callback=function(i,k,g,f){if(!f){f="http://"}var j=prompt(quicktagsL10n.enterImageURL,f),h;if(j){h=prompt(quicktagsL10n.enterImageDescription,"");this.tagStart=''+h+'';d.TagButton.prototype.callback.call(this,i,k,g)}};d.FullscreenButton=function(){d.Button.call(this,"fullscreen",quicktagsL10n.fullscreen,"f",quicktagsL10n.toggleFullscreen)};d.FullscreenButton.prototype=new d.Button();d.FullscreenButton.prototype.callback=function(f,g){if(g.id!="content"||typeof(fullscreen)=="undefined"){return}fullscreen.on()};edButtons[10]=new d.TagButton("strong","b","","","b");edButtons[20]=new d.TagButton("em","i","","","i"),edButtons[30]=new d.LinkButton(),edButtons[40]=new d.TagButton("block","b-quote","\n\n
","
\n\n","q"),edButtons[50]=new d.TagButton("del","del",'',"","d"),edButtons[60]=new d.TagButton("ins","ins",'',"","s"),edButtons[70]=new d.ImgButton(),edButtons[80]=new d.TagButton("ul","ul","
    \n","
\n\n","u"),edButtons[90]=new d.TagButton("ol","ol","
    \n","
\n\n","o"),edButtons[100]=new d.TagButton("li","li","\t
  • ","
  • \n","l"),edButtons[110]=new d.TagButton("code","code","","","c"),edButtons[120]=new d.TagButton("more","more","","","t",-1),edButtons[130]=new d.SpellButton(),edButtons[140]=new d.CloseButton()})(); \ No newline at end of file +var QTags,edButtons=[],edCanvas;function quicktags(a){return new QTags(a)}function edInsertContent(b,a){return QTags.insertContent(a)}function edButton(f,e,c,b,a,d){return QTags.addButton(f,e,c,b,d,a)}(function(){var c=function(h){var g,f,e;if(typeof jQuery!="undefined"){jQuery(document).ready(h)}else{g=c;g.funcs=[];g.ready=function(){if(!g.isReady){g.isReady=true;for(f=0;f'};d.Button.prototype.callback=function(){};d.TagButton=function(l,j,g,f,e,h,k){var i=this;d.Button.call(i,l,j,e,k);i.tagStart=g;i.tagEnd=f;i.open=h};d.TagButton.prototype=new d.Button();d.TagButton.prototype.openTag=function(h,f){var g=this;if(!f.openTags){f.openTags=[]}if(g.tagEnd){f.openTags.push(g.id);h.value="/"+h.value}};d.TagButton.prototype.closeTag=function(j,f){var h=this,g=h.isOpen(f);if(g!==false){f.openTags.splice(g,1)}j.value=h.display};d.TagButton.prototype.isOpen=function(e){var h=this,g=0,f=false;if(e.openTags){while(f===false&&g0){g.text=w.tagStart+g.text+m}else{if(w.isOpen(q)===false||w.tagEnd===""){g.text=w.tagStart;w.openTag(p,q)}else{g.text=m;w.closeTag(p,q)}}j.focus()}else{if(j.selectionStart||j.selectionStart=="0"){s=j.selectionStart;f=j.selectionEnd;n=f;h=j.scrollTop;k=u.substring(0,s);e=u.substring(f,u.length);o=u.substring(s,f);if(s!=f){j.value=k+w.tagStart+o+m+e;if(m===""){n=s}n+=w.tagStart.length+m.length}else{if(w.isOpen(q)===false||w.tagEnd===""){j.value=k+w.tagStart+e;w.openTag(p,q);n=s+w.tagStart.length}else{j.value=k+m+e;n=s+m.length;w.closeTag(p,q)}}j.focus();j.selectionStart=n;j.selectionEnd=n;j.scrollTop=h}else{if(w.isOpen(q)!==false||w.tagEnd===""){j.value+=w.tagStart;w.openTag(p,q)}else{j.value+=m;w.closeTag(p,q)}j.focus()}}};d.SpellButton=function(){d.Button.call(this,"spell",quicktagsL10n.lookup,"",quicktagsL10n.dictionaryLookup)};d.SpellButton.prototype=new d.Button();d.SpellButton.prototype.callback=function(i,h,e){var k="",j,g,f;if(document.selection){h.focus();j=document.selection.createRange();if(j.text.length>0){k=j.text}}else{if(h.selectionStart||h.selectionStart=="0"){g=h.selectionStart;f=h.selectionEnd;if(g!=f){k=h.value.substring(g,f)}}}if(k===""){k=prompt(quicktagsL10n.wordLookup,"")}if(k!==null&&/^\w[\w ]*$/.test(k)){window.open("http://www.answers.com/"+encodeURIComponent(k))}};d.CloseButton=function(){d.Button.call(this,"close",quicktagsL10n.closeTags,"",quicktagsL10n.closeAllOpenTags)};d.CloseButton.prototype=new d.Button();d.CloseButton.prototype.callback=function(j,k,f){var h,g,i=f.openTags;if(i){while(i.length>0){h=f.getButton(i[i.length-1]);g=document.getElementById(f.name+"_"+h.id);h.callback.call(h,g,k,f)}}};d.closeAllTags=function(g){var e=this.getInstance(g),f=e.getButton("close");f.callback.call(f,"",e.canvas,e)};d.LinkButton=function(){d.TagButton.call(this,"link","link","","
    ","a")};d.LinkButton.prototype=new d.TagButton();d.LinkButton.prototype.callback=function(j,k,h,g){var f,i=this;if(typeof(wpLink)!="undefined"){wpLink.open();return}if(!g){g="http://"}if(i.isOpen(h)===false){f=prompt(quicktagsL10n.enterURL,g);if(f){i.tagStart='';d.TagButton.prototype.callback.call(i,j,k,h)}}else{d.TagButton.prototype.callback.call(i,j,k,h)}};d.ImgButton=function(){d.TagButton.call(this,"img","img","","","m",-1)};d.ImgButton.prototype=new d.TagButton();d.ImgButton.prototype.callback=function(i,k,g,f){if(!f){f="http://"}var j=prompt(quicktagsL10n.enterImageURL,f),h;if(j){h=prompt(quicktagsL10n.enterImageDescription,"");this.tagStart=''+h+'';d.TagButton.prototype.callback.call(this,i,k,g)}};d.FullscreenButton=function(){d.Button.call(this,"fullscreen",quicktagsL10n.fullscreen,"f",quicktagsL10n.toggleFullscreen)};d.FullscreenButton.prototype=new d.Button();d.FullscreenButton.prototype.callback=function(f,g){if(g.id!="content"||typeof(fullscreen)=="undefined"){return}fullscreen.on()};edButtons[10]=new d.TagButton("strong","b","","","b");edButtons[20]=new d.TagButton("em","i","","","i"),edButtons[30]=new d.LinkButton(),edButtons[40]=new d.TagButton("block","b-quote","\n\n
    ","
    \n\n","q"),edButtons[50]=new d.TagButton("del","del",'',"","d"),edButtons[60]=new d.TagButton("ins","ins",'',"","s"),edButtons[70]=new d.ImgButton(),edButtons[80]=new d.TagButton("ul","ul","
      \n","
    \n\n","u"),edButtons[90]=new d.TagButton("ol","ol","
      \n","
    \n\n","o"),edButtons[100]=new d.TagButton("li","li","\t
  • ","
  • \n","l"),edButtons[110]=new d.TagButton("code","code","","","c"),edButtons[120]=new d.TagButton("more","more","","","t",-1),edButtons[130]=new d.SpellButton(),edButtons[140]=new d.CloseButton()})(); \ No newline at end of file diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 5a563a9321..83110e7126 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -68,7 +68,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1', 1 ); - $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20110819', 1 ); + $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20110820', 1 ); $scripts->add_script_data( 'quicktags', 'quicktagsL10n', array( 'wordLookup' => __('Enter a word to look up:'), 'dictionaryLookup' => esc_attr(__('Dictionary lookup')), @@ -84,7 +84,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' ); - $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), '20110802', 1 ); + $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), '20110820', 1 ); $scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110802', 1 ); @@ -269,7 +269,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20110429', 1 ); - $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'jquery-query'), '20110804', 1 ); + $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'quicktags', 'jquery-query'), '20110820', 1 ); $scripts->add_script_data( 'admin-comments', 'adminCommentsL10n', array( 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),