From 33e3ef3a1ef3079b210489dc81e91e4c1868819c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=9E=B3?= <7854742+wang_rumeng@user.noreply.gitee.com> Date: Wed, 13 Aug 2025 18:20:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=9C=A8=E5=8F=97?= =?UTF-8?q?=E6=8E=A7=E7=BB=84=E4=BB=B6=E4=B8=AD=E7=9B=B4=E6=8E=A5=E4=BD=BF?= =?UTF-8?q?=E7=94=A8contentEditable=20=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ui/main-editor/HighlightText.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/components/ui/main-editor/HighlightText.tsx b/components/ui/main-editor/HighlightText.tsx index cfdb317..4097535 100644 --- a/components/ui/main-editor/HighlightText.tsx +++ b/components/ui/main-editor/HighlightText.tsx @@ -17,13 +17,25 @@ interface HighlightTextOptions { } export function HighlightText(props: ReactNodeViewProps) { - const { text, color } = props.node.attrs as HighlightTextAttributes + const { text: initialText, color } = props.node.attrs as HighlightTextAttributes + const [text, setText] = useState(initialText) + + const handleInput = (e: React.FormEvent) => { + const newText = e.currentTarget.textContent || '' + setText(newText) + // 通知Tiptap更新内容 + props.updateAttributes({ + text: newText + }) + } return ( {text}