🔍 Add support for external search state in SearchBar component
This commit is contained in:
@@ -80,12 +80,19 @@ const props = defineProps({
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
searchState: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
});
|
||||
|
||||
const fileLines = toRef(props, 'fileLines');
|
||||
const displayLines = toRef(props, 'displayLines');
|
||||
|
||||
const internalSearchState = useGamemasterSearch(fileLines, displayLines);
|
||||
const activeSearchState = computed(() => props.searchState || internalSearchState);
|
||||
|
||||
const {
|
||||
searchQuery,
|
||||
searchResults,
|
||||
@@ -100,7 +107,7 @@ const {
|
||||
currentResultLineNumber,
|
||||
resultCountDisplay,
|
||||
hasSearchResults
|
||||
} = useGamemasterSearch(fileLines, displayLines);
|
||||
} = activeSearchState.value;
|
||||
|
||||
const isDisabled = computed(
|
||||
() => props.disabled || fileLines.value.length === 0
|
||||
|
||||
Reference in New Issue
Block a user