feat: reset style only (#108)

* reset style only
* close #107
This commit is contained in:
Yang Libin 2021-11-30 00:13:27 +08:00 committed by GitHub
parent 449617fd23
commit bc4a629222
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 16 deletions

View File

@ -31,11 +31,11 @@
>
<i class="el-icon-document" size="medium" @click="$emit('export')"></i>
</el-tooltip>
<!-- 页面重置 -->
<!-- 样式重置 -->
<el-tooltip
class="header__item"
:effect="effect"
content="重置页面"
content="重置样式"
placement="bottom-start"
>
<i
@ -316,11 +316,10 @@ export default {
this.setCssEditorValue(DEFAULT_CSS_CONTENT);
}
},
//
//
confirmReset() {
localStorage.clear();
this.clearEditorToDefault();
this.editor.focus();
this.cssEditor.setValue(DEFAULT_CSS_CONTENT);
this.citeStatus = false;
this.statusChanged(false);
this.fontChanged(this.config.builtinFonts[0].value);
@ -337,7 +336,6 @@ export default {
this.editor.focus();
},
...mapMutations([
"clearEditorToDefault",
"setCurrentColor",
"setCiteStatus",
"themeChanged",

View File

@ -5,7 +5,7 @@
:visible="showResetConfirm"
@close="$emit('close')"
>
<div class="text">此操作将丢失本地缓存的文本和自定义样式是否继续?</div>
<div class="text">此操作将丢失本地自定义样式是否继续?</div>
<div slot="footer" class="dialog-footer">
<el-button :type="btnType" plain @click="$emit('close')"> </el-button>
<el-button :type="btnType" @click="$emit('confirm')" plain

View File

@ -47,8 +47,8 @@ export default {
key: "insertTable",
},
{
text: "页面重置",
key: "pageReset",
text: "恢复默认样式",
key: "resetStyle",
},
],
[

View File

@ -392,7 +392,7 @@ export default {
},
onMenuEvent(type, info = {}) {
switch (type) {
case "pageReset":
case "resetStyle":
this.$refs.header.showResetConfirm = true;
break;
case "insertPic":

View File

@ -154,12 +154,6 @@ const mutations = {
}
state.output = output;
},
clearEditorToDefault(state) {
const doc = formatDoc(DEFAULT_CONTENT);
state.editor.setValue(doc);
state.cssEditor.setValue(DEFAULT_CSS_CONTENT);
},
};
export default new Vuex.Store({