refactor timi-web
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import type { NotifyContentType } from "./types";
|
||||
|
||||
/** 将未知通知正文类型归一化为组件支持的类型。 */
|
||||
export function normalizeNotifyContentType(contentType?: string): NotifyContentType {
|
||||
return contentType === "TEXT" ? "TEXT" : "TIP_TAP";
|
||||
}
|
||||
@@ -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>;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user