mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 15:25:51 +01:00
find box can be used also on render notes
This commit is contained in:
@@ -142,19 +142,11 @@ export default class FindWidget extends NoteContextAwareWidget {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!['text', 'code'].includes(this.note.type) || !this.$findBox.is(":hidden")) {
|
||||
if (!['text', 'code', 'render'].includes(this.note.type) || !this.$findBox.is(":hidden")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const readOnly = await this.noteContext.isReadOnly();
|
||||
|
||||
if (readOnly) {
|
||||
this.handler = this.htmlHandler;
|
||||
} else {
|
||||
this.handler = this.note.type === "code"
|
||||
? this.codeHandler
|
||||
: this.textHandler;
|
||||
}
|
||||
this.handler = await this.getHandler();
|
||||
|
||||
this.$findBox.show();
|
||||
this.$input.focus();
|
||||
@@ -173,6 +165,22 @@ export default class FindWidget extends NoteContextAwareWidget {
|
||||
}
|
||||
}
|
||||
|
||||
async getHandler() {
|
||||
if (this.note.type === 'render') {
|
||||
return this.htmlHandler;
|
||||
}
|
||||
|
||||
const readOnly = await this.noteContext.isReadOnly();
|
||||
|
||||
if (readOnly) {
|
||||
return this.htmlHandler;
|
||||
} else {
|
||||
return this.note.type === "code"
|
||||
? this.codeHandler
|
||||
: this.textHandler;
|
||||
}
|
||||
}
|
||||
|
||||
startSearch() {
|
||||
// XXX This should clear the previous search immediately in all cases
|
||||
// (the search is stale when waitforenter but also while the
|
||||
@@ -250,6 +258,6 @@ export default class FindWidget extends NoteContextAwareWidget {
|
||||
}
|
||||
|
||||
isEnabled() {
|
||||
return super.isEnabled() && ['text', 'code'].includes(this.note.type);
|
||||
return super.isEnabled() && ['text', 'code', 'render'].includes(this.note.type);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user