Fix clearing search result when closing search box
This commit is contained in:
parent
bd73739343
commit
ad3ac339cf
|
@ -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}
|
||||||
|
|
Loading…
Reference in New Issue