feat(client): select all and copy monaco command (#51963)

This commit is contained in:
Krzysztof G
2023-10-18 22:43:24 +02:00
committed by GitHub
parent d78405d10b
commit 2c7caa09cf

View File

@@ -567,6 +567,24 @@ const Editor = (props: EditorProps): JSX.Element => {
],
run: toggleAriaRoledescription
});
editor.addAction({
id: 'select-all-and-copy',
label: 'Select All and Copy',
contextMenuGroupId: '9_cutcopypaste',
contextMenuOrder: 3,
run: () => {
const fullSelection = editor.getModel()?.getFullModelRange();
if (fullSelection) {
editor.setSelection(fullSelection);
const data = editor.getModel()?.getValueInRange(fullSelection);
if (data) {
navigator.clipboard
.writeText(data)
.catch(err => console.error(err));
}
}
}
});
editor.onDidFocusEditorWidget(() => props.setEditorFocusability(true));
// aria-roledescription is on (true) by default, check if it needs