import type { Article, NotifyDetail, UploadResult } from "timi-tdesign-pc"; /** 编辑器演示使用的固定内容,避免每个页面各自维护一份 HTML。 */ export const DEMO_ARTICLE_CONTENT = `

跨平台编辑器

这段内容同时验证标题、段落、链接、表格和代码块的渲染。

移动端和 PC 端只替换交互层,共享文档模型。

const message: string = "timi editor";
`; export const DEMO_CODE = `type DemoUser = { \tid: string; \tname: string; }; const user: DemoUser = { \tid: "demo-001", \tname: "Timi" }; console.log(user.name);`; export const DEMO_ARTICLE: Article = { title: "编辑器组件演示文章", description: "用于验证文章编辑、预览和附件处理。", contentType: "TIP_TAP", content: DEMO_ARTICLE_CONTENT, attachmentList: [] }; export const DEMO_NOTIFY: NotifyDetail = { subject: "编辑器通知演示", msgType: "INTERNAL", contentType: "TIP_TAP", content: DEMO_ARTICLE_CONTENT, status: "WAITING", attachmentList: [] }; export function cloneArticle(): Article { return { ...DEMO_ARTICLE, attachmentList: [...(DEMO_ARTICLE.attachmentList || [])] }; } export function cloneNotify(): NotifyDetail { return { ...DEMO_NOTIFY, attachmentList: [...(DEMO_NOTIFY.attachmentList || [])] }; } /** 返回本地预览地址,让示例无需依赖后端上传接口。 */ export async function uploadDemoMedia(file: File): Promise { return { id: `demo-${Date.now()}-${file.name}`, name: file.name, url: URL.createObjectURL(file) }; }