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
+6
View File
@@ -0,0 +1,6 @@
import type { NotifyContentType } from "./types";
/** 将未知通知正文类型归一化为组件支持的类型。 */
export function normalizeNotifyContentType(contentType?: string): NotifyContentType {
return contentType === "TEXT" ? "TEXT" : "TIP_TAP";
}
+3 -1
View File
@@ -1,6 +1,8 @@
import view from "./index.vue";
import { Toolkit } from "timi-web";
import type { NotifyDetail } from "timi-web/editor";
import type { NotifyDetail } from "./types";
export type { NotifyContentType, NotifyDetail } from "./types";
export type NotifyEditorExpose = {
submit: () => Promise<NotifyDetail>;
+3 -2
View File
@@ -13,10 +13,11 @@
</template>
<script lang="ts" setup>
import type { Article, ArticleContentType, Attachment, NotifyDetail, UploadResult } from "timi-web/editor";
import type { Article, ArticleContentType, Attachment, UploadResult } from "../article-editor/types";
import type { NotifyDetail } from "./types";
import type { ArticleEditorExpose } from "../article-editor";
import { ArticleEditor } from "../article-editor";
import { normalizeNotifyContentType } from "timi-web/editor";
import { normalizeNotifyContentType } from "./content";
defineOptions({
name: "NotifyEditor"
+15
View File
@@ -0,0 +1,15 @@
import type { Article, Attachment } from "../article-editor/types";
/** 通知内容支持的正文类型。 */
export type NotifyContentType = "TEXT" | "TIP_TAP";
/** 通知编辑器需要的通知最小结构。 */
export type NotifyDetail = {
[key: string]: unknown;
content?: string;
contentType?: string;
attachmentList?: Attachment[];
};
/** 通知内部复用文章编辑器的对象结构。 */
export type NotifyArticle = Article;