From aee30ee8810f2a64bf8d870098801612e9455da9 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: Tue, 19 Aug 2025 18:15:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=87=E6=9C=AC=E6=A1=86?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/adapter/textToShot.ts | 16 +++++++++++++++- components/ui/shot-editor/ShotsEditor.tsx | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/service/adapter/textToShot.ts b/app/service/adapter/textToShot.ts index 6315f72..6de8cf2 100644 --- a/app/service/adapter/textToShot.ts +++ b/app/service/adapter/textToShot.ts @@ -25,8 +25,16 @@ interface HighlightNode { attrs: HighlightAttributes; } +// 定义只读文本节点接口 +interface ReadonlyTextNode { + type: 'readonlyText'; + attrs: { + text: string; + }; +} + // 定义内容节点类型(文本或角色标记) -type ContentNode = TextNode | CharacterTokenNode | HighlightNode; +type ContentNode = TextNode | CharacterTokenNode | HighlightNode | ReadonlyTextNode; // 定义段落接口 interface Paragraph { @@ -217,6 +225,12 @@ export class TextToShotAdapter { attrs: { ...roleMatch }}, + { + type: 'readonlyText', + attrs: { + text: ':' + } + }, ...dialogNodes ] }; diff --git a/components/ui/shot-editor/ShotsEditor.tsx b/components/ui/shot-editor/ShotsEditor.tsx index 4d80bf2..a670393 100644 --- a/components/ui/shot-editor/ShotsEditor.tsx +++ b/components/ui/shot-editor/ShotsEditor.tsx @@ -171,7 +171,7 @@ export const ShotsEditor = forwardRef(function ShotsEdito avatar: '' } }, - { type: 'text', text: ' says:' } + { type: 'readonlyText', attrs: { text: ':' } } ] };