hl-core 0.0.9-beta.19 → 0.0.9-beta.20

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.
@@ -9,7 +9,7 @@
9
9
  <v-text-field v-model="$dataStore.user.fullName" :readonly="true" hide-details variant="plain" :label="$dataStore.user.roles?.join(', ')" />
10
10
  <i class="mdi mdi-account-outline text-2xl text-[#A0B3D8]"></i
11
11
  ></base-panel-item>
12
- <base-panel-item v-if="$dataStore.isEFO && !isProduction && $dataStore.accessToken" @click="changeBridge('lka', $dataStore.accessToken)" class="cursor-pointer">
12
+ <base-panel-item v-if="$dataStore.isEFO && $dataStore.accessToken" @click="changeBridge('lka', $dataStore.accessToken)" class="cursor-pointer">
13
13
  {{ $dataStore.t('labels.lkaLong') }}
14
14
  <i class="mdi mdi-chevron-right text-2xl text-[#A0B3D8]"></i
15
15
  ></base-panel-item>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.9-beta.19",
3
+ "version": "0.0.9-beta.20",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -74,14 +74,31 @@ export const useDataStore = defineStore('data', {
74
74
  childFrame.contentWindow.postMessage({ action: action, value: value }, '*');
75
75
  }
76
76
  },
77
- copyToClipboard(text: unknown) {
77
+ async copyToClipboard(text: unknown) {
78
78
  if (typeof text === 'string' || typeof text === 'number') {
79
- if (this.isBridge) {
80
- navigator.clipboard.writeText(String(text));
79
+ if (navigator.clipboard && window.isSecureContext) {
80
+ if (this.isBridge) {
81
+ await navigator.clipboard.writeText(String(text));
82
+ this.showToaster('success', this.t('toaster.copied'));
83
+ } else {
84
+ this.sendToParent(constants.postActions.clipboard, String(text));
85
+ }
81
86
  } else {
82
- this.sendToParent(constants.postActions.clipboard, String(text));
87
+ const textarea = document.createElement('textarea');
88
+ textarea.value = String(text);
89
+ textarea.style.position = 'absolute';
90
+ textarea.style.left = '-99999999px';
91
+ document.body.prepend(textarea);
92
+ textarea.select();
93
+ try {
94
+ document.execCommand('copy');
95
+ this.showToaster('success', this.t('toaster.copied'));
96
+ } catch (err) {
97
+ console.log(err);
98
+ } finally {
99
+ textarea.remove();
100
+ }
83
101
  }
84
- this.showToaster('success', this.t('toaster.copied'));
85
102
  } else {
86
103
  this.showToaster('error', this.t('toaster.noUrl'));
87
104
  }