11import "./message-editor.css" ;
22import { ArrowUp , Stop } from "@phosphor-icons/react" ;
33import { Flex , IconButton , Text , Tooltip } from "@radix-ui/themes" ;
4+ import { EditorContent } from "@tiptap/react" ;
45import { forwardRef , useImperativeHandle } from "react" ;
5- import type { EditorContent } from "../core/content" ;
6- import { useMessageEditor } from "../hooks/useMessageEditor" ;
6+ import type { EditorContent as EditorContentType } from "../core/content" ;
77import { useDraftStore } from "../stores/draftStore" ;
8+ import { useTiptapEditor } from "../tiptap/useTiptapEditor" ;
89import type { EditorHandle } from "../types" ;
910import { EditorToolbar } from "./EditorToolbar" ;
1011import { SuggestionPopup } from "./SuggestionPopup" ;
1112
1213export type { EditorHandle as MessageEditorHandle } ;
13- export type { EditorContent } ;
14+ export type { EditorContentType as EditorContent } ;
1415
1516interface MessageEditorProps {
1617 sessionId : string ;
@@ -45,7 +46,7 @@ export const MessageEditor = forwardRef<EditorHandle, MessageEditorProps>(
4546 const repoPath = context ?. repoPath ;
4647
4748 const {
48- editorRef ,
49+ editor ,
4950 isEmpty,
5051 isBashMode,
5152 submit,
@@ -56,13 +57,7 @@ export const MessageEditor = forwardRef<EditorHandle, MessageEditorProps>(
5657 getContent,
5758 setContent,
5859 insertChip,
59- onInput,
60- onKeyDown,
61- onPaste,
62- onFocus,
63- onCompositionStart,
64- onCompositionEnd,
65- } = useMessageEditor ( {
60+ } = useTiptapEditor ( {
6661 sessionId,
6762 taskId,
6863 placeholder,
@@ -104,25 +99,7 @@ export const MessageEditor = forwardRef<EditorHandle, MessageEditorProps>(
10499 style = { { cursor : "text" } }
105100 >
106101 < div className = "max-h-[200px] min-h-[30px] flex-1 overflow-y-auto font-mono text-sm" >
107- { /* biome-ignore lint/a11y/useSemanticElements: contenteditable is intentional for rich mention chips */ }
108- < div
109- ref = { editorRef }
110- className = "cli-editor min-h-[1.5em] w-full break-words border-none bg-transparent font-mono text-[12px] text-[var(--gray-12)] outline-none [overflow-wrap:break-word] [white-space:pre-wrap] [word-break:break-word]"
111- contentEditable = { ! disabled }
112- suppressContentEditableWarning
113- spellCheck = { false }
114- role = "textbox"
115- tabIndex = { disabled ? - 1 : 0 }
116- aria-multiline = "true"
117- aria-placeholder = { placeholder }
118- data-placeholder = { placeholder }
119- onInput = { onInput }
120- onKeyDown = { onKeyDown }
121- onPaste = { onPaste }
122- onFocus = { onFocus }
123- onCompositionStart = { onCompositionStart }
124- onCompositionEnd = { onCompositionEnd }
125- />
102+ < EditorContent editor = { editor } />
126103 </ div >
127104
128105 < SuggestionPopup sessionId = { sessionId } />
0 commit comments