1.排程管理新增检核规则提示词维护,用于传入Dify中作为检核规则
2.聊天界面内容不可复制问题修复
This commit is contained in:
1 parent
452f6ebc6d
commit
ff2d02051f
17 files changed
+355
-20
No files matched your search
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copy plain text to the clipboard with fallbacks for restricted browsers
|
||||
* (e.g. WeCom embedded WebView, HTTP deployments).
|
||||
*/
|
||||
export async function copyTextToClipboard(text: string): Promise<boolean> {
|
||||
const value = String(text ?? '');
|
||||
if (!value.trim()) return false;
|
||||
|
||||
if (navigator.clipboard?.writeText) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(value);
|
||||
return true;
|
||||
} catch {
|
||||
// Fall through to legacy copy.
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.value = value;
|
||||
textarea.setAttribute('readonly', 'true');
|
||||
textarea.style.position = 'fixed';
|
||||
textarea.style.left = '-9999px';
|
||||
textarea.style.top = '0';
|
||||
textarea.style.opacity = '0';
|
||||
document.body.appendChild(textarea);
|
||||
textarea.focus();
|
||||
textarea.select();
|
||||
textarea.setSelectionRange(0, value.length);
|
||||
const ok = document.execCommand('copy');
|
||||
document.body.removeChild(textarea);
|
||||
return ok;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user