diff --git a/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx b/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx
index 55493a6f7..f782b31a3 100644
--- a/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx
+++ b/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx
@@ -56,7 +56,8 @@ const SEARCH_OPTIONS: SearchOption[] = [
attributeName: "ancestor",
attributeType: "relation",
icon: "bx bx-filter-alt",
- label: t("search_definition.ancestor")
+ label: t("search_definition.ancestor"),
+ component: AncestorOption
},
{
attributeName: "fastSearch",
@@ -341,8 +342,7 @@ function SearchScriptOption({ note, ...restProps }: SearchOptionProps) {
{t("search_script.example_code")}
{t("search_script.note")}
>}
- note={note}
- {...restProps}
+ note={note} {...restProps}
>
+}
+
+function AncestorOption({ note, ...restProps}: SearchOptionProps) {
+ const [ ancestor, setAncestor ] = useNoteRelation(note, "ancestor");
+
+ return
+ setAncestor(noteId ?? "root")}
+ placeholder={t("ancestor.placeholder")}
+ />
+ ;
}
\ No newline at end of file
diff --git a/apps/client/src/widgets/search_options/ancestor.ts b/apps/client/src/widgets/search_options/ancestor.ts
index fa9fc672e..54a8874c0 100644
--- a/apps/client/src/widgets/search_options/ancestor.ts
+++ b/apps/client/src/widgets/search_options/ancestor.ts
@@ -5,14 +5,7 @@ import { t } from "../../services/i18n.js";
const TPL = /*html*/`
-
- ${t("ancestor.label")}:
-
-
-
-
- ${t("ancestor.depth_label")}:
-
+ ${t("ancestor.depth_label")}:
|
-
-
- |
`;
export default class Ancestor extends AbstractSearchOption {
- static async create(noteId: string) {
- await AbstractSearchOption.setAttribute(noteId, "relation", "ancestor", "root");
- }
-
doRender() {
const $option = $(TPL);
const $ancestor = $option.find(".ancestor");