From be75cdbe7cb62033fb8604c212939df642d50c5b Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Thu, 25 Feb 2016 03:47:46 +0000 Subject: [PATCH] TinyMCE, inline link dialog: - Reset the inline dialog when canceling the advanced modal. If there is a link it should be on the first stage: follow/preview link. - Fix tabbing in the inline edit dialog. See #33301. git-svn-id: https://develop.svn.wordpress.org/trunk@36703 602fd350-edb4-49c9-b593-d223f7449a82 --- .../js/tinymce/plugins/wplink/plugin.js | 8 +++++++- src/wp-includes/js/wplink.js | 16 +++++----------- src/wp-includes/version.php | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/wp-includes/js/tinymce/plugins/wplink/plugin.js b/src/wp-includes/js/tinymce/plugins/wplink/plugin.js index e339d7fefb..fcad125f3f 100644 --- a/src/wp-includes/js/tinymce/plugins/wplink/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wplink/plugin.js @@ -57,7 +57,7 @@ return ( '' ); }, @@ -445,5 +445,11 @@ cmd: 'wp_link_apply', classes: 'widget btn primary' } ); + + return { + hideEditToolbar: function() { + editToolbar.hide(); + } + }; } ); } )( window.tinymce ); diff --git a/src/wp-includes/js/wplink.js b/src/wp-includes/js/wplink.js index d324da6ad9..8e177cf276 100644 --- a/src/wp-includes/js/wplink.js +++ b/src/wp-includes/js/wplink.js @@ -208,7 +208,9 @@ var wpLink; // Focus the URL field and highlight its contents. // If this is moved above the selection changes, // IE will show a flashing cursor over the dialog. - inputs.url.focus()[0].select(); + window.setTimeout( function() { + inputs.url.focus()[0].select(); + }, 100 ); } correctedURL = inputs.url.val().replace( /^http:\/\//, '' ); @@ -242,8 +244,7 @@ var wpLink; }, mceRefresh: function( url, text ) { - var selectedNode = editor.selection.getNode(), - linkNode = editor.dom.getParent( selectedNode, 'a[href]' ), + var linkNode = editor.dom.getParent( editor.selection.getNode(), 'a[href]' ), onlyText = this.hasSelectedText( linkNode ); if ( linkNode ) { @@ -272,8 +273,6 @@ var wpLink; }, close: function() { - var linkNode; - $( document.body ).removeClass( 'modal-open' ); if ( ! wpLink.isMCE() ) { @@ -284,12 +283,7 @@ var wpLink; wpLink.range.select(); } } else { - linkNode = editor.dom.getParent( editor.selection.getNode(), 'a[href]' ); - - if ( linkNode && editor.dom.getAttrib( linkNode, 'href' ) === '_wp_link_placeholder' ) { - editor.dom.remove( linkNode, true ); - } - + editor.plugins.wplink.hideEditToolbar(); editor.focus(); } diff --git a/src/wp-includes/version.php b/src/wp-includes/version.php index cf10f27d0a..6502ffa066 100644 --- a/src/wp-includes/version.php +++ b/src/wp-includes/version.php @@ -18,7 +18,7 @@ $wp_db_version = 36686; * * @global string $tinymce_version */ -$tinymce_version = '4304-20160219'; +$tinymce_version = '4304-20160224'; /** * Holds the required PHP version