We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a937132 commit 733755eCopy full SHA for 733755e
1 file changed
editable-samples-2/js/editable.js
@@ -52,16 +52,19 @@ function onEdit(e) {
52
applyCode(e.currentTarget.textContent, e.currentTarget.parentNode);
53
}
54
55
-document.addEventListener('copy', function(e){
+
56
+function copyTextOnly(e) {
57
var selection = window.getSelection();
58
var range = selection.getRangeAt(0);
59
60
e.clipboardData.setData('text/plain', range.toString());
61
e.clipboardData.setData('text/html', range.toString());
62
e.preventDefault();
63
e.stopPropagation();
-
64
-});
+}
65
66
+document.addEventListener('cut', copyTextOnly);
67
+document.addEventListener('copy', copyTextOnly);
68
69
for (exampleChoice of exampleChoices) {
70
exampleChoice.addEventListener("click", onChoose);
0 commit comments