28 lines
500 B
TypeScript

import { ScriptEditKey } from "../usecase/ScriptEditUseCase";
/**
* 渲染数据转换器
* @param key
* @param headerName
* @param scriptText
* @returns
*/
export function parseScriptBlock(
key: ScriptEditKey,
headerName: string,
scriptText: string,
contentType?: 'paragraph' | 'bold' | 'italic' | 'heading' | 'tag',
) {
return {
id: key,
title: headerName,
content: [
{
type: contentType || "paragraph",
text: scriptText,
},
],
};
}