diff --git a/ui/src/class/contentExporter.ts b/ui/src/class/contentExporter.ts index e9afb85..2fb67a5 100644 --- a/ui/src/class/contentExporter.ts +++ b/ui/src/class/contentExporter.ts @@ -22,7 +22,7 @@ export class ContentExporter { (type) => type.type === content.rawType?.toLowerCase(), )?.extension || ""; } else if (exportType === "markdown") { - if (content.rawType === "html") { + if (content.rawType?.toLowerCase() === "html") { const converter = ConverterFactory.getConverter("html", "markdown"); exportContent = converter.convert(post, content); } else { diff --git a/ui/src/class/postOperations.ts b/ui/src/class/postOperations.ts index ec3686e..57c9dfc 100644 --- a/ui/src/class/postOperations.ts +++ b/ui/src/class/postOperations.ts @@ -18,12 +18,15 @@ export class PostOperations { return; } - if (content.rawType === toType) { + if (content.rawType.toLowerCase() === toType) { Toast.warning(`当前文档已经是 ${toType} 格式,已忽略转换`); return; } - const converter = ConverterFactory.getConverter(content.rawType, toType); + const converter = ConverterFactory.getConverter( + content.rawType.toLowerCase(), + toType, + ); const convertedContent = converter.convert(post, content); diff --git a/ui/src/utils/markdown.ts b/ui/src/utils/markdown.ts index 0e04058..db361ac 100644 --- a/ui/src/utils/markdown.ts +++ b/ui/src/utils/markdown.ts @@ -9,7 +9,7 @@ export function convertPostContentToMarkdown( content: ContentWrapper, needsFrontMatter?: boolean, ): string { - if (content.rawType === "markdown") { + if (content.rawType?.toLowerCase() === "markdown") { return content.raw || ""; } @@ -38,7 +38,7 @@ export function convertPostContentToMarkdown( } export function convertPostContentToHTML(content: ContentWrapper): string { - if (content.rawType === "html") { + if (content.rawType?.toLowerCase() === "html") { return content.raw || ""; }