diff --git a/src/JSONEditor.svelte b/src/JSONEditor.svelte index 62334bc..6197cdd 100644 --- a/src/JSONEditor.svelte +++ b/src/JSONEditor.svelte @@ -261,6 +261,12 @@ focusActiveSearchResult(searchResult && searchResult.activeItem) } + function clearSearchResult () { + showSearch = false + searchText = '' + searchResult = search(doc, searchText, searchResult) + } + function previousSearchResult () { searchResult = searchPrevious(searchResult) focusActiveSearchResult(searchResult && searchResult.activeItem) @@ -517,10 +523,7 @@ onChange={changeSearchText} onNext={nextSearchResult} onPrevious={previousSearchResult} - onClose={() => { - showSearch = false - searchText = '' - }} + onClose={clearSearchResult} /> {/if}