diff --git a/wp-admin/includes/internal-linking.php b/wp-admin/includes/internal-linking.php
index db3262adf9..28ee9aa319 100644
--- a/wp-admin/includes/internal-linking.php
+++ b/wp-admin/includes/internal-linking.php
@@ -70,18 +70,18 @@ function wp_link_query( $args = array() ) {
*/
function wp_link_dialog() {
?>
-
-
+
\ 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 d13394c010..bdc63ddc5b 100644
--- a/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js
+++ b/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js
@@ -36,6 +36,21 @@
};
}
});
+
+ $(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) {
@@ -60,12 +75,9 @@
t.element = t.windows[ f.id ] = element;
// Store selection
- t.bookmark = t.editor.selection.getBookmark();
+ t.bookmark = t.editor.selection.getBookmark(1);
- if ( tinyMCEPopup )
- tinyMCEPopup.init();
-
- element.dialog({
+ element.wpdialog({
title: f.title,
width: f.width,
height: f.height,
@@ -75,7 +87,7 @@
});
},
close : wpDialogFn(function() {
- this.element.dialog('close');
+ this.element.wpdialog('close');
})
});
diff --git a/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js b/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js
index 51664cf377..fc621f13a9 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"}}});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();if(tinyMCEPopup){tinyMCEPopup.init()}c.dialog({title:e.title,width:e.width,height:e.height,modal:true,dialogClass:"wp-dialog",zIndex:300000})},close:a(function(){this.element.dialog("close")})});tinymce.PluginManager.add("wpdialogs",tinymce.plugins.WPDialogs)})(jQuery);
\ No newline at end of file
+(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
diff --git a/wp-includes/js/tinymce/plugins/wplink/css/wplink.css b/wp-includes/js/tinymce/plugins/wplink/css/wplink.css
index ff2d3a3791..ff482ef438 100644
--- a/wp-includes/js/tinymce/plugins/wplink/css/wplink.css
+++ b/wp-includes/js/tinymce/plugins/wplink/css/wplink.css
@@ -1 +1 @@
-#wp-link p.howto{margin:3px;}#link-options{padding:10px 0 14px;border-bottom:1px solid #dfdfdf;margin:0 6px 14px;}#wp-link label input[type="text"]{width:360px;margin-top:5px;}#wp-link label span{display:inline-block;width:80px;text-align:right;padding-right:5px;}#wp-link .link-search-wrapper{margin:5px 5px 9px;display:block;overflow:hidden;}#wp-link .link-search-wrapper span{float:left;margin-top:6px;}#wp-link .link-search-wrapper input[type="text"]{float:left;width:220px;}#wp-link .link-search-wrapper img.waiting{margin:8px 1px 0 4px;float:left;display:none;}#wp-link .link-target{width:auto;padding:3px 0 0;margin:0 0 0 87px;font-size:11px;}#wp-link .query-results{border:1px #dfdfdf solid;margin:0 5px 5px;background:#fff;height:185px;overflow:auto;}#wp-link li,#wp-link .query-notice{margin-bottom:0;border-bottom:1px solid #f1f1f1;color:#333;padding:4px 6px;cursor:pointer;}#wp-link li:hover{background:#eaf2fa;color:#151515;}#wp-link li.unselectable{border-bottom:1px solid #dfdfdf;}#wp-link li.unselectable:hover{background:#fff;cursor:auto;color:#333;}#wp-link li.selected{background:#ddd;color:#333;}#wp-link li.selected .item-title{font-weight:bold;}#wp-link .item-info{text-transform:uppercase;color:#666;font-size:11px;float:right;}#search-results{display:none;}#wp-link .river-waiting{display:none;padding:10px 0;}#wp-link .river-waiting img.waiting{margin:0 auto;display:block;}#wp-link .submitbox{padding:5px 10px;font-size:11px;overflow:auto;height:29px;}#wp-link-cancel{line-height:25px;float:left;}#wp-link-update{line-height:23px;float:right;}#wp-link-update a{display:inline-block;}
\ No newline at end of file
+#wp-link p.howto{margin:3px;}#link-options{padding:10px 0 14px;border-bottom:1px solid #dfdfdf;margin:0 6px 14px;}#wp-link label input[type="text"]{width:360px;margin-top:5px;}#wp-link label span{display:inline-block;width:80px;text-align:right;padding-right:5px;}#wp-link .link-search-wrapper{margin:5px 5px 9px;display:block;overflow:hidden;}#wp-link .link-search-wrapper span{float:left;margin-top:6px;}#wp-link .link-search-wrapper input[type="text"]{float:left;width:220px;}#wp-link .link-search-wrapper img.waiting{margin:8px 1px 0 4px;float:left;display:none;}#wp-link .link-target{width:auto;padding:3px 0 0;margin:0 0 0 87px;font-size:11px;}#wp-link .query-results{border:1px #dfdfdf solid;margin:0 5px 5px;background:#fff;height:185px;overflow:auto;position:relative;}#wp-link li,#wp-link .query-notice{margin-bottom:0;border-bottom:1px solid #f1f1f1;color:#333;padding:4px 6px;cursor:pointer;}#wp-link li:hover{background:#eaf2fa;color:#151515;}#wp-link li.unselectable{border-bottom:1px solid #dfdfdf;}#wp-link li.unselectable:hover{background:#fff;cursor:auto;color:#333;}#wp-link li.selected{background:#ddd;color:#333;}#wp-link li.selected .item-title{font-weight:bold;}#wp-link .item-info{text-transform:uppercase;color:#666;font-size:11px;float:right;}#search-results{display:none;}#wp-link .river-waiting{display:none;padding:10px 0;}#wp-link .river-waiting img.waiting{margin:0 auto;display:block;}#wp-link .submitbox{padding:5px 10px;font-size:11px;overflow:auto;height:29px;}#wp-link-cancel{line-height:25px;float:left;}#wp-link-update{line-height:23px;float:right;}
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/wplink/css/wplink.dev.css b/wp-includes/js/tinymce/plugins/wplink/css/wplink.dev.css
index b1b5a248b6..c0d0765f93 100644
--- a/wp-includes/js/tinymce/plugins/wplink/css/wplink.dev.css
+++ b/wp-includes/js/tinymce/plugins/wplink/css/wplink.dev.css
@@ -46,6 +46,7 @@
background: #fff;
height: 185px;
overflow: auto;
+ position: relative;
}
#wp-link li,
#wp-link .query-notice {
@@ -104,7 +105,4 @@
#wp-link-update {
line-height: 23px;
float: right;
-}
-#wp-link-update a {
- display: inline-block;
}
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js b/wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js
index 6e446dcabd..c69a54fbdc 100644
--- a/wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js
+++ b/wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js
@@ -9,8 +9,12 @@
* @param {string} url Absolute URL to where the plugin is located.
*/
init : function(ed, url) {
+ var disabled = true;
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
ed.addCommand('WP_Link', function() {
+ if ( disabled )
+ return;
ed.windowManager.open({
id : 'wp-link',
width : 480,
@@ -29,10 +33,9 @@
});
ed.addShortcut('alt+shift+a', ed.getLang('advanced.link_desc'), 'WP_Link');
-
- // Add a node change handler, selects the button in the UI when a link is selected
- ed.onNodeChange.add(function(ed, cm, n) {
- cm.setActive('wplink', n.nodeName == 'A');
+
+ ed.onNodeChange.add(function(ed, cm, n, co) {
+ disabled = co && n.nodeName != 'A';
});
},
/**
diff --git a/wp-includes/js/tinymce/plugins/wplink/editor_plugin.js b/wp-includes/js/tinymce/plugins/wplink/editor_plugin.js
index 5318f0ebb6..49b94aedb4 100644
--- a/wp-includes/js/tinymce/plugins/wplink/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/wplink/editor_plugin.js
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.wpLink",{init:function(a,b){a.addCommand("WP_Link",function(){a.windowManager.open({id:"wp-link",width:480,height:"auto",wpDialog:true,title:a.getLang("advlink.link_desc")},{plugin_url:b})});a.addButton("link",{title:a.getLang("advanced.link_desc"),cmd:"WP_Link"});a.addShortcut("alt+shift+a",a.getLang("advanced.link_desc"),"WP_Link");a.onNodeChange.add(function(d,c,e){c.setActive("wplink",e.nodeName=="A")})},getInfo:function(){return{longname:"WordPress Link Dialog",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wplink",tinymce.plugins.wpLink)})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.wpLink",{init:function(a,b){var c=true;a.addCommand("WP_Link",function(){if(c){return}a.windowManager.open({id:"wp-link",width:480,height:"auto",wpDialog:true,title:a.getLang("advlink.link_desc")},{plugin_url:b})});a.addButton("link",{title:a.getLang("advanced.link_desc"),cmd:"WP_Link"});a.addShortcut("alt+shift+a",a.getLang("advanced.link_desc"),"WP_Link");a.onNodeChange.add(function(e,d,g,f){c=f&&g.nodeName!="A"})},getInfo:function(){return{longname:"WordPress Link Dialog",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wplink",tinymce.plugins.wpLink)})();
\ 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 7a91261206..21d86390bd 100644
--- a/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js
+++ b/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js
@@ -7,10 +7,11 @@ var wpLink;
timeToTriggerRiver: 150,
minRiverAJAXDuration: 200,
riverBottomThreshold: 5,
+ keySensitivity: 100,
lastSearch: '',
init : function() {
inputs.dialog = $('#wp-link');
- inputs.update = $('#wp-link-update a');
+ inputs.submit = $('#wp-link-submit');
// URL
inputs.url = $('#url-field');
// Secondary options
@@ -24,22 +25,28 @@ var wpLink;
rivers.elements = $('.query-results', inputs.dialog);
// Bind event handlers
- inputs.update.click( wpLink.update );
- $('#wp-link-cancel').click( function() { tinyMCEPopup.close(); } );
+ inputs.dialog.keydown( wpLink.keydown );
+ inputs.dialog.keyup( wpLink.keyup );
+ inputs.submit.click( function(e){
+ wpLink.update();
+ e.preventDefault();
+ });
+ $('#wp-link-cancel').click( wpLink.cancel );
- rivers.elements.delegate('li', 'click', wpLink.selectInternalLink )
+ rivers.elements.bind('river-select', wpLink.updateFields );
inputs.search.keyup( wpLink.searchInternalLinks );
- inputs.dialog.bind('dialogopen', wpLink.refresh);
+ inputs.dialog.bind('wpdialogrefresh', wpLink.refresh);
},
refresh : function() {
var e;
ed = tinyMCEPopup.editor;
- // Clear previously selected links
- rivers.elements.find('.selected').removeClass('selected');
+ // Refresh rivers (clear links, check visibility)
+ rivers.search.refresh();
+ rivers.recent.refresh();
tinyMCEPopup.restoreSelection();
@@ -52,71 +59,58 @@ var wpLink;
if ( "_blank" == ed.dom.getAttrib(e, 'target') )
inputs.openInNewTab.attr('checked','checked');
// Update save prompt.
- inputs.update.text( wpLinkL10n.update );
+ inputs.submit.val( wpLinkL10n.update );
// If there's no link, set the default values.
} else {
- // Set URL and description to defaults.
- // Leave the new tab setting as-is.
- inputs.url.val('http://');
- inputs.title.val('');
+ wpLink.setDefaultValues();
// Update save prompt.
- inputs.update.text( wpLinkL10n.save );
+ inputs.submit.val( wpLinkL10n.save );
}
tinyMCEPopup.storeSelection();
- // If the focus is moved above the selection changes,
- // IE will show a flashing cursor over the dialog.
- inputs.url.focus();
+ // 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();
+ },
update : function() {
- var el,
- ed = tinyMCEPopup.editor,
+ var ed = tinyMCEPopup.editor,
attrs = {
href : inputs.url.val(),
title : inputs.title.val(),
target : inputs.openInNewTab.attr('checked') ? '_blank' : ''
- }, e, b,
- defaultContent = attrs.title ? attrs.title : attrs.href;
+ }, e, b;
tinyMCEPopup.restoreSelection();
e = ed.dom.getParent(ed.selection.getNode(), 'A');
- // If the values are empty...
+ // If the values are empty, unlink and return
if ( ! attrs.href || attrs.href == 'http://' ) {
- // ...and nothing is selected, we should return
- if ( ed.selection.isCollapsed() ) {
- tinyMCEPopup.close();
- return;
- // ...and a link exists, we should unlink and return
- } else if ( e ) {
+ if ( e ) {
tinyMCEPopup.execCommand("mceBeginUndoLevel");
b = ed.selection.getBookmark();
ed.dom.remove(e, 1);
ed.selection.moveToBookmark(b);
tinyMCEPopup.execCommand("mceEndUndoLevel");
tinyMCEPopup.close();
- return;
}
+ return;
}
tinyMCEPopup.execCommand("mceBeginUndoLevel");
if (e == null) {
ed.getDoc().execCommand("unlink", false, null);
-
- // If no selection exists, create a new link from scratch.
- if ( ed.selection.isCollapsed() ) {
- el = ed.dom.create('a', { href: "#mce_temp_url#" }, defaultContent);
- ed.selection.setNode(el);
- // If a selection exists, wrap it in a link.
- } else {
- tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
- }
+ tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
tinymce.each(ed.dom.select("a"), function(n) {
if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
@@ -124,13 +118,20 @@ var wpLink;
ed.dom.setAttribs(e, attrs);
}
});
+
+ // Sometimes WebKit lets a user create a link where
+ // they shouldn't be able to. In this case, CreateLink
+ // injects "#mce_temp_url#" into their content. Fix it.
+ if ( $(e).text() == '#mce_temp_url#' ) {
+ ed.dom.remove(e);
+ e = null;
+ }
} else {
ed.dom.setAttribs(e, attrs);
}
- children = $(e).children();
// Don't move caret if selection was image
- if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {
+ if ( e && (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') ) {
ed.focus();
ed.selection.select(e);
ed.selection.collapse(0);
@@ -141,14 +142,17 @@ var wpLink;
tinyMCEPopup.close();
},
- selectInternalLink : function() {
- var t = $(this);
- if ( t.hasClass('unselectable') )
- return;
- t.siblings('.selected').removeClass('selected');
- t.addClass('selected');
- inputs.url.val( t.children('.item-permalink').val() );
- inputs.title.val( t.children('.item-title').text() );
+ updateFields : function( e, li, originalEvent ) {
+ inputs.url.val( li.children('.item-permalink').val() );
+ inputs.title.val( li.children('.item-title').text() );
+ if ( originalEvent && originalEvent.type == "click" )
+ inputs.url.focus();
+ },
+ setDefaultValues : function() {
+ // Set URL and description to defaults.
+ // Leave the new tab setting as-is.
+ inputs.url.val('http://');
+ inputs.title.val('');
},
searchInternalLinks : function() {
@@ -156,8 +160,8 @@ var wpLink;
search = t.val();
if ( search.length > 2 ) {
- rivers.recent.element.hide();
- rivers.search.element.show();
+ rivers.recent.hide();
+ rivers.search.show();
// Don't search if the keypress didn't change the title.
if ( wpLink.lastSearch == search )
@@ -169,10 +173,53 @@ var wpLink;
rivers.search.change( search );
rivers.search.ajax( function(){ waiting.hide(); });
} else {
- rivers.search.element.hide();
- rivers.recent.element.show();
+ rivers.search.hide();
+ rivers.recent.show();
}
},
+
+ next : function() {
+ rivers.search.next();
+ rivers.recent.next();
+ },
+ prev : function() {
+ rivers.search.prev();
+ rivers.recent.prev();
+ },
+
+ keydown : function( event ) {
+ var fn, key = $.ui.keyCode;
+
+ switch( event.which ) {
+ case key.UP:
+ fn = 'prev';
+ case key.DOWN:
+ fn = fn || 'next';
+ clearInterval( wpLink.keyInterval );
+ wpLink[ fn ]();
+ wpLink.keyInterval = setInterval( wpLink[ fn ], wpLink.keySensitivity );
+ break;
+ default:
+ return;
+ }
+ event.preventDefault();
+ },
+ keyup: function( event ) {
+ var key = $.ui.keyCode;
+
+ switch( event.which ) {
+ case key.ESCAPE:
+ wpLink.cancel();
+ break;
+ case key.UP:
+ case key.DOWN:
+ clearInterval( wpLink.keyInterval );
+ break;
+ default:
+ return;
+ }
+ event.preventDefault();
+ },
delayedCallback : function( func, delay ) {
var timeoutTriggered, funcTriggered, funcArgs, funcContext;
@@ -205,11 +252,75 @@ var wpLink;
this.waiting = element.find('.river-waiting');
this.change( search );
+ this.refresh();
element.scroll( function(){ self.maybeLoad(); });
+ element.delegate('li', 'click', function(e){ self.select( $(this), e ); });
};
$.extend( River.prototype, {
+ refresh: function() {
+ this.deselect();
+ this.visible = this.element.is(':visible');
+ },
+ show: function() {
+ if ( ! this.visible ) {
+ this.deselect();
+ this.element.show();
+ this.visible = true;
+ }
+ },
+ hide: function() {
+ this.element.hide();
+ this.visible = false;
+ },
+ // Selects a list item and triggers the river-select event.
+ select: function( li, event ) {
+ var liHeight, elHeight, liTop, elTop;
+
+ if ( li.hasClass('unselectable') || li == this.selected )
+ return;
+
+ this.deselect();
+ this.selected = li.addClass('selected');
+ // Make sure the element is visible
+ liHeight = li.outerHeight();
+ elHeight = this.element.height();
+ liTop = li.position().top;
+ elTop = this.element.scrollTop();
+
+ if ( liTop < 0 ) // Make first visible element
+ this.element.scrollTop( elTop + liTop );
+ else if ( liTop + liHeight > elHeight ) // Make last visible element
+ this.element.scrollTop( elTop + liTop - elHeight + liHeight );
+
+ // Trigger the river-select event
+ this.element.trigger('river-select', [ li, event, this ]);
+ },
+ deselect: function() {
+ if ( this.selected )
+ this.selected.removeClass('selected');
+ this.selected = false;
+ },
+ prev: function() {
+ if ( ! this.visible )
+ return;
+
+ var to;
+ if ( this.selected ) {
+ to = this.selected.prev('li');
+ if ( to.length )
+ this.select( to );
+ }
+ },
+ next: function() {
+ if ( ! this.visible )
+ return;
+
+ var to = this.selected ? this.selected.next('li') : $('li:not(.unselectable):first', this.element);
+ if ( to.length )
+ this.select( to );
+ },
ajax: function( callback ) {
var self = this,
delay = this.query.page == 1 ? 0 : wpLink.minRiverAJAXDuration,
diff --git a/wp-includes/js/tinymce/plugins/wplink/js/wplink.js b/wp-includes/js/tinymce/plugins/wplink/js/wplink.js
index 679c84b13e..28e6842c15 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,lastSearch:"",init:function(){b.dialog=f("#wp-link");b.update=f("#wp-link-update a");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.update.click(wpLink.update);f("#wp-link-cancel").click(function(){tinyMCEPopup.close()});e.elements.delegate("li","click",wpLink.selectInternalLink);b.search.keyup(wpLink.searchInternalLinks);b.dialog.bind("dialogopen",wpLink.refresh)},refresh:function(){var g;d=tinyMCEPopup.editor;e.elements.find(".selected").removeClass("selected");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.update.text(wpLinkL10n.update)}else{b.url.val("http://");b.title.val("");b.update.text(wpLinkL10n.save)}tinyMCEPopup.storeSelection();b.url.focus();if(!e.recent.ul.children().length){e.recent.ajax()}},update:function(){var k,h=tinyMCEPopup.editor,i={href:b.url.val(),title:b.title.val(),target:b.openInNewTab.attr("checked")?"_blank":""},l,g,j=i.title?i.title:i.href;tinyMCEPopup.restoreSelection();l=h.dom.getParent(h.selection.getNode(),"A");if(!i.href||i.href=="http://"){if(h.selection.isCollapsed()){tinyMCEPopup.close();return}else{if(l){tinyMCEPopup.execCommand("mceBeginUndoLevel");g=h.selection.getBookmark();h.dom.remove(l,1);h.selection.moveToBookmark(g);tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close();return}}}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(l==null){h.getDoc().execCommand("unlink",false,null);if(h.selection.isCollapsed()){k=h.dom.create("a",{href:"#mce_temp_url#"},j);h.selection.setNode(k)}else{tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1})}tinymce.each(h.dom.select("a"),function(m){if(h.dom.getAttrib(m,"href")=="#mce_temp_url#"){l=m;h.dom.setAttribs(l,i)}})}else{h.dom.setAttribs(l,i)}children=f(l).children();if(l.childNodes.length!=1||l.firstChild.nodeName!="IMG"){h.focus();h.selection.select(l);h.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()},selectInternalLink:function(){var g=f(this);if(g.hasClass("unselectable")){return}g.siblings(".selected").removeClass("selected");g.addClass("selected");b.url.val(g.children(".item-permalink").val());b.title.val(g.children(".item-title").text())},searchInternalLinks:function(){var h=f(this),i,g=h.val();if(g.length>2){e.recent.element.hide();e.search.element.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.element.hide();e.recent.element.show()}},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}}};a=function(i,h){var g=this;this.element=i;this.ul=i.children("ul");this.waiting=i.find(".river-waiting");this.change(h);i.scroll(function(){g.maybeLoad()})};f.extend(a.prototype,{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(g,k){var h="",i=true,j=k.page==1;if(!g){if(j){h+=''+wpLinkL10n.noMatchesFound+""}}else{f.each(g,function(){h+=i?'':"";h+='';h+='';h+=this["title"]?this["title"]:""+wpLinkL10n.untitled+"";h+=''+this["info"]+"";i=!i})}this.ul[j?"html":"append"](h)},maybeLoad:function(){var h=this,i=this.element,g=i.scrollTop()+i.height();if(!this.query.ready()||g2){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}}};a=function(i,h){var g=this;this.element=i;this.ul=i.children("ul");this.waiting=i.find(".river-waiting");this.change(h);this.refresh();i.scroll(function(){g.maybeLoad()});i.delegate("li","click",function(j){g.select(f(this),j)})};f.extend(a.prototype,{refresh:function(){this.deselect();this.visible=this.element.is(":visible")},show:function(){if(!this.visible){this.deselect();this.element.show();this.visible=true}},hide:function(){this.element.hide();this.visible=false},select:function(h,k){var j,i,l,g;if(h.hasClass("unselectable")||h==this.selected){return}this.deselect();this.selected=h.addClass("selected");j=h.outerHeight();i=this.element.height();l=h.position().top;g=this.element.scrollTop();if(l<0){this.element.scrollTop(g+l)}else{if(l+j>i){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(g,k){var h="",i=true,j=k.page==1;if(!g){if(j){h+=''+wpLinkL10n.noMatchesFound+""}}else{f.each(g,function(){h+=i?'':"";h+='';h+='';h+=this["title"]?this["title"]:""+wpLinkL10n.untitled+"";h+=''+this["info"]+"";i=!i})}this.ul[j?"html":"append"](h)},maybeLoad:function(){var h=this,i=this.element,g=i.scrollTop()+i.height();if(!this.query.ready()||g 'try{convertEntities(adminBarL10n);}catch(e){};',
) );
- $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20101120' );
+ $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20101123' );
$scripts->localize( 'wplink', 'wpLinkL10n', array(
'update' => __('Update'),
'save' => __('Save Link'),
@@ -518,7 +518,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100907' );
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101117' );
$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101119' );
- $styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101119' );
+ $styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101123' );
foreach ( $rtl_styles as $rtl_style ) {
$styles->add_data( $rtl_style, 'rtl', true );