Skip to content

Commit

Permalink
bug: wrong logic for FloatingLinkEditorPlugin bad node
Browse files Browse the repository at this point in the history
  • Loading branch information
umaranis committed May 7, 2024
1 parent 3dd164f commit d3e7496
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@
$isLink = false;
return;
}
const badNode = selection.getNodes().find((node) => {
const linkNode = findMatchingParent(node, isLinkNode);
const autoLinkNode = findMatchingParent(node, isAutoLinkNode);
if (
!linkNode?.is(focusLinkNode) &&
!autoLinkNode?.is(focusAutoLinkNode) &&
!linkNode &&
!autoLinkNode &&
!isLineBreakNode(node)
) {
return node;
}
});
const badNode = selection
.getNodes()
.filter((node) => !isLineBreakNode(node))
.find((node) => {
const linkNode = findMatchingParent(node, isLinkNode);
const autoLinkNode = findMatchingParent(node, isAutoLinkNode);
return (
(focusLinkNode && !focusLinkNode.is(linkNode)) ||
(linkNode && !linkNode.is(focusLinkNode)) ||
(focusAutoLinkNode && !focusAutoLinkNode.is(autoLinkNode)) ||
(autoLinkNode && !autoLinkNode.is(focusAutoLinkNode))
);
});
if (!badNode) {
$isLink = true;
} else {
Expand Down

0 comments on commit d3e7496

Please sign in to comment.