<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[36677] trunk/src/wp-includes: TinyMCE, inline link dialog:</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/36677">36677</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/36677","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>azaozz</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-02-24 06:20:01 +0000 (Wed, 24 Feb 2016)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>TinyMCE, inline link dialog:
- Remove the bottom half of the (old) modal and add autocomplete on the URL field.
- Disable the inline edit dialog in old IE (7, 8 and 9). Use only the modal there.
- Fix in IE10 and 11.
- Fix (most?) remaining edge cases.
- Fix focusing the inline dialog, the modal and the editor.

See <a href="https://core.trac.wordpress.org/ticket/33301">#33301</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswpeditorphp">trunk/src/wp-includes/class-wp-editor.php</a></li>
<li><a href="#trunksrcwpincludescsseditorcss">trunk/src/wp-includes/css/editor.css</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginswplinkpluginjs">trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjswplinkjs">trunk/src/wp-includes/js/wplink.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasswpeditorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-editor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-editor.php 2016-02-24 05:56:40 UTC (rev 36676)
+++ trunk/src/wp-includes/class-wp-editor.php   2016-02-24 06:20:01 UTC (rev 36677)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1414,41 +1414,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <div id="link-options">
</span><span class="cx" style="display: block; padding: 0 10px">                                <p class="howto"><?php _e( 'Enter the destination URL' ); ?></p>
</span><span class="cx" style="display: block; padding: 0 10px">                                <div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        <label><span><?php _e( 'URL' ); ?></span><input id="wp-link-url" type="text" /></label>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 <label><span><?php _e( 'URL' ); ?></span>
+                                       <input id="wp-link-url" type="text" role="combobox" aria-autocomplete="list" aria-expanded="false" placeholder="<?php _e( 'Paste URL or type to search' ); ?>" /></label>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 </div>
</span><span class="cx" style="display: block; padding: 0 10px">                                <div class="wp-link-text-field">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        <label><span><?php _e( 'Link Text' ); ?></span><input id="wp-link-text" type="text" /></label>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 <label><span><?php _e( 'Link Text' ); ?></span>
+                                       <input id="wp-link-text" type="text" /></label>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 </div>
</span><span class="cx" style="display: block; padding: 0 10px">                                <div class="link-target">
</span><span class="cx" style="display: block; padding: 0 10px">                                        <label><span>&nbsp;</span><input type="checkbox" id="wp-link-target" /> <?php _e( 'Open link in a new tab' ); ?></label>
</span><span class="cx" style="display: block; padding: 0 10px">                                </div>
</span><span class="cx" style="display: block; padding: 0 10px">                        </div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <p class="howto"><a href="#" id="wp-link-search-toggle"><?php _e( 'Or link to existing content' ); ?></a></p>
-                       <div id="search-panel">
-                               <div class="link-search-wrapper">
-                                       <label>
-                                               <span class="search-label"><?php _e( 'Search' ); ?></span>
-                                               <input type="search" id="wp-link-search" class="link-search-field" autocomplete="off" />
-                                               <span class="spinner"></span>
-                                       </label>
-                               </div>
-                               <div id="search-results" class="query-results" tabindex="0">
-                                       <ul></ul>
-                                       <div class="river-waiting">
-                                               <span class="spinner"></span>
-                                       </div>
-                               </div>
-                               <div id="most-recent-results" class="query-results" tabindex="0">
-                                       <div class="query-notice" id="query-notice-message">
-                                               <em class="query-notice-default"><?php _e( 'No search term specified. Showing recent items.' ); ?></em>
-                                               <em class="query-notice-hint screen-reader-text"><?php _e( 'Search or use up and down arrow keys to select an item.' ); ?></em>
-                                       </div>
-                                       <ul></ul>
-                                       <div class="river-waiting">
-                                               <span class="spinner"></span>
-                                       </div>
-                               </div>
-                       </div>
</del><span class="cx" style="display: block; padding: 0 10px">                 </div>
</span><span class="cx" style="display: block; padding: 0 10px">                <div class="submitbox">
</span><span class="cx" style="display: block; padding: 0 10px">                        <div id="wp-link-cancel">
</span></span></pre></div>
<a id="trunksrcwpincludescsseditorcss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/css/editor.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/css/editor.css      2016-02-24 05:56:40 UTC (rev 36676)
+++ trunk/src/wp-includes/css/editor.css        2016-02-24 06:20:01 UTC (rev 36677)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -84,8 +84,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> .mce-textbox,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.mce-checkbox i.mce-i-checkbox,
-#wp-link .query-results {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.mce-checkbox i.mce-i-checkbox {
</ins><span class="cx" style="display: block; padding: 0 10px">         border: 1px solid #ddd;
</span><span class="cx" style="display: block; padding: 0 10px">        -webkit-border-radius: 0;
</span><span class="cx" style="display: block; padding: 0 10px">        border-radius: 0;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1334,11 +1333,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        height: 100%;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-#wp-link-wrap.search-panel-visible {
-       height: 500px;
-       margin-top: -250px;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> #wp-link-wrap .wp-link-text-field {
</span><span class="cx" style="display: block; padding: 0 10px">        display: none;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1406,12 +1400,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> #wp-link-wrap.search-panel-visible #link-selector {
</span><span class="cx" style="display: block; padding: 0 10px">        -webkit-overflow-scrolling: touch;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        padding: 0 16px;
-       position: absolute;
-       top: 36px;
-       left: 0;
-       right: 0;
-       bottom: 44px;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> #wp-link ol,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1421,20 +1409,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        padding: 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-#wp-link-search-toggle:after {
-       display: inline-block;
-       font: normal 20px/1 dashicons;
-       vertical-align: top;
-       speak: none;
-       -webkit-font-smoothing: antialiased;
-       -moz-osx-font-smoothing: grayscale;
-       content: "\f140";
-}
-
-.search-panel-visible #wp-link-search-toggle:after {
-       content: "\f142";
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> #wp-link input[type="text"] {
</span><span class="cx" style="display: block; padding: 0 10px">        -webkit-box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px">        -moz-box-sizing: border-box;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1454,17 +1428,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">        color: inherit;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-#wp-link-search-toggle {
-       cursor: pointer;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> #wp-link label input[type="text"] {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        margin-top: 5px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ margin: 5px 0 0;
</ins><span class="cx" style="display: block; padding: 0 10px">         width: 70%;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-#wp-link #link-options label span,
-#wp-link #search-panel label span.search-label {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+#wp-link #link-options label span {
</ins><span class="cx" style="display: block; padding: 0 10px">         display: inline-block;
</span><span class="cx" style="display: block; padding: 0 10px">        width: 80px;
</span><span class="cx" style="display: block; padding: 0 10px">        text-align: right;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1474,27 +1443,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        word-wrap: break-word;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-#wp-link .link-search-field {
-       float: left;
-       width: 250px;
-       max-width: 70%;
-}
-
-#wp-link .link-search-wrapper {
-       margin: 5px 0 9px;
-       display: block;
-       overflow: hidden;
-}
-
-#wp-link .link-search-wrapper span {
-       float: left;
-       margin-top: 4px;
-}
-
-#wp-link .link-search-wrapper .spinner {
-       margin-top: 5px;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> #wp-link .link-target {
</span><span class="cx" style="display: block; padding: 0 10px">        padding: 3px 0 0;
</span><span class="cx" style="display: block; padding: 0 10px">        white-space: nowrap;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1506,22 +1454,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        max-width: 70%;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-#wp-link .query-results {
-       border: 1px #dfdfdf solid;
-       margin: 0;
-       background: #fff;
-       overflow: auto;
-       position: absolute;
-       left: 16px;
-       right: 16px;
-       bottom: 16px;
-       top: 172px;
-}
-
-.has-text-field #wp-link .query-results {
-       top: 205px;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> #wp-link li {
</span><span class="cx" style="display: block; padding: 0 10px">        clear: both;
</span><span class="cx" style="display: block; padding: 0 10px">        margin-bottom: 0;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1532,36 +1464,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        position: relative;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-#wp-link .query-notice {
-       padding: 0;
-       border-bottom: 1px solid #dfdfdf;
-       background-color: #f7fcfe;
-       color: #000;
-}
-
-#wp-link .query-notice .query-notice-default,
-#wp-link .query-notice .query-notice-hint {
-       display: block;
-       padding: 6px;
-       border-left: 4px solid #00a0d2;
-}
-
-#wp-link .unselectable.no-matches-found {
-       padding: 0;
-       border-bottom: 1px solid #dfdfdf;
-       background-color: #fef7f1;
-}
-
-#wp-link .no-matches-found .item-title {
-       display: block;
-       padding: 6px;
-       border-left: 4px solid #d54e21;
-}
-
-#wp-link .query-results em {
-       font-style: normal;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> #wp-link li:hover {
</span><span class="cx" style="display: block; padding: 0 10px">        background: #eaf2fa;
</span><span class="cx" style="display: block; padding: 0 10px">        color: #151515;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1607,20 +1509,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        top: 5px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-#wp-link #search-results,
-#wp-link #search-panel {
-       display: none;
-}
-
-#wp-link-wrap.search-panel-visible #search-panel {
-       display: block;
-}
-
-#wp-link .river-waiting {
-       display: none;
-       padding: 10px 0;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> #wp-link .submitbox {
</span><span class="cx" style="display: block; padding: 0 10px">        padding: 8px 16px;
</span><span class="cx" style="display: block; padding: 0 10px">        background: #fcfcfc;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1651,14 +1539,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                margin-top: -140px;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        #wp-link-wrap.search-panel-visible .query-results {
-               top: 195px;
-       }
-
-       #wp-link-wrap.search-panel-visible.has-text-field .query-results {
-               top: 235px;
-       }
-
</del><span class="cx" style="display: block; padding: 0 10px">         #link-selector {
</span><span class="cx" style="display: block; padding: 0 10px">                padding: 0 16px 60px;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1687,21 +1567,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                -webkit-transition: none;
</span><span class="cx" style="display: block; padding: 0 10px">                transition: none;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       #wp-link-wrap.search-panel-visible {
-               height: auto;
-               margin-top: 0;
-               top: 10px;
-               bottom: 10px;
-       }
-
-       .search-panel-visible #link-selector {
-               overflow: auto;
-       }
-
-       .search-panel-visible #search-panel .query-results {
-               position: static;
-       }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> @media screen and ( max-height: 290px ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1718,10 +1583,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                height: calc(100% - 92px);
</span><span class="cx" style="display: block; padding: 0 10px">                padding-bottom: 2px;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       #search-panel .query-results {
-               position: static;
-       }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> div.wp-link-preview {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1744,15 +1605,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        cursor: pointer;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-@media screen and ( max-width: 782px ) {
-       div.wp-link-preview {
-               margin: 8px 0 8px 5px;
-               max-width: 70%;
-               max-width: -webkit-calc(100% - 86px);
-               max-width: calc(100% - 86px);
-       }
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> div.wp-link-input {
</span><span class="cx" style="display: block; padding: 0 10px">        float: left;
</span><span class="cx" style="display: block; padding: 0 10px">        margin: 2px;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1767,14 +1619,33 @@
</span><span class="cx" style="display: block; padding: 0 10px">        box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-@media screen and ( max-width: 400px ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.ui-autocomplete.wplink-autocomplete {
+       z-index: 100110;
+       max-height: 200px;
+       overflow-y: auto;
+}
+
+.wplink-autocomplete li {
+       clear: both;
+       white-space: normal;
+}
+
+@media screen and ( max-width: 782px ) {
+       div.wp-link-preview,
</ins><span class="cx" style="display: block; padding: 0 10px">         div.wp-link-input {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                min-width: 0;
</del><span class="cx" style="display: block; padding: 0 10px">                 max-width: 70%;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                max-width: -webkit-calc(100% - 80px);
-               max-width: calc(100% - 80px);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         max-width: -webkit-calc(100% - 86px);
+               max-width: calc(100% - 86px);
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        div.wp-link-preview {
+               margin: 8px 0 8px 5px;
+       }
+
+       div.wp-link-input {
+               width: 300px;
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         div.wp-link-input input {
</span><span class="cx" style="display: block; padding: 0 10px">                width: 100%;
</span><span class="cx" style="display: block; padding: 0 10px">                font-size: 16px;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1782,13 +1653,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.ui-autocomplete.mce-wp-autocomplete {
-       z-index: 100100;
-       margin-top: 10px;
-       max-height: 200px;
-       overflow-y: auto;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> /* =Overlay Body
</span><span class="cx" style="display: block; padding: 0 10px"> -------------------------------------------------------------- */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginswplinkpluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js 2016-02-24 05:56:40 UTC (rev 36676)
+++ trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js   2016-02-24 06:20:01 UTC (rev 36677)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -57,16 +57,27 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return (
</span><span class="cx" style="display: block; padding: 0 10px">                                '<div id="' + this._id + '" class="wp-link-input">' +
</span><span class="cx" style="display: block; padding: 0 10px">                                        '<input type="text" value="" tabindex="-1" placeholder="' + tinymce.translate('Paste URL or type to search') + '" />' +
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        '<input type="hidden" value="" />' +
</ins><span class="cx" style="display: block; padding: 0 10px">                                 '</div>'
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px">                setURL: function( url ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        this.getEl().firstChild.value = url;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                },
+               getURL: function() {
+                       return tinymce.trim( this.getEl().firstChild.value );
+               },
+               getLinkText: function() {
+                       return tinymce.trim( this.getEl().firstChild.nextSibling.value );
+               },
+               reset: function() {
+                       var urlInput = this.getEl().firstChild;
+                       urlInput.value = '';
+                       urlInput.nextSibling.value = '';
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        tinymce.PluginManager.add( 'wplink', function( editor ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                var a;
</del><span class="cx" style="display: block; padding: 0 10px">                 var toolbar;
</span><span class="cx" style="display: block; padding: 0 10px">                var editToolbar;
</span><span class="cx" style="display: block; padding: 0 10px">                var previewInstance;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -104,15 +115,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( $element.attr( 'href' ) === '_wp_link_placeholder' ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        editor.dom.remove( element, true );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                } else if ( $element.attr( 'data-wp-link-edit' ) ) {
-                                       $element.attr( 'data-wp-link-edit', null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         } else if ( $element.attr( 'data-wplink-edit' ) ) {
+                                       $element.attr( 'data-wplink-edit', null );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px">                        });
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                function removePlaceholderStrings( content, dataAttr ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( dataAttr ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                content = content.replace( / data-wp-link-edit="true"/g, '' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         content = content.replace( / data-wplink-edit="true"/g, '' );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        return content.replace( /<a [^>]*?href="_wp_link_placeholder"[^>]*>([\s\S]+)<\/a>/g, '$1' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -135,12 +146,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                editToolbar.on( 'show', function() {
</span><span class="cx" style="display: block; padding: 0 10px">                                        var inputNode = editToolbar.find( 'toolbar' )[0];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        inputNode && inputNode.focus( true );
-                                       a = getSelectedLink();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( inputNode && ! tinymce.$( document.body ).hasClass( 'modal-open' ) ) {
+                                               window.setTimeout( function() {
+                                                       inputNode.focus( true );
+                                               });
+                                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                                 } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                editToolbar.on( 'hide', function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        editToolbar.scrolling || editor.execCommand( 'wp_link_cancel' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( ! editToolbar.scrolling ) {
+                                               editor.execCommand( 'wp_link_cancel' );
+                                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                                 } );
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                } );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -148,14 +164,23 @@
</span><span class="cx" style="display: block; padding: 0 10px">                editor.addCommand( 'WP_Link', function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        var link = getSelectedLink();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        if ( tinymce.Env.ie && tinymce.Env.ie < 10 ) {
+                               if ( typeof window.wpLink !== 'undefined' ) {
+                                       window.wpLink.open( editor.id );
+                               }
+
+                               return;
+                       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         if ( link ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                editor.dom.setAttribs( link, { 'data-wp-link-edit': true } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         editor.dom.setAttribs( link, { 'data-wplink-edit': true } );
</ins><span class="cx" style="display: block; padding: 0 10px">                         } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                removePlaceholders();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                editor.execCommand( 'mceInsertLink', false, { href: '_wp_link_placeholder' } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                editor.execCommand( 'mceInsertLink', false, { href: '_wp_link_placeholder' } );
-                               editor.selection.select( editor.$( 'a[href="_wp_link_placeholder"]' )[0] );
-                               editor.nodeChanged();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( tinymce.Env.ie ) {
+                                       editor.windowManager.wplinkBookmark = editor.selection.getBookmark();
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -164,32 +189,48 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                return;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        var href = tinymce.trim( inputInstance.getEl().firstChild.value );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 var href, text,
+                               linkNode = getSelectedLink();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( href && ! /^(?:[a-z]+:|#|\?|\.|\/)/.test( href ) ) {
-                               href = 'http://' + href;
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( linkNode ) {
+                               href = inputInstance.getURL();
+                               text = inputInstance.getLinkText();
+                               editor.focus();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( ! href ) {
-                               editor.dom.remove( a, true );
-                               return;
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( tinymce.isIE ) {
+                                       editor.selection.moveToBookmark( editor.windowManager.wplinkBookmark );
+                                       editor.windowManager.wplinkBookmark = null;
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( a ) {
-                               editor.dom.setAttribs( a, { href: href, 'data-wp-link-edit': null } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( ! href ) {
+                                       editor.dom.remove( linkNode, true );
+                                       return;
+                               }
+
+                               if ( ! /^(?:[a-z]+:|#|\?|\.|\/)/.test( href ) ) {
+                                       href = 'http://' + href;
+                               }
+
+                               editor.dom.setAttribs( linkNode, { href: href, 'data-wplink-edit': null } );
+
+                               if ( ! tinymce.trim( linkNode.innerHTML ) ) {
+                                       editor.$( linkNode ).text( text || href );
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        a = false;
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 inputInstance.reset();
</ins><span class="cx" style="display: block; padding: 0 10px">                         editor.nodeChanged();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        editor.focus();
</del><span class="cx" style="display: block; padding: 0 10px">                 } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                editor.addCommand( 'wp_link_cancel', function() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        inputInstance.reset();
</ins><span class="cx" style="display: block; padding: 0 10px">                         removePlaceholders();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        a = false;
-                       editor.nodeChanged();
</del><span class="cx" style="display: block; padding: 0 10px">                         editor.focus();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       if ( tinymce.isIE ) {
+                               editor.selection.moveToBookmark( editor.windowManager.wplinkBookmark );
+                               editor.windowManager.wplinkBookmark = null;
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                 } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // WP default shortcut
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -259,16 +300,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                editor.addButton( 'wp_link_input', {
</span><span class="cx" style="display: block; padding: 0 10px">                        type: 'WPLinkInput',
</span><span class="cx" style="display: block; padding: 0 10px">                        onPostRender: function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                var input = this.getEl().firstChild;
-                               var cache;
-                               var last;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         var element = this.getEl(),
+                                       input = element.firstChild,
+                                       $input, cache, last;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                inputInstance = this;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( $ && $.ui && $.ui.autocomplete ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $( input )
-                                       .on( 'keydown', function() {
-                                               $( input ).removeAttr( 'aria-activedescendant' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $input = $( input );
+
+                                       $input.on( 'keydown', function() {
+                                               $input.removeAttr( 'aria-activedescendant' );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         } )
</span><span class="cx" style="display: block; padding: 0 10px">                                        .autocomplete( {
</span><span class="cx" style="display: block; padding: 0 10px">                                                source: function( request, response ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -294,23 +336,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                        last = request.term;
</span><span class="cx" style="display: block; padding: 0 10px">                                                },
</span><span class="cx" style="display: block; padding: 0 10px">                                                focus: function( event, ui ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        $( input ).attr( 'aria-activedescendant', 'mce-wp-autocomplete-' + ui.item.ID );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 $input.attr( 'aria-activedescendant', 'mce-wp-autocomplete-' + ui.item.ID );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 },
</span><span class="cx" style="display: block; padding: 0 10px">                                                select: function( event, ui ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        $( input ).val( ui.item.permalink );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 $input.val( ui.item.permalink );
+                                                       $( element.firstChild.nextSibling ).val( ui.item.title );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         return false;
</span><span class="cx" style="display: block; padding: 0 10px">                                                },
</span><span class="cx" style="display: block; padding: 0 10px">                                                open: function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        $( input ).attr( 'aria-expanded', 'true' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 $input.attr( 'aria-expanded', 'true' );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         editToolbar.blockHide = true;
</span><span class="cx" style="display: block; padding: 0 10px">                                                },
</span><span class="cx" style="display: block; padding: 0 10px">                                                close: function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        $( input ).attr( 'aria-expanded', 'false' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 $input.attr( 'aria-expanded', 'false' );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         editToolbar.blockHide = false;
</span><span class="cx" style="display: block; padding: 0 10px">                                                },
</span><span class="cx" style="display: block; padding: 0 10px">                                                minLength: 2,
</span><span class="cx" style="display: block; padding: 0 10px">                                                position: {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        my: 'left top+5'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 my: 'left top+2'
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 }
</span><span class="cx" style="display: block; padding: 0 10px">                                        } ).autocomplete( 'instance' )._renderItem = function( ul, item ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                                return $( '<li role="option" id="mce-wp-autocomplete-' + item.ID + '">' )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -318,43 +361,51 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                .appendTo( ul );
</span><span class="cx" style="display: block; padding: 0 10px">                                        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $( input )
-                                       .attr( {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $input.attr( {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 'role': 'combobox',
</span><span class="cx" style="display: block; padding: 0 10px">                                                'aria-autocomplete': 'list',
</span><span class="cx" style="display: block; padding: 0 10px">                                                'aria-expanded': 'false',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                'aria-owns': $( input ).autocomplete( 'widget' ).attr( 'id' )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         'aria-owns': $input.autocomplete( 'widget' ).attr( 'id' )
</ins><span class="cx" style="display: block; padding: 0 10px">                                         }  )
</span><span class="cx" style="display: block; padding: 0 10px">                                        .on( 'focus', function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                $( input ).autocomplete( 'search' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         $input.autocomplete( 'search' );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         } )
</span><span class="cx" style="display: block; padding: 0 10px">                                        .autocomplete( 'widget' )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                .addClass( 'mce-wp-autocomplete' )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         .addClass( 'wplink-autocomplete' )
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 .attr( 'role', 'listbox' );
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                tinymce.$( input ).on( 'keydown', function( event ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        event.keyCode === 13 && editor.execCommand( 'wp_link_apply' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( event.keyCode === 13 ) {
+                                               editor.execCommand( 'wp_link_apply' );
+                                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                                 } );
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                editor.on( 'wptoolbar', function( event ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        var anchor = editor.dom.getParent( event.element, 'a' ),
-                               $anchor, href, edit;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 var linkNode = editor.dom.getParent( event.element, 'a' ),
+                               $linkNode, href, edit;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( anchor ) {
-                               $anchor = editor.$( anchor );
-                               href = $anchor.attr( 'href' );
-                               edit = $anchor.attr( 'data-wp-link-edit' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( tinymce.$( document.body ).hasClass( 'modal-open' ) ) {
+                               return;
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        if ( linkNode ) {
+                               $linkNode = editor.$( linkNode );
+                               href = $linkNode.attr( 'href' );
+                               edit = $linkNode.attr( 'data-wplink-edit' );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 if ( href === '_wp_link_placeholder' || edit ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        inputInstance.setURL( edit ? href : '' );
-                                       event.element = anchor;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( edit && ! inputInstance.getURL() ) {
+                                               inputInstance.setURL( href );
+                                       }
+
+                                       event.element = linkNode;
</ins><span class="cx" style="display: block; padding: 0 10px">                                         event.toolbar = editToolbar;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                } else if ( href && ! $anchor.find( 'img' ).length ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         } else if ( href && ! $linkNode.find( 'img' ).length ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         previewInstance.setURL( href );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        event.element = anchor;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 event.element = linkNode;
</ins><span class="cx" style="display: block; padding: 0 10px">                                         event.toolbar = toolbar;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -378,11 +429,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        icon: 'dashicon dashicons-admin-generic',
</span><span class="cx" style="display: block; padding: 0 10px">                        onclick: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( typeof window.wpLink !== 'undefined' ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        if ( inputInstance.getEl().firstChild.value ) {
-                                               editor.execCommand( 'wp_link_apply' );
-                                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 var url = inputInstance.getURL() || null,
+                                               text = inputInstance.getLinkText() || null;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        window.wpLink.open( editor.id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 editor.focus();
+                                       window.wpLink.open( editor.id, url, text );
+                                       inputInstance.reset();
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                } );
</span></span></pre></div>
<a id="trunksrcwpincludesjswplinkjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/wplink.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/wplink.js        2016-02-24 05:56:40 UTC (rev 36676)
+++ trunk/src/wp-includes/js/wplink.js  2016-02-24 06:20:01 UTC (rev 36677)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,10 +1,9 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/* global ajaxurl, tinymce, wpLinkL10n, setUserSetting, wpActiveEditor */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* global tinymce, wpLinkL10n, wpActiveEditor */
</ins><span class="cx" style="display: block; padding: 0 10px"> var wpLink;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> ( function( $ ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        var editor, searchTimer, River, Query, correctedURL,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var editor, correctedURL,
</ins><span class="cx" style="display: block; padding: 0 10px">                 inputs = {},
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                rivers = {},
</del><span class="cx" style="display: block; padding: 0 10px">                 isTouch = ( 'ontouchend' in document );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        function getLink() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -12,11 +11,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        wpLink = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                timeToTriggerRiver: 150,
-               minRiverAJAXDuration: 200,
-               riverBottomThreshold: 5,
-               keySensitivity: 100,
-               lastSearch: '',
</del><span class="cx" style="display: block; padding: 0 10px">                 textarea: '',
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                init: function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -29,59 +23,95 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        // Input
</span><span class="cx" style="display: block; padding: 0 10px">                        inputs.text = $( '#wp-link-text' );
</span><span class="cx" style="display: block; padding: 0 10px">                        inputs.url = $( '#wp-link-url' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        inputs.nonce = $( '#_ajax_linking_nonce' );
</del><span class="cx" style="display: block; padding: 0 10px">                         inputs.openInNewTab = $( '#wp-link-target' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        inputs.search = $( '#wp-link-search' );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Build Rivers
-                       rivers.search = new River( $( '#search-results' ) );
-                       rivers.recent = new River( $( '#most-recent-results' ) );
-                       rivers.elements = inputs.dialog.find( '.query-results' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $.ui && $.ui.autocomplete ) {
+                               wpLink.setAutocomplete();
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Get search notice text
-                       inputs.queryNotice = $( '#query-notice-message' );
-                       inputs.queryNoticeTextDefault = inputs.queryNotice.find( '.query-notice-default' );
-                       inputs.queryNoticeTextHint = inputs.queryNotice.find( '.query-notice-hint' );
-
-                       // Bind event handlers
-                       inputs.dialog.keydown( wpLink.keydown );
-                       inputs.dialog.keyup( wpLink.keyup );
</del><span class="cx" style="display: block; padding: 0 10px">                         inputs.submit.click( function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                event.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px">                                wpLink.update();
</span><span class="cx" style="display: block; padding: 0 10px">                        });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         inputs.close.add( inputs.backdrop ).add( '#wp-link-cancel a' ).click( function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                event.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px">                                wpLink.close();
</span><span class="cx" style="display: block; padding: 0 10px">                        });
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $( '#wp-link-search-toggle' ).on( 'click', wpLink.toggleInternalLinking );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 inputs.url.on( 'paste', function() {
+                               setTimeout( wpLink.correctURL, 0 );
+                       } );
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        rivers.elements.on( 'river-select', wpLink.updateFields );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         setAutocomplete: function() {
+                       var $input = inputs.url,
+                               cache, last;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Display 'hint' message when search field or 'query-results' box are focused
-                       inputs.search.on( 'focus.wplink', function() {
-                               inputs.queryNoticeTextDefault.hide();
-                               inputs.queryNoticeTextHint.removeClass( 'screen-reader-text' ).show();
-                       } ).on( 'blur.wplink', function() {
-                               inputs.queryNoticeTextDefault.show();
-                               inputs.queryNoticeTextHint.addClass( 'screen-reader-text' ).hide();
-                       } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $input.on( 'keydown', function() {
+                               $input.removeAttr( 'aria-activedescendant' );
+                       } ).autocomplete( {
+                               source: function( request, response ) {
+                                       if ( last === request.term ) {
+                                               response( cache );
+                                               return;
+                                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        inputs.search.on( 'keyup input', function() {
-                               var self = this;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( /^https?:/.test( request.term ) || request.term.indexOf( '.' ) !== -1 ) {
+                                               return response();
+                                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                window.clearTimeout( searchTimer );
-                               searchTimer = window.setTimeout( function() {
-                                       wpLink.searchInternalLinks.call( self );
-                               }, 500 );
-                       });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $.post( window.ajaxurl, {
+                                               action: 'wp-link-ajax',
+                                               page: 1,
+                                               search: request.term,
+                                               _ajax_linking_nonce: $( '#_ajax_linking_nonce' ).val()
+                                       }, function( data ) {
+                                               cache = data;
+                                               response( data );
+                                       }, 'json' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        inputs.url.on( 'paste', function() {
-                               setTimeout( wpLink.correctURL, 0 );
-                       } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 last = request.term;
+                               },
+                               focus: function( event, ui ) {
+                                       $input.attr( 'aria-activedescendant', 'mce-wp-autocomplete-' + ui.item.ID );
+                               },
+                               select: function( event, ui ) {
+                                       $input.val( ui.item.permalink );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        inputs.url.on( 'blur', wpLink.correctURL );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( inputs.wrap.hasClass( 'has-text-field' ) && tinymce.trim( inputs.text.val() ) === '' ) {
+                                               inputs.text.val( ui.item.title );
+                                       }
+
+                                       return false;
+                               },
+                               open: function() {
+                                       $input.attr( 'aria-expanded', 'true' );
+                               },
+                               close: function() {
+                                       $input.attr( 'aria-expanded', 'false' );
+                               },
+                               minLength: 2,
+                               position: {
+                                       my: 'left top+2'
+                               }
+                       } ).autocomplete( 'instance' )._renderItem = function( ul, item ) {
+                               return $( '<li role="option" id="mce-wp-autocomplete-' + item.ID + '">' )
+                               .append( '<span class="item-title">' + item.title + '</span>&nbsp;<span class="item-date alignright">' + item.info + '</span>' )
+                               .appendTo( ul );
+                       };
+
+                       $input.attr( {
+                               'aria-owns': $input.autocomplete( 'widget' ).attr( 'id' )
+                       }  )
+                       .on( 'focus', function() {
+                               $input.autocomplete( 'search' );
+                       } )
+                       .autocomplete( 'widget' )
+                               .addClass( 'wplink-autocomplete' )
+                               .attr( 'role', 'listbox' );
+
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // If URL wasn't corrected last time and doesn't start with http:, https:, ? # or /, prepend http://
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -94,7 +124,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                open: function( editorId ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         open: function( editorId, url, text ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         var ed,
</span><span class="cx" style="display: block; padding: 0 10px">                                $body = $( document.body );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -125,8 +155,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        editor = null;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ( editor && tinymce.isIE ) {
-                                       editor.windowManager.bookmark = editor.selection.getBookmark();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( editor && tinymce.isIE && ! editor.windowManager.wplinkBookmark ) {
+                                       editor.windowManager.wplinkBookmark = editor.selection.getBookmark();
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -138,7 +168,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        inputs.wrap.show();
</span><span class="cx" style="display: block; padding: 0 10px">                        inputs.backdrop.show();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        wpLink.refresh();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 wpLink.refresh( url, text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        $( document ).trigger( 'wplink-open', inputs.wrap );
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -147,15 +177,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return editor && ! editor.isHidden();
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                refresh: function() {
-                       var text = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         refresh: function( url, text ) {
+                       var linkText = '';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Refresh rivers (clear links, check visibility)
-                       rivers.search.refresh();
-                       rivers.recent.refresh();
-
</del><span class="cx" style="display: block; padding: 0 10px">                         if ( wpLink.isMCE() ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                wpLink.mceRefresh();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         wpLink.mceRefresh( url, text );
</ins><span class="cx" style="display: block; padding: 0 10px">                         } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                // For the Text editor the "Link text" field is always shown
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( ! inputs.wrap.hasClass( 'has-text-field' ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -164,11 +190,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( document.selection ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        // Old IE
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        text = document.selection.createRange().text || '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 linkText = document.selection.createRange().text || text || '';
</ins><span class="cx" style="display: block; padding: 0 10px">                                 } else if ( typeof this.textarea.selectionStart !== 'undefined' &&
</span><span class="cx" style="display: block; padding: 0 10px">                                        ( this.textarea.selectionStart !== this.textarea.selectionEnd ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        // W3C
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        text = this.textarea.value.substring( this.textarea.selectionStart, this.textarea.selectionEnd ) || '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 text = this.textarea.value.substring( this.textarea.selectionStart, this.textarea.selectionEnd ) || text || '';
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                inputs.text.val( text );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -185,16 +211,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                inputs.url.focus()[0].select();
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Load the most recent results if this is the first time opening the panel.
-                       if ( ! rivers.recent.ul.children().length ) {
-                               rivers.recent.ajax();
-                       }
-
</del><span class="cx" style="display: block; padding: 0 10px">                         correctedURL = inputs.url.val().replace( /^http:\/\//, '' );
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                hasSelectedText: function( linkNode ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        var html = editor.selection.getContent();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 var node, nodes, i, html = editor.selection.getContent();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Partial html and not a fully selected anchor element
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( /</.test( html ) && ( ! /^<a [^>]+>[^<]+<\/a>$/.test( html ) || html.indexOf('href=') === -1 ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -202,14 +223,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( linkNode ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                var nodes = linkNode.childNodes, i;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         nodes = linkNode.childNodes;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( nodes.length === 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        return false;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                for ( i = nodes.length - 1; i >= 0; i-- ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        if ( nodes[i].nodeType != 3 ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 node = nodes[i];
+
+                                       if ( node.nodeType != 3 && ! tinymce.dom.BookmarkManager.isBookmarkNode( node ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 return false;
</span><span class="cx" style="display: block; padding: 0 10px">                                        }
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -218,15 +241,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return true;
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                mceRefresh: function() {
-                       var text, url,
-                               selectedNode = editor.selection.getNode(),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         mceRefresh: function( url, text ) {
+                       var selectedNode = editor.selection.getNode(),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 linkNode = editor.dom.getParent( selectedNode, 'a[href]' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                onlyText = this.hasSelectedText( linkNode );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( linkNode ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                text = linkNode.innerText || linkNode.textContent;
-                               url = editor.dom.getAttrib( linkNode, 'href' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         text = tinymce.trim( linkNode.innerText || linkNode.textContent ) || text;
+                               url = url || editor.dom.getAttrib( linkNode, 'href' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( url === '_wp_link_placeholder' ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        url = '';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -236,7 +258,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                inputs.openInNewTab.prop( 'checked', '_blank' === editor.dom.getAttrib( linkNode, 'target' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                                inputs.submit.val( wpLinkL10n.update );
</span><span class="cx" style="display: block; padding: 0 10px">                        } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                text = editor.selection.getContent({ format: 'text' });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         text = editor.selection.getContent({ format: 'text' }) || text;
</ins><span class="cx" style="display: block; padding: 0 10px">                                 this.setDefaultValues();
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -251,7 +273,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                close: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        var linkNode;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         $( document.body ).removeClass( 'modal-open' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( ! wpLink.isMCE() ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -369,7 +391,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        editor.focus();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( tinymce.isIE ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                editor.selection.moveToBookmark( editor.windowManager.bookmark );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         editor.selection.moveToBookmark( editor.windowManager.wplinkBookmark );
+                               editor.windowManager.wplinkBookmark = null;
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( ! attrs.href ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -405,10 +428,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        editor.nodeChanged();
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                updateFields: function( e, li ) {
-                       inputs.url.val( li.children( '.item-permalink' ).val() );
-               },
-
</del><span class="cx" style="display: block; padding: 0 10px">                 setDefaultValues: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        var selection,
</span><span class="cx" style="display: block; padding: 0 10px">                                emailRegexp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -435,305 +454,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Update save prompt.
</span><span class="cx" style="display: block; padding: 0 10px">                        inputs.submit.val( wpLinkL10n.save );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                },
-
-               searchInternalLinks: function() {
-                       var t = $( this ), waiting,
-                               search = t.val();
-
-                       if ( search.length > 2 ) {
-                               rivers.recent.hide();
-                               rivers.search.show();
-
-                               // Don't search if the keypress didn't change the title.
-                               if ( wpLink.lastSearch == search )
-                                       return;
-
-                               wpLink.lastSearch = search;
-                               waiting = t.parent().find( '.spinner' ).addClass( 'is-active' );
-
-                               rivers.search.change( search );
-                               rivers.search.ajax( function() {
-                                       waiting.removeClass( 'is-active' );
-                               });
-                       } else {
-                               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, id;
-
-                       // Escape key.
-                       if ( 27 === event.keyCode ) {
-                               wpLink.close();
-                               event.stopImmediatePropagation();
-                       // Tab key.
-                       } else if ( 9 === event.keyCode ) {
-                               id = event.target.id;
-
-                               // wp-link-submit must always be the last focusable element in the dialog.
-                               // following focusable elements will be skipped on keyboard navigation.
-                               if ( id === 'wp-link-submit' && ! event.shiftKey ) {
-                                       inputs.close.focus();
-                                       event.preventDefault();
-                               } else if ( id === 'wp-link-close' && event.shiftKey ) {
-                                       inputs.submit.focus();
-                                       event.preventDefault();
-                               }
-                       }
-
-                       // Up Arrow and Down Arrow keys.
-                       if ( 38 !== event.keyCode && 40 !== event.keyCode ) {
-                               return;
-                       }
-
-                       if ( document.activeElement &&
-                               ( document.activeElement.id === 'link-title-field' || document.activeElement.id === 'url-field' ) ) {
-                               return;
-                       }
-
-                       // Up Arrow key.
-                       fn = 38 === event.keyCode ? 'prev' : 'next';
-                       clearInterval( wpLink.keyInterval );
-                       wpLink[ fn ]();
-                       wpLink.keyInterval = setInterval( wpLink[ fn ], wpLink.keySensitivity );
-                       event.preventDefault();
-               },
-
-               keyup: function( event ) {
-                       // Up Arrow and Down Arrow keys.
-                       if ( 38 === event.keyCode || 40 === event.keyCode ) {
-                               clearInterval( wpLink.keyInterval );
-                               event.preventDefault();
-                       }
-               },
-
-               delayedCallback: function( func, delay ) {
-                       var timeoutTriggered, funcTriggered, funcArgs, funcContext;
-
-                       if ( ! delay )
-                               return func;
-
-                       setTimeout( function() {
-                               if ( funcTriggered )
-                                       return func.apply( funcContext, funcArgs );
-                               // Otherwise, wait.
-                               timeoutTriggered = true;
-                       }, delay );
-
-                       return function() {
-                               if ( timeoutTriggered )
-                                       return func.apply( this, arguments );
-                               // Otherwise, wait.
-                               funcArgs = arguments;
-                               funcContext = this;
-                               funcTriggered = true;
-                       };
-               },
-
-               toggleInternalLinking: function( event ) {
-                       var visible = inputs.wrap.hasClass( 'search-panel-visible' );
-
-                       inputs.wrap.toggleClass( 'search-panel-visible', ! visible );
-                       setUserSetting( 'wplink', visible ? '0' : '1' );
-                       inputs[ ! visible ? 'search' : 'url' ].focus();
-                       event.preventDefault();
</del><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        River = function( element, search ) {
-               var self = this;
-               this.element = element;
-               this.ul = element.children( 'ul' );
-               this.contentHeight = element.children( '#link-selector-height' );
-               this.waiting = element.find('.river-waiting');
-
-               this.change( search );
-               this.refresh();
-
-               $( '#wp-link .query-results, #wp-link #link-selector' ).scroll( function() {
-                       self.maybeLoad();
-               });
-               element.on( 'click', 'li', function( event ) {
-                       self.select( $( this ), event );
-               });
-       };
-
-       $.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,
-                               response = wpLink.delayedCallback( function( results, params ) {
-                                       self.process( results, params );
-                                       if ( callback )
-                                               callback( results, params );
-                               }, delay );
-
-                       this.query.ajax( response );
-               },
-               change: function( search ) {
-                       if ( this.query && this._search == search )
-                               return;
-
-                       this._search = search;
-                       this.query = new Query( search );
-                       this.element.scrollTop( 0 );
-               },
-               process: function( results, params ) {
-                       var list = '', alt = true, classes = '',
-                               firstPage = params.page == 1;
-
-                       if ( ! results ) {
-                               if ( firstPage ) {
-                                       list += '<li class="unselectable no-matches-found"><span class="item-title"><em>' +
-                                               wpLinkL10n.noMatchesFound + '</em></span></li>';
-                               }
-                       } else {
-                               $.each( results, function() {
-                                       classes = alt ? 'alternate' : '';
-                                       classes += this.title ? '' : ' no-title';
-                                       list += classes ? '<li class="' + classes + '">' : '<li>';
-                                       list += '<input type="hidden" class="item-permalink" value="' + this.permalink + '" />';
-                                       list += '<span class="item-title">';
-                                       list += this.title ? this.title : wpLinkL10n.noTitle;
-                                       list += '</span><span class="item-info">' + this.info + '</span></li>';
-                                       alt = ! alt;
-                               });
-                       }
-
-                       this.ul[ firstPage ? 'html' : 'append' ]( list );
-               },
-               maybeLoad: function() {
-                       var self = this,
-                               el = this.element,
-                               bottom = el.scrollTop() + el.height();
-
-                       if ( ! this.query.ready() || bottom < this.contentHeight.height() - wpLink.riverBottomThreshold )
-                               return;
-
-                       setTimeout(function() {
-                               var newTop = el.scrollTop(),
-                                       newBottom = newTop + el.height();
-
-                               if ( ! self.query.ready() || newBottom < self.contentHeight.height() - wpLink.riverBottomThreshold )
-                                       return;
-
-                               self.waiting.addClass( 'is-active' );
-                               el.scrollTop( newTop + self.waiting.outerHeight() );
-
-                               self.ajax( function() {
-                                       self.waiting.removeClass( 'is-active' );
-                               });
-                       }, wpLink.timeToTriggerRiver );
-               }
-       });
-
-       Query = function( search ) {
-               this.page = 1;
-               this.allLoaded = false;
-               this.querying = false;
-               this.search = search;
-       };
-
-       $.extend( Query.prototype, {
-               ready: function() {
-                       return ! ( this.querying || this.allLoaded );
-               },
-               ajax: function( callback ) {
-                       var self = this,
-                               query = {
-                                       action : 'wp-link-ajax',
-                                       page : this.page,
-                                       '_ajax_linking_nonce' : inputs.nonce.val()
-                               };
-
-                       if ( this.search )
-                               query.search = this.search;
-
-                       this.querying = true;
-
-                       $.post( ajaxurl, query, function( r ) {
-                               self.page++;
-                               self.querying = false;
-                               self.allLoaded = ! r;
-                               callback( r, query );
-                       }, 'json' );
-               }
-       });
-
</del><span class="cx" style="display: block; padding: 0 10px">         $( document ).ready( wpLink.init );
</span><span class="cx" style="display: block; padding: 0 10px"> })( jQuery );
</span></span></pre>
</div>
</div>

</body>
</html>