✨ Add support for external selection state in JsonViewer component
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user