diff --git a/client/src/templates/Challenges/classic/editor.tsx b/client/src/templates/Challenges/classic/editor.tsx index 0534ded34b1..ae1e7d5b515 100644 --- a/client/src/templates/Challenges/classic/editor.tsx +++ b/client/src/templates/Challenges/classic/editor.tsx @@ -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