Fix a bug of find widget

This commit is contained in:
SiriusXT 2024-08-30 11:42:55 +00:00
parent a18ac7c504
commit 35171fe2b4

View File

@ -218,6 +218,10 @@ export default class FindWidget extends NoteContextAwareWidget {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
async findNext(direction) { async findNext(direction) {
if (this.$totalFound.text()=="?"){
await this.performFind();
return
}
const searchTerm = this.$input.val(); const searchTerm = this.$input.val();
if (waitForEnter && this.searchTerm !== searchTerm) { if (waitForEnter && this.searchTerm !== searchTerm) {
await this.performFind(); await this.performFind();
@ -272,4 +276,10 @@ export default class FindWidget extends NoteContextAwareWidget {
isEnabled() { isEnabled() {
return super.isEnabled() && ['text', 'code', 'render'].includes(this.note.type); return super.isEnabled() && ['text', 'code', 'render'].includes(this.note.type);
} }
async entitiesReloadedEvent({loadResults}) {
if (loadResults.isNoteContentReloaded(this.noteId)) {
this.$totalFound.text("?")
}
}
} }