mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Implement saving of global search string.
This implements point 1 of issue 868. After performing a search, when returning to the global search tab the previous search term is now retained and preselected, making it easier to repeat the same search or modify it.
This commit is contained in:
parent
05d2f4fe96
commit
927da84d3b
@ -2,6 +2,7 @@ import AbstractSearchOption from "./abstract_search_option.js";
|
|||||||
import SpacedUpdate from "../../services/spaced_update.js";
|
import SpacedUpdate from "../../services/spaced_update.js";
|
||||||
import server from "../../services/server.js";
|
import server from "../../services/server.js";
|
||||||
import shortcutService from "../../services/shortcuts.js";
|
import shortcutService from "../../services/shortcuts.js";
|
||||||
|
import appContext from "../../components/app_context.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<tr>
|
<tr>
|
||||||
@ -56,6 +57,7 @@ export default class SearchString extends AbstractSearchOption {
|
|||||||
|
|
||||||
this.spacedUpdate = new SpacedUpdate(async () => {
|
this.spacedUpdate = new SpacedUpdate(async () => {
|
||||||
const searchString = this.$searchString.val();
|
const searchString = this.$searchString.val();
|
||||||
|
appContext.lastSearchString = searchString;
|
||||||
|
|
||||||
await this.setAttribute('label', 'searchString', searchString);
|
await this.setAttribute('label', 'searchString', searchString);
|
||||||
|
|
||||||
@ -84,6 +86,7 @@ export default class SearchString extends AbstractSearchOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
focusOnSearchDefinitionEvent() {
|
focusOnSearchDefinitionEvent() {
|
||||||
this.$searchString.focus();
|
this.$searchString.val(appContext.lastSearchString).focus().select();
|
||||||
|
this.spacedUpdate.scheduleUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user