mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 07:46:30 +01:00
chore(react/ribbon): search & execute button
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user