Skip to content

v1.1.1 - Fix Copy buttons in model info popup

Choose a tag to compare

@acer1204 acer1204 released this 30 Apr 05:35
· 7 commits to main since this release

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.clipboardundefined,呼叫 .writeText() 會同步拋出 TypeError.catch() 只能攔截 rejected Promise,無法攔截同步錯誤,導致點擊後靜默失敗、無任何回饋。

Changes:

  • Added _copyTextToClipboard() helper: tries modern navigator.clipboard API first, falls back to document.execCommand('copy') for HTTP environments
  • Wrapped the call in try-catch to 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 / 初始版本