diff --git a/src/wp-includes/class-wp-editor.php b/src/wp-includes/class-wp-editor.php
index 88c64a01bd..a4f18fd6ff 100644
--- a/src/wp-includes/class-wp-editor.php
+++ b/src/wp-includes/class-wp-editor.php
@@ -1043,6 +1043,7 @@ final class _WP_Editors {
'No alignment' => __( 'No alignment' ), // Tooltip for the 'alignnone' button in the image toolbar
'Remove' => __( 'Remove' ), // Tooltip for the 'remove' button in the image toolbar
'Edit ' => __( 'Edit' ), // Tooltip for the 'edit' button in the image toolbar
+ 'Paste URL or type to search' => __( 'Paste URL or type to search' ), // Placeholder for the inline link dialog
// Shortcuts help modal
'Keyboard Shortcuts' => __( 'Keyboard Shortcuts' ),
diff --git a/src/wp-includes/js/tinymce/plugins/wplink/plugin.js b/src/wp-includes/js/tinymce/plugins/wplink/plugin.js
index 2a8c4a14eb..b1769a51c7 100644
--- a/src/wp-includes/js/tinymce/plugins/wplink/plugin.js
+++ b/src/wp-includes/js/tinymce/plugins/wplink/plugin.js
@@ -32,6 +32,11 @@
url = url.slice( 0, -1 );
}
+ // If nothing's left (maybe the URL was just a fragment), use the whole URL.
+ if ( url === '' ) {
+ url = this.url;
+ }
+
// If the URL is longer that 40 chars, concatenate the beginning (after the domain) and ending with ...
if ( url.length > 40 && ( index = url.indexOf( '/' ) ) !== -1 && ( lastIndex = url.lastIndexOf( '/' ) ) !== -1 && lastIndex !== index ) {
// If the beginning + ending are shorter that 40 chars, show more of the ending
@@ -51,7 +56,7 @@
renderHtml: function() {
return (
'
' +
- '' +
+ '' +
'
'
);
},
@@ -68,6 +73,28 @@
var inputInstance;
var $ = window.jQuery;
+ function getSelectedLink() {
+ var href,
+ selectedNode = editor.selection.getNode(),
+ selectedText = editor.selection.getContent(),
+ link = editor.dom.getParent( selectedNode, 'a[href]' );
+
+ if ( ! link && selectedText.indexOf( '' ) !== -1 ) {
+ href = selectedText.match( /href="([^">]+)"/ );
+
+ if ( href && href[1] ) {
+ link = editor.$( 'a[href="' + href[1] + '"]', selectedNode )[0];
+ }
+
+ if ( link ) {
+ editor.selection.select( link );
+ editor.nodeChanged();
+ }
+ }
+
+ return link;
+ }
+
editor.on( 'preinit', function() {
if ( editor.wp && editor.wp._createToolbar ) {
toolbar = editor.wp._createToolbar( [
@@ -83,9 +110,10 @@
], true );
editToolbar.on( 'show', function() {
- var node = editToolbar.find( 'toolbar' )[0];
- node && node.focus( true );
- a = editor.dom.getParent( editor.selection.getNode(), 'a' );
+ var inputNode = editToolbar.find( 'toolbar' )[0];
+
+ inputNode && inputNode.focus( true );
+ a = getSelectedLink();
} );
editToolbar.on( 'hide', function() {
@@ -95,15 +123,14 @@
} );
editor.addCommand( 'WP_Link', function() {
- var a = editor.dom.getParent( editor.selection.getNode(), 'a' );
+ var link = getSelectedLink();
- if ( a ) {
- editor.dom.setAttribs( a, { 'data-wp-edit': true } );
+ if ( link ) {
+ editor.dom.setAttribs( link, { 'data-wp-edit': true } );
} else {
editor.execCommand( 'mceInsertLink', false, { href: '_wp_link_placeholder' } );
+ editor.nodeChanged();
}
-
- editor.nodeChanged();
} );
editor.addCommand( 'wp_link_apply', function() {
diff --git a/src/wp-includes/version.php b/src/wp-includes/version.php
index 4b7105f321..a9d90a9ed1 100644
--- a/src/wp-includes/version.php
+++ b/src/wp-includes/version.php
@@ -18,7 +18,7 @@ $wp_db_version = 36180;
*
* @global string $tinymce_version
*/
-$tinymce_version = '4303-20160119';
+$tinymce_version = '4303-20160205';
/**
* Holds the required PHP version