4.8.10 test (#2539)

* fix: i18n

* fix: null value

* fix: workflow refresh variables

* perf: copy data

* doc

* perf: run app code

* perf: variable store

* update doc

* perf: pay ui

* fix: log header ui

* fix: log header ui
This commit is contained in:
Archer
2024-08-27 19:48:42 +08:00
committed by GitHub
parent 454a479fd8
commit c9bb39d802
20 changed files with 87 additions and 118 deletions

View File

@@ -2,6 +2,7 @@ import { useTranslation } from 'next-i18next';
import { useToast } from '@fastgpt/web/hooks/useToast';
import { useCallback } from 'react';
import { hasHttps } from '@fastgpt/web/common/system/utils';
import { isProduction } from '@fastgpt/service/common/system/constants';
/**
* copy text data
@@ -17,20 +18,31 @@ export const useCopyData = () => {
duration = 1000
) => {
try {
if (hasHttps() && navigator.clipboard) {
if (hasHttps() && !isProduction && navigator.clipboard) {
await navigator.clipboard.writeText(data);
} else {
throw new Error('');
}
} catch (error) {
console.log(error);
// console.log(error);
const textarea = document.createElement('textarea');
textarea.value = data;
textarea.style.position = 'absolute';
textarea.style.opacity = '0';
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body?.removeChild(textarea);
const res = document.execCommand('copy');
document.body.removeChild(textarea);
if (!res) {
return toast({
title: t('common:common.Copy_failed'),
status: 'error',
duration
});
}
}
if (title) {