diff --git a/src/assets/scripts/util.js b/src/assets/scripts/util.js index 4fed100..3d966ad 100644 --- a/src/assets/scripts/util.js +++ b/src/assets/scripts/util.js @@ -188,6 +188,10 @@ export function saveEditorContent(editor, name) { } } +/** + * 格式化文档 + * @param {文档内容} content + */ export function formatDoc(content) { const doc = prettier.format(content, { parser: "markdown", @@ -196,6 +200,7 @@ export function formatDoc(content) { return doc; } + export function fixCodeWhiteSpace(value = "pre") { const preDomList = document.getElementsByClassName("code__pre"); if (preDomList.length > 0) { @@ -205,6 +210,10 @@ export function fixCodeWhiteSpace(value = "pre") { } } +/** + * 下载原始 Markdown 文档 + * @param {文档内容} doc + */ export function downLoadMD(doc) { let downLink = document.createElement("a"); diff --git a/src/components/CodemirrorEditor/header.vue b/src/components/CodemirrorEditor/header.vue index 92f2a8b..bc377e7 100644 --- a/src/components/CodemirrorEditor/header.vue +++ b/src/components/CodemirrorEditor/header.vue @@ -313,8 +313,8 @@ export default { setTimeout(() => { this.cssEditor.refresh(); }, 50); - let flag = await localStorage.getItem("__css_content"); + let flag = await localStorage.getItem("__css_content"); if (!flag) { this.setCssEditorValue(DEFAULT_CSS_CONTENT); }