mirror of
https://github.com/codex-team/editor.js
synced 2026-03-18 00:19:53 +01:00
small caret fix
This commit is contained in:
parent
5c08edae77
commit
f8043ff959
3 changed files with 13 additions and 1 deletions
|
|
@ -2688,6 +2688,12 @@ var Caret = function (_Module) {
|
|||
*/
|
||||
var firstLetterPosition = anchorNode.textContent.search(/\S/);
|
||||
|
||||
if (firstLetterPosition === -1) {
|
||||
// empty text
|
||||
|
||||
firstLetterPosition = 0;
|
||||
}
|
||||
|
||||
if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {
|
||||
|
||||
return true;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -233,6 +233,12 @@ export default class Caret extends Module {
|
|||
*/
|
||||
let firstLetterPosition = anchorNode.textContent.search(/\S/);
|
||||
|
||||
if (firstLetterPosition === -1) { // empty text
|
||||
|
||||
firstLetterPosition = 0;
|
||||
|
||||
}
|
||||
|
||||
if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue