refactor timi-web

This commit is contained in:
Timi
2026-08-27 16:04:06 +08:00
parent 13bd61326d
commit 7ef7653deb
33 changed files with 1193 additions and 1097 deletions
+7 -7
View File
@@ -13,17 +13,15 @@
</template>
<script lang="ts" setup>
import type { Article, Attachment } from "timi-web/editor";
import { AttachmentAPI } from "timi-web/editor";
import type { Article, Attachment } from "../article-editor/types";
import { MarkdownView } from "timi-web";
import { TiptapView } from "../tiptap-view";
import {
ATTACHMENT_ID_ATTR,
getAttachmentIdFromSrc,
normalizeArticleContentType,
normalizeContent,
normalizeRawArticleContent
} from "timi-web/editor";
} from "../article-editor/content";
import { ATTACHMENT_ID_ATTR, normalizeContent } from "timi-web/editor";
defineOptions({
name: "ArticleView"
@@ -69,11 +67,13 @@ async function buildAttachmentPreviewUrl(attachmentId: string) {
return customUrl;
}
}
const previewUrl = `${attachment?.metadata?.previewUrl || ""}`;
const previewUrl = typeof attachment?.metadata?.previewUrl === "string"
? attachment.metadata.previewUrl
: "";
if (previewUrl) {
return previewUrl;
}
return attachmentId ? AttachmentAPI.getReadURL(attachmentId) : "";
return attachment?.url || "";
}
async function buildRenderContent(content?: string) {