Skip to content

Build your personal knowledge base with Trilium Notes

chore(react/ribbon): search & execute button

Elian Doran80ad87671af2
diff --git a/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx b/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx
index 9607f3784e..45954f1e80 100644
--- a/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx
+++ b/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx
@@ -156,6 +156,16 @@ export default function SearchDefinitionTab({ note, ntxId }: TabContext) {
keyboardShortcut="Enter"
onClick={refreshResults}
/>
+
+ <Button
+ icon="bx bxs-zap"
+ text={t("search_definition.search_execute")}
+ onClick={async () => {
+ await server.post(`search-and-execute-note/${note.noteId}`);
+ refreshResults();
+ toast.showMessage(t("search_definition.actions_executed"), 3000);
+ }}
+ />
</div>
</td>
</tr>
diff --git a/apps/client/src/widgets/ribbon_widgets/search_definition.ts b/apps/client/src/widgets/ribbon_widgets/search_definition.ts
index a77ebc7430..a948bc89b6 100644
--- a/apps/client/src/widgets/ribbon_widgets/search_definition.ts
+++ b/apps/client/src/widgets/ribbon_widgets/search_definition.ts
@@ -41,16 +41,6 @@ const TPL = /*html*/`
<tr>
<td colspan="3">
<div style="display: flex; justify-content: space-evenly">
- <button type="button" class="btn btn-sm search-button">
- <span class="bx bx-search"></span>
- ${}
- </button>
-
- <button type="button" class="btn btn-sm search-and-execute-button">
- <span class="bx bxs-zap"></span>
- ${t("search_definition.search_execute")}
- </button>
-
<button type="button" class="btn btn-sm save-to-note-button">
<span class="bx bx-save"></span>
${t("search_definition.save_to_note")}
@@ -126,9 +116,6 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget {
this.$searchOptions = this.$widget.find(".search-options");
this.$actionOptions = this.$widget.find(".action-options");
- this.$searchAndExecuteButton = this.$widget.find(".search-and-execute-button");
- this.$searchAndExecuteButton.on("click", () => this.searchAndExecute());
-
this.$saveToNoteButton = this.$widget.find(".save-to-note-button");
this.$saveToNoteButton.on("click", async () => {
const { notePath } = await server.post<SaveSearchNoteResponse>("special-notes/save-search-note", { searchNoteId: this.noteId });
@@ -162,18 +149,6 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget {
this.$searchAndExecuteButton.css("visibility", actions.length > 0 ? "visible" : "_hidden");
}
- getContent() {
- return "";
- }
-
- async searchAndExecute() {
- await server.post(`search-and-execute-note/${this.noteId}`);
-
- this.triggerCommand("refreshResults");
-
- toastService.showMessage(t("search_definition.actions_executed"), 3000);
- }
-
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
// only refreshing deleted attrs, otherwise components update themselves
if (loadResults.getAttributeRows().find((attrRow) => attrRow.type === "label" && attrRow.name === "action" && attrRow.isDeleted)) {