From 0780c617b1fa8ef0385d3b0a3da4b1640c002364 Mon Sep 17 00:00:00 2001 From: Shane Friedman Date: Tue, 6 Aug 2024 16:36:31 -0400 Subject: [PATCH] Return the result from useEditorEventCallback (#118) When we updated useEditorEventCallback to call its callback only when EditorView was set, we unintentionally stopped returning its result. This change simply goes back to always returning it. --- .yarn/versions/404a2ee9.yml | 2 ++ src/hooks/useEditorEventCallback.ts | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .yarn/versions/404a2ee9.yml diff --git a/.yarn/versions/404a2ee9.yml b/.yarn/versions/404a2ee9.yml new file mode 100644 index 00000000..90948e78 --- /dev/null +++ b/.yarn/versions/404a2ee9.yml @@ -0,0 +1,2 @@ +releases: + "@nytimes/react-prosemirror": patch diff --git a/src/hooks/useEditorEventCallback.ts b/src/hooks/useEditorEventCallback.ts index 18547751..5d1a171b 100644 --- a/src/hooks/useEditorEventCallback.ts +++ b/src/hooks/useEditorEventCallback.ts @@ -30,7 +30,10 @@ export function useEditorEventCallback( return useCallback( (...args: T) => { - if (editorView) ref.current(editorView, ...args); + if (editorView) { + return ref.current(editorView, ...args); + } + return; }, [editorView] );