@abi-software/map-utilities 1.0.1-beta.0 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-utilities",
3
- "version": "1.0.1-beta.0",
3
+ "version": "1.0.1-beta.2",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -33,12 +33,13 @@ export default {
33
33
  default: '',
34
34
  },
35
35
  /**
36
- * Theme 'primary' or 'dark' or any name not 'light'
37
- * will show primary button color.
36
+ * `theme: light` will show white button,
37
+ * to use when the button is over other readable text content.
38
+ * Default button is transparent.
38
39
  */
39
40
  theme: {
40
41
  type: String,
41
- default: 'light',
42
+ default: '',
42
43
  },
43
44
  },
44
45
  data: function () {
@@ -48,21 +49,29 @@ export default {
48
49
  iconColor: appPrimaryColor,
49
50
  };
50
51
  },
51
- mounted: function () {
52
- if (this.theme !== 'light') {
53
- this.iconColor = 'white';
54
- }
55
- },
56
52
  methods: {
57
53
  copyToClipboard: async function () {
58
54
  let copiedSuccessfully = true;
59
55
  this.autoHideTimeout = 600;
60
56
 
61
57
  try {
62
- await navigator.clipboard.writeText(this.content);
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]);
63
72
  } catch (err) {
64
73
  console.error(
65
- "Error when trying to use navigator.clipboard.writeText()",
74
+ "Error when trying to use navigator.clipboard.write()",
66
75
  err
67
76
  );
68
77
  copiedSuccessfully = false;
@@ -93,29 +102,23 @@ export default {
93
102
  &,
94
103
  &:focus,
95
104
  &:active {
96
- color: #fff !important;
97
- background: $app-primary-color;
98
- border-color: $app-primary-color !important;
99
- }
100
-
101
- &:hover {
102
- background: #ac76c5 !important;
103
- border-color: #ac76c5 !important;
105
+ color: $app-primary-color !important;
106
+ background: transparent;
107
+ border-color: transparent !important;
104
108
  }
105
109
 
106
110
  &.light {
107
111
  &,
108
112
  &:focus,
109
113
  &:active {
110
- color: $app-primary-color !important;
111
- background: transparent;
112
- border-color: transparent !important;
114
+ background: #fff;
115
+ border-color: #fff !important;
113
116
  }
117
+ }
114
118
 
115
- &:hover {
116
- background: #f3e6f9 !important;
117
- border-color: #f3e6f9 !important;
118
- }
119
+ &:hover {
120
+ background: #f3e6f9 !important;
121
+ border-color: #f3e6f9 !important;
119
122
  }
120
123
  }
121
124