Skip to content

Commit 3e52fde

Browse files
authored
fix: some more sentry fixes (#1577)
* fix: check if relatedTarget exists first Resolves: https://blocknote-js.sentry.io/issues/33990038/?environment=vercel-production&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&stream_index=23 * fix: early exit if html ends up being empty Resolves: https://blocknote-js.sentry.io/issues/32467184 * fix: only set state if it exists Resolves: https://blocknote-js.sentry.io/issues/32235378/
1 parent 18aedff commit 3e52fde

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

packages/core/src/editor/BlockNoteEditor.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,9 @@ export class BlockNoteEditor<
15021502
if (!raw) {
15031503
htmlToPaste = this.convertHtmlToBlockNoteHtml(html);
15041504
}
1505+
if (!htmlToPaste) {
1506+
return;
1507+
}
15051508
this.prosemirrorView?.pasteHTML(htmlToPaste);
15061509
}
15071510

packages/core/src/extensions/SuggestionMenu/SuggestionPlugin.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ class SuggestionMenuView<
8686
this.pluginState = stopped ? prev : next;
8787

8888
if (stopped || !this.editor.isEditable) {
89-
this.state!.show = false;
89+
if (this.state) {
90+
this.state.show = false;
91+
}
9092
this.emitUpdate(this.pluginState!.triggerCharacter);
9193

9294
return;

packages/react/src/components/Comments/ThreadsSidebar.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ const ThreadItem = React.memo(
4444
// If the focused element is within the action toolbar, we don't want to
4545
// blur the thread for UX reasons.
4646
if (
47-
(event.relatedTarget as HTMLElement).closest(".bn-action-toolbar")
47+
!event.relatedTarget ||
48+
event.relatedTarget.closest(".bn-action-toolbar")
4849
) {
4950
return;
5051
}

0 commit comments

Comments
 (0)