diff --git a/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/entityFeatures.ts b/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/entityFeatures.ts index d1ea6531055..891e084bac5 100644 --- a/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/entityFeatures.ts +++ b/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/entityFeatures.ts @@ -146,7 +146,7 @@ function cacheGetNeighborEntityElement( () => { const range = editor.getSelectionRange(); - if (collapseOnly && !range.collapsed) { + if (!range || (collapseOnly && !range.collapsed)) { return null; }