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