@abi-software/map-utilities 1.0.1-beta.1 → 1.0.1-beta.2
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.
package/package.json
CHANGED
|
@@ -55,10 +55,23 @@ export default {
|
|
|
55
55
|
this.autoHideTimeout = 600;
|
|
56
56
|
|
|
57
57
|
try {
|
|
58
|
-
|
|
58
|
+
const htmlContent = this.content.replaceAll('\n', '');
|
|
59
|
+
const tempElement = document.createElement('div');
|
|
60
|
+
tempElement.innerHTML = this.content;
|
|
61
|
+
const plainTextContent = tempElement.textContent || tempElement.innerText || '';
|
|
62
|
+
|
|
63
|
+
const htmlBlob = new Blob([htmlContent], { type: 'text/html' });
|
|
64
|
+
const textBlob = new Blob([plainTextContent], { type: 'text/plain' });
|
|
65
|
+
|
|
66
|
+
const clipboardItem = new ClipboardItem({
|
|
67
|
+
'text/html': htmlBlob,
|
|
68
|
+
'text/plain': textBlob
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
await navigator.clipboard.write([clipboardItem]);
|
|
59
72
|
} catch (err) {
|
|
60
73
|
console.error(
|
|
61
|
-
"Error when trying to use navigator.clipboard.
|
|
74
|
+
"Error when trying to use navigator.clipboard.write()",
|
|
62
75
|
err
|
|
63
76
|
);
|
|
64
77
|
copiedSuccessfully = false;
|