Add support for external selection state in ActionToolbar component

This commit is contained in:
2026-01-29 04:00:47 +00:00
parent 1d6e1ca196
commit 6cce9ba646

View File

@@ -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>