Refactored relevant methods to SearchHistory
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
const debouncedOnInput = debounce(() => {
|
||||
// If typing a query and not executing it,
|
||||
// the next time we open the modal, the search field will be empty
|
||||
plugin.cacheManager.addToSearchHistory('')
|
||||
plugin.searchHistory.addToHistory('')
|
||||
dispatch('input', value)
|
||||
}, 300)
|
||||
</script>
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
|
||||
async function prevSearchHistory() {
|
||||
// Filter out the empty string, if it's there
|
||||
const history = (await plugin.cacheManager.getSearchHistory()).filter(
|
||||
const history = (await plugin.searchHistory.getHistory()).filter(
|
||||
s => s
|
||||
)
|
||||
if (++historySearchIndex >= history.length) {
|
||||
@@ -121,7 +121,7 @@
|
||||
}
|
||||
|
||||
async function nextSearchHistory() {
|
||||
const history = (await plugin.cacheManager.getSearchHistory()).filter(
|
||||
const history = (await plugin.searchHistory.getHistory()).filter(
|
||||
s => s
|
||||
)
|
||||
if (--historySearchIndex < 0) {
|
||||
@@ -192,7 +192,7 @@
|
||||
|
||||
function saveCurrentQuery() {
|
||||
if (searchQuery) {
|
||||
plugin.cacheManager.addToSearchHistory(searchQuery)
|
||||
plugin.searchHistory.addToHistory(searchQuery)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ export class OmnisearchVaultModal extends OmnisearchModal {
|
||||
.getActiveViewOfType(MarkdownView)
|
||||
?.editor.getSelection()
|
||||
|
||||
plugin.cacheManager.getSearchHistory().then(history => {
|
||||
plugin.searchHistory.getHistory().then(history => {
|
||||
// Previously searched query (if enabled in settings)
|
||||
const previous = plugin.settings.showPreviousQueryResults
|
||||
? history[0]
|
||||
|
||||
Reference in New Issue
Block a user