Editor: ensure there is a selection before getting the caret position. Fixes a bug in Firefox when there is no selection for a hidden element.

Props johnschulz, azaozz.

Fixes #43012 for trunk.
Built from https://develop.svn.wordpress.org/trunk@42430


git-svn-id: http://core.svn.wordpress.org/trunk@42260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2018-01-08 20:20:53 +00:00
parent fbb1f9162b
commit 4a3faae0e8
3 changed files with 5 additions and 5 deletions

View File

@ -695,10 +695,10 @@ window.wp = window.wp || {};
*/
function findBookmarkedPosition( editor ) {
// Get the TinyMCE `window` reference, since we need to access the raw selection.
var TinyMCEWIndow = editor.getWin(),
selection = TinyMCEWIndow.getSelection();
var TinyMCEWindow = editor.getWin(),
selection = TinyMCEWindow.getSelection();
if ( selection.rangeCount <= 0 ) {
if ( ! selection || selection.rangeCount < 1 ) {
// no selection, no need to continue.
return;
}

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-42429';
$wp_version = '5.0-alpha-42430';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.