diff --git a/src/helpers/isLinkActive.ts b/src/helpers/isLinkActive.ts index e7a48543..e41e83dc 100644 --- a/src/helpers/isLinkActive.ts +++ b/src/helpers/isLinkActive.ts @@ -13,6 +13,10 @@ export const isLinkActive = (state: EditorState): boolean => { const isForwardSelection = anchor === from; const linkMarks: Mark[] = getSelectionMarks(state).filter(mark => mark.type === schema.marks.link); + if (!linkMarks.length) { + return false; + } + const selectionHasOnlyMarks = isForwardSelection ? ( state.doc.rangeHasMark(anchor, anchor + 1, schema.marks.link) &&