✨ Add support for external selection state in JsonViewer component
This commit is contained in:
@@ -111,6 +111,10 @@ const props = defineProps({
|
|||||||
lineHeight: {
|
lineHeight: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 20
|
default: 20
|
||||||
|
},
|
||||||
|
selectionState: {
|
||||||
|
type: Object,
|
||||||
|
default: null
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -120,11 +124,13 @@ const selectedFile = toRef(props, 'selectedFile');
|
|||||||
|
|
||||||
const virtualScroller = ref(null);
|
const virtualScroller = ref(null);
|
||||||
|
|
||||||
const { selectedLines, toggleLineSelection } = useLineSelection(
|
const internalSelectionState = useLineSelection(
|
||||||
displayLines,
|
displayLines,
|
||||||
fileContent,
|
fileContent,
|
||||||
selectedFile
|
selectedFile
|
||||||
);
|
);
|
||||||
|
const activeSelectionState = computed(() => props.selectionState || internalSelectionState);
|
||||||
|
const { selectedLines, toggleLineSelection } = activeSelectionState.value;
|
||||||
|
|
||||||
const isCurrentResult = lineNumber => {
|
const isCurrentResult = lineNumber => {
|
||||||
if (!props.searchResults.length) return false;
|
if (!props.searchResults.length) return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user