Add support for external selection state in JsonViewer component

This commit is contained in:
2026-01-29 04:00:37 +00:00
parent 9f41ad7817
commit 51ca3dc2c4

View File

@@ -111,6 +111,10 @@ const props = defineProps({
lineHeight: {
type: Number,
default: 20
},
selectionState: {
type: Object,
default: null
}
});
@@ -120,11 +124,13 @@ const selectedFile = toRef(props, 'selectedFile');
const virtualScroller = ref(null);
const { selectedLines, toggleLineSelection } = useLineSelection(
const internalSelectionState = useLineSelection(
displayLines,
fileContent,
selectedFile
);
const activeSelectionState = computed(() => props.selectionState || internalSelectionState);
const { selectedLines, toggleLineSelection } = activeSelectionState.value;
const isCurrentResult = lineNumber => {
if (!props.searchResults.length) return false;