Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

search bar "go to link" feature approach version 2: added and "go to link" option so that user can toggle this feature.

Wu Baiyang (Student)3a6656cf3488
diff --git a/src/components/Settings/SearchBar.vue b/src/components/Settings/SearchBar.vue
index 93020a52..cf4dc338 100644
--- a/src/components/Settings/SearchBar.vue
+++ b/src/components/Settings/SearchBar.vue
@@ -52,6 +52,13 @@
/>
Disable Web Search
</label>
+ <label class="theme-label">
+ <input
+ type="checkbox"
+ v-model="goToLinkEnabled"
+ />
+ Go to Link (auto-detect links)
+ </label>
</div>
</div>
</div>
@@ -85,6 +92,7 @@ export default {
akn: new ArrowKeyNavigation(),
getCustomKeyShortcuts,
showSearchPanel: false,
+ goToLinkEnabled: true, // default: enabled
};
},
computed: {
@@ -177,15 +185,15 @@ export default {
/* Launch web search, to correct search engine, passing in users query */
searchSubmitted() {
- const { searchPrefs } = this;
+ const { searchPrefs, goToLinkEnabled } = this;
const input = this.input.trim();
- // 1. If input is URL-like, always open as link
- if (this.isUrlLike(input)) {
+ // 1. If "Go to Link" is enabled and input is URL-like, always open as link
+ if (goToLinkEnabled && this.isUrlLike(input)) {
window.open(this.normalizeUrl(input), '_blank');
this.clearFilterInput();
return;
}
- // 2. If not URL-like, only search if web search is enabled
+ // 2. If not URL-like, or "Go to Link" is disabled, only search if web search is enabled
if (!searchPrefs.disableWebSearch) {
const bangList = { ...defaultSearchBangs, ...(searchPrefs.searchBangs || {}) };
const openingMethod = searchPrefs.openingMethod || defaultSearchOpeningMethod;