Skip to content

Commit 50178a8

Browse files
committed
return to tiptap, humbled
1 parent 712812c commit 50178a8

File tree

12 files changed

+1297
-1915
lines changed

12 files changed

+1297
-1915
lines changed

apps/array/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@
101101
"@radix-ui/themes": "^3.2.1",
102102
"@tanstack/react-query": "^5.90.2",
103103
"@tanstack/react-virtual": "^3.13.12",
104+
"@tiptap/core": "^3.13.0",
105+
"@tiptap/extension-placeholder": "^3.13.0",
106+
"@tiptap/pm": "^3.13.0",
107+
"@tiptap/react": "^3.13.0",
108+
"@tiptap/starter-kit": "^3.13.0",
104109
"@trpc/client": "^11.8.0",
105110
"@trpc/react-query": "^11.8.0",
106111
"@trpc/server": "^11.8.0",

apps/array/src/renderer/features/message-editor/components/MessageEditor.tsx

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import "./message-editor.css";
22
import { ArrowUp, Stop } from "@phosphor-icons/react";
33
import { Flex, IconButton, Text, Tooltip } from "@radix-ui/themes";
4+
import { EditorContent } from "@tiptap/react";
45
import { 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";
77
import { useDraftStore } from "../stores/draftStore";
8+
import { useTiptapEditor } from "../tiptap/useTiptapEditor";
89
import type { EditorHandle } from "../types";
910
import { EditorToolbar } from "./EditorToolbar";
1011
import { SuggestionPopup } from "./SuggestionPopup";
1112

1213
export type { EditorHandle as MessageEditorHandle };
13-
export type { EditorContent };
14+
export type { EditorContentType as EditorContent };
1415

1516
interface 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

Comments
 (0)