Merge pull request #377 from SiriusXT/find_widget

Fix a bug of find widget
This commit is contained in:
Elian Doran 2024-08-30 22:22:44 +03:00 committed by GitHub
commit b1163624ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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("?")
}
}
} }