Update click outside events to limit only to click events, ignoring blur (#1953)

This commit is contained in:
Mutasem Aldmour 2021-06-30 10:17:30 +03:00 committed by GitHub
parent 38f0cc1a8f
commit a080fab1f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 9 deletions

View file

@ -10,7 +10,7 @@
@keydown.esc="onEscape"
ref="input"
size="4"
v-click-outside="onBlur"
v-click-outside="onClickOutside"
/>
</ExpandableInputBase>
</template>
@ -47,8 +47,10 @@ export default Vue.extend({
onEnter() {
this.$emit('enter', (this.$refs.input as HTMLInputElement).value);
},
onBlur() {
this.$emit('blur', (this.$refs.input as HTMLInputElement).value);
onClickOutside(e: Event) {
if (e.type === 'click') {
this.$emit('blur', (this.$refs.input as HTMLInputElement).value);
}
},
onEscape() {
this.$emit('esc');

View file

@ -1,7 +1,7 @@
<template>
<div>
<SlideTransition>
<div class="node-creator" v-if="active" v-click-outside="closeCreator">
<div class="node-creator" v-if="active" v-click-outside="onClickOutside">
<MainPanel @nodeTypeSelected="nodeTypeSelected" :categorizedItems="categorizedItems" :categoriesWithNodes="categoriesWithNodes" :searchItems="searchItems"></MainPanel>
</div>
</SlideTransition>
@ -64,8 +64,10 @@ export default Vue.extend({
},
},
methods: {
closeCreator () {
this.$emit('closeNodeCreator');
onClickOutside (e: Event) {
if (e.type === 'click') {
this.$emit('closeNodeCreator');
}
},
nodeTypeSelected (nodeTypeName: string) {
this.$emit('nodeTypeSelected', nodeTypeName);

View file

@ -1,5 +1,5 @@
<template>
<div :class="{'tags-container': true, focused}" @keydown.stop v-click-outside="onBlur">
<div :class="{'tags-container': true, focused}" @keydown.stop v-click-outside="onClickOutside">
<el-select
:popperAppendToBody="false"
:value="appliedTags"
@ -215,8 +215,10 @@ export default mixins(showMessage).extend({
this.focusOnInput();
});
},
onBlur() {
this.$emit('blur');
onClickOutside(e: Event) {
if (e.type === 'click') {
this.$emit('blur');
}
},
},
watch: {