mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix refocusing find widget, closes #3252
This commit is contained in:
parent
64d3ec940c
commit
521d95021b
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.56.1",
|
"version": "0.56.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.56.1",
|
"version": "0.56.2",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -142,28 +142,29 @@ export default class FindWidget extends NoteContextAwareWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!['text', 'code', 'render'].includes(this.note.type) || !this.$findBox.is(":hidden")) {
|
if (!['text', 'code', 'render'].includes(this.note.type)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.handler = await this.getHandler();
|
|
||||||
|
|
||||||
this.$findBox.show();
|
this.$findBox.show();
|
||||||
this.$input.focus();
|
this.$input.focus();
|
||||||
|
this.handler = await this.getHandler();
|
||||||
|
|
||||||
|
const isAlreadyVisible = this.$findBox.is(":visible");
|
||||||
|
|
||||||
|
if (isAlreadyVisible) {
|
||||||
|
this.$input.select();
|
||||||
|
} else {
|
||||||
this.$totalFound.text(0);
|
this.$totalFound.text(0);
|
||||||
this.$currentFound.text(0);
|
this.$currentFound.text(0);
|
||||||
|
|
||||||
const searchTerm = await this.handler.getInitialSearchTerm();
|
const searchTerm = await this.handler.getInitialSearchTerm();
|
||||||
|
|
||||||
this.$input.val(searchTerm || "");
|
this.$input.val(searchTerm || "");
|
||||||
|
|
||||||
// Directly perform the search if there's some text to
|
|
||||||
// find, without delaying or waiting for enter
|
|
||||||
if (searchTerm !== "") {
|
if (searchTerm !== "") {
|
||||||
this.$input.select();
|
this.$input.select();
|
||||||
await this.performFind();
|
await this.performFind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getHandler() {
|
async getHandler() {
|
||||||
if (this.note.type === 'render') {
|
if (this.note.type === 'render') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user