chore: upgrade dependencies version (#109)

This commit is contained in:
Yang Libin 2021-11-30 16:56:57 +08:00 committed by GitHub
parent bc4a629222
commit 56d8fb66e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 38 deletions

View File

@ -11,53 +11,46 @@
"mm": "npx mockm --cwd=mm" "mm": "npx mockm --cwd=mm"
}, },
"dependencies": { "dependencies": {
"@vue/shared": "^3.0.11", "@vue/shared": "^3.2.23",
"ali-oss": "^6.16.0", "ali-oss": "^6.16.0",
"axios": "^0.21.2", "axios": "^0.24.0",
"buffer-from": "^1.1.1", "buffer-from": "^1.1.2",
"codemirror": "^5.61.0", "codemirror": "^5.64.0",
"core-js": "^3.11.0", "core-js": "^3.19.2",
"cos-js-sdk-v5": "^1.3.1", "cos-js-sdk-v5": "^1.3.1",
"crypto-js": "^4.0.0", "crypto-js": "^4.1.1",
"element-ui": "^2.15.1", "element-ui": "^2.15.6",
"form-data": "2.3.3", "form-data": "4.0.0",
"jquery": "^3.6.0", "jquery": "^3.6.0",
"juice": "^7.0.0", "juice": "^8.0.0",
"marked": "^2.0.3", "marked": "^4.0.5",
"node-fetch": "2.6.2", "node-fetch": "3.1.0",
"prettier": "^2.2.1", "prettier": "^2.5.0",
"prettify": "^0.1.7", "prettify": "^0.1.7",
"qiniu-js": "^3.4.0", "qiniu-js": "^3.4.0",
"regenerator-runtime": "^0.13.7", "regenerator-runtime": "^0.13.9",
"uuid": "^8.3.2", "uuid": "^8.3.2",
"vue": "^2.6.12", "vue": "^2.6.14",
"vue-router": "^3.4.9", "vue-router": "^3.5.3",
"vuex": "^3.5.1" "vuex": "^3.6.2"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "~4.5.12", "@vue/cli-plugin-babel": "~4.5.15",
"@vue/cli-service": "~4.5.12", "@vue/cli-service": "~4.5.15",
"async-validator": "^3.5.1", "async-validator": "^4.0.7",
"babel-plugin-import": "^1.13.3", "babel-plugin-import": "^1.13.3",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"jest": "^25.4.0", "jest": "^27.4.0",
"less": "^3.12.2", "less": "^4.1.2",
"less-loader": "^5.0.0", "less-loader": "^7.3.0",
"mini-types": "*", "mini-types": "*",
"miniprogram-api-typings": "*", "miniprogram-api-typings": "*",
"mockm": "^1.1.25", "mockm": "^1.1.25",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"postcss-comment": "^2.0.0", "postcss-comment": "^2.0.0",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"sass-loader": "^11.0.1", "sass-loader": "^12.3.0",
"shx": "^0.3.3", "shx": "^0.3.3",
"vue-template-compiler": "^2.6.12" "vue-template-compiler": "^2.6.14"
},
"browserslist": [
"Android >= 4",
"ios >= 8"
],
"uni-app": {
"scripts": {}
} }
} }

View File

@ -1,4 +1,5 @@
import marked from "marked"; import { Renderer } from "marked";
class WxRenderer { class WxRenderer {
constructor(opts) { constructor(opts) {
this.opts = opts; this.opts = opts;
@ -96,7 +97,7 @@ class WxRenderer {
footnoteIndex = 0; footnoteIndex = 0;
styleMapping = this.buildTheme(this.opts.theme); styleMapping = this.buildTheme(this.opts.theme);
let renderer = new marked.Renderer(); let renderer = new Renderer();
renderer.heading = (text, level) => { renderer.heading = (text, level) => {
switch (level) { switch (level) {

View File

@ -2,7 +2,7 @@ import Vue from "vue";
import Vuex from "vuex"; import Vuex from "vuex";
import config from "../assets/scripts/config"; import config from "../assets/scripts/config";
import WxRenderer from "../assets/scripts/renderers/wx-renderer"; import WxRenderer from "../assets/scripts/renderers/wx-renderer";
import marked from "marked"; import { marked } from "marked";
import CodeMirror from "codemirror/lib/codemirror"; import CodeMirror from "codemirror/lib/codemirror";
import DEFAULT_CONTENT from "@/assets/example/markdown.md"; import DEFAULT_CONTENT from "@/assets/example/markdown.md";
import DEFAULT_CSS_CONTENT from "@/assets/example/theme-css.txt"; import DEFAULT_CSS_CONTENT from "@/assets/example/theme-css.txt";
@ -111,7 +111,7 @@ const mutations = {
"Ctrl-I": function italic(editor) { "Ctrl-I": function italic(editor) {
const selected = editor.getSelection(); const selected = editor.getSelection();
editor.replaceSelection(`*${selected}*`); editor.replaceSelection(`*${selected}*`);
} },
}, },
}); });
}, },
@ -140,9 +140,9 @@ const mutations = {
}); });
}, },
editorRefresh(state) { editorRefresh(state) {
let output = marked(state.editor.getValue(0), { let renderer = state.wxRenderer.getRenderer(state.citeStatus);
renderer: state.wxRenderer.getRenderer(state.citeStatus), marked.setOptions({ renderer });
}); let output = marked.parse(state.editor.getValue(0));
// 去除第一行的 margin-top // 去除第一行的 margin-top
output = output.replace(/(style=".*?)"/, '$1;margin-top: 0"'); output = output.replace(/(style=".*?)"/, '$1;margin-top: 0"');