@arsedizioni/ars-utils 21.0.40 → 21.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -915,6 +915,9 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
|
|
|
915
915
|
this.relevants.hits = data.total;
|
|
916
916
|
this.updateRelevants();
|
|
917
917
|
break;
|
|
918
|
+
case 'copy':
|
|
919
|
+
this.copy(data.html);
|
|
920
|
+
break;
|
|
918
921
|
}
|
|
919
922
|
this.changeDetector.markForCheck();
|
|
920
923
|
}
|
|
@@ -1324,33 +1327,32 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
|
|
|
1324
1327
|
}
|
|
1325
1328
|
/**
|
|
1326
1329
|
* Copy to clipboard
|
|
1330
|
+
* @param data : the data to copy. If null, request from iframe
|
|
1327
1331
|
*/
|
|
1328
|
-
async copy() {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
catch (err) {
|
|
1353
|
-
this.dialogService.toast("Errore copiando negli appunti: " + err);
|
|
1332
|
+
async copy(data = null) {
|
|
1333
|
+
if (!data) {
|
|
1334
|
+
let f = document.getElementById('clipper-document-iframe');
|
|
1335
|
+
f?.contentWindow.postMessage('{"type": "copy", "value":""}', '*');
|
|
1336
|
+
}
|
|
1337
|
+
else {
|
|
1338
|
+
const htmlBlob = new Blob([data], { type: 'text/html' });
|
|
1339
|
+
const textBlob = new Blob([data], { type: 'text/plain' });
|
|
1340
|
+
try {
|
|
1341
|
+
const data = [
|
|
1342
|
+
new ClipboardItem({
|
|
1343
|
+
'text/html': htmlBlob,
|
|
1344
|
+
'text/plain': textBlob
|
|
1345
|
+
})
|
|
1346
|
+
];
|
|
1347
|
+
setTimeout(async () => {
|
|
1348
|
+
window.focus();
|
|
1349
|
+
await navigator.clipboard.write(data);
|
|
1350
|
+
}, 0);
|
|
1351
|
+
this.dialogService.toast("Copiato negli appunti.");
|
|
1352
|
+
}
|
|
1353
|
+
catch (err) {
|
|
1354
|
+
this.dialogService.toast("Errore copiando negli appunti: " + err);
|
|
1355
|
+
}
|
|
1354
1356
|
}
|
|
1355
1357
|
}
|
|
1356
1358
|
/**
|