From daf683f210558824085e08a0a0209f825ba719ac Mon Sep 17 00:00:00 2001 From: Arunima22 Date: Fri, 14 Mar 2025 22:42:53 +0530 Subject: [PATCH] modified ContextMenuCloak.vue --- .../frontend/shared/views/ContextMenuCloak.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/contentcuration/contentcuration/frontend/shared/views/ContextMenuCloak.vue b/contentcuration/contentcuration/frontend/shared/views/ContextMenuCloak.vue index f8f3e951b2..637fee0529 100644 --- a/contentcuration/contentcuration/frontend/shared/views/ContextMenuCloak.vue +++ b/contentcuration/contentcuration/frontend/shared/views/ContextMenuCloak.vue @@ -28,6 +28,12 @@ return !this.disabled && this.currentContextMenu === this._uid; }, }, + mounted() { + document.addEventListener('click', this.hideMenu); + }, + beforeDestroy() { + document.removeEventListener('click', this.hideMenu); + }, methods: { ...mapMutations('contextMenu', { setMenu: 'SET_CONTEXT_MENU' }), showMenu(e) { @@ -37,8 +43,14 @@ this.y = e.clientY; this.setMenu(this._uid); }, + hideMenu(e) { + if (this.currentContextMenu && !this.$el.contains(e.target)) { + this.setMenu(''); + } + }, extendSlot, }, + render() { if (this.disabled) { return this.extendSlot('default');