task-247(admin.html观感对齐): 行内工具组件化(状态药丸/复制文本/掩码揭示复用 secret-mask)

This commit is contained in:
2026-09-05 20:59:54 +08:00
parent 8b0bf3d563
commit f7ad99deda
6 changed files with 256 additions and 0 deletions
@@ -0,0 +1,13 @@
/**
* 复制文本反馈模型(module 13 task 247):非空给出「已复制 X」,失败/空值给降级文案。
*/
export const COPY_FEEDBACK_FALLBACK = '复制失败,请手动选择'
export function copyFeedback(text: string): string {
const t = typeof text === 'string' ? text.trim() : ''
return t ? `已复制 ${t}` : COPY_FEEDBACK_FALLBACK
}
export function isCopySupported(): boolean {
return typeof navigator !== 'undefined' && typeof navigator.clipboard?.writeText === 'function'
}