diff --git a/site/app/editor/PostEditor.tsx b/site/app/editor/PostEditor.tsx index 0f4c4a3..aa95fe1 100644 --- a/site/app/editor/PostEditor.tsx +++ b/site/app/editor/PostEditor.tsx @@ -4,7 +4,16 @@ import Collaboration from '@tiptap/extension-collaboration'; import { CollaborationCaret } from '@tiptap/extension-collaboration-caret'; import { Placeholder } from '@tiptap/extensions'; import { EditorContent, useEditor, useEditorState } from '@tiptap/react'; -import { useEffect, useState, type FormEvent } from 'react'; +import { + createContext, + useContext, + useEffect, + useRef, + useState, + type FocusEvent, + type FormEvent, + type KeyboardEvent, +} from 'react'; import { readingMinutes } from '../posts'; import { CALLOUT_TINTS, columnsOf, postExtensions } from './extensions'; import { holdSession, openSession } from './session'; @@ -52,6 +61,8 @@ function selection(user: Record) { type Ask = { kind: 'link' | 'video'; value: string } | null; +const StopContext = createContext<(label: string) => 0 | -1>(() => 0); + function Mark({ on, label, @@ -65,6 +76,7 @@ function Mark({ act: () => void; className?: string; }) { + const stop = useContext(StopContext); return ( + { + const file = event.target.files?.[0]; + if (file) { + void uploadCover(file); + } + event.target.value = ''; + }} + /> {draft.coverUpload && (