Skip to content

Commit

Permalink
fix: improve active mark detection for inline nodes, fix #1893
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkuehn committed Sep 15, 2021
1 parent 80570e2 commit 6437790
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/helpers/isMarkActive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function isMarkActive(
let markRanges: MarkRange[] = []

state.doc.nodesBetween(from, to, (node, pos) => {
if (node.isText) {
if (node.isText || node.marks.length) {
const relativeFrom = Math.max(from, pos)
const relativeTo = Math.min(to, pos + node.nodeSize)
const range = relativeTo - relativeFrom
Expand Down

1 comment on commit 6437790

@websiddu
Copy link

@websiddu websiddu commented on 6437790 Dec 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this fixes #1893 introduces another unwanted behavior, e.g if there is a link at the end of the content, the link is shown when the cursor is placed at the end. So there should be an additonal check i.e node.isText || (!node.isText && node.marks.length) to make sure when using the text it will not make text as active when cursor is at the end of the link.

Please sign in to comment.