v1.1.1 - Fix Copy buttons in model info popup
Bug Fixes / 錯誤修復
Fix: Copy / Copy All buttons in model info popup had no effect when clicked
修復:model info 視窗中的「📋 Copy」與「📋 Copy All」按鈕點擊後完全無反應
Root cause: navigator.clipboard.writeText() throws a synchronous TypeError when the Clipboard API is unavailable (e.g., HTTP without browser permission). The .catch() handler only intercepts rejected Promises, not synchronous errors — resulting in a completely silent failure with no feedback.
根本原因:在 HTTP 環境或瀏覽器未授予 clipboard 權限時,navigator.clipboard 為 undefined,呼叫 .writeText() 會同步拋出 TypeError。.catch() 只能攔截 rejected Promise,無法攔截同步錯誤,導致點擊後靜默失敗、無任何回饋。
Changes:
- Added
_copyTextToClipboard()helper: tries modernnavigator.clipboardAPI first, falls back todocument.execCommand('copy')for HTTP environments - Wrapped the call in
try-catchto handle synchronous errors from the Clipboard API - On failure, displays an alert with the text so users can copy manually
變更內容:
- 新增
_copyTextToClipboard()helper:優先使用navigator.clipboard,不可用時自動 fallback 到document.execCommand('copy')(適用 HTTP localhost 環境) - 用
try-catch包住整個呼叫,確保同步錯誤也能被攔截 - 失敗時顯示 alert 並附上文字,方便手動複製
Previous Releases / 歷史版本
- v1.1.0 - Multi-version Cards & civitai.red Full Support / 多版本卡片 + civitai.red 完整支援
- v1.0.2 - Fix installed detection for commission/restricted models / 修復受限模型安裝偵測
- v1.0.1 - Initial release / 初始版本