Skip to content

Commit

Permalink
Avoid placing the editor in focus while copying.
Browse files Browse the repository at this point in the history
  • Loading branch information
coatless committed Feb 4, 2024
1 parent 8c86aef commit 1381e37
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions _extensions/webr/qwebr-monaco-editor-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,10 @@ globalThis.qwebrCreateMonacoEditorInstance = function (cellData) {

// Add a click event listener to the reset button
copyButton.onclick = function () {
// Ensure the editor is in focus
editor.focus();

// Retrieve data
// Retrieve current code data
const data = editor.getValue();

// Set the clipboard contents.
// Write code data onto the clipboard.
navigator.clipboard.writeText(data || "");
};

Expand Down

0 comments on commit 1381e37

Please sign in to comment.