build: release v1.3.5

This commit is contained in:
yanglbme 2020-07-26 23:27:42 +08:00
parent 0921c783ac
commit 20118445a1
3 changed files with 9 additions and 21 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "vue-md", "name": "vue-md",
"version": "1.3.4", "version": "1.3.5",
"private": true, "private": true,
"homepage": "https://doocs.gitee.io/md", "homepage": "https://doocs.gitee.io/md",
"scripts": { "scripts": {

View File

@ -76,7 +76,7 @@ export default {
} else { } else {
this.$emit('menuTick', key) this.$emit('menuTick', key)
} }
this.$emit('closeMenu',false) this.$emit('closeMenu', false)
} }
}, },
} }

View File

@ -24,7 +24,7 @@ const state = {
currentColor: '', currentColor: '',
citeStatus: 0, citeStatus: 0,
nightMode: false, nightMode: false,
rightClickMenuVisible:false rightClickMenuVisible: false
}; };
const mutations = { const mutations = {
setEditorValue(state, data) { setEditorValue(state, data) {
@ -52,7 +52,7 @@ const mutations = {
state.currentColor = data; state.currentColor = data;
localStorage.setItem('color', data) localStorage.setItem('color', data)
}, },
setRightClickMenuVisible(state,data) { setRightClickMenuVisible(state, data) {
state.rightClickMenuVisible = data; state.rightClickMenuVisible = data;
}, },
themeChanged(state) { themeChanged(state) {
@ -72,8 +72,7 @@ const mutations = {
}, },
initEditorEntity(state) { initEditorEntity(state) {
state.editor = CodeMirror.fromTextArea( state.editor = CodeMirror.fromTextArea(
document.getElementById('editor'), document.getElementById('editor'), {
{
value: '', value: '',
mode: 'text/x-markdown', mode: 'text/x-markdown',
theme: 'xq-light', theme: 'xq-light',
@ -90,19 +89,13 @@ const mutations = {
} }
} }
) )
// 如果有编辑器内容被保存则读取,否则加载默认内容
if (localStorage.getItem('__editor_content')) {
state.editor.setValue(localStorage.getItem('__editor_content'))
} else {
const doc = formatDoc(DEFAULT_CONTENT)
state.editor.setValue(doc)
}
// 如果有编辑器内容被保存则读取,否则加载默认内容
state.editor.setValue(localStorage.getItem('__editor_content') || formatDoc(DEFAULT_CONTENT))
}, },
initCssEditorEntity(state) { initCssEditorEntity(state) {
state.cssEditor = CodeMirror.fromTextArea( state.cssEditor = CodeMirror.fromTextArea(
document.getElementById('cssEditor'), document.getElementById('cssEditor'), {
{
value: '', value: '',
mode: 'css', mode: 'css',
theme: 'style-mirror', theme: 'style-mirror',
@ -113,7 +106,6 @@ const mutations = {
extraKeys: { extraKeys: {
'Ctrl-F': function autoFormat(editor) { 'Ctrl-F': function autoFormat(editor) {
const totalLines = editor.lineCount() const totalLines = editor.lineCount()
editor.autoFormatRange({ editor.autoFormatRange({
line: 0, line: 0,
ch: 0 ch: 0
@ -126,11 +118,7 @@ const mutations = {
) )
// 如果有编辑器内容被保存则读取,否则加载默认内容 // 如果有编辑器内容被保存则读取,否则加载默认内容
if (localStorage.getItem('__css_content')) { state.cssEditor.setValue(localStorage.getItem('__css_content') || DEFAULT_CSS_CONTENT)
state.cssEditor.setValue(localStorage.getItem('__css_content'))
} else {
state.cssEditor.setValue(DEFAULT_CSS_CONTENT)
}
}, },
editorRefresh(state) { editorRefresh(state) {
let output = marked(state.editor.getValue(0), { let output = marked(state.editor.getValue(0), {