From 2d59e7feb0d1c3e5d6fb07a6b24acf571d4d16e5 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sat, 23 Apr 2011 02:12:56 +0000 Subject: [PATCH] Use wpLink in the HTML editor too, props koopersmith, fixes #16631 git-svn-id: https://develop.svn.wordpress.org/trunk@17687 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/js/quicktags.dev.js | 24 ++- wp-includes/js/quicktags.js | 2 +- .../plugins/wpdialogs/editor_plugin.dev.js | 115 +++++------- .../plugins/wpdialogs/editor_plugin.js | 2 +- .../plugins/wpdialogs/js/wpdialog.dev.js | 23 +++ .../tinymce/plugins/wpdialogs/js/wpdialog.js | 1 + .../tinymce/plugins/wplink/js/wplink.dev.js | 172 +++++++++++++++--- .../js/tinymce/plugins/wplink/js/wplink.js | 2 +- wp-includes/script-loader.php | 10 +- 9 files changed, 247 insertions(+), 104 deletions(-) create mode 100644 wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js create mode 100644 wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.js diff --git a/wp-includes/js/quicktags.dev.js b/wp-includes/js/quicktags.dev.js index 48b7b6a188..28e17a3f38 100644 --- a/wp-includes/js/quicktags.dev.js +++ b/wp-includes/js/quicktags.dev.js @@ -360,19 +360,23 @@ function edInsertContent(myField, myValue) { } function edInsertLink(myField, i, defaultValue) { - if (!defaultValue) { - defaultValue = 'http://'; - } - if (!edCheckOpenTags(i)) { - var URL = prompt(quicktagsL10n.enterURL, defaultValue); - if (URL) { - edButtons[i].tagStart = ''; + if ( 'object' == typeof(wpLink) ) { + wpLink.open(); + } else { + if (!defaultValue) { + defaultValue = 'http://'; + } + if (!edCheckOpenTags(i)) { + var URL = prompt(quicktagsL10n.enterURL, defaultValue); + if (URL) { + edButtons[i].tagStart = ''; + edInsertTag(myField, i); + } + } + else { edInsertTag(myField, i); } } - else { - edInsertTag(myField, i); - } } function edInsertImage(myField) { diff --git a/wp-includes/js/quicktags.js b/wp-includes/js/quicktags.js index da51f4e96f..f99a8ee218 100644 --- a/wp-includes/js/quicktags.js +++ b/wp-includes/js/quicktags.js @@ -1 +1 @@ -var edButtons=new Array(),edLinks=new Array(),edOpenTags=new Array(),now=new Date(),datetime;function edButton(f,e,c,b,a,d){this.id=f;this.display=e;this.tagStart=c;this.tagEnd=b;this.access=a;this.open=d}function zeroise(b,a){var c=b.toString();if(b<0){c=c.substr(1,c.length)}while(c.length","","b");edButtons[edButtons.length]=new edButton("ed_em","i","","","i");edButtons[edButtons.length]=new edButton("ed_link","link","","","a");edButtons[edButtons.length]=new edButton("ed_block","b-quote","\n\n
","
\n\n","q");edButtons[edButtons.length]=new edButton("ed_del","del",'',"","d");edButtons[edButtons.length]=new edButton("ed_ins","ins",'',"","s");edButtons[edButtons.length]=new edButton("ed_img","img","","","m",-1);edButtons[edButtons.length]=new edButton("ed_ul","ul","\n\n","u");edButtons[edButtons.length]=new edButton("ed_ol","ol","
    \n","
\n\n","o");edButtons[edButtons.length]=new edButton("ed_li","li","\t
  • ","
  • \n","l");edButtons[edButtons.length]=new edButton("ed_code","code","","","c");edButtons[edButtons.length]=new edButton("ed_more","more","","","t",-1);function edLink(){this.display="";this.URL="";this.newWin=0}edLinks[edLinks.length]=new edLink("WordPress","http://wordpress.org/");edLinks[edLinks.length]=new edLink("alexking.org","http://www.alexking.org/");function edShowButton(b,a){if(b.id=="ed_img"){document.write('')}else{if(b.id=="ed_link"){document.write('')}else{document.write('')}}}function edShowLinks(){var a='";document.write(a)}function edAddTag(a){if(edButtons[a].tagEnd!=""){edOpenTags[edOpenTags.length]=a;document.getElementById(edButtons[a].id).value="/"+document.getElementById(edButtons[a].id).value}}function edRemoveTag(b){for(var a=0;a0){return true}else{return false}}function edCloseAllTags(){var a=edOpenTags.length,b;for(b=0;b-1){var b="",a;if(edLinks[c].newWin==1){b=' target="_blank"'}a='"+edLinks[c].display+"";d.selectedIndex=0;edInsertContent(edCanvas,a)}else{d.selectedIndex=0}}function edSpell(c){var e="",d,b,a;if(document.selection){c.focus();d=document.selection.createRange();if(d.text.length>0){e=d.text}}else{if(c.selectionStart||c.selectionStart=="0"){b=c.selectionStart;a=c.selectionEnd;if(b!=a){e=c.value.substring(b,a)}}}if(e==""){e=prompt(quicktagsL10n.wordLookup,"")}if(e!==null&&/^\w[\w ]*$/.test(e)){window.open("http://www.answers.com/"+escape(e))}}function edToolbar(){document.write('
    ');for(var a=0;a');document.write('');document.write("
    ")}function edInsertTag(d,c){if(document.selection){d.focus();var e=document.selection.createRange();if(e.text.length>0){e.text=edButtons[c].tagStart+e.text+edButtons[c].tagEnd}else{if(!edCheckOpenTags(c)||edButtons[c].tagEnd==""){e.text=edButtons[c].tagStart;edAddTag(c)}else{e.text=edButtons[c].tagEnd;edRemoveTag(c)}}d.focus()}else{if(d.selectionStart||d.selectionStart=="0"){var b=d.selectionStart,a=d.selectionEnd,g=a,f=d.scrollTop;if(b!=a){d.value=d.value.substring(0,b)+edButtons[c].tagStart+d.value.substring(b,a)+edButtons[c].tagEnd+d.value.substring(a,d.value.length);g+=edButtons[c].tagStart.length+edButtons[c].tagEnd.length}else{if(!edCheckOpenTags(c)||edButtons[c].tagEnd==""){d.value=d.value.substring(0,b)+edButtons[c].tagStart+d.value.substring(a,d.value.length);edAddTag(c);g=b+edButtons[c].tagStart.length}else{d.value=d.value.substring(0,b)+edButtons[c].tagEnd+d.value.substring(a,d.value.length);edRemoveTag(c);g=b+edButtons[c].tagEnd.length}}d.focus();d.selectionStart=g;d.selectionEnd=g;d.scrollTop=f}else{if(!edCheckOpenTags(c)||edButtons[c].tagEnd==""){d.value+=edButtons[c].tagStart;edAddTag(c)}else{d.value+=edButtons[c].tagEnd;edRemoveTag(c)}d.focus()}}}function edInsertContent(d,c){var e,b,a,f;if(document.selection){d.focus();e=document.selection.createRange();e.text=c;d.focus()}else{if(d.selectionStart||d.selectionStart=="0"){b=d.selectionStart;a=d.selectionEnd;f=d.scrollTop;d.value=d.value.substring(0,b)+c+d.value.substring(a,d.value.length);d.focus();d.selectionStart=b+c.length;d.selectionEnd=b+c.length;d.scrollTop=f}else{d.value+=c;d.focus()}}}function edInsertLink(d,c,b){if(!b){b="http://"}if(!edCheckOpenTags(c)){var a=prompt(quicktagsL10n.enterURL,b);if(a){edButtons[c].tagStart='';edInsertTag(d,c)}}else{edInsertTag(d,c)}}function edInsertImage(b){var a=prompt(quicktagsL10n.enterImageURL,"http://");if(a){a=''+prompt(quicktagsL10n.enterImageDescription,';edInsertContent(b,a)}}var QTags=function(a,c,b,f){var j=this,k=document.getElementById(b),g,l,e,h,d;j.Buttons=[];j.Links=[];j.OpenTags=[];j.Canvas=document.getElementById(c);if(!j.Canvas||!k){return}f=(typeof f!="undefined")?","+f+",":"";j.edShowButton=function(n,m){if(f&&(f.indexOf(","+n.display+",")!=-1)){return""}else{if(n.id==a+"_img"){return''}else{if(n.id==a+"_link"){return''}else{return''}}}};j.edAddTag=function(i){if(j.Buttons[i].tagEnd!=""){j.OpenTags[j.OpenTags.length]=i;document.getElementById(j.Buttons[i].id).value="/"+document.getElementById(j.Buttons[i].id).value}};j.edRemoveTag=function(i){for(g=0;g0){return true}else{return false}};this.edCloseAllTags=function(){var i=j.OpenTags.length;for(var m=0;m-1){var n="",m;if(Links[o].newWin==1){n=' target="_blank"'}m='"+Links[o].display+"";p.selectedIndex=0;edInsertContent(j.Canvas,m)}else{p.selectedIndex=0}};j.edInsertTag=function(o){if(document.selection){j.Canvas.focus();d=document.selection.createRange();if(d.text.length>0){d.text=j.Buttons[o].tagStart+d.text+j.Buttons[o].tagEnd}else{if(!j.edCheckOpenTags(o)||j.Buttons[o].tagEnd==""){d.text=j.Buttons[o].tagStart;j.edAddTag(o)}else{d.text=j.Buttons[o].tagEnd;j.edRemoveTag(o)}}j.Canvas.focus()}else{if(j.Canvas.selectionStart||j.Canvas.selectionStart=="0"){var n=j.Canvas.selectionStart,m=j.Canvas.selectionEnd,q=m,p=j.Canvas.scrollTop;if(n!=m){j.Canvas.value=j.Canvas.value.substring(0,n)+j.Buttons[o].tagStart+j.Canvas.value.substring(n,m)+j.Buttons[o].tagEnd+j.Canvas.value.substring(m,j.Canvas.value.length);q+=j.Buttons[o].tagStart.length+j.Buttons[o].tagEnd.length}else{if(!j.edCheckOpenTags(o)||j.Buttons[o].tagEnd==""){j.Canvas.value=j.Canvas.value.substring(0,n)+j.Buttons[o].tagStart+j.Canvas.value.substring(m,j.Canvas.value.length);j.edAddTag(o);q=n+j.Buttons[o].tagStart.length}else{j.Canvas.value=j.Canvas.value.substring(0,n)+j.Buttons[o].tagEnd+j.Canvas.value.substring(m,j.Canvas.value.length);j.edRemoveTag(o);q=n+j.Buttons[o].tagEnd.length}}j.Canvas.focus();j.Canvas.selectionStart=q;j.Canvas.selectionEnd=q;j.Canvas.scrollTop=p}else{if(!j.edCheckOpenTags(o)||j.Buttons[o].tagEnd==""){j.Canvas.value+=Buttons[o].tagStart;j.edAddTag(o)}else{j.Canvas.value+=Buttons[o].tagEnd;j.edRemoveTag(o)}j.Canvas.focus()}}};this.edInsertLink=function(o,n){if(!n){n="http://"}if(!j.edCheckOpenTags(o)){var m=prompt(quicktagsL10n.enterURL,n);if(m){j.Buttons[o].tagStart='';j.edInsertTag(o)}}else{j.edInsertTag(o)}};this.edInsertImage=function(){var i=prompt(quicktagsL10n.enterImageURL,"http://");if(i){i=''+prompt(quicktagsL10n.enterImageDescription,';edInsertContent(j.Canvas,i)}};j.Buttons[j.Buttons.length]=new edButton(a+"_strong","b","","","b");j.Buttons[j.Buttons.length]=new edButton(a+"_em","i","","","i");j.Buttons[j.Buttons.length]=new edButton(a+"_link","link","","","a");j.Buttons[j.Buttons.length]=new edButton(a+"_block","b-quote","\n\n
    ","
    \n\n","q");j.Buttons[j.Buttons.length]=new edButton(a+"_del","del",'',"","d");j.Buttons[j.Buttons.length]=new edButton(a+"_ins","ins",'',"","s");j.Buttons[j.Buttons.length]=new edButton(a+"_img","img","","","m",-1);j.Buttons[j.Buttons.length]=new edButton(a+"_ul","ul","
      \n","
    \n\n","u");j.Buttons[j.Buttons.length]=new edButton(a+"_ol","ol","
      \n","
    \n\n","o");j.Buttons[j.Buttons.length]=new edButton(a+"_li","li","\t
  • ","
  • \n","l");j.Buttons[j.Buttons.length]=new edButton(a+"_code","code","","","c");j.Buttons[j.Buttons.length]=new edButton(a+"_more","more","","","t",-1);e=document.createElement("div");e.id=a+"_qtags";h='
    ';for(g=0;g';h+='
    ';e.innerHTML=h;k.parentNode.insertBefore(e,k)}; \ No newline at end of file +var edButtons=new Array(),edLinks=new Array(),edOpenTags=new Array(),now=new Date(),datetime;function edButton(f,e,c,b,a,d){this.id=f;this.display=e;this.tagStart=c;this.tagEnd=b;this.access=a;this.open=d}function zeroise(b,a){var c=b.toString();if(b<0){c=c.substr(1,c.length)}while(c.length","","b");edButtons[edButtons.length]=new edButton("ed_em","i","","","i");edButtons[edButtons.length]=new edButton("ed_link","link","","","a");edButtons[edButtons.length]=new edButton("ed_block","b-quote","\n\n
    ","
    \n\n","q");edButtons[edButtons.length]=new edButton("ed_del","del",'',"","d");edButtons[edButtons.length]=new edButton("ed_ins","ins",'',"","s");edButtons[edButtons.length]=new edButton("ed_img","img","","","m",-1);edButtons[edButtons.length]=new edButton("ed_ul","ul","
      \n","
    \n\n","u");edButtons[edButtons.length]=new edButton("ed_ol","ol","
      \n","
    \n\n","o");edButtons[edButtons.length]=new edButton("ed_li","li","\t
  • ","
  • \n","l");edButtons[edButtons.length]=new edButton("ed_code","code","","","c");edButtons[edButtons.length]=new edButton("ed_more","more","","","t",-1);function edLink(){this.display="";this.URL="";this.newWin=0}edLinks[edLinks.length]=new edLink("WordPress","http://wordpress.org/");edLinks[edLinks.length]=new edLink("alexking.org","http://www.alexking.org/");function edShowButton(b,a){if(b.id=="ed_img"){document.write('')}else{if(b.id=="ed_link"){document.write('')}else{document.write('')}}}function edShowLinks(){var a='";document.write(a)}function edAddTag(a){if(edButtons[a].tagEnd!=""){edOpenTags[edOpenTags.length]=a;document.getElementById(edButtons[a].id).value="/"+document.getElementById(edButtons[a].id).value}}function edRemoveTag(b){for(var a=0;a0){return true}else{return false}}function edCloseAllTags(){var a=edOpenTags.length,b;for(b=0;b-1){var b="",a;if(edLinks[c].newWin==1){b=' target="_blank"'}a='"+edLinks[c].display+"";d.selectedIndex=0;edInsertContent(edCanvas,a)}else{d.selectedIndex=0}}function edSpell(c){var e="",d,b,a;if(document.selection){c.focus();d=document.selection.createRange();if(d.text.length>0){e=d.text}}else{if(c.selectionStart||c.selectionStart=="0"){b=c.selectionStart;a=c.selectionEnd;if(b!=a){e=c.value.substring(b,a)}}}if(e==""){e=prompt(quicktagsL10n.wordLookup,"")}if(e!==null&&/^\w[\w ]*$/.test(e)){window.open("http://www.answers.com/"+escape(e))}}function edToolbar(){document.write('
    ');for(var a=0;a');document.write('');document.write("
    ")}function edInsertTag(d,c){if(document.selection){d.focus();var e=document.selection.createRange();if(e.text.length>0){e.text=edButtons[c].tagStart+e.text+edButtons[c].tagEnd}else{if(!edCheckOpenTags(c)||edButtons[c].tagEnd==""){e.text=edButtons[c].tagStart;edAddTag(c)}else{e.text=edButtons[c].tagEnd;edRemoveTag(c)}}d.focus()}else{if(d.selectionStart||d.selectionStart=="0"){var b=d.selectionStart,a=d.selectionEnd,g=a,f=d.scrollTop;if(b!=a){d.value=d.value.substring(0,b)+edButtons[c].tagStart+d.value.substring(b,a)+edButtons[c].tagEnd+d.value.substring(a,d.value.length);g+=edButtons[c].tagStart.length+edButtons[c].tagEnd.length}else{if(!edCheckOpenTags(c)||edButtons[c].tagEnd==""){d.value=d.value.substring(0,b)+edButtons[c].tagStart+d.value.substring(a,d.value.length);edAddTag(c);g=b+edButtons[c].tagStart.length}else{d.value=d.value.substring(0,b)+edButtons[c].tagEnd+d.value.substring(a,d.value.length);edRemoveTag(c);g=b+edButtons[c].tagEnd.length}}d.focus();d.selectionStart=g;d.selectionEnd=g;d.scrollTop=f}else{if(!edCheckOpenTags(c)||edButtons[c].tagEnd==""){d.value+=edButtons[c].tagStart;edAddTag(c)}else{d.value+=edButtons[c].tagEnd;edRemoveTag(c)}d.focus()}}}function edInsertContent(d,c){var e,b,a,f;if(document.selection){d.focus();e=document.selection.createRange();e.text=c;d.focus()}else{if(d.selectionStart||d.selectionStart=="0"){b=d.selectionStart;a=d.selectionEnd;f=d.scrollTop;d.value=d.value.substring(0,b)+c+d.value.substring(a,d.value.length);d.focus();d.selectionStart=b+c.length;d.selectionEnd=b+c.length;d.scrollTop=f}else{d.value+=c;d.focus()}}}function edInsertLink(d,c,b){if("object"==typeof(wpLink)){wpLink.open()}else{if(!b){b="http://"}if(!edCheckOpenTags(c)){var a=prompt(quicktagsL10n.enterURL,b);if(a){edButtons[c].tagStart='';edInsertTag(d,c)}}else{edInsertTag(d,c)}}}function edInsertImage(b){var a=prompt(quicktagsL10n.enterImageURL,"http://");if(a){a=''+prompt(quicktagsL10n.enterImageDescription,';edInsertContent(b,a)}}var QTags=function(a,c,b,f){var j=this,k=document.getElementById(b),g,l,e,h,d;j.Buttons=[];j.Links=[];j.OpenTags=[];j.Canvas=document.getElementById(c);if(!j.Canvas||!k){return}f=(typeof f!="undefined")?","+f+",":"";j.edShowButton=function(n,m){if(f&&(f.indexOf(","+n.display+",")!=-1)){return""}else{if(n.id==a+"_img"){return''}else{if(n.id==a+"_link"){return''}else{return''}}}};j.edAddTag=function(i){if(j.Buttons[i].tagEnd!=""){j.OpenTags[j.OpenTags.length]=i;document.getElementById(j.Buttons[i].id).value="/"+document.getElementById(j.Buttons[i].id).value}};j.edRemoveTag=function(i){for(g=0;g0){return true}else{return false}};this.edCloseAllTags=function(){var i=j.OpenTags.length;for(var m=0;m-1){var n="",m;if(Links[o].newWin==1){n=' target="_blank"'}m='"+Links[o].display+"";p.selectedIndex=0;edInsertContent(j.Canvas,m)}else{p.selectedIndex=0}};j.edInsertTag=function(o){if(document.selection){j.Canvas.focus();d=document.selection.createRange();if(d.text.length>0){d.text=j.Buttons[o].tagStart+d.text+j.Buttons[o].tagEnd}else{if(!j.edCheckOpenTags(o)||j.Buttons[o].tagEnd==""){d.text=j.Buttons[o].tagStart;j.edAddTag(o)}else{d.text=j.Buttons[o].tagEnd;j.edRemoveTag(o)}}j.Canvas.focus()}else{if(j.Canvas.selectionStart||j.Canvas.selectionStart=="0"){var n=j.Canvas.selectionStart,m=j.Canvas.selectionEnd,q=m,p=j.Canvas.scrollTop;if(n!=m){j.Canvas.value=j.Canvas.value.substring(0,n)+j.Buttons[o].tagStart+j.Canvas.value.substring(n,m)+j.Buttons[o].tagEnd+j.Canvas.value.substring(m,j.Canvas.value.length);q+=j.Buttons[o].tagStart.length+j.Buttons[o].tagEnd.length}else{if(!j.edCheckOpenTags(o)||j.Buttons[o].tagEnd==""){j.Canvas.value=j.Canvas.value.substring(0,n)+j.Buttons[o].tagStart+j.Canvas.value.substring(m,j.Canvas.value.length);j.edAddTag(o);q=n+j.Buttons[o].tagStart.length}else{j.Canvas.value=j.Canvas.value.substring(0,n)+j.Buttons[o].tagEnd+j.Canvas.value.substring(m,j.Canvas.value.length);j.edRemoveTag(o);q=n+j.Buttons[o].tagEnd.length}}j.Canvas.focus();j.Canvas.selectionStart=q;j.Canvas.selectionEnd=q;j.Canvas.scrollTop=p}else{if(!j.edCheckOpenTags(o)||j.Buttons[o].tagEnd==""){j.Canvas.value+=Buttons[o].tagStart;j.edAddTag(o)}else{j.Canvas.value+=Buttons[o].tagEnd;j.edRemoveTag(o)}j.Canvas.focus()}}};this.edInsertLink=function(o,n){if(!n){n="http://"}if(!j.edCheckOpenTags(o)){var m=prompt(quicktagsL10n.enterURL,n);if(m){j.Buttons[o].tagStart='';j.edInsertTag(o)}}else{j.edInsertTag(o)}};this.edInsertImage=function(){var i=prompt(quicktagsL10n.enterImageURL,"http://");if(i){i=''+prompt(quicktagsL10n.enterImageDescription,';edInsertContent(j.Canvas,i)}};j.Buttons[j.Buttons.length]=new edButton(a+"_strong","b","","","b");j.Buttons[j.Buttons.length]=new edButton(a+"_em","i","","","i");j.Buttons[j.Buttons.length]=new edButton(a+"_link","link","","","a");j.Buttons[j.Buttons.length]=new edButton(a+"_block","b-quote","\n\n
    ","
    \n\n","q");j.Buttons[j.Buttons.length]=new edButton(a+"_del","del",'',"","d");j.Buttons[j.Buttons.length]=new edButton(a+"_ins","ins",'',"","s");j.Buttons[j.Buttons.length]=new edButton(a+"_img","img","","","m",-1);j.Buttons[j.Buttons.length]=new edButton(a+"_ul","ul","
      \n","
    \n\n","u");j.Buttons[j.Buttons.length]=new edButton(a+"_ol","ol","
      \n","
    \n\n","o");j.Buttons[j.Buttons.length]=new edButton(a+"_li","li","\t
  • ","
  • \n","l");j.Buttons[j.Buttons.length]=new edButton(a+"_code","code","","","c");j.Buttons[j.Buttons.length]=new edButton(a+"_more","more","","","t",-1);e=document.createElement("div");e.id=a+"_qtags";h='
    ';for(g=0;g';h+='
    ';e.innerHTML=h;k.parentNode.insertBefore(e,k)}; \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js b/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js index bdc63ddc5b..4be9c3faf4 100644 --- a/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js +++ b/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js @@ -8,18 +8,56 @@ * Contributing: http://tinymce.moxiecode.com/contributing */ -(function($) { - var wpDialogFn = function( fn ) { - return function() { - if ( this.features.wpDialog ) - return fn.apply( this, arguments ); - else - return this.parent.apply( this, arguments ); - }; - }; - +(function() { tinymce.create('tinymce.plugins.WPDialogs', { init : function(ed, url) { + tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', { + WPWindowManager : function(ed) { + this.parent(ed); + }, + + open : function(f, p) { + var t = this, element; + + if ( ! f.wpDialog ) + return this.parent( f, p ); + else if ( ! f.id ) + return; + + element = jQuery('#' + f.id); + if ( ! element.length ) + return; + + t.features = f; + t.params = p; + t.onOpen.dispatch(t, f, p); + t.element = t.windows[ f.id ] = element; + + // Store selection + t.bookmark = t.editor.selection.getBookmark(1); + + // Create the dialog if necessary + if ( ! element.data('wpdialog') ) { + element.wpdialog({ + title: f.title, + width: f.width, + height: f.height, + modal: true, + dialogClass: 'wp-dialog', + zIndex: 300000 + }); + } + + element.wpdialog('open'); + }, + close : function() { + if ( ! this.features.wpDialog ) + return this.parent.apply( this, arguments ); + + this.element.wpdialog('close'); + } + }); + // Replace window manager ed.onBeforeRenderUI.add(function() { ed.windowManager = new tinymce.WPWindowManager(ed); @@ -36,62 +74,7 @@ }; } }); - - $(document).ready(function() { - $.widget("wp.wpdialog", $.ui.dialog, { - open: function() { - // Initialize tinyMCEPopup if it exists. - if ( tinyMCEPopup ) - tinyMCEPopup.init(); - // Open the dialog. - $.ui.dialog.prototype.open.apply( this, arguments ); - // WebKit leaves focus in the TinyMCE editor unless we shift focus. - this.element.focus(); - this._trigger('refresh'); - } - }); - }); - - tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', { - WPWindowManager : function(ed) { - this.parent(ed); - }, - - open : function(f, p) { - var t = this, element; - // Can't use wpDialogFn here; this.features isn't set yet. - if ( ! f.wpDialog ) - return this.parent( f, p ); - else if ( ! f.id ) - return; - - element = $('#' + f.id); - if ( ! element.length ) - return; - - t.features = f; - t.params = p; - t.onOpen.dispatch(t, f, p); - t.element = t.windows[ f.id ] = element; - - // Store selection - t.bookmark = t.editor.selection.getBookmark(1); - - element.wpdialog({ - title: f.title, - width: f.width, - height: f.height, - modal: true, - dialogClass: 'wp-dialog', - zIndex: 300000 - }); - }, - close : wpDialogFn(function() { - this.element.wpdialog('close'); - }) - }); // Register plugin tinymce.PluginManager.add('wpdialogs', tinymce.plugins.WPDialogs); -})(jQuery); - +})(); diff --git a/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js b/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js index fc621f13a9..1ba21e3ce3 100644 --- a/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js @@ -1 +1 @@ -(function(b){var a=function(c){return function(){if(this.features.wpDialog){return c.apply(this,arguments)}else{return this.parent.apply(this,arguments)}}};tinymce.create("tinymce.plugins.WPDialogs",{init:function(c,d){c.onBeforeRenderUI.add(function(){c.windowManager=new tinymce.WPWindowManager(c)})},getInfo:function(){return{longname:"WPDialogs",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"0.1"}}});b(document).ready(function(){b.widget("wp.wpdialog",b.ui.dialog,{open:function(){if(tinyMCEPopup){tinyMCEPopup.init()}b.ui.dialog.prototype.open.apply(this,arguments);this.element.focus();this._trigger("refresh")}})});tinymce.create("tinymce.WPWindowManager:tinymce.InlineWindowManager",{WPWindowManager:function(c){this.parent(c)},open:function(e,g){var d=this,c;if(!e.wpDialog){return this.parent(e,g)}else{if(!e.id){return}}c=b("#"+e.id);if(!c.length){return}d.features=e;d.params=g;d.onOpen.dispatch(d,e,g);d.element=d.windows[e.id]=c;d.bookmark=d.editor.selection.getBookmark(1);c.wpdialog({title:e.title,width:e.width,height:e.height,modal:true,dialogClass:"wp-dialog",zIndex:300000})},close:a(function(){this.element.wpdialog("close")})});tinymce.PluginManager.add("wpdialogs",tinymce.plugins.WPDialogs)})(jQuery); \ No newline at end of file +(function(){tinymce.create("tinymce.plugins.WPDialogs",{init:function(a,b){tinymce.create("tinymce.WPWindowManager:tinymce.InlineWindowManager",{WPWindowManager:function(c){this.parent(c)},open:function(e,g){var d=this,c;if(!e.wpDialog){return this.parent(e,g)}else{if(!e.id){return}}c=jQuery("#"+e.id);if(!c.length){return}d.features=e;d.params=g;d.onOpen.dispatch(d,e,g);d.element=d.windows[e.id]=c;d.bookmark=d.editor.selection.getBookmark(1);if(!c.data("wpdialog")){c.wpdialog({title:e.title,width:e.width,height:e.height,modal:true,dialogClass:"wp-dialog",zIndex:300000})}c.wpdialog("open")},close:function(){if(!this.features.wpDialog){return this.parent.apply(this,arguments)}this.element.wpdialog("close")}});a.onBeforeRenderUI.add(function(){a.windowManager=new tinymce.WPWindowManager(a)})},getInfo:function(){return{longname:"WPDialogs",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"0.1"}}});tinymce.PluginManager.add("wpdialogs",tinymce.plugins.WPDialogs)})(); \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js b/wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js new file mode 100644 index 0000000000..620213fe85 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js @@ -0,0 +1,23 @@ +(function($){ + $.widget("wp.wpdialog", $.ui.dialog, { + open: function() { + var ed; + + // Initialize tinyMCEPopup if it exists and is the editor is active. + if ( tinyMCEPopup && typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) { + tinyMCEPopup.init(); + } + + // Add beforeOpen event. + if ( this._isOpen || false === this._trigger('beforeOpen') ) { + return; + } + + // Open the dialog. + $.ui.dialog.prototype.open.apply( this, arguments ); + // WebKit leaves focus in the TinyMCE editor unless we shift focus. + this.element.focus(); + this._trigger('refresh'); + } + }); +})(jQuery); diff --git a/wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.js b/wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.js new file mode 100644 index 0000000000..bf6f05ce17 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.js @@ -0,0 +1 @@ +(function(a){a.widget("wp.wpdialog",a.ui.dialog,{open:function(){var b;if(tinyMCEPopup&&typeof tinyMCE!="undefined"&&(b=tinyMCE.activeEditor)&&!b.isHidden()){tinyMCEPopup.init()}if(this._isOpen||false===this._trigger("beforeOpen")){return}a.ui.dialog.prototype.open.apply(this,arguments);this.element.focus();this._trigger("refresh")}})})(jQuery); \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js b/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js index 8f12ebec29..233c491638 100644 --- a/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js +++ b/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js @@ -9,6 +9,8 @@ var wpLink; riverBottomThreshold: 5, keySensitivity: 100, lastSearch: '', + textarea: edCanvas, + init : function() { inputs.dialog = $('#wp-link'); inputs.submit = $('#wp-link-submit'); @@ -31,7 +33,7 @@ var wpLink; wpLink.update(); e.preventDefault(); }); - $('#wp-link-cancel').click( wpLink.cancel ); + $('#wp-link-cancel').click( wpLink.close ); $('#internal-toggle').click( wpLink.toggleInternalLinking ); rivers.elements.bind('river-select', wpLink.updateFields ); @@ -39,16 +41,62 @@ var wpLink; inputs.search.keyup( wpLink.searchInternalLinks ); inputs.dialog.bind('wpdialogrefresh', wpLink.refresh); + inputs.dialog.bind('wpdialogbeforeopen', wpLink.beforeOpen); + inputs.dialog.bind('wpdialogclose', wpLink.onClose); + }, + + beforeOpen : function() { + wpLink.range = null; + + if ( ! wpLink.isMCE() && document.selection ) { + wpLink.textarea.focus(); + wpLink.range = document.selection.createRange(); + } + }, + + open : function() { + // Initialize the dialog if necessary (html mode). + if ( ! inputs.dialog.data('wpdialog') ) { + inputs.dialog.wpdialog({ + title: wpLinkL10n.title, + width: 480, + height: 'auto', + modal: true, + dialogClass: 'wp-dialog', + zIndex: 300000 + }); + } + + inputs.dialog.wpdialog('open'); + }, + + isMCE : function() { + return tinyMCEPopup && ( ed = tinyMCEPopup.editor ) && ! ed.isHidden(); }, refresh : function() { - var e; - ed = tinyMCEPopup.editor; - // Refresh rivers (clear links, check visibility) rivers.search.refresh(); rivers.recent.refresh(); + if ( wpLink.isMCE() ) + wpLink.mceRefresh(); + else + wpLink.setDefaultValues(); + + // Focus the URL field and highlight its contents. + // If this is moved above the selection changes, + // IE will show a flashing cursor over the dialog. + inputs.url.focus()[0].select(); + // Load the most recent results if this is the first time opening the panel. + if ( ! rivers.recent.ul.children().length ) + rivers.recent.ajax(); + }, + + mceRefresh : function() { + var e; + ed = tinyMCEPopup.editor; + tinyMCEPopup.restoreSelection(); // If link exists, select proper values. @@ -65,31 +113,106 @@ var wpLink; // If there's no link, set the default values. } else { wpLink.setDefaultValues(); - // Update save prompt. - inputs.submit.val( wpLinkL10n.save ); } tinyMCEPopup.storeSelection(); - // Focus the URL field and highlight its contents. - // If this is moved above the selection changes, - // IE will show a flashing cursor over the dialog. - inputs.url.focus()[0].select(); - // Load the most recent results if this is the first time opening the panel. - if ( ! rivers.recent.ul.children().length ) - rivers.recent.ajax(); }, - cancel : function() { - tinyMCEPopup.close(); + close : function() { + if ( wpLink.isMCE() ) + tinyMCEPopup.close(); + else + inputs.dialog.wpdialog('close'); + }, + + onClose: function() { + if ( ! wpLink.isMCE() ) { + wpLink.textarea.focus(); + if ( wpLink.range ) { + wpLink.range.moveToBookmark( wpLink.range.getBookmark() ); + wpLink.range.select(); + } + } + }, + + getAttrs : function() { + return { + href : inputs.url.val(), + title : inputs.title.val(), + target : inputs.openInNewTab.attr('checked') ? '_blank' : '' + }; }, update : function() { + if ( wpLink.isMCE() ) + wpLink.mceUpdate(); + else + wpLink.htmlUpdate(); + }, + + htmlUpdate : function() { + var attrs, html, start, end, cursor, + textarea = wpLink.textarea; + + if ( ! textarea ) + return; + + attrs = wpLink.getAttrs(); + + // If there's no href, return. + if ( ! attrs.href || attrs.href == 'http://' ) + return; + + // Build HTML + html = ''; + cursor = start + html.length; + + // If no next is selected, place the cursor inside the closing tag. + if ( start == end ) + cursor -= ''.length; + + textarea.value = textarea.value.substring( 0, start ) + + html + + textarea.value.substring( end, textarea.value.length ); + + // Update cursor position + textarea.selectionStart = textarea.selectionEnd = cursor; + + // IE + // Note: If no text is selected, IE will not place the cursor + // inside the closing tag. + } else if ( document.selection && wpLink.range ) { + textarea.focus(); + wpLink.range.text = html + wpLink.range.text + ''; + wpLink.range.moveToBookmark( wpLink.range.getBookmark() ); + wpLink.range.select(); + + wpLink.range = null; + } + + wpLink.close(); + textarea.focus(); + }, + + mceUpdate : function() { var ed = tinyMCEPopup.editor, - attrs = { - href : inputs.url.val(), - title : inputs.title.val(), - target : inputs.openInNewTab.attr('checked') ? '_blank' : '' - }, e, b; + attrs = wpLink.getAttrs(), + e, b; tinyMCEPopup.restoreSelection(); e = ed.dom.getParent(ed.selection.getNode(), 'A'); @@ -102,7 +225,7 @@ var wpLink; ed.dom.remove(e, 1); ed.selection.moveToBookmark(b); tinyMCEPopup.execCommand("mceEndUndoLevel"); - tinyMCEPopup.close(); + wpLink.close(); } return; } @@ -140,7 +263,7 @@ var wpLink; } tinyMCEPopup.execCommand("mceEndUndoLevel"); - tinyMCEPopup.close(); + wpLink.close(); }, updateFields : function( e, li, originalEvent ) { @@ -154,6 +277,9 @@ var wpLink; // Leave the new tab setting as-is. inputs.url.val('http://'); inputs.title.val(''); + + // Update save prompt. + inputs.submit.val( wpLinkL10n.save ); }, searchInternalLinks : function() { @@ -210,7 +336,7 @@ var wpLink; switch( event.which ) { case key.ESCAPE: - wpLink.cancel(); + wpLink.close(); break; case key.UP: case key.DOWN: diff --git a/wp-includes/js/tinymce/plugins/wplink/js/wplink.js b/wp-includes/js/tinymce/plugins/wplink/js/wplink.js index 565c49bb05..0da1d8a2cc 100644 --- a/wp-includes/js/tinymce/plugins/wplink/js/wplink.js +++ b/wp-includes/js/tinymce/plugins/wplink/js/wplink.js @@ -1 +1 @@ -var wpLink;(function(f){var b={},e={},d,a,c;wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5,keySensitivity:100,lastSearch:"",init:function(){b.dialog=f("#wp-link");b.submit=f("#wp-link-submit");b.url=f("#url-field");b.title=f("#link-title-field");b.openInNewTab=f("#link-target-checkbox");b.search=f("#search-field");e.search=new a(f("#search-results"));e.recent=new a(f("#most-recent-results"));e.elements=f(".query-results",b.dialog);b.dialog.keydown(wpLink.keydown);b.dialog.keyup(wpLink.keyup);b.submit.click(function(g){wpLink.update();g.preventDefault()});f("#wp-link-cancel").click(wpLink.cancel);f("#internal-toggle").click(wpLink.toggleInternalLinking);e.elements.bind("river-select",wpLink.updateFields);b.search.keyup(wpLink.searchInternalLinks);b.dialog.bind("wpdialogrefresh",wpLink.refresh)},refresh:function(){var g;d=tinyMCEPopup.editor;e.search.refresh();e.recent.refresh();tinyMCEPopup.restoreSelection();if(g=d.dom.getParent(d.selection.getNode(),"A")){b.url.val(g.href);b.title.val(d.dom.getAttrib(g,"title"));if("_blank"==d.dom.getAttrib(g,"target")){b.openInNewTab.attr("checked","checked")}b.submit.val(wpLinkL10n.update)}else{wpLink.setDefaultValues();b.submit.val(wpLinkL10n.save)}tinyMCEPopup.storeSelection();b.url.focus()[0].select();if(!e.recent.ul.children().length){e.recent.ajax()}},cancel:function(){tinyMCEPopup.close()},update:function(){var h=tinyMCEPopup.editor,i={href:b.url.val(),title:b.title.val(),target:b.openInNewTab.attr("checked")?"_blank":""},j,g;tinyMCEPopup.restoreSelection();j=h.dom.getParent(h.selection.getNode(),"A");if(!i.href||i.href=="http://"){if(j){tinyMCEPopup.execCommand("mceBeginUndoLevel");g=h.selection.getBookmark();h.dom.remove(j,1);h.selection.moveToBookmark(g);tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()}return}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(j==null){h.getDoc().execCommand("unlink",false,null);tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});tinymce.each(h.dom.select("a"),function(k){if(h.dom.getAttrib(k,"href")=="#mce_temp_url#"){j=k;h.dom.setAttribs(j,i)}});if(f(j).text()=="#mce_temp_url#"){h.dom.remove(j);j=null}}else{h.dom.setAttribs(j,i)}if(j&&(j.childNodes.length!=1||j.firstChild.nodeName!="IMG")){h.focus();h.selection.select(j);h.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()},updateFields:function(i,h,g){b.url.val(h.children(".item-permalink").val());b.title.val(h.hasClass("no-title")?"":h.children(".item-title").text());if(g&&g.type=="click"){b.url.focus()}},setDefaultValues:function(){b.url.val("http://");b.title.val("")},searchInternalLinks:function(){var h=f(this),i,g=h.val();if(g.length>2){e.recent.hide();e.search.show();if(wpLink.lastSearch==g){return}wpLink.lastSearch=g;i=h.siblings("img.waiting").show();e.search.change(g);e.search.ajax(function(){i.hide()})}else{e.search.hide();e.recent.show()}},next:function(){e.search.next();e.recent.next()},prev:function(){e.search.prev();e.recent.prev()},keydown:function(i){var h,g=f.ui.keyCode;switch(i.which){case g.UP:h="prev";case g.DOWN:h=h||"next";clearInterval(wpLink.keyInterval);wpLink[h]();wpLink.keyInterval=setInterval(wpLink[h],wpLink.keySensitivity);break;default:return}i.preventDefault()},keyup:function(h){var g=f.ui.keyCode;switch(h.which){case g.ESCAPE:wpLink.cancel();break;case g.UP:case g.DOWN:clearInterval(wpLink.keyInterval);break;default:return}h.preventDefault()},delayedCallback:function(i,g){var l,k,j,h;if(!g){return i}setTimeout(function(){if(k){return i.apply(h,j)}l=true},g);return function(){if(l){return i.apply(this,arguments)}j=arguments;h=this;k=true}},toggleInternalLinking:function(h){var g=f("#search-panel"),i=b.dialog.wpdialog("widget"),k=!g.is(":visible"),j=f(window);f(this).toggleClass("toggle-arrow-active",k);b.dialog.height("auto");g.slideToggle(300,function(){setUserSetting("wplink",k?"1":"0");b[k?"search":"url"].focus();var l=j.scrollTop(),o=i.offset().top,m=o+i.outerHeight(),n=m-j.height();if(n>l){i.animate({top:ni){this.element.scrollTop(g+l-i+j)}}this.element.trigger("river-select",[h,k,this])},deselect:function(){if(this.selected){this.selected.removeClass("selected")}this.selected=false},prev:function(){if(!this.visible){return}var g;if(this.selected){g=this.selected.prev("li");if(g.length){this.select(g)}}},next:function(){if(!this.visible){return}var g=this.selected?this.selected.next("li"):f("li:not(.unselectable):first",this.element);if(g.length){this.select(g)}},ajax:function(j){var h=this,i=this.query.page==1?0:wpLink.minRiverAJAXDuration,g=wpLink.delayedCallback(function(k,l){h.process(k,l);if(j){j(k,l)}},i);this.query.ajax(g)},change:function(g){if(this.query&&this._search==g){return}this._search=g;this.query=new c(g);this.element.scrollTop(0)},process:function(h,l){var i="",j=true,g="",k=l.page==1;if(!h){if(k){i+='
  • '+wpLinkL10n.noMatchesFound+"
  • "}}else{f.each(h,function(){g=j?"alternate":"";g+=this["title"]?"":" no-title";i+=g?'
  • ':"
  • ";i+='';i+='';i+=this["title"]?this["title"]:wpLinkL10n.noTitle;i+=''+this["info"]+"
  • ";j=!j})}this.ul[k?"html":"append"](i)},maybeLoad:function(){var h=this,i=this.element,g=i.scrollTop()+i.height();if(!this.query.ready()||g";k=l+j.length;if(l==h){k-="".length}g.value=g.value.substring(0,l)+j+g.value.substring(h,g.value.length);g.selectionStart=g.selectionEnd=k}else{if(document.selection&&wpLink.range){g.focus();wpLink.range.text=j+wpLink.range.text+"";wpLink.range.moveToBookmark(wpLink.range.getBookmark());wpLink.range.select();wpLink.range=null}}wpLink.close();g.focus()},mceUpdate:function(){var h=tinyMCEPopup.editor,i=wpLink.getAttrs(),j,g;tinyMCEPopup.restoreSelection();j=h.dom.getParent(h.selection.getNode(),"A");if(!i.href||i.href=="http://"){if(j){tinyMCEPopup.execCommand("mceBeginUndoLevel");g=h.selection.getBookmark();h.dom.remove(j,1);h.selection.moveToBookmark(g);tinyMCEPopup.execCommand("mceEndUndoLevel");wpLink.close()}return}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(j==null){h.getDoc().execCommand("unlink",false,null);tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});tinymce.each(h.dom.select("a"),function(k){if(h.dom.getAttrib(k,"href")=="#mce_temp_url#"){j=k;h.dom.setAttribs(j,i)}});if(f(j).text()=="#mce_temp_url#"){h.dom.remove(j);j=null}}else{h.dom.setAttribs(j,i)}if(j&&(j.childNodes.length!=1||j.firstChild.nodeName!="IMG")){h.focus();h.selection.select(j);h.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");wpLink.close()},updateFields:function(i,h,g){b.url.val(h.children(".item-permalink").val());b.title.val(h.hasClass("no-title")?"":h.children(".item-title").text());if(g&&g.type=="click"){b.url.focus()}},setDefaultValues:function(){b.url.val("http://");b.title.val("");b.submit.val(wpLinkL10n.save)},searchInternalLinks:function(){var h=f(this),i,g=h.val();if(g.length>2){e.recent.hide();e.search.show();if(wpLink.lastSearch==g){return}wpLink.lastSearch=g;i=h.siblings("img.waiting").show();e.search.change(g);e.search.ajax(function(){i.hide()})}else{e.search.hide();e.recent.show()}},next:function(){e.search.next();e.recent.next()},prev:function(){e.search.prev();e.recent.prev()},keydown:function(i){var h,g=f.ui.keyCode;switch(i.which){case g.UP:h="prev";case g.DOWN:h=h||"next";clearInterval(wpLink.keyInterval);wpLink[h]();wpLink.keyInterval=setInterval(wpLink[h],wpLink.keySensitivity);break;default:return}i.preventDefault()},keyup:function(h){var g=f.ui.keyCode;switch(h.which){case g.ESCAPE:wpLink.close();break;case g.UP:case g.DOWN:clearInterval(wpLink.keyInterval);break;default:return}h.preventDefault()},delayedCallback:function(i,g){var l,k,j,h;if(!g){return i}setTimeout(function(){if(k){return i.apply(h,j)}l=true},g);return function(){if(l){return i.apply(this,arguments)}j=arguments;h=this;k=true}},toggleInternalLinking:function(h){var g=f("#search-panel"),i=b.dialog.wpdialog("widget"),k=!g.is(":visible"),j=f(window);f(this).toggleClass("toggle-arrow-active",k);b.dialog.height("auto");g.slideToggle(300,function(){setUserSetting("wplink",k?"1":"0");b[k?"search":"url"].focus();var l=j.scrollTop(),o=i.offset().top,m=o+i.outerHeight(),n=m-j.height();if(n>l){i.animate({top:ni){this.element.scrollTop(g+l-i+j)}}this.element.trigger("river-select",[h,k,this])},deselect:function(){if(this.selected){this.selected.removeClass("selected")}this.selected=false},prev:function(){if(!this.visible){return}var g;if(this.selected){g=this.selected.prev("li");if(g.length){this.select(g)}}},next:function(){if(!this.visible){return}var g=this.selected?this.selected.next("li"):f("li:not(.unselectable):first",this.element);if(g.length){this.select(g)}},ajax:function(j){var h=this,i=this.query.page==1?0:wpLink.minRiverAJAXDuration,g=wpLink.delayedCallback(function(k,l){h.process(k,l);if(j){j(k,l)}},i);this.query.ajax(g)},change:function(g){if(this.query&&this._search==g){return}this._search=g;this.query=new c(g);this.element.scrollTop(0)},process:function(h,l){var i="",j=true,g="",k=l.page==1;if(!h){if(k){i+='
  • '+wpLinkL10n.noMatchesFound+"
  • "}}else{f.each(h,function(){g=j?"alternate":"";g+=this["title"]?"":" no-title";i+=g?'
  • ':"
  • ";i+='';i+='';i+=this["title"]?this["title"]:wpLinkL10n.noTitle;i+=''+this["info"]+"
  • ";j=!j})}this.ul[k?"html":"append"](i)},maybeLoad:function(){var h=this,i=this.element,g=i.scrollTop()+i.height();if(!this.query.ready()||gadd( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", false, '20110131' ); $scripts->add_data( 'admin-bar', 'group', 1 ); - $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20110111' ); + $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array( 'jquery', 'wpdialogs' ), '20110421' ); + $scripts->add_data( 'wplink', 'group', 1 ); $scripts->localize( 'wplink', 'wpLinkL10n', array( + 'title' => __('Insert/edit link'), 'update' => __('Update'), 'save' => __('Add Link'), 'noTitle' => __('(no title)'), @@ -276,7 +278,11 @@ function wp_default_scripts( &$scripts ) { 'l10n_print_after' => 'try{convertEntities(wpLinkL10n);}catch(e){};', ) ); - $scripts->add( 'wpdialogs-popup', "/wp-includes/js/tinymce/plugins/wpdialogs/js/popup$suffix.js", array( 'jquery-ui-dialog' ), '20101119' ); + $scripts->add( 'wpdialogs', "/wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), '20110421' ); + $scripts->add_data( 'wpdialogs', 'group', 1 ); + + $scripts->add( 'wpdialogs-popup', "/wp-includes/js/tinymce/plugins/wpdialogs/js/popup$suffix.js", array( 'wpdialogs' ), '20110421' ); + $scripts->add_data( 'wpdialogs-popup', 'group', 1 ); if ( is_admin() ) { $scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' );