@@ -135,20 +135,9 @@ const onToggleUnchanged = () => {
135
135
}
136
136
};
137
137
138
- const onCopyDelta = () => {
139
- document .addEventListener (' copy' , $_onDocumentCopy );
140
- document .execCommand (' copy' , false );
141
- document .removeEventListener (' copy' , $_onDocumentCopy );
142
-
143
- // modern alternative, but don't have permission [?]
144
- // navigator.clipboard.writeText(sDiff).then(
145
- // () => {
146
- // console.log('clipboard successfully set');
147
- // },
148
- // (e) => {
149
- // console.error('clipboard write failed', e);
150
- // }
151
- // );
138
+ const onCopyDelta = async () => {
139
+ const sDiff = JSON .stringify (deltaObj .value , null , 2 );
140
+ await navigator .clipboard .writeText (sDiff );
152
141
};
153
142
154
143
function $_onRuntimeMessage(req ) {
@@ -162,12 +151,6 @@ function $_onRuntimeMessage(req) {
162
151
}
163
152
}
164
153
165
- function $_onDocumentCopy(e : ClipboardEvent ) {
166
- const sDiff = JSON .stringify (deltaObj .value , null , 2 );
167
- e .clipboardData ?.setData (' text' , sDiff );
168
- e .preventDefault ();
169
- }
170
-
171
154
function $_restartLastUpdated() {
172
155
window .clearInterval (timer );
173
156
timer = window .setInterval (() => {
0 commit comments