Skip to content

Commit

Permalink
fix($findBeautifulMentionNodes): add null check for CustomBeautifulMe…
Browse files Browse the repository at this point in the history
…ntionNode (#572)
  • Loading branch information
sodenn authored Jul 23, 2024
1 parent e585e8f commit f481f85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/cyan-windows-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"lexical-beautiful-mentions": patch
---

fix($findBeautifulMentionNodes): add null check for CustomBeautifulMentionNode
5 changes: 4 additions & 1 deletion plugin/src/mention-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ export function $selectEnd() {

export function $findBeautifulMentionNodes(editor?: LexicalEditor) {
editor = editor || $getEditor();
if (editor.hasNodes([CustomBeautifulMentionNode])) {
if (
CustomBeautifulMentionNode &&
editor.hasNodes([CustomBeautifulMentionNode])
) {
return $nodesOfType(CustomBeautifulMentionNode);
}
return $nodesOfType(BeautifulMentionNode);
Expand Down

0 comments on commit f481f85

Please sign in to comment.