aboutsummaryrefslogtreecommitdiff
path: root/src/modules/command-palette/command-palette.vue
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/command-palette/command-palette.vue')
-rw-r--r--src/modules/command-palette/command-palette.vue20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/modules/command-palette/command-palette.vue b/src/modules/command-palette/command-palette.vue
index bd431a0..12ad5fb 100644
--- a/src/modules/command-palette/command-palette.vue
+++ b/src/modules/command-palette/command-palette.vue
@@ -76,19 +76,35 @@ function getOptionIndex(option: PaletteOption) {
}
function activateOption(option: PaletteOption) {
+ const { closeOnSelect } = option;
+
if (option.action) {
option.action();
+
+ if (closeOnSelect) {
+ close();
+ }
+
return;
}
+ const closeAfterNavigation = closeOnSelect || _.isUndefined(closeOnSelect);
+
if (option.to) {
router.push(option.to);
- close();
+
+ if (closeAfterNavigation) {
+ close();
+ }
+ return;
}
if (option.href) {
window.open(option.href, '_blank');
- close();
+
+ if (closeAfterNavigation) {
+ close();
+ }
}
}
</script>