diff --git a/web/components/editor.tsx b/web/components/editor.tsx index 27e8ac45..5b075039 100644 --- a/web/components/editor.tsx +++ b/web/components/editor.tsx @@ -42,6 +42,7 @@ import ItalicIcon from 'web/lib/icons/italic-icon' import LinkIcon from 'web/lib/icons/link-icon' import { getUrl } from 'common/util/parse' import { TiptapSpoiler } from 'common/util/tiptap-spoiler' +import { useWarnUnsavedChanges } from 'web/hooks/use-warn-unsaved-changes' const DisplayImage = Image.configure({ HTMLAttributes: { @@ -150,6 +151,9 @@ export function useTextEditor(props: { editor?.setEditable(!disabled) }, [editor, disabled]) + const isEditorFilled = editor != null && !editor.isEmpty + useWarnUnsavedChanges(isEditorFilled) + return { editor, upload } }