mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
fix: copy to clipboard failed in non-secure (HTTP) contexts (#32287)
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
'use client'
|
||||
import copy from 'copy-to-clipboard'
|
||||
import { t } from 'i18next'
|
||||
import * as React from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import CopyFeedback from '@/app/components/base/copy-feedback'
|
||||
import Tooltip from '@/app/components/base/tooltip'
|
||||
import { writeTextToClipboard } from '@/utils/clipboard'
|
||||
|
||||
type IInputCopyProps = {
|
||||
value?: string
|
||||
@ -39,8 +39,9 @@ const InputCopy = ({
|
||||
<div
|
||||
className="r-0 absolute left-0 top-0 w-full cursor-pointer truncate pl-2 pr-2"
|
||||
onClick={() => {
|
||||
copy(value)
|
||||
setIsCopied(true)
|
||||
writeTextToClipboard(value).then(() => {
|
||||
setIsCopied(true)
|
||||
})
|
||||
}}
|
||||
>
|
||||
<Tooltip
|
||||
|
||||
Reference in New Issue
Block a user