diff --git a/README.md b/README.md index 370462b..a9d7a4e 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Markdown 文档自动即时渲染为微信图文,让你不再为微信文章排版而发愁!只要你会基本的 Markdown 语法,就能做出一篇样式简洁而又美观大方的微信图文。 ## 在线编辑器地址 + - Gitee Pages:https://doocs.gitee.io/md - GitHub Pages:https://doocs.github.io/md diff --git a/package.json b/package.json index 449532b..653cde0 100644 --- a/package.json +++ b/package.json @@ -1,42 +1,42 @@ { - "name": "vue-md", - "version": "1.3.2", - "private": true, - "homepage": "https://doocs.gitee.io/md", - "scripts": { - "serve": "vue-cli-service serve", - "build": "vue-cli-service build", - "lint": "vue-cli-service lint", - "test:unit": "vue-cli-service test:unit" - }, - "dependencies": { - "axios": "^0.19.1", - "codemirror": "^5.50.2", - "core-js": "^3.4.4", - "element-ui": "^2.13.0", - "jquery": "^3.4.1", - "juice": "^6.0.0", - "markdown": "^0.5.0", - "marked": "^0.8.0", - "prettier": "^2.0.5", - "prettify": "^0.1.7", - "vue": "^2.6.10", - "vue-router": "^3.1.3", - "vuex": "^3.1.2" - }, - "devDependencies": { - "@vue/cli-plugin-babel": "^4.1.0", - "@vue/cli-plugin-eslint": "^4.1.0", - "@vue/cli-plugin-unit-jest": "^4.1.0", - "@vue/cli-service": "^4.1.0", - "@vue/eslint-config-standard": "^4.0.0", - "@vue/test-utils": "1.0.0-beta.29", - "babel-eslint": "^10.0.3", - "eslint": "^5.16.0", - "eslint-plugin-vue": "^5.0.0", - "less-loader": "^6.0.0", - "node-sass": "^4.12.0", - "sass-loader": "^8.0.0", - "vue-template-compiler": "^2.6.10" - } + "name": "vue-md", + "version": "1.3.3", + "private": true, + "homepage": "https://doocs.gitee.io/md", + "scripts": { + "serve": "vue-cli-service serve", + "build": "vue-cli-service build", + "lint": "vue-cli-service lint", + "test:unit": "vue-cli-service test:unit" + }, + "dependencies": { + "axios": "^0.19.1", + "codemirror": "^5.50.2", + "core-js": "^3.4.4", + "element-ui": "^2.13.0", + "jquery": "^3.4.1", + "juice": "^6.0.0", + "markdown": "^0.5.0", + "marked": "^0.8.0", + "prettier": "^2.0.5", + "prettify": "^0.1.7", + "vue": "^2.6.10", + "vue-router": "^3.1.3", + "vuex": "^3.1.2" + }, + "devDependencies": { + "@vue/cli-plugin-babel": "^4.1.0", + "@vue/cli-plugin-eslint": "^4.1.0", + "@vue/cli-plugin-unit-jest": "^4.1.0", + "@vue/cli-service": "^4.1.0", + "@vue/eslint-config-standard": "^4.0.0", + "@vue/test-utils": "1.0.0-beta.29", + "babel-eslint": "^10.0.3", + "eslint": "^5.16.0", + "eslint-plugin-vue": "^5.0.0", + "less-loader": "^6.0.0", + "node-sass": "^4.12.0", + "sass-loader": "^8.0.0", + "vue-template-compiler": "^2.6.10" + } } \ No newline at end of file diff --git a/src/components/codeMirror/header.vue b/src/components/codeMirror/header.vue index bc85a9f..2603f5b 100644 --- a/src/components/codeMirror/header.vue +++ b/src/components/codeMirror/header.vue @@ -58,7 +58,7 @@ - 复制 + 复制 关于
@@ -171,13 +171,13 @@ export default { return false; }, // 复制到微信公众号 - copy() { + copy(e) { this.$emit('startCopy'); setTimeout(() => { + let clipboardDiv = document.getElementById('output'); solveWeChatImage(); fixCodeWhiteSpace(); - this.setOutput(solveHtml()); - let clipboardDiv = document.getElementById('output'); + this.setHtml(solveHtml()); clipboardDiv.focus(); window.getSelection().removeAllRanges(); @@ -187,9 +187,10 @@ export default { range.setEndAfter(clipboardDiv.lastChild); window.getSelection().addRange(range); document.execCommand('copy'); - range.setStartBefore(clipboardDiv.firstChild); - range.setEndAfter(clipboardDiv.firstChild); + window.getSelection().removeAllRanges() fixCodeWhiteSpace('normal'); + + clipboardDiv.innerHTML = this.output; // 输出提示 this.$notify({ showClose: true, @@ -201,6 +202,7 @@ export default { this.$emit('refresh'); this.$emit('endCopy'); }, 350); + e.target.blur(); }, // 自定义CSS样式 async customStyle () { diff --git a/src/store/index.js b/src/store/index.js index 71669f2..0e9876e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -16,6 +16,7 @@ Vue.use(Vuex) const state = { wxRenderer: null, output: '', + html: '', editor: null, cssEditor: null, currentFont: '', @@ -25,8 +26,8 @@ const state = { nightMode: false }; const mutations = { - setOutput(state, data) { - state.output = data; + setHtmL(state, data) { + state.html = data; }, setEditorValue(state, data) { state.editor.setValue(data)