🔍 Add support for external search state in SearchBar component

This commit is contained in:
2026-01-29 04:00:22 +00:00
parent 02f198db93
commit 6b31eab984

View File

@@ -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