✨ Add support for external selection state in ActionToolbar component
This commit is contained in:
@@ -36,6 +36,10 @@ const props = defineProps({
|
||||
selectedFile: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
selectionState: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
});
|
||||
|
||||
@@ -43,6 +47,13 @@ const displayLines = toRef(props, 'displayLines');
|
||||
const fileContent = toRef(props, 'fileContent');
|
||||
const selectedFile = toRef(props, 'selectedFile');
|
||||
|
||||
const internalSelectionState = useLineSelection(
|
||||
displayLines,
|
||||
fileContent,
|
||||
selectedFile
|
||||
);
|
||||
const activeSelectionState = props.selectionState || internalSelectionState;
|
||||
|
||||
const {
|
||||
selectionCount,
|
||||
copySelected,
|
||||
@@ -50,7 +61,7 @@ const {
|
||||
exportSelected,
|
||||
exportAll,
|
||||
shareUrl
|
||||
} = useLineSelection(displayLines, fileContent, selectedFile);
|
||||
} = activeSelectionState;
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user