showSearchSuggestions of the quick lauch will now inherit the setting from the search widget.
This commit is contained in:
parent
ed827837aa
commit
454d51808e
@ -359,7 +359,7 @@ There are a few optional settings for the Quick Launch feature:
|
||||
|
||||
- `searchDescriptions`: which lets you control whether item descriptions are included in searches. This is off by default. When enabled, results that match the item name will be placed above those that only match the description.
|
||||
- `hideInternetSearch`: disable automatically including the currently-selected web search (e.g. from the widget) as a Quick Launch option. This is false by default, enabling the feature.
|
||||
- `showSearchSuggestions`: shows search suggestions for the internet search. This is false by default.
|
||||
- `showSearchSuggestions`: shows search suggestions for the internet search. This value will be inherited from the search widget if it is not specified. If it is not specified there either, it will default to false.
|
||||
- `hideVisitURL`: disable detecting and offering an option to open URLs. This is false by default, enabling the feature.
|
||||
|
||||
```yaml
|
||||
|
||||
@ -9,6 +9,7 @@ You can add a search bar to your top widget area that can search using Google, D
|
||||
- search:
|
||||
provider: google # google, duckduckgo, bing, baidu, brave or custom
|
||||
focus: true # Optional, will set focus to the search bar on page load
|
||||
showSearchSuggestions: true # Optional, will show search suggestions
|
||||
target: _blank # One of _self, _blank, _parent or _top
|
||||
```
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useEffect, useState, useRef, useCallback, useContext } from "react";
|
||||
import classNames from "classnames";
|
||||
import useSWR from "swr";
|
||||
|
||||
import ResolvedIcon from "./resolvedicon";
|
||||
|
||||
@ -15,10 +16,19 @@ export default function QuickLaunch({
|
||||
searchProvider,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { data: widgets } = useSWR("/api/widgets");
|
||||
const searchWidget = Object.values(widgets).find((w) => w.type === "search");
|
||||
|
||||
const { settings } = useContext(SettingsContext);
|
||||
const { searchDescriptions, hideVisitURL, showSearchSuggestions } = settings?.quicklaunch
|
||||
const { searchDescriptions, hideVisitURL } = settings?.quicklaunch
|
||||
? settings.quicklaunch
|
||||
: { searchDescriptions: false, hideVisitURL: false, showSearchSuggestions: false };
|
||||
: {
|
||||
searchDescriptions: false,
|
||||
hideVisitURL: false,
|
||||
};
|
||||
const showSearchSuggestions =
|
||||
settings?.quicklaunch?.showSearchSuggestions ?? searchWidget.options.showSearchSuggestions ?? false;
|
||||
|
||||
const searchField = useRef();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user