Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
Solved a bug when editor.selection is null
Browse files Browse the repository at this point in the history
  • Loading branch information
silviubogan committed Jun 22, 2020
1 parent d8a0f4c commit faea4f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/editor/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export function isCursorAtBlockStart(editor) {
// fixSelection(editor);

// if the selection is collapsed
if (Range.isCollapsed(editor.selection)) {
if (editor.selection && Range.isCollapsed(editor.selection)) {
// if the selection is at root block or in the first block
if (
!editor.selection.anchor.path ||
Expand All @@ -189,7 +189,7 @@ export function isCursorAtBlockEnd(editor) {
// fixSelection(editor);

// if the selection is collapsed
if (Range.isCollapsed(editor.selection)) {
if (editor.selection && Range.isCollapsed(editor.selection)) {
const anchor = editor.selection?.anchor || {};

// the last block node in the editor
Expand Down

0 comments on commit faea4f8

Please sign in to comment.