Skip to content

Commit ec3ff92

Browse files
committed
clean up. tested in real life
1 parent 84ad3d9 commit ec3ff92

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

csvButton.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -124,28 +124,11 @@ export function csvButton (dom, tracker) {
124124
div.addEventListener('copy', event => {
125125
// alert ('Copy caught');
126126
const csv = csvText(store, tracker);
127-
const csv1 = TestCSVstring
128127
event.clipboardData.setData("text/plain", csv);
129128
event.clipboardData.setData("text/csv", csv);
130129
alert ('Copy data: ' + csv)
131130
event.preventDefault();
132131
})
133-
134-
var copyEvent = new ClipboardEvent('copy');
135-
if (!copyEvent) {
136-
alert('CSV: Copy event failed.')
137-
} else if (!copyEvent.clipboardData){
138-
alert('CSV: Now do a copy operation to copy as CSV data')
139-
} else {
140-
copyEvent.clipboardData.items.add(csv, 'text/csv');
141-
copyEvent.clipboardData.items.add(csv, 'text/plain');
142-
dom.dispatchEvent(copyEvent);
143-
alert('Copy dispatched.')
144-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/copy_event
145-
// t's possible to construct and dispatch a synthetic copy event,
146-
// but this will not affect the system clipboard.
147-
}
148-
event.preventDefault()
149132
})
150133

151134
wrapper.appendChild(button)

0 commit comments

Comments
 (0)