优化文本框对话解析

This commit is contained in:
北枳 2025-08-19 18:15:02 +08:00
parent 47a85428f5
commit aee30ee881
2 changed files with 16 additions and 2 deletions

View File

@ -25,8 +25,16 @@ interface HighlightNode {
attrs: HighlightAttributes; attrs: HighlightAttributes;
} }
// 定义只读文本节点接口
interface ReadonlyTextNode {
type: 'readonlyText';
attrs: {
text: string;
};
}
// 定义内容节点类型(文本或角色标记) // 定义内容节点类型(文本或角色标记)
type ContentNode = TextNode | CharacterTokenNode | HighlightNode; type ContentNode = TextNode | CharacterTokenNode | HighlightNode | ReadonlyTextNode;
// 定义段落接口 // 定义段落接口
interface Paragraph { interface Paragraph {
@ -217,6 +225,12 @@ export class TextToShotAdapter {
attrs: { attrs: {
...roleMatch ...roleMatch
}}, }},
{
type: 'readonlyText',
attrs: {
text: ''
}
},
...dialogNodes ...dialogNodes
] ]
}; };

View File

@ -171,7 +171,7 @@ export const ShotsEditor = forwardRef<any, ShotsEditorProps>(function ShotsEdito
avatar: '' avatar: ''
} }
}, },
{ type: 'text', text: ' says:' } { type: 'readonlyText', attrs: { text: '' } }
] ]
}; };