fix: resolve images issue

This commit is contained in:
yanglbme 2020-07-04 09:41:47 +08:00
parent 90fe9d45b0
commit c8575cd016
2 changed files with 8 additions and 5 deletions

View File

@ -174,10 +174,10 @@ export default {
copy(e) { copy(e) {
this.$emit('startCopy'); this.$emit('startCopy');
setTimeout(() => { setTimeout(() => {
let clipboardDiv = document.getElementById('output');
solveWeChatImage(); solveWeChatImage();
fixCodeWhiteSpace(); fixCodeWhiteSpace();
this.setOutput(solveHtml()); this.setHtml(solveHtml());
let clipboardDiv = document.getElementById('output');
clipboardDiv.focus(); clipboardDiv.focus();
window.getSelection().removeAllRanges(); window.getSelection().removeAllRanges();
@ -189,6 +189,8 @@ export default {
document.execCommand('copy'); document.execCommand('copy');
window.getSelection().removeAllRanges() window.getSelection().removeAllRanges()
fixCodeWhiteSpace('normal'); fixCodeWhiteSpace('normal');
clipboardDiv.innerHTML = this.output;
// //
this.$notify({ this.$notify({
showClose: true, showClose: true,
@ -251,7 +253,7 @@ export default {
document.body.removeChild(downLink) document.body.removeChild(downLink)
}, },
...mapMutations(['clearEditorToDefault','setCurrentColor', 'setCiteStatus', 'themeChanged', ...mapMutations(['clearEditorToDefault','setCurrentColor', 'setCiteStatus', 'themeChanged',
'setOutput', 'setCurrentFont', 'setCurrentSize', 'setCssEditorValue', 'setWxRendererOptions']) 'setHtml', 'setCurrentFont', 'setCurrentSize', 'setCssEditorValue', 'setWxRendererOptions'])
}, },
mounted() { mounted() {
this.selectFont = this.currentFont; this.selectFont = this.currentFont;

View File

@ -16,6 +16,7 @@ Vue.use(Vuex)
const state = { const state = {
wxRenderer: null, wxRenderer: null,
output: '', output: '',
html: '',
editor: null, editor: null,
cssEditor: null, cssEditor: null,
currentFont: '', currentFont: '',
@ -25,8 +26,8 @@ const state = {
nightMode: false nightMode: false
}; };
const mutations = { const mutations = {
setOutput(state, data) { setHtmL(state, data) {
state.output = data; state.html = data;
}, },
setEditorValue(state, data) { setEditorValue(state, data) {
state.editor.setValue(data) state.editor.setValue(data)