X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fenterkey%2Fplugin.js;h=f383fb45c57303630e389f176029b11fb47df943;hp=10b7e621004e3056502b2c8e43d1ff4792272bf6;hb=e371ddf8abcb89013e20e6d0dd746adec344d0e5;hpb=055b6b0792ce7dc53d47af606b367c04b927c2ab diff --git a/_source/plugins/enterkey/plugin.js b/_source/plugins/enterkey/plugin.js index 10b7e62..f383fb4 100644 --- a/_source/plugins/enterkey/plugin.js +++ b/_source/plugins/enterkey/plugin.js @@ -24,6 +24,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Get the range for the current selection. range = range || getRange( editor ); + // We may not have valid ranges to work on, like when inside a + // contenteditable=false element. + if ( !range ) + return; + var doc = range.document; // Exit the list when we're inside an empty list item block. (#5376) @@ -189,6 +194,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Get the range for the current selection. range = range || getRange( editor ); + // We may not have valid ranges to work on, like when inside a + // contenteditable=false element. + if ( !range ) + return; + var doc = range.document; // Determine the block element to be used. @@ -339,7 +349,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license function getRange( editor ) { // Get the selection ranges. - var ranges = editor.getSelection().getRanges(); + var ranges = editor.getSelection().getRanges( true ); // Delete the contents of all ranges except the first one. for ( var i = ranges.length - 1 ; i > 0 ; i-- )