mirror of
https://github.com/zadam/trilium.git
synced 2025-12-04 14:34:24 +01:00
Merge 2069bb28c95cb4f675545a25ee448317b5d8c38e into b8585594cd138783588a7ac4d6a3260de779427d
This commit is contained in:
commit
b99cb17bc7
@ -386,6 +386,7 @@
|
|||||||
"workspace_template": "This note will appear in the selection of available template when creating new note, but only when hoisted into a workspace containing this template",
|
"workspace_template": "This note will appear in the selection of available template when creating new note, but only when hoisted into a workspace containing this template",
|
||||||
"search_home": "new search notes will be created as children of this note",
|
"search_home": "new search notes will be created as children of this note",
|
||||||
"workspace_search_home": "new search notes will be created as children of this note when hoisted to some ancestor of this workspace note",
|
"workspace_search_home": "new search notes will be created as children of this note when hoisted to some ancestor of this workspace note",
|
||||||
|
"auto_execute_search": "Automatically executes the search defined in a saved search note and switches to the Collection Properties tab if any notes match the query",
|
||||||
"inbox": "default inbox location for new notes - when you create a note using \"new note\" button in the sidebar, notes will be created as child notes in the note marked as with <code>#inbox</code> label.",
|
"inbox": "default inbox location for new notes - when you create a note using \"new note\" button in the sidebar, notes will be created as child notes in the note marked as with <code>#inbox</code> label.",
|
||||||
"workspace_inbox": "default inbox location for new notes when hoisted to some ancestor of this workspace note",
|
"workspace_inbox": "default inbox location for new notes when hoisted to some ancestor of this workspace note",
|
||||||
"sql_console_home": "default location of SQL console notes",
|
"sql_console_home": "default location of SQL console notes",
|
||||||
|
|||||||
@ -236,6 +236,7 @@ const ATTR_HELP: Record<string, Record<string, string>> = {
|
|||||||
workspaceTemplate: t("attribute_detail.workspace_template"),
|
workspaceTemplate: t("attribute_detail.workspace_template"),
|
||||||
searchHome: t("attribute_detail.search_home"),
|
searchHome: t("attribute_detail.search_home"),
|
||||||
workspaceSearchHome: t("attribute_detail.workspace_search_home"),
|
workspaceSearchHome: t("attribute_detail.workspace_search_home"),
|
||||||
|
autoExecuteSearch: t("attribute_detail.auto_execute_search"),
|
||||||
inbox: t("attribute_detail.inbox"),
|
inbox: t("attribute_detail.inbox"),
|
||||||
workspaceInbox: t("attribute_detail.workspace_inbox"),
|
workspaceInbox: t("attribute_detail.workspace_inbox"),
|
||||||
sqlConsoleHome: t("attribute_detail.sql_console_home"),
|
sqlConsoleHome: t("attribute_detail.sql_console_home"),
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import RenameNoteBulkAction from "../bulk_actions/note/rename_note";
|
|||||||
import { getErrorMessage } from "../../services/utils";
|
import { getErrorMessage } from "../../services/utils";
|
||||||
import "./SearchDefinitionTab.css";
|
import "./SearchDefinitionTab.css";
|
||||||
|
|
||||||
export default function SearchDefinitionTab({ note, ntxId, hidden }: TabContext) {
|
export default function SearchDefinitionTab({ note, ntxId, hidden, noteContext }: TabContext) {
|
||||||
const parentComponent = useContext(ParentComponent);
|
const parentComponent = useContext(ParentComponent);
|
||||||
const [ searchOptions, setSearchOptions ] = useState<{ availableOptions: SearchOption[], activeOptions: SearchOption[] }>();
|
const [ searchOptions, setSearchOptions ] = useState<{ availableOptions: SearchOption[], activeOptions: SearchOption[] }>();
|
||||||
const [ error, setError ] = useState<{ message: string }>();
|
const [ error, setError ] = useState<{ message: string }>();
|
||||||
@ -73,6 +73,27 @@ export default function SearchDefinitionTab({ note, ntxId, hidden }: TabContext)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function autoExecute() {
|
||||||
|
if (!note || note.type !== "search" || !note.hasLabel("autoExecuteSearch")) {
|
||||||
|
executionState.save("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lastExecutedNoteId = executionState.load();
|
||||||
|
if (lastExecutedNoteId !== note.noteId) {
|
||||||
|
executionState.save(note.noteId);
|
||||||
|
|
||||||
|
await refreshResults();
|
||||||
|
|
||||||
|
if (noteContext?.viewScope?.viewMode === "default" && note.children.length > 0) {
|
||||||
|
parentComponent?.triggerCommand("toggleRibbonTabBookProperties", {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
autoExecute();
|
||||||
|
}, [note]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="search-definition-widget">
|
<div className="search-definition-widget">
|
||||||
<div className="search-settings">
|
<div className="search-settings">
|
||||||
@ -160,6 +181,14 @@ export default function SearchDefinitionTab({ note, ntxId, hidden }: TabContext)
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const executionState = function() {
|
||||||
|
let lastAutoExecutedSearchNoteId = "";
|
||||||
|
return {
|
||||||
|
load: () => lastAutoExecutedSearchNoteId,
|
||||||
|
save: (noteId: string) => lastAutoExecutedSearchNoteId = noteId,
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
|
||||||
function BulkActionsList({ note }: { note: FNote }) {
|
function BulkActionsList({ note }: { note: FNote }) {
|
||||||
const [ bulkActions, setBulkActions ] = useState<RenameNoteBulkAction[]>();
|
const [ bulkActions, setBulkActions ] = useState<RenameNoteBulkAction[]>();
|
||||||
|
|
||||||
|
|||||||
@ -222,6 +222,14 @@
|
|||||||
<a
|
<a
|
||||||
class="reference-link" href="#root/_help_m523cpzocqaD">Saved Search</a>).</td>
|
class="reference-link" href="#root/_help_m523cpzocqaD">Saved Search</a>).</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>autoExecuteSearch</code>
|
||||||
|
</td>
|
||||||
|
<td>Automatically executes the search defined in a saved search note and switches
|
||||||
|
to the <em>Collection Properties</em> tab if any notes match the query. A
|
||||||
|
search note with this attribute functions as a dynamic collection of notes
|
||||||
|
(see <a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a>)</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>workspace</code> and related attributes</td>
|
<td><code>workspace</code> and related attributes</td>
|
||||||
<td>See <a class="reference-link" href="#root/_help_9sRHySam5fXb">Workspaces</a>.</td>
|
<td>See <a class="reference-link" href="#root/_help_9sRHySam5fXb">Workspaces</a>.</td>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -23,6 +23,7 @@ type Labels = {
|
|||||||
ancestorDepth: string;
|
ancestorDepth: string;
|
||||||
orderBy: string;
|
orderBy: string;
|
||||||
orderDirection: string;
|
orderDirection: string;
|
||||||
|
autoExecuteSearch: boolean;
|
||||||
|
|
||||||
// Collection-specific
|
// Collection-specific
|
||||||
viewType: string;
|
viewType: string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user