Fix clearing search result when closing search box

This commit is contained in:
Jos de Jong 2020-07-26 11:11:46 +02:00
parent bd73739343
commit ad3ac339cf
1 changed files with 7 additions and 4 deletions

View File

@ -261,6 +261,12 @@
focusActiveSearchResult(searchResult && searchResult.activeItem) focusActiveSearchResult(searchResult && searchResult.activeItem)
} }
function clearSearchResult () {
showSearch = false
searchText = ''
searchResult = search(doc, searchText, searchResult)
}
function previousSearchResult () { function previousSearchResult () {
searchResult = searchPrevious(searchResult) searchResult = searchPrevious(searchResult)
focusActiveSearchResult(searchResult && searchResult.activeItem) focusActiveSearchResult(searchResult && searchResult.activeItem)
@ -517,10 +523,7 @@
onChange={changeSearchText} onChange={changeSearchText}
onNext={nextSearchResult} onNext={nextSearchResult}
onPrevious={previousSearchResult} onPrevious={previousSearchResult}
onClose={() => { onClose={clearSearchResult}
showSearch = false
searchText = ''
}}
/> />
</div> </div>
{/if} {/if}