Merged revision 42430 from trunk:

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 4.9.2.

Built from https://develop.svn.wordpress.org/branches/4.9@42442


git-svn-id: http://core.svn.wordpress.org/branches/4.9@42272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2018-01-13 11:28:43 +00:00
parent b8ebacbf82
commit 397b2de6e5
2 changed files with 4 additions and 4 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