mirror of
https://github.com/doocs/md.git
synced 2024-12-01 06:42:23 +08:00
fix: right click menu visable bug
This commit is contained in:
parent
0b9ba2252a
commit
aade1445bc
@ -71,15 +71,6 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
value(newVal) {
|
|
||||||
if (newVal) {
|
|
||||||
document.body.addEventListener('click', this.closeCB.bind(this));
|
|
||||||
} else {
|
|
||||||
document.body.removeEventListener('click', this.closeCB.bind(this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -23,7 +23,8 @@ const state = {
|
|||||||
currentSize: '',
|
currentSize: '',
|
||||||
currentColor: '',
|
currentColor: '',
|
||||||
citeStatus: 0,
|
citeStatus: 0,
|
||||||
nightMode: false
|
nightMode: false,
|
||||||
|
rightClickMenuVisible:false
|
||||||
};
|
};
|
||||||
const mutations = {
|
const mutations = {
|
||||||
setEditorValue(state, data) {
|
setEditorValue(state, data) {
|
||||||
@ -51,6 +52,9 @@ const mutations = {
|
|||||||
state.currentColor = data;
|
state.currentColor = data;
|
||||||
localStorage.setItem('color', data)
|
localStorage.setItem('color', data)
|
||||||
},
|
},
|
||||||
|
setRightClickMenuVisible(state,data){
|
||||||
|
state.rightClickMenuVisible = data;
|
||||||
|
},
|
||||||
themeChanged(state) {
|
themeChanged(state) {
|
||||||
state.nightMode = !state.nightMode;
|
state.nightMode = !state.nightMode;
|
||||||
},
|
},
|
||||||
@ -93,6 +97,17 @@ const mutations = {
|
|||||||
const doc = formatDoc(DEFAULT_CONTENT)
|
const doc = formatDoc(DEFAULT_CONTENT)
|
||||||
state.editor.setValue(doc)
|
state.editor.setValue(doc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.editor.on("cursorActivity",function(){
|
||||||
|
state.rightClickMenuVisible = false
|
||||||
|
});
|
||||||
|
state.editor.on("blur",function(){
|
||||||
|
state.rightClickMenuVisible = false
|
||||||
|
});
|
||||||
|
state.editor.on("scroll",function(){
|
||||||
|
state.rightClickMenuVisible = false
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
initCssEditorEntity(state) {
|
initCssEditorEntity(state) {
|
||||||
state.cssEditor = CodeMirror.fromTextArea(
|
state.cssEditor = CodeMirror.fromTextArea(
|
||||||
|
@ -82,7 +82,6 @@ export default {
|
|||||||
showCssEditor: false,
|
showCssEditor: false,
|
||||||
aboutDialogVisible: false,
|
aboutDialogVisible: false,
|
||||||
dialogFormVisible: false,
|
dialogFormVisible: false,
|
||||||
rightClickMenuVisible: false,
|
|
||||||
isCoping: false,
|
isCoping: false,
|
||||||
isImgLoading: false,
|
isImgLoading: false,
|
||||||
backLight: false,
|
backLight: false,
|
||||||
@ -107,7 +106,8 @@ export default {
|
|||||||
cssEditor: state=> state.cssEditor,
|
cssEditor: state=> state.cssEditor,
|
||||||
currentSize: state=> state.currentSize,
|
currentSize: state=> state.currentSize,
|
||||||
currentColor: state=> state.currentColor,
|
currentColor: state=> state.currentColor,
|
||||||
nightMode: state=> state.nightMode
|
nightMode: state=> state.nightMode,
|
||||||
|
rightClickMenuVisible: state=> state.rightClickMenuVisible
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -267,7 +267,7 @@ export default {
|
|||||||
const left = e.clientX - offsetLeft;
|
const left = e.clientX - offsetLeft;
|
||||||
this.mouseLeft = Math.min(maxLeft, left);
|
this.mouseLeft = Math.min(maxLeft, left);
|
||||||
this.mouseTop = e.clientY + 10;
|
this.mouseTop = e.clientY + 10;
|
||||||
this.rightClickMenuVisible = true;
|
this.$store.commit('setRightClickMenuVisible', true);
|
||||||
},
|
},
|
||||||
onMenuEvent(type, info = {}) {
|
onMenuEvent(type, info = {}) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user