diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index a06e7df56c..e0f4464d94 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -64,7 +64,7 @@ $core_actions_post = array( 'parse-media-shortcode', 'destroy-sessions', 'install-plugin', 'update-plugin', 'press-this-save-post', 'press-this-add-category', 'crop-image', 'generate-password', 'save-wporg-username', 'delete-plugin', 'search-plugins', 'search-install-plugins', 'activate-plugin', 'update-theme', 'delete-theme', - 'install-theme', 'test_url', 'get-post-thumbnail-html', + 'install-theme', 'get-post-thumbnail-html', ); // Deprecated diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index dad9deaebe..e91b522227 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -3886,46 +3886,3 @@ function wp_ajax_search_install_plugins() { wp_send_json_success( $status ); } - -/** - * Ajax handler for testing if a URL exists. - * - * Used in the editor. - * - * @since 4.6.0 - */ -function wp_ajax_test_url() { - if ( ! current_user_can( 'edit_posts' ) || ! wp_verify_nonce( $_POST['nonce'], 'wp-test-url' ) ) { - wp_send_json_error(); - } - - $href = esc_url_raw( $_POST['href'] ); - - // Relative URL - if ( strpos( $href, '//' ) !== 0 && in_array( $href[0], array( '/', '#', '?' ), true ) ) { - $href = get_bloginfo( 'url' ) . $href; - } - - // No redirects - $response = wp_safe_remote_get( $href, array( - 'timeout' => 15, - // Use an explicit user-agent - 'user-agent' => 'WordPress URL Test', - ) ); - - $error = false; - - if ( is_wp_error( $response ) ) { - if ( strpos( $response->get_error_message(), 'resolve host' ) !== false ) { - $error = true; - } - } elseif ( wp_remote_retrieve_response_code( $response ) === 404 ) { - $error = true; - } - - if ( $error ) { - wp_send_json_error( array( 'httpError' => true ) ); - } - - wp_send_json_success(); -} diff --git a/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php index 85d943c972..f0290b0f1b 100644 --- a/wp-includes/class-wp-editor.php +++ b/wp-includes/class-wp-editor.php @@ -1065,7 +1065,7 @@ final class _WP_Editors { 'Ctrl + letter:' => __( 'Ctrl + letter:' ), 'Letter' => __( 'Letter' ), 'Action' => __( 'Action' ), - 'Warning: the link has been inserted but the destination cannot be reached.' => __( 'Warning: the link has been inserted but the destination cannot be reached.' ), + 'Warning: the link has been inserted but may have errors. Please test it.' => __( 'Warning: the link has been inserted but may have errors. Please test it.' ), 'To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.' => __( 'To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.' ), 'When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' => @@ -1286,13 +1286,7 @@ final class _WP_Editors { '; - } - - if ( $has_wplink || in_array( 'link', self::$qt_buttons, true ) ) { + if ( in_array( 'wplink', self::$plugins, true ) || in_array( 'link', self::$qt_buttons, true ) ) { self::wp_link_dialog(); } diff --git a/wp-includes/js/tinymce/plugins/wplink/plugin.js b/wp-includes/js/tinymce/plugins/wplink/plugin.js index 8ba459a581..1ce1c926c1 100644 --- a/wp-includes/js/tinymce/plugins/wplink/plugin.js +++ b/wp-includes/js/tinymce/plugins/wplink/plugin.js @@ -93,8 +93,9 @@ var doingUndoRedo; var doingUndoRedoTimer; var $ = window.jQuery; - var urlErrors = {}; var emailRegex = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i; + var urlRegex1 = /^https?:\/\/([^\s/?.#-][^\s\/?.#]*\.?)+(\/[^\s"]*)?$/i; + var urlRegex2 = /^https?:\/\/[^\/]+\.[^\/]+($|\/)/i; var speak = ( typeof window.wp !== 'undefined' && window.wp.a11y && window.wp.a11y.speak ) ? window.wp.a11y.speak : function() {}; var hasLinkError = false; @@ -150,16 +151,6 @@ }); } - function setLinkError( $link ) { - hasLinkError = true; - $link.attr( 'data-wplink-url-error', 'true' ); - speak( editor.translate( 'Warning: the link has been inserted but the destination cannot be reached.' ), 'assertive' ); - - if ( toolbar && toolbar.visible() ) { - toolbar.$el.find( '.wp-link-preview a' ).addClass( 'wplink-url-error' ); - } - } - function checkLink( node ) { var $link = editor.$( node ); var href = $link.attr( 'href' ); @@ -170,34 +161,13 @@ hasLinkError = false; - if ( /^http/i.test( href ) && ! /^https?:\/\/[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}(\/|$)/i.test( href ) ) { - urlErrors[href] = true; - } - - if ( urlErrors.hasOwnProperty( href ) ) { - setLinkError( $link ); - return; + if ( /^http/i.test( href ) && ( ! urlRegex1.test( href ) || ! urlRegex2.test( href ) ) ) { + hasLinkError = true; + $link.attr( 'data-wplink-url-error', 'true' ); + speak( editor.translate( 'Warning: the link has been inserted but may have errors. Please test it.' ), 'assertive' ); } else { $link.removeAttr( 'data-wplink-url-error' ); } - - $.post( - window.ajaxurl, { - action: 'test_url', - nonce: $( '#_wplink_urltest_nonce' ).val(), - href: href - }, - 'json' - ).done( function( response ) { - if ( response.success ) { - return; - } - - if ( response.data && response.data.httpError ) { - urlErrors[href] = true; - setLinkError( $link ); - } - }); } editor.on( 'preinit', function() { diff --git a/wp-includes/js/tinymce/plugins/wplink/plugin.min.js b/wp-includes/js/tinymce/plugins/wplink/plugin.min.js index 2297e635dc..9df32cb398 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 a.replace(/(]+>)([\s\S]*?)<\/a>/g,function(a,c,d){return c.indexOf(' href="_wp_link_placeholder"')>-1?d:(b&&(c=c.replace(/ data-wplink-edit="true"/g,"")),c=c.replace(/ data-wplink-url-error="true"/g,""),c+d+"")})}function f(a){s=!0,a.attr("data-wplink-url-error","true"),r(b.translate("Warning: the link has been inserted but the destination cannot be reached."),"assertive"),h&&h.visible()&&h.$el.find(".wp-link-preview a").addClass("wplink-url-error")}function g(a){var c=b.$(a),d=c.attr("href");if(d&&"undefined"!=typeof o){if(s=!1,/^http/i.test(d)&&!/^https?:\/\/[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}(\/|$)/i.test(d)&&(p[d]=!0),p.hasOwnProperty(d))return void f(c);c.removeAttr("data-wplink-url-error"),o.post(window.ajaxurl,{action:"test_url",nonce:o("#_wplink_urltest_nonce").val(),href:d},"json").done(function(a){a.success||a.data&&a.data.httpError&&(p[d]=!0,f(c))})}}var h,i,j,k,l,m,n,o=window.jQuery,p={},q=/^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i,r="undefined"!=typeof window.wp&&window.wp.a11y&&window.wp.a11y.speak?window.wp.a11y.speak:function(){},s=!1;return b.on("preinit",function(){if(b.wp&&b.wp._createToolbar){h=b.wp._createToolbar(["wp_link_preview","wp_link_edit","wp_link_remove"],!0);var a=["wp_link_input","wp_link_apply"];"undefined"!=typeof window.wpLink&&a.push("wp_link_advanced"),i=b.wp._createToolbar(a,!0),i.on("show",function(){"undefined"!=typeof window.wpLink&&window.wpLink.modalOpen||window.setTimeout(function(){var a=i.$el.find("input.ui-autocomplete-input")[0],b=l&&(l.textContent||l.innerText);a&&(!a.value&&b&&"undefined"!=typeof window.wpLink&&(a.value=window.wpLink.getUrlFromSelection(b)),m||(a.focus(),a.select()))})}),i.on("hide",function(){i.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):(l=c(),i.tempHide=!1,void(l?b.dom.setAttribs(l,{"data-wplink-edit":!0}):(d(),b.execCommand("mceInsertLink",!1,{href:"_wp_link_placeholder"}),l=b.$('a[href="_wp_link_placeholder"]')[0],b.nodeChanged())))}),b.addCommand("wp_link_apply",function(){if(!i.scrolling){var c,d;if(l){if(c=k.getURL(),d=k.getLinkText(),b.focus(),!c)return void b.dom.remove(l,!0);/^(?:[a-z]+:|#|\?|\.|\/)/.test(c)||q.test(c)||(c="http://"+c),b.dom.setAttribs(l,{href:c,"data-wplink-edit":null}),a.trim(l.innerHTML)||b.$(l).text(d||c),g(l)}k.reset(),b.nodeChanged(),"undefined"==typeof window.wpLinkL10n||s||r(window.wpLinkL10n.linkInserted)}}),b.addCommand("wp_link_cancel",function(){i.tempHide||(k.reset(),d())}),b.addCommand("wp_unlink",function(){b.execCommand("unlink"),i.tempHide=!1,b.execCommand("wp_link_cancel")}),b.addShortcut("access+a","","WP_Link"),b.addShortcut("access+s","","wp_unlink"),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.on("keydown",function(c){27===c.keyCode&&b.execCommand("wp_link_cancel"),c.altKey||a.Env.mac&&(!c.metaKey||c.ctrlKey)||!a.Env.mac&&!c.ctrlKey||89!==c.keyCode&&90!==c.keyCode||(m=!0,window.clearTimeout(n),n=window.setTimeout(function(){m=!1},500))}),b.addButton("wp_link_preview",{type:"WPLinkPreview",onPostRender:function(){j=this}}),b.addButton("wp_link_input",{type:"WPLinkInput",onPostRender:function(){var c,d,e,f=this.getEl(),g=f.firstChild;k=this,o&&o.ui&&o.ui.autocomplete&&(c=o(g),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():(o.post(window.ajaxurl,{action:"wp-link-ajax",page:1,search:a.term,_ajax_linking_nonce:o("#_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),a.preventDefault()},select:function(a,b){return c.val(b.item.permalink),o(f.firstChild.nextSibling).val(b.item.title),9===a.keyCode&&"undefined"!=typeof window.wpLinkL10n&&r(window.wpLinkL10n.linkSelected),!1},open:function(){c.attr("aria-expanded","true"),i.blockHide=!0},close:function(){c.attr("aria-expanded","false"),i.blockHide=!1},minLength:2,position:{my:"left top+2"},messages:{noResults:"undefined"!=typeof window.uiAutocompleteL10n?window.uiAutocompleteL10n.noResults:"",results:function(a){return"undefined"!=typeof window.uiAutocompleteL10n?a>1?window.uiAutocompleteL10n.manyResults.replace("%d",a):window.uiAutocompleteL10n.oneResult:void 0}}}).autocomplete("instance")._renderItem=function(a,b){return o('
  • ').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(){var a=c.val();a&&!/^https?:/.test(a)&&c.autocomplete("search")}).autocomplete("widget").addClass("wplink-autocomplete").attr("role","listbox").removeAttr("tabindex").on("menufocus",function(a,b){b.item.attr("aria-selected","true")}).on("menublur",function(){o(this).find('[aria-selected="true"]').removeAttr("aria-selected")})),a.$(g).on("keydown",function(a){13===a.keyCode&&(b.execCommand("wp_link_apply"),a.preventDefault())})}}),b.on("wptoolbar",function(a){var c,d,e,f=b.dom.getParent(a.element,"a");return"undefined"!=typeof window.wpLink&&window.wpLink.modalOpen?void(i.tempHide=!0):(i.tempHide=!1,void(f?(c=b.$(f),d=c.attr("href"),e=c.attr("data-wplink-edit"),"_wp_link_placeholder"===d||e?("_wp_link_placeholder"===d||k.getURL()||k.setURL(d),a.element=f,a.toolbar=i):d&&!c.find("img").length&&(j.setURL(d),a.element=f,a.toolbar=h,"true"===c.attr("data-wplink-url-error")?h.$el.find(".wp-link-preview a").addClass("wplink-url-error"):(h.$el.find(".wp-link-preview a").removeClass("wplink-url-error"),s=!1))):i.visible()&&b.execCommand("wp_link_cancel")))}),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:"wp_unlink"}),b.addButton("wp_link_advanced",{tooltip:"Link options",icon:"dashicon dashicons-admin-generic",onclick:function(){if("undefined"!=typeof window.wpLink){var c=k.getURL()||null,d=k.getLinkText()||null;a.Env.ie&&b.focus(),window.wpLink.open(b.id,c,d,l),i.tempHide=!0,k.reset()}}}),b.addButton("wp_link_apply",{tooltip:"Apply",icon:"dashicon dashicons-editor-break",cmd:"wp_link_apply",classes:"widget btn primary"}),{close:function(){i.tempHide=!1,b.execCommand("wp_link_cancel")},checkLink:g}})}(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 a.replace(/(]+>)([\s\S]*?)<\/a>/g,function(a,c,d){return c.indexOf(' href="_wp_link_placeholder"')>-1?d:(b&&(c=c.replace(/ data-wplink-edit="true"/g,"")),c=c.replace(/ data-wplink-url-error="true"/g,""),c+d+"")})}function f(a){var c=b.$(a),d=c.attr("href");d&&"undefined"!=typeof n&&(s=!1,!/^http/i.test(d)||p.test(d)&&q.test(d)?c.removeAttr("data-wplink-url-error"):(s=!0,c.attr("data-wplink-url-error","true"),r(b.translate("Warning: the link has been inserted but may have errors. Please test it."),"assertive")))}var g,h,i,j,k,l,m,n=window.jQuery,o=/^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i,p=/^https?:\/\/([^\s/?.#-][^\s\/?.#]*\.?)+(\/[^\s"]*)?$/i,q=/^https?:\/\/[^\/]+\.[^\/]+($|\/)/i,r="undefined"!=typeof window.wp&&window.wp.a11y&&window.wp.a11y.speak?window.wp.a11y.speak:function(){},s=!1;return b.on("preinit",function(){if(b.wp&&b.wp._createToolbar){g=b.wp._createToolbar(["wp_link_preview","wp_link_edit","wp_link_remove"],!0);var a=["wp_link_input","wp_link_apply"];"undefined"!=typeof window.wpLink&&a.push("wp_link_advanced"),h=b.wp._createToolbar(a,!0),h.on("show",function(){"undefined"!=typeof window.wpLink&&window.wpLink.modalOpen||window.setTimeout(function(){var a=h.$el.find("input.ui-autocomplete-input")[0],b=k&&(k.textContent||k.innerText);a&&(!a.value&&b&&"undefined"!=typeof window.wpLink&&(a.value=window.wpLink.getUrlFromSelection(b)),l||(a.focus(),a.select()))})}),h.on("hide",function(){h.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):(k=c(),h.tempHide=!1,void(k?b.dom.setAttribs(k,{"data-wplink-edit":!0}):(d(),b.execCommand("mceInsertLink",!1,{href:"_wp_link_placeholder"}),k=b.$('a[href="_wp_link_placeholder"]')[0],b.nodeChanged())))}),b.addCommand("wp_link_apply",function(){if(!h.scrolling){var c,d;if(k){if(c=j.getURL(),d=j.getLinkText(),b.focus(),!c)return void b.dom.remove(k,!0);/^(?:[a-z]+:|#|\?|\.|\/)/.test(c)||o.test(c)||(c="http://"+c),b.dom.setAttribs(k,{href:c,"data-wplink-edit":null}),a.trim(k.innerHTML)||b.$(k).text(d||c),f(k)}j.reset(),b.nodeChanged(),"undefined"==typeof window.wpLinkL10n||s||r(window.wpLinkL10n.linkInserted)}}),b.addCommand("wp_link_cancel",function(){h.tempHide||(j.reset(),d())}),b.addCommand("wp_unlink",function(){b.execCommand("unlink"),h.tempHide=!1,b.execCommand("wp_link_cancel")}),b.addShortcut("access+a","","WP_Link"),b.addShortcut("access+s","","wp_unlink"),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.on("keydown",function(c){27===c.keyCode&&b.execCommand("wp_link_cancel"),c.altKey||a.Env.mac&&(!c.metaKey||c.ctrlKey)||!a.Env.mac&&!c.ctrlKey||89!==c.keyCode&&90!==c.keyCode||(l=!0,window.clearTimeout(m),m=window.setTimeout(function(){l=!1},500))}),b.addButton("wp_link_preview",{type:"WPLinkPreview",onPostRender:function(){i=this}}),b.addButton("wp_link_input",{type:"WPLinkInput",onPostRender:function(){var c,d,e,f=this.getEl(),g=f.firstChild;j=this,n&&n.ui&&n.ui.autocomplete&&(c=n(g),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():(n.post(window.ajaxurl,{action:"wp-link-ajax",page:1,search:a.term,_ajax_linking_nonce:n("#_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),a.preventDefault()},select:function(a,b){return c.val(b.item.permalink),n(f.firstChild.nextSibling).val(b.item.title),9===a.keyCode&&"undefined"!=typeof window.wpLinkL10n&&r(window.wpLinkL10n.linkSelected),!1},open:function(){c.attr("aria-expanded","true"),h.blockHide=!0},close:function(){c.attr("aria-expanded","false"),h.blockHide=!1},minLength:2,position:{my:"left top+2"},messages:{noResults:"undefined"!=typeof window.uiAutocompleteL10n?window.uiAutocompleteL10n.noResults:"",results:function(a){return"undefined"!=typeof window.uiAutocompleteL10n?a>1?window.uiAutocompleteL10n.manyResults.replace("%d",a):window.uiAutocompleteL10n.oneResult:void 0}}}).autocomplete("instance")._renderItem=function(a,b){return n('
  • ').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(){var a=c.val();a&&!/^https?:/.test(a)&&c.autocomplete("search")}).autocomplete("widget").addClass("wplink-autocomplete").attr("role","listbox").removeAttr("tabindex").on("menufocus",function(a,b){b.item.attr("aria-selected","true")}).on("menublur",function(){n(this).find('[aria-selected="true"]').removeAttr("aria-selected")})),a.$(g).on("keydown",function(a){13===a.keyCode&&(b.execCommand("wp_link_apply"),a.preventDefault())})}}),b.on("wptoolbar",function(a){var c,d,e,f=b.dom.getParent(a.element,"a");return"undefined"!=typeof window.wpLink&&window.wpLink.modalOpen?void(h.tempHide=!0):(h.tempHide=!1,void(f?(c=b.$(f),d=c.attr("href"),e=c.attr("data-wplink-edit"),"_wp_link_placeholder"===d||e?("_wp_link_placeholder"===d||j.getURL()||j.setURL(d),a.element=f,a.toolbar=h):d&&!c.find("img").length&&(i.setURL(d),a.element=f,a.toolbar=g,"true"===c.attr("data-wplink-url-error")?g.$el.find(".wp-link-preview a").addClass("wplink-url-error"):(g.$el.find(".wp-link-preview a").removeClass("wplink-url-error"),s=!1))):h.visible()&&b.execCommand("wp_link_cancel")))}),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:"wp_unlink"}),b.addButton("wp_link_advanced",{tooltip:"Link options",icon:"dashicon dashicons-admin-generic",onclick:function(){if("undefined"!=typeof window.wpLink){var c=j.getURL()||null,d=j.getLinkText()||null;a.Env.ie&&b.focus(),window.wpLink.open(b.id,c,d,k),h.tempHide=!0,j.reset()}}}),b.addButton("wp_link_apply",{tooltip:"Apply",icon:"dashicon dashicons-editor-break",cmd:"wp_link_apply",classes:"widget btn primary"}),{close:function(){h.tempHide=!1,b.execCommand("wp_link_cancel")},checkLink:f}})}(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 baa8a16b0c..7c496f7b3a 100644 Binary files a/wp-includes/js/tinymce/wp-tinymce.js.gz and b/wp-includes/js/tinymce/wp-tinymce.js.gz differ diff --git a/wp-includes/version.php b/wp-includes/version.php index c8974ba7c9..96346b46db 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-beta4-38158'; +$wp_version = '4.6-beta4-38159'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.