From b8d57697264651975e8362d1a5df78b042584efc Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 29 Feb 2016 19:38:27 +0000 Subject: [PATCH] TinyMCE, inline link: - Fix running wpLink without tinymce.js and the TinyMCE plugin without wplink.js. - Do not show the Advanced button in the inline link dialog when wpLink is not loaded. See #33301. Built from https://develop.svn.wordpress.org/trunk@36777 git-svn-id: http://core.svn.wordpress.org/trunk@36744 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../js/tinymce/plugins/wplink/plugin.js | 20 +++++++++------- .../js/tinymce/plugins/wplink/plugin.min.js | 2 +- wp-includes/js/tinymce/wp-tinymce.js.gz | Bin 165889 -> 165910 bytes wp-includes/js/wplink.js | 22 +++++++++--------- wp-includes/js/wplink.min.js | 2 +- wp-includes/version.php | 2 +- 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/wp-includes/js/tinymce/plugins/wplink/plugin.js b/wp-includes/js/tinymce/plugins/wplink/plugin.js index c47b4c384f..690c3ea626 100644 --- a/wp-includes/js/tinymce/plugins/wplink/plugin.js +++ b/wp-includes/js/tinymce/plugins/wplink/plugin.js @@ -144,11 +144,16 @@ 'wp_link_remove' ], true ); - editToolbar = editor.wp._createToolbar( [ + var editButtons = [ 'wp_link_input', - 'wp_link_apply', - 'wp_link_advanced' - ], true ); + 'wp_link_apply' + ]; + + if ( typeof window.wpLink !== 'undefined' ) { + editButtons.push( 'wp_link_advanced' ); + } + + editToolbar = editor.wp._createToolbar( editButtons, true ); editToolbar.on( 'show', function() { if ( ! tinymce.$( document.body ).hasClass( 'modal-open' ) ) { @@ -177,11 +182,8 @@ } ); editor.addCommand( 'WP_Link', function() { - if ( tinymce.Env.ie && tinymce.Env.ie < 10 ) { - if ( typeof window.wpLink !== 'undefined' ) { - window.wpLink.open( editor.id ); - } - + if ( tinymce.Env.ie && tinymce.Env.ie < 10 && typeof window.wpLink !== 'undefined' ) { + window.wpLink.open( editor.id ); return; } diff --git a/wp-includes/js/tinymce/plugins/wplink/plugin.min.js b/wp-includes/js/tinymce/plugins/wplink/plugin.min.js index 1e78a57d56..597f2d9a32 100644 --- a/wp-includes/js/tinymce/plugins/wplink/plugin.min.js +++ b/wp-includes/js/tinymce/plugins/wplink/plugin.min.js @@ -1 +1 @@ -!function(a){a.ui.WPLinkPreview=a.ui.Control.extend({url:"#",renderHtml:function(){return'"},setURL:function(b){var c,d;this.url!==b&&(this.url=b,b=window.decodeURIComponent(b),b=b.replace(/^(?:https?:)?\/\/(?:www\.)?/,""),-1!==(c=b.indexOf("?"))&&(b=b.slice(0,c)),-1!==(c=b.indexOf("#"))&&(b=b.slice(0,c)),b=b.replace(/(?:index)?\.html$/,""),"/"===b.charAt(b.length-1)&&(b=b.slice(0,-1)),""===b&&(b=this.url),b.length>40&&-1!==(c=b.indexOf("/"))&&-1!==(d=b.lastIndexOf("/"))&&d!==c&&(c+b.length-d<40&&(d=-(40-(c+1))),b=b.slice(0,c+1)+"\u2026"+b.slice(d)),a.$(this.getEl().firstChild).attr("href",this.url).text(b))}}),a.ui.WPLinkInput=a.ui.Control.extend({renderHtml:function(){return''},setURL:function(a){this.getEl().firstChild.value=a},getURL:function(){return a.trim(this.getEl().firstChild.value)},getLinkText:function(){var b=this.getEl().firstChild.nextSibling.value;return a.trim(b)?b.replace(/[\r\n\t ]+/g," "):""},reset:function(){var a=this.getEl().firstChild;a.value="",a.nextSibling.value=""}}),a.PluginManager.add("wplink",function(b){function c(){var a,c,d=b.selection.getNode(),e=b.dom.getParent(d,"a[href]");return e||(c=b.selection.getContent({format:"raw"}),c&&-1!==c.indexOf("")&&(a=c.match(/href="([^">]+)"/),a&&a[1]&&(e=b.$('a[href="'+a[1]+'"]',d)[0]),e&&b.selection.select(e))),e}function d(){b.$("a").each(function(a,c){var d=b.$(c);"_wp_link_placeholder"===d.attr("href")?b.dom.remove(c,!0):d.attr("data-wplink-edit")&&d.attr("data-wplink-edit",null)})}function e(a,b){return b&&(a=a.replace(/ data-wplink-edit="true"/g,"")),a.replace(/]*?href="_wp_link_placeholder"[^>]*>([\s\S]+)<\/a>/g,"$1")}var f,g,h,i,j,k=window.jQuery;return b.on("preinit",function(){b.wp&&b.wp._createToolbar&&(f=b.wp._createToolbar(["wp_link_preview","wp_link_edit","wp_link_remove"],!0),g=b.wp._createToolbar(["wp_link_input","wp_link_apply","wp_link_advanced"],!0),g.on("show",function(){a.$(document.body).hasClass("modal-open")||window.setTimeout(function(){var a=g.$el.find("input.ui-autocomplete-input")[0],b=j&&(j.textContent||j.innerText);a&&(!a.value&&b&&"undefined"!=typeof window.wpLink&&(a.value=window.wpLink.getUrlFromSelection(b)),a.focus(),a.select())})}),g.on("hide",function(){g.scrolling||b.execCommand("wp_link_cancel")}))}),b.addCommand("WP_Link",function(){return a.Env.ie&&a.Env.ie<10?void("undefined"!=typeof window.wpLink&&window.wpLink.open(b.id)):(j=c(),g.tempHide=!1,void(j?b.dom.setAttribs(j,{"data-wplink-edit":!0}):(d(),b.execCommand("mceInsertLink",!1,{href:"_wp_link_placeholder"}),j=b.$('a[href="_wp_link_placeholder"]')[0],b.nodeChanged())))}),b.addCommand("wp_link_apply",function(){if(!g.scrolling){var c,d;if(j){if(c=i.getURL(),d=i.getLinkText(),b.focus(),!c)return void b.dom.remove(j,!0);/^(?:[a-z]+:|#|\?|\.|\/)/.test(c)||(c="http://"+c),b.dom.setAttribs(j,{href:c,"data-wplink-edit":null}),a.trim(j.innerHTML)||b.$(j).text(d||c)}i.reset(),b.nodeChanged()}}),b.addCommand("wp_link_cancel",function(){g.tempHide||(i.reset(),d(),b.focus(),g.tempHide=!1)}),b.addShortcut("access+a","","WP_Link"),b.addShortcut("meta+k","","WP_Link"),b.addButton("link",{icon:"link",tooltip:"Insert/edit link",cmd:"WP_Link",stateSelector:"a[href]"}),b.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink"}),b.addMenuItem("link",{icon:"link",text:"Insert/edit link",cmd:"WP_Link",stateSelector:"a[href]",context:"insert",prependToContext:!0}),b.on("pastepreprocess",function(c){var d=c.content,e=/^(?:https?:)?\/\/\S+$/i;b.selection.isCollapsed()||e.test(b.selection.getContent())||(d=d.replace(/<[^>]+>/g,""),d=a.trim(d),e.test(d)&&(b.execCommand("mceInsertLink",!1,{href:b.dom.decode(d)}),c.preventDefault()))}),b.on("savecontent",function(a){a.content=e(a.content,!0)}),b.on("BeforeAddUndo",function(a){a.lastLevel&&a.lastLevel.content&&a.level.content&&a.lastLevel.content===e(a.level.content)&&a.preventDefault()}),b.addButton("wp_link_preview",{type:"WPLinkPreview",onPostRender:function(){h=this}}),b.addButton("wp_link_input",{type:"WPLinkInput",onPostRender:function(){var c,d,e,f=this.getEl(),h=f.firstChild;i=this,k&&k.ui&&k.ui.autocomplete&&(c=k(h),c.on("keydown",function(){c.removeAttr("aria-activedescendant")}).autocomplete({source:function(a,b){return e===a.term?void b(d):/^https?:/.test(a.term)||-1!==a.term.indexOf(".")?b():(k.post(window.ajaxurl,{action:"wp-link-ajax",page:1,search:a.term,_ajax_linking_nonce:k("#_ajax_linking_nonce").val()},function(a){d=a,b(a)},"json"),void(e=a.term))},focus:function(a,b){c.attr("aria-activedescendant","mce-wp-autocomplete-"+b.item.ID)},select:function(a,b){return c.val(b.item.permalink),k(f.firstChild.nextSibling).val(b.item.title),!1},open:function(){c.attr("aria-expanded","true"),g.blockHide=!0},close:function(){c.attr("aria-expanded","false"),g.blockHide=!1},minLength:2,position:{my:"left top+2"}}).autocomplete("instance")._renderItem=function(a,b){return k('
  • ').append(""+b.title+' '+b.info+"").appendTo(a)},c.attr({role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-owns":c.autocomplete("widget").attr("id")}).on("focus",function(){c.autocomplete("search")}).autocomplete("widget").addClass("wplink-autocomplete").attr("role","listbox")),a.$(h).on("keydown",function(a){13===a.keyCode&&(b.execCommand("wp_link_apply"),a.preventDefault())})}}),b.on("wptoolbar",function(c){var d,e,j,k=b.dom.getParent(c.element,"a");return a.$(document.body).hasClass("modal-open")?void(g.tempHide=!0):(g.tempHide=!1,void(k&&(d=b.$(k),e=d.attr("href"),j=d.attr("data-wplink-edit"),"_wp_link_placeholder"===e||j?(j&&!i.getURL()&&i.setURL(e),c.element=k,c.toolbar=g):e&&!d.find("img").length&&(h.setURL(e),c.element=k,c.toolbar=f))))}),b.addButton("wp_link_edit",{tooltip:"Edit ",icon:"dashicon dashicons-edit",cmd:"WP_Link"}),b.addButton("wp_link_remove",{tooltip:"Remove",icon:"dashicon dashicons-no",cmd:"unlink"}),b.addButton("wp_link_advanced",{tooltip:"Advanced",icon:"dashicon dashicons-admin-generic",onclick:function(){if("undefined"!=typeof window.wpLink){var a=i.getURL()||null,c=i.getLinkText()||null;b.focus(),window.wpLink.open(b.id,a,c,j),g.tempHide=!0,i.reset()}}}),b.addButton("wp_link_apply",{tooltip:"Apply",icon:"dashicon dashicons-editor-break",cmd:"wp_link_apply",classes:"widget btn primary"}),{close:function(){g.tempHide=!1,b.execCommand("wp_link_cancel")}}})}(window.tinymce); \ No newline at end of file +!function(a){a.ui.WPLinkPreview=a.ui.Control.extend({url:"#",renderHtml:function(){return'"},setURL:function(b){var c,d;this.url!==b&&(this.url=b,b=window.decodeURIComponent(b),b=b.replace(/^(?:https?:)?\/\/(?:www\.)?/,""),-1!==(c=b.indexOf("?"))&&(b=b.slice(0,c)),-1!==(c=b.indexOf("#"))&&(b=b.slice(0,c)),b=b.replace(/(?:index)?\.html$/,""),"/"===b.charAt(b.length-1)&&(b=b.slice(0,-1)),""===b&&(b=this.url),b.length>40&&-1!==(c=b.indexOf("/"))&&-1!==(d=b.lastIndexOf("/"))&&d!==c&&(c+b.length-d<40&&(d=-(40-(c+1))),b=b.slice(0,c+1)+"\u2026"+b.slice(d)),a.$(this.getEl().firstChild).attr("href",this.url).text(b))}}),a.ui.WPLinkInput=a.ui.Control.extend({renderHtml:function(){return''},setURL:function(a){this.getEl().firstChild.value=a},getURL:function(){return a.trim(this.getEl().firstChild.value)},getLinkText:function(){var b=this.getEl().firstChild.nextSibling.value;return a.trim(b)?b.replace(/[\r\n\t ]+/g," "):""},reset:function(){var a=this.getEl().firstChild;a.value="",a.nextSibling.value=""}}),a.PluginManager.add("wplink",function(b){function c(){var a,c,d=b.selection.getNode(),e=b.dom.getParent(d,"a[href]");return e||(c=b.selection.getContent({format:"raw"}),c&&-1!==c.indexOf("")&&(a=c.match(/href="([^">]+)"/),a&&a[1]&&(e=b.$('a[href="'+a[1]+'"]',d)[0]),e&&b.selection.select(e))),e}function d(){b.$("a").each(function(a,c){var d=b.$(c);"_wp_link_placeholder"===d.attr("href")?b.dom.remove(c,!0):d.attr("data-wplink-edit")&&d.attr("data-wplink-edit",null)})}function e(a,b){return b&&(a=a.replace(/ data-wplink-edit="true"/g,"")),a.replace(/]*?href="_wp_link_placeholder"[^>]*>([\s\S]+)<\/a>/g,"$1")}var f,g,h,i,j,k=window.jQuery;return b.on("preinit",function(){if(b.wp&&b.wp._createToolbar){f=b.wp._createToolbar(["wp_link_preview","wp_link_edit","wp_link_remove"],!0);var c=["wp_link_input","wp_link_apply"];"undefined"!=typeof window.wpLink&&c.push("wp_link_advanced"),g=b.wp._createToolbar(c,!0),g.on("show",function(){a.$(document.body).hasClass("modal-open")||window.setTimeout(function(){var a=g.$el.find("input.ui-autocomplete-input")[0],b=j&&(j.textContent||j.innerText);a&&(!a.value&&b&&"undefined"!=typeof window.wpLink&&(a.value=window.wpLink.getUrlFromSelection(b)),a.focus(),a.select())})}),g.on("hide",function(){g.scrolling||b.execCommand("wp_link_cancel")})}}),b.addCommand("WP_Link",function(){return a.Env.ie&&a.Env.ie<10&&"undefined"!=typeof window.wpLink?void window.wpLink.open(b.id):(j=c(),g.tempHide=!1,void(j?b.dom.setAttribs(j,{"data-wplink-edit":!0}):(d(),b.execCommand("mceInsertLink",!1,{href:"_wp_link_placeholder"}),j=b.$('a[href="_wp_link_placeholder"]')[0],b.nodeChanged())))}),b.addCommand("wp_link_apply",function(){if(!g.scrolling){var c,d;if(j){if(c=i.getURL(),d=i.getLinkText(),b.focus(),!c)return void b.dom.remove(j,!0);/^(?:[a-z]+:|#|\?|\.|\/)/.test(c)||(c="http://"+c),b.dom.setAttribs(j,{href:c,"data-wplink-edit":null}),a.trim(j.innerHTML)||b.$(j).text(d||c)}i.reset(),b.nodeChanged()}}),b.addCommand("wp_link_cancel",function(){g.tempHide||(i.reset(),d(),b.focus(),g.tempHide=!1)}),b.addShortcut("access+a","","WP_Link"),b.addShortcut("meta+k","","WP_Link"),b.addButton("link",{icon:"link",tooltip:"Insert/edit link",cmd:"WP_Link",stateSelector:"a[href]"}),b.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink"}),b.addMenuItem("link",{icon:"link",text:"Insert/edit link",cmd:"WP_Link",stateSelector:"a[href]",context:"insert",prependToContext:!0}),b.on("pastepreprocess",function(c){var d=c.content,e=/^(?:https?:)?\/\/\S+$/i;b.selection.isCollapsed()||e.test(b.selection.getContent())||(d=d.replace(/<[^>]+>/g,""),d=a.trim(d),e.test(d)&&(b.execCommand("mceInsertLink",!1,{href:b.dom.decode(d)}),c.preventDefault()))}),b.on("savecontent",function(a){a.content=e(a.content,!0)}),b.on("BeforeAddUndo",function(a){a.lastLevel&&a.lastLevel.content&&a.level.content&&a.lastLevel.content===e(a.level.content)&&a.preventDefault()}),b.addButton("wp_link_preview",{type:"WPLinkPreview",onPostRender:function(){h=this}}),b.addButton("wp_link_input",{type:"WPLinkInput",onPostRender:function(){var c,d,e,f=this.getEl(),h=f.firstChild;i=this,k&&k.ui&&k.ui.autocomplete&&(c=k(h),c.on("keydown",function(){c.removeAttr("aria-activedescendant")}).autocomplete({source:function(a,b){return e===a.term?void b(d):/^https?:/.test(a.term)||-1!==a.term.indexOf(".")?b():(k.post(window.ajaxurl,{action:"wp-link-ajax",page:1,search:a.term,_ajax_linking_nonce:k("#_ajax_linking_nonce").val()},function(a){d=a,b(a)},"json"),void(e=a.term))},focus:function(a,b){c.attr("aria-activedescendant","mce-wp-autocomplete-"+b.item.ID)},select:function(a,b){return c.val(b.item.permalink),k(f.firstChild.nextSibling).val(b.item.title),!1},open:function(){c.attr("aria-expanded","true"),g.blockHide=!0},close:function(){c.attr("aria-expanded","false"),g.blockHide=!1},minLength:2,position:{my:"left top+2"}}).autocomplete("instance")._renderItem=function(a,b){return k('
  • ').append(""+b.title+' '+b.info+"").appendTo(a)},c.attr({role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-owns":c.autocomplete("widget").attr("id")}).on("focus",function(){c.autocomplete("search")}).autocomplete("widget").addClass("wplink-autocomplete").attr("role","listbox")),a.$(h).on("keydown",function(a){13===a.keyCode&&(b.execCommand("wp_link_apply"),a.preventDefault())})}}),b.on("wptoolbar",function(c){var d,e,j,k=b.dom.getParent(c.element,"a");return a.$(document.body).hasClass("modal-open")?void(g.tempHide=!0):(g.tempHide=!1,void(k&&(d=b.$(k),e=d.attr("href"),j=d.attr("data-wplink-edit"),"_wp_link_placeholder"===e||j?(j&&!i.getURL()&&i.setURL(e),c.element=k,c.toolbar=g):e&&!d.find("img").length&&(h.setURL(e),c.element=k,c.toolbar=f))))}),b.addButton("wp_link_edit",{tooltip:"Edit ",icon:"dashicon dashicons-edit",cmd:"WP_Link"}),b.addButton("wp_link_remove",{tooltip:"Remove",icon:"dashicon dashicons-no",cmd:"unlink"}),b.addButton("wp_link_advanced",{tooltip:"Advanced",icon:"dashicon dashicons-admin-generic",onclick:function(){if("undefined"!=typeof window.wpLink){var a=i.getURL()||null,c=i.getLinkText()||null;b.focus(),window.wpLink.open(b.id,a,c,j),g.tempHide=!0,i.reset()}}}),b.addButton("wp_link_apply",{tooltip:"Apply",icon:"dashicon dashicons-editor-break",cmd:"wp_link_apply",classes:"widget btn primary"}),{close:function(){g.tempHide=!1,b.execCommand("wp_link_cancel")}}})}(window.tinymce); \ No newline at end of file diff --git a/wp-includes/js/tinymce/wp-tinymce.js.gz b/wp-includes/js/tinymce/wp-tinymce.js.gz index c90f4a5ff3fd00d34ae2b976103d8fd43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c zDB<2AE)`U(m=&NekSjWcxsG@)_5q0_NB)j7Xdbb`_l2hBi?V{nCT zTqehGVe+L$l|@F$GW?S;vlg&DU`wT3^P>e38jlN0E`a}qJRl-YUZ5`2RaS2Jtfwp#{ZwxI16T(6>{%yJOkztVxYPjGC6Hej*#95^Qp!K){F68Ob`jsH`$*#3 TG(TP--tYeaNPbiy$DaoP&Zvt- diff --git a/wp-includes/js/wplink.js b/wp-includes/js/wplink.js index d82fd8604b..8cef9544c5 100644 --- a/wp-includes/js/wplink.js +++ b/wp-includes/js/wplink.js @@ -1,7 +1,7 @@ -/* global tinymce, wpLinkL10n, wpActiveEditor */ + var wpLink; -( function( $ ) { +( function( $, wpLinkL10n ) { var editor, correctedURL, linkNode, inputs = {}, isTouch = ( 'ontouchend' in document ); @@ -80,7 +80,7 @@ var wpLink; select: function( event, ui ) { $input.val( ui.item.permalink ); - if ( inputs.wrap.hasClass( 'has-text-field' ) && tinymce.trim( inputs.text.val() ) === '' ) { + if ( inputs.wrap.hasClass( 'has-text-field' ) && $.trim( inputs.text.val() ) === '' ) { inputs.text.val( ui.item.title ); } @@ -144,12 +144,12 @@ var wpLink; this.textarea = $( '#' + window.wpActiveEditor ).get( 0 ); - if ( typeof tinymce !== 'undefined' ) { + if ( typeof window.tinymce !== 'undefined' ) { // Make sure the link wrapper is the last element in the body, // or the inline editor toolbar may show above the backdrop. $body.append( inputs.backdrop, inputs.wrap ); - ed = tinymce.get( wpActiveEditor ); + ed = window.tinymce.get( window.wpActiveEditor ); if ( ed && ! ed.isHidden() ) { editor = ed; @@ -157,7 +157,7 @@ var wpLink; editor = null; } - if ( editor && tinymce.isIE && ! editor.windowManager.wplinkBookmark ) { + if ( editor && window.tinymce.isIE && ! editor.windowManager.wplinkBookmark ) { editor.windowManager.wplinkBookmark = editor.selection.getBookmark(); } } @@ -236,7 +236,7 @@ var wpLink; for ( i = nodes.length - 1; i >= 0; i-- ) { node = nodes[i]; - if ( node.nodeType != 3 && ! tinymce.dom.BookmarkManager.isBookmarkNode( node ) ) { + if ( node.nodeType != 3 && ! window.tinymce.dom.BookmarkManager.isBookmarkNode( node ) ) { return false; } } @@ -253,7 +253,7 @@ var wpLink; if ( linkNode ) { linkText = linkNode.innerText || linkNode.textContent; - if ( ! tinymce.trim( linkText ) ) { + if ( ! $.trim( linkText ) ) { linkText = text || ''; } @@ -397,7 +397,7 @@ var wpLink; editor.focus(); - if ( tinymce.isIE && editor.windowManager.wplinkBookmark ) { + if ( window.tinymce.isIE && editor.windowManager.wplinkBookmark ) { editor.selection.moveToBookmark( editor.windowManager.wplinkBookmark ); editor.windowManager.wplinkBookmark = null; } @@ -474,7 +474,7 @@ var wpLink; } } - selection = tinymce.trim( selection ); + selection = $.trim( selection ); if ( selection && emailRegexp.test( selection ) ) { // Selection is email address @@ -496,4 +496,4 @@ var wpLink; }; $( document ).ready( wpLink.init ); -})( jQuery ); +})( jQuery, window.wpLinkL10n ); diff --git a/wp-includes/js/wplink.min.js b/wp-includes/js/wplink.min.js index d388ca3f94..da75b03f97 100644 --- a/wp-includes/js/wplink.min.js +++ b/wp-includes/js/wplink.min.js @@ -1 +1 @@ -var wpLink;!function(a){function b(){return e||c.dom.getParent(c.selection.getNode(),"a[href]")}var c,d,e,f={},g="ontouchend"in document;wpLink={textarea:"",init:function(){f.wrap=a("#wp-link-wrap"),f.dialog=a("#wp-link"),f.backdrop=a("#wp-link-backdrop"),f.submit=a("#wp-link-submit"),f.close=a("#wp-link-close"),f.text=a("#wp-link-text"),f.url=a("#wp-link-url"),f.openInNewTab=a("#wp-link-target"),a.ui&&a.ui.autocomplete&&wpLink.setAutocomplete(),f.dialog.on("keydown",wpLink.keydown),f.submit.on("click",function(a){a.preventDefault(),wpLink.update()}),f.close.add(f.backdrop).add("#wp-link-cancel a").click(function(a){a.preventDefault(),wpLink.close()}),f.url.on("paste",function(){setTimeout(wpLink.correctURL,0)})},setAutocomplete:function(){var b,c,d=f.url;d.on("keydown",function(){d.removeAttr("aria-activedescendant")}).autocomplete({source:function(d,e){return c===d.term?void e(b):/^https?:/.test(d.term)||-1!==d.term.indexOf(".")?e():(a.post(window.ajaxurl,{action:"wp-link-ajax",page:1,search:d.term,_ajax_linking_nonce:a("#_ajax_linking_nonce").val()},function(a){b=a,e(a)},"json"),void(c=d.term))},focus:function(a,b){d.attr("aria-activedescendant","mce-wp-autocomplete-"+b.item.ID)},select:function(a,b){return d.val(b.item.permalink),f.wrap.hasClass("has-text-field")&&""===tinymce.trim(f.text.val())&&f.text.val(b.item.title),!1},open:function(){d.attr("aria-expanded","true")},close:function(){d.attr("aria-expanded","false")},minLength:2,position:{my:"left top+2"}}).autocomplete("instance")._renderItem=function(b,c){return a('
  • ').append(''+c.title+' '+c.info+"").appendTo(b)},d.attr({"aria-owns":d.autocomplete("widget").attr("id")}).on("focus",function(){d.autocomplete("search")}).autocomplete("widget").addClass("wplink-autocomplete").attr("role","listbox")},correctURL:function(){var b=a.trim(f.url.val());b&&d!==b&&!/^(?:[a-z]+:|#|\?|\.|\/)/.test(b)&&(f.url.val("http://"+b),d=b)},open:function(b,d,g,h){var i,j=a(document.body);j.addClass("modal-open"),e=h,wpLink.range=null,b&&(window.wpActiveEditor=b),window.wpActiveEditor&&(this.textarea=a("#"+window.wpActiveEditor).get(0),"undefined"!=typeof tinymce&&(j.append(f.backdrop,f.wrap),i=tinymce.get(wpActiveEditor),c=i&&!i.isHidden()?i:null,c&&tinymce.isIE&&!c.windowManager.wplinkBookmark&&(c.windowManager.wplinkBookmark=c.selection.getBookmark())),!wpLink.isMCE()&&document.selection&&(this.textarea.focus(),this.range=document.selection.createRange()),f.wrap.show(),f.backdrop.show(),wpLink.refresh(d,g),a(document).trigger("wplink-open",f.wrap))},isMCE:function(){return c&&!c.isHidden()},refresh:function(a,b){var c="";wpLink.isMCE()?wpLink.mceRefresh(a,b):(f.wrap.hasClass("has-text-field")||f.wrap.addClass("has-text-field"),document.selection?c=document.selection.createRange().text||b||"":"undefined"!=typeof this.textarea.selectionStart&&this.textarea.selectionStart!==this.textarea.selectionEnd&&(b=this.textarea.value.substring(this.textarea.selectionStart,this.textarea.selectionEnd)||b||""),f.text.val(b),wpLink.setDefaultValues()),g?f.url.focus().blur():window.setTimeout(function(){f.url.focus()[0].select()}),d=f.url.val().replace(/^http:\/\//,"")},hasSelectedText:function(a){var b,d,e,f=c.selection.getContent();if(/]+>[^<]+<\/a>$/.test(f)||-1===f.indexOf("href=")))return!1;if(a){if(d=a.childNodes,0===d.length)return!1;for(e=d.length-1;e>=0;e--)if(b=d[e],3!=b.nodeType&&!tinymce.dom.BookmarkManager.isBookmarkNode(b))return!1}return!0},mceRefresh:function(a,d){var e,g=b(),h=this.hasSelectedText(g);g?(e=g.innerText||g.textContent,tinymce.trim(e)||(e=d||""),a=a||c.dom.getAttrib(g,"href"),"_wp_link_placeholder"!==a?(f.url.val(a),f.openInNewTab.prop("checked","_blank"===c.dom.getAttrib(g,"target")),f.submit.val(wpLinkL10n.update)):this.setDefaultValues(e)):(e=c.selection.getContent({format:"text"})||d||"",this.setDefaultValues(e)),h?(f.text.val(e),f.wrap.addClass("has-text-field")):(f.text.val(""),f.wrap.removeClass("has-text-field"))},close:function(b){a(document.body).removeClass("modal-open"),"noReset"!==b&&(wpLink.isMCE()?(c.plugins.wplink&&c.plugins.wplink.close(),c.focus()):(wpLink.textarea.focus(),wpLink.range&&(wpLink.range.moveToBookmark(wpLink.range.getBookmark()),wpLink.range.select()))),f.backdrop.hide(),f.wrap.hide(),d=!1,a(document).trigger("wplink-close",f.wrap)},getAttrs:function(){return wpLink.correctURL(),{href:a.trim(f.url.val()),target:f.openInNewTab.prop("checked")?"_blank":""}},buildHtml:function(a){var b='"},update:function(){wpLink.isMCE()?wpLink.mceUpdate():wpLink.htmlUpdate()},htmlUpdate:function(){var a,b,c,d,e,g,h,i=wpLink.textarea;i&&(a=wpLink.getAttrs(),b=f.text.val(),a.href&&(c=wpLink.buildHtml(a),document.selection&&wpLink.range?(i.focus(),wpLink.range.text=c+(b||wpLink.range.text)+"",wpLink.range.moveToBookmark(wpLink.range.getBookmark()),wpLink.range.select(),wpLink.range=null):"undefined"!=typeof i.selectionStart&&(d=i.selectionStart,e=i.selectionEnd,h=b||i.value.substring(d,e),c=c+h+"",g=d+c.length,d!==e||h||(g-=4),i.value=i.value.substring(0,d)+c+i.value.substring(e,i.value.length),i.selectionStart=i.selectionEnd=g),wpLink.close(),i.focus()))},mceUpdate:function(){var a,d,e=wpLink.getAttrs();return c.focus(),tinymce.isIE&&c.windowManager.wplinkBookmark&&(c.selection.moveToBookmark(c.windowManager.wplinkBookmark),c.windowManager.wplinkBookmark=null),e.href?(a=b(),f.wrap.hasClass("has-text-field")&&(d=f.text.val()||e.href),a?(d&&("innerText"in a?a.innerText=d:a.textContent=d),c.dom.setAttribs(a,e)):d?c.selection.setNode(c.dom.create("a",e,c.dom.encode(d))):c.execCommand("mceInsertLink",!1,e),wpLink.close("noReset"),c.focus(),void c.nodeChanged()):(c.execCommand("unlink"),void wpLink.close())},keydown:function(a){var b;27===a.keyCode?(wpLink.close(),a.stopImmediatePropagation()):9===a.keyCode&&(b=a.target.id,"wp-link-submit"!==b||a.shiftKey?"wp-link-close"===b&&a.shiftKey&&(f.submit.focus(),a.preventDefault()):(f.close.focus(),a.preventDefault()))},getUrlFromSelection:function(a){var b=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,d=/^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,4}[^ "]*$/i;return a||(this.isMCE()?a=c.selection.getContent({format:"text"}):document.selection&&wpLink.range?a=wpLink.range.text:"undefined"!=typeof this.textarea.selectionStart&&(a=this.textarea.value.substring(this.textarea.selectionStart,this.textarea.selectionEnd))),a=tinymce.trim(a),a&&b.test(a)?"mailto:"+a:a&&d.test(a)?a.replace(/&|�?38;/gi,"&"):""},setDefaultValues:function(a){f.url.val(this.getUrlFromSelection(a)),f.submit.val(wpLinkL10n.save)}},a(document).ready(wpLink.init)}(jQuery); \ No newline at end of file +var wpLink;!function(a,b){function c(){return f||d.dom.getParent(d.selection.getNode(),"a[href]")}var d,e,f,g={},h="ontouchend"in document;wpLink={textarea:"",init:function(){g.wrap=a("#wp-link-wrap"),g.dialog=a("#wp-link"),g.backdrop=a("#wp-link-backdrop"),g.submit=a("#wp-link-submit"),g.close=a("#wp-link-close"),g.text=a("#wp-link-text"),g.url=a("#wp-link-url"),g.openInNewTab=a("#wp-link-target"),a.ui&&a.ui.autocomplete&&wpLink.setAutocomplete(),g.dialog.on("keydown",wpLink.keydown),g.submit.on("click",function(a){a.preventDefault(),wpLink.update()}),g.close.add(g.backdrop).add("#wp-link-cancel a").click(function(a){a.preventDefault(),wpLink.close()}),g.url.on("paste",function(){setTimeout(wpLink.correctURL,0)})},setAutocomplete:function(){var b,c,d=g.url;d.on("keydown",function(){d.removeAttr("aria-activedescendant")}).autocomplete({source:function(d,e){return c===d.term?void e(b):/^https?:/.test(d.term)||-1!==d.term.indexOf(".")?e():(a.post(window.ajaxurl,{action:"wp-link-ajax",page:1,search:d.term,_ajax_linking_nonce:a("#_ajax_linking_nonce").val()},function(a){b=a,e(a)},"json"),void(c=d.term))},focus:function(a,b){d.attr("aria-activedescendant","mce-wp-autocomplete-"+b.item.ID)},select:function(b,c){return d.val(c.item.permalink),g.wrap.hasClass("has-text-field")&&""===a.trim(g.text.val())&&g.text.val(c.item.title),!1},open:function(){d.attr("aria-expanded","true")},close:function(){d.attr("aria-expanded","false")},minLength:2,position:{my:"left top+2"}}).autocomplete("instance")._renderItem=function(b,c){return a('
  • ').append(''+c.title+' '+c.info+"").appendTo(b)},d.attr({"aria-owns":d.autocomplete("widget").attr("id")}).on("focus",function(){d.autocomplete("search")}).autocomplete("widget").addClass("wplink-autocomplete").attr("role","listbox")},correctURL:function(){var b=a.trim(g.url.val());b&&e!==b&&!/^(?:[a-z]+:|#|\?|\.|\/)/.test(b)&&(g.url.val("http://"+b),e=b)},open:function(b,c,e,h){var i,j=a(document.body);j.addClass("modal-open"),f=h,wpLink.range=null,b&&(window.wpActiveEditor=b),window.wpActiveEditor&&(this.textarea=a("#"+window.wpActiveEditor).get(0),"undefined"!=typeof window.tinymce&&(j.append(g.backdrop,g.wrap),i=window.tinymce.get(window.wpActiveEditor),d=i&&!i.isHidden()?i:null,d&&window.tinymce.isIE&&!d.windowManager.wplinkBookmark&&(d.windowManager.wplinkBookmark=d.selection.getBookmark())),!wpLink.isMCE()&&document.selection&&(this.textarea.focus(),this.range=document.selection.createRange()),g.wrap.show(),g.backdrop.show(),wpLink.refresh(c,e),a(document).trigger("wplink-open",g.wrap))},isMCE:function(){return d&&!d.isHidden()},refresh:function(a,b){var c="";wpLink.isMCE()?wpLink.mceRefresh(a,b):(g.wrap.hasClass("has-text-field")||g.wrap.addClass("has-text-field"),document.selection?c=document.selection.createRange().text||b||"":"undefined"!=typeof this.textarea.selectionStart&&this.textarea.selectionStart!==this.textarea.selectionEnd&&(b=this.textarea.value.substring(this.textarea.selectionStart,this.textarea.selectionEnd)||b||""),g.text.val(b),wpLink.setDefaultValues()),h?g.url.focus().blur():window.setTimeout(function(){g.url.focus()[0].select()}),e=g.url.val().replace(/^http:\/\//,"")},hasSelectedText:function(a){var b,c,e,f=d.selection.getContent();if(/]+>[^<]+<\/a>$/.test(f)||-1===f.indexOf("href=")))return!1;if(a){if(c=a.childNodes,0===c.length)return!1;for(e=c.length-1;e>=0;e--)if(b=c[e],3!=b.nodeType&&!window.tinymce.dom.BookmarkManager.isBookmarkNode(b))return!1}return!0},mceRefresh:function(e,f){var h,i=c(),j=this.hasSelectedText(i);i?(h=i.innerText||i.textContent,a.trim(h)||(h=f||""),e=e||d.dom.getAttrib(i,"href"),"_wp_link_placeholder"!==e?(g.url.val(e),g.openInNewTab.prop("checked","_blank"===d.dom.getAttrib(i,"target")),g.submit.val(b.update)):this.setDefaultValues(h)):(h=d.selection.getContent({format:"text"})||f||"",this.setDefaultValues(h)),j?(g.text.val(h),g.wrap.addClass("has-text-field")):(g.text.val(""),g.wrap.removeClass("has-text-field"))},close:function(b){a(document.body).removeClass("modal-open"),"noReset"!==b&&(wpLink.isMCE()?(d.plugins.wplink&&d.plugins.wplink.close(),d.focus()):(wpLink.textarea.focus(),wpLink.range&&(wpLink.range.moveToBookmark(wpLink.range.getBookmark()),wpLink.range.select()))),g.backdrop.hide(),g.wrap.hide(),e=!1,a(document).trigger("wplink-close",g.wrap)},getAttrs:function(){return wpLink.correctURL(),{href:a.trim(g.url.val()),target:g.openInNewTab.prop("checked")?"_blank":""}},buildHtml:function(a){var b='"},update:function(){wpLink.isMCE()?wpLink.mceUpdate():wpLink.htmlUpdate()},htmlUpdate:function(){var a,b,c,d,e,f,h,i=wpLink.textarea;i&&(a=wpLink.getAttrs(),b=g.text.val(),a.href&&(c=wpLink.buildHtml(a),document.selection&&wpLink.range?(i.focus(),wpLink.range.text=c+(b||wpLink.range.text)+"",wpLink.range.moveToBookmark(wpLink.range.getBookmark()),wpLink.range.select(),wpLink.range=null):"undefined"!=typeof i.selectionStart&&(d=i.selectionStart,e=i.selectionEnd,h=b||i.value.substring(d,e),c=c+h+"",f=d+c.length,d!==e||h||(f-=4),i.value=i.value.substring(0,d)+c+i.value.substring(e,i.value.length),i.selectionStart=i.selectionEnd=f),wpLink.close(),i.focus()))},mceUpdate:function(){var a,b,e=wpLink.getAttrs();return d.focus(),window.tinymce.isIE&&d.windowManager.wplinkBookmark&&(d.selection.moveToBookmark(d.windowManager.wplinkBookmark),d.windowManager.wplinkBookmark=null),e.href?(a=c(),g.wrap.hasClass("has-text-field")&&(b=g.text.val()||e.href),a?(b&&("innerText"in a?a.innerText=b:a.textContent=b),d.dom.setAttribs(a,e)):b?d.selection.setNode(d.dom.create("a",e,d.dom.encode(b))):d.execCommand("mceInsertLink",!1,e),wpLink.close("noReset"),d.focus(),void d.nodeChanged()):(d.execCommand("unlink"),void wpLink.close())},keydown:function(a){var b;27===a.keyCode?(wpLink.close(),a.stopImmediatePropagation()):9===a.keyCode&&(b=a.target.id,"wp-link-submit"!==b||a.shiftKey?"wp-link-close"===b&&a.shiftKey&&(g.submit.focus(),a.preventDefault()):(g.close.focus(),a.preventDefault()))},getUrlFromSelection:function(b){var c=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,e=/^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,4}[^ "]*$/i;return b||(this.isMCE()?b=d.selection.getContent({format:"text"}):document.selection&&wpLink.range?b=wpLink.range.text:"undefined"!=typeof this.textarea.selectionStart&&(b=this.textarea.value.substring(this.textarea.selectionStart,this.textarea.selectionEnd))),b=a.trim(b),b&&c.test(b)?"mailto:"+b:b&&e.test(b)?b.replace(/&|�?38;/gi,"&"):""},setDefaultValues:function(a){g.url.val(this.getUrlFromSelection(a)),g.submit.val(b.save)}},a(document).ready(wpLink.init)}(jQuery,window.wpLinkL10n); \ No newline at end of file diff --git a/wp-includes/version.php b/wp-includes/version.php index 3407f300bf..ce11e3d061 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-beta1-36776'; +$wp_version = '4.5-beta1-36777'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.