diff --git a/assets/scripts/editor.js b/assets/scripts/editor.js
index ac810d5..bda8901 100644
--- a/assets/scripts/editor.js
+++ b/assets/scripts/editor.js
@@ -24,7 +24,7 @@ let app = new Vue({
sizeOption: [
{ label: '13px', value: '13px', desc: '稍小' },
{ label: '14px', value: '14px', desc: '推荐' },
- { label: '15px', value: '15px', desc: '稍大' },
+ { label: '15px', value: '15px', desc: '稍大' }
],
colorOption: [
{ label: '橘红', value: 'rgba(255, 95, 46, 0.9)', hex: '#FF5F2E' },
@@ -47,7 +47,7 @@ let app = new Vue({
lineWrapping: true,
styleActiveLine: true,
theme: this.currentEditorTheme,
- mode: 'text/x-markdown',
+ mode: 'text/x-markdown'
}
);
this.editor.on("change", (cm, change) => {
@@ -65,9 +65,9 @@ let app = new Vue({
} else {
axios({
method: 'get',
- url: './assets/default-content.md',
+ url: './assets/default-content.md'
}).then(resp => {
- this.editor.setValue(resp.data)
+ this.editor.setValue(resp.data);
})
}
},
@@ -82,33 +82,33 @@ let app = new Vue({
// 附加的一些 style
output += this.wxRenderer.buildAddition();
}
- return output
+ return output;
},
editorThemeChanged(editorTheme) {
- this.editor.setOption('theme', editorTheme)
+ this.editor.setOption('theme', editorTheme);
},
fontChanged(fonts) {
this.wxRenderer.setOptions({
fonts: fonts
});
- this.refresh()
+ this.refresh();
},
sizeChanged(size) {
this.wxRenderer.setOptions({
size: size
});
- this.refresh()
+ this.refresh();
},
colorChanged(color) {
let theme = setColor(color)
this.wxRenderer.setOptions({
theme: theme
- })
- this.refresh()
+ });
+ this.refresh();
},
// 刷新右侧预览
refresh() {
- this.output = this.renderWeChat(this.editor.getValue(0))
+ this.output = this.renderWeChat(this.editor.getValue(0));
},
// 将左侧编辑器内容保存到 LocalStorage
saveEditorContent() {
@@ -156,7 +156,7 @@ let app = new Vue({
});
}
},
- openWindow(url) {
+ visit(url) {
window.open(url);
}
},
diff --git a/assets/scripts/renderers/wx-renderer.js b/assets/scripts/renderers/wx-renderer.js
index 87b6725..b2fa4d0 100644
--- a/assets/scripts/renderers/wx-renderer.js
+++ b/assets/scripts/renderers/wx-renderer.js
@@ -7,7 +7,7 @@ let WxRenderer = function (opts) {
let footnoteIndex = 0;
let styleMapping = null;
- let CODE_FONT_FAMILY = "Menlo, Operator Mono, Consolas, Monaco, monospace";
+ const CODE_FONT_FAMILY = "Menlo, Operator Mono, Consolas, Monaco, monospace";
let merge = (base, extend) => Object.assign({}, base, extend);
@@ -25,7 +25,7 @@ let WxRenderer = function (opts) {
style['font-family'] = CODE_FONT_FAMILY;
style['white-space'] = 'normal';
}
- mapping[ele] = merge(base, style)
+ mapping[ele] = merge(base, style);
}
}
@@ -33,12 +33,12 @@ let WxRenderer = function (opts) {
if (themeTpl.block.hasOwnProperty(ele)) {
let style = themeTpl.block[ele];
if (ele === 'code') {
- style['font-family'] = CODE_FONT_FAMILY
+ style['font-family'] = CODE_FONT_FAMILY;
}
- mapping[ele] = merge(base_block, style)
+ mapping[ele] = merge(base_block, style);
}
}
- return mapping
+ return mapping;
};
let getStyles = (tokenName, addition) => {
@@ -46,9 +46,9 @@ let WxRenderer = function (opts) {
let dict = styleMapping[tokenName];
if (!dict) return '';
for (const key in dict) {
- arr.push(key + ':' + dict[key])
+ arr.push(key + ':' + dict[key]);
}
- return `style="${arr.join(';') + (addition || '')}"`
+ return `style="${arr.join(';') + (addition || '')}"`;
};
let addFootnote = (title, link) => {
@@ -59,11 +59,11 @@ let WxRenderer = function (opts) {
this.buildFootnotes = () => {
let footnoteArray = footnotes.map(x => {
if (x[1] === x[2]) {
- return `[${x[0]}]
: ${x[1]}
`
+ return `[${x[0]}]
: ${x[1]}
`;
}
- return `[${x[0]}]
${x[1]}: ${x[2]}
`
+ return `[${x[0]}]
${x[1]}: ${x[2]}
`;
});
- return `
${footnoteArray.join('\n')}
` + return `${footnoteArray.join('\n')}
`; }; this.buildAddition = () => { @@ -87,7 +87,7 @@ let WxRenderer = function (opts) { } this.setOptions = newOpts => { - this.opts = merge(this.opts, newOpts) + this.opts = merge(this.opts, newOpts); }; this.hasFootnotes = () => footnotes.length !== 0; @@ -116,7 +116,7 @@ let WxRenderer = function (opts) { renderer.blockquote = text => { text = text.replace(/`); - return `
${text}` + return `
${text}`; }; renderer.code = (text, infoString) => { text = text.replace(/${(line || '
扫码关注我的公众号,原创技术文章第一时间推送!