chatluna-plugin-onebot-sandbox 1.2.7 → 1.2.8

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.
@@ -12,6 +12,7 @@ import {
12
12
  Badge,
13
13
  Button,
14
14
  Checkbox,
15
+ copyText,
15
16
  Dialog,
16
17
  DialogContent,
17
18
  DialogDescription,
@@ -111,12 +112,8 @@ export function TestCredentialManager() {
111
112
  }
112
113
 
113
114
  const copy = async (token: string) => {
114
- try {
115
- await navigator.clipboard.writeText(token)
116
- toast.success(t('sandbox.credential.copied'))
117
- } catch {
118
- toast.error(t('sandbox.credential.copyFailed'))
119
- }
115
+ if (await copyText(token)) toast.success(t('sandbox.credential.copied'))
116
+ else toast.error(t('sandbox.credential.copyFailed'))
120
117
  }
121
118
 
122
119
  // 退场动画期间沿用最后一份内容,标题、Token 区与输入框不在淡出时变成空态。
@@ -23,6 +23,7 @@ import {
23
23
  Badge,
24
24
  Button,
25
25
  cn,
26
+ copyText,
26
27
  Popover,
27
28
  PopoverContent,
28
29
  PopoverTrigger,
@@ -343,12 +344,8 @@ export function JsonBlock({ value }: { value: unknown }) {
343
344
  return () => clearTimeout(timer)
344
345
  }, [copied])
345
346
  const copy = async () => {
346
- try {
347
- await navigator.clipboard.writeText(text)
348
- setCopied(true)
349
- } catch {
350
- toast.error(t('sandbox.records.copyFailed'))
351
- }
347
+ if (await copyText(text)) setCopied(true)
348
+ else toast.error(t('sandbox.records.copyFailed'))
352
349
  }
353
350
  return (
354
351
  <div className="sandbox-record-code">
@@ -3,6 +3,7 @@ import { createPortal } from 'react-dom'
3
3
  import { CheckIcon, CopyIcon, XIcon } from 'lucide-react'
4
4
  import {
5
5
  Button,
6
+ copyText,
6
7
  Dialog,
7
8
  DialogContent,
8
9
  DialogDescription,
@@ -293,12 +294,8 @@ function CopyIdButton({ value }: { value: string }) {
293
294
  return () => clearTimeout(timer)
294
295
  }, [copied])
295
296
  const copy = async () => {
296
- try {
297
- await navigator.clipboard.writeText(value)
298
- setCopied(true)
299
- } catch {
300
- toast.error(t('sandbox.records.copyFailed'))
301
- }
297
+ if (await copyText(value)) setCopied(true)
298
+ else toast.error(t('sandbox.records.copyFailed'))
302
299
  }
303
300
  return (
304
301
  <Button variant="ghost" size="icon-xs" aria-label={t(copied ? 'sandbox.profile.copied' : 'sandbox.profile.copyId')} onClick={() => void copy()}>
@@ -1,15 +1,15 @@
1
1
  {
2
- "_i18n-BeNV36zL.js": {
3
- "file": "i18n-BeNV36zL.js",
2
+ "_i18n-ConiNer6.js": {
3
+ "file": "i18n-ConiNer6.js",
4
4
  "name": "i18n"
5
5
  },
6
6
  "client/app.tsx": {
7
- "file": "app-Cr5eX7UP.js",
7
+ "file": "app-CNldCALP.js",
8
8
  "name": "app",
9
9
  "src": "client/app.tsx",
10
10
  "isDynamicEntry": true,
11
11
  "imports": [
12
- "_i18n-BeNV36zL.js"
12
+ "_i18n-ConiNer6.js"
13
13
  ]
14
14
  },
15
15
  "client/index.ts": {
@@ -18,7 +18,7 @@
18
18
  "src": "client/index.ts",
19
19
  "isEntry": true,
20
20
  "imports": [
21
- "_i18n-BeNV36zL.js"
21
+ "_i18n-ConiNer6.js"
22
22
  ],
23
23
  "dynamicImports": [
24
24
  "client/app.tsx"