Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat(sql-editor): close the popover when clickoutside of share popover (#655)

Yunwei Xiao6c6e51c05a46
diff --git a/frontend/src/views/SqlEditor/EditorPanel/EditorAction.vue b/frontend/src/views/SqlEditor/EditorPanel/EditorAction.vue
index eea47cc1b7..753c8514e6 100644
--- a/frontend/src/views/SqlEditor/EditorPanel/EditorAction.vue
+++ b/frontend/src/views/SqlEditor/EditorPanel/EditorAction.vue
@@ -76,20 +76,21 @@
<carbon:share class="h-5 w-5" /> &nbsp; {{ $t("common.share") }}
</NButton>
</template>
- <SharePopover @close="isShowSharePopover = false" />
+ <SharePopover ref="sharePopover" @close="isShowSharePopover = false" />
</NPopover>
</div>
</div>
</template>
<script lang="ts" setup>
-import { computed, ref, watch } from "vue";
+import { computed, onMounted, ref, watch } from "vue";
import {
useNamespacedState,
useNamespacedActions,
useNamespacedGetters,
} from "vuex-composition-helpers";
import { useStore } from "vuex";
+import { onClickOutside } from "@vueuse/core";
import {
SqlEditorState,
@@ -123,6 +124,7 @@ const { updateCurrentTab } = useNamespacedActions<TabActions>("tab", [
]);
const isShowSharePopover = ref(false);
+const sharePopover = ref(null);
const isEmptyStatement = computed(
() => !currentTab.value || currentTab.value.statement === ""
);
@@ -159,6 +161,10 @@ watch(
}
}
);
+
+onMounted(() => {
+ onClickOutside(sharePopover, (event) => (isShowSharePopover.value = false));
+});
</script>
<style scoped>