Skip to content

fix(client): fix editor clipboard copy in non-secure HTTP contexts - #2362

Open
iamraydoan wants to merge 1 commit into
OtterMind:mainfrom
iamraydoan:fix/editor-clipboard-http-context
Open

fix(client): fix editor clipboard copy in non-secure HTTP contexts#2362
iamraydoan wants to merge 1 commit into
OtterMind:mainfrom
iamraydoan:fix/editor-clipboard-http-context

Conversation

@iamraydoan

Copy link
Copy Markdown
Contributor

Related issue

Closes #2361

Summary

  • Fixed SQL Editor Copy and Cut operations failing when Chat2DB Web is deployed over non-HTTPS (HTTP) environments.
  • Replaced direct navigator.clipboard.writeText calls in SQLEditorWithOperation/index.tsx with the copyToClipboard utility helper from @/utils/copy.
  • The copyToClipboard helper automatically falls back to standard DOM <textarea> selection + document.execCommand('copy') when navigator.clipboard is restricted or throws an error in non-secure contexts.

Affected surfaces

  • Frontend / Web
  • Backend / API / Storage
  • Database plugin / Driver
  • JCEF / Desktop packaging
  • CI / Build / Release
  • Documentation only

Verification

  • Commands and results:
    • yarn run lint: PASSED (0 errors, 0 warnings)
    • yarn run test:sql-in-clipboard: PASSED
    • yarn run build:web:community --app_version=0.0.0: PASSED (Compiled successfully in 38.00s)
  • Manual verification: Verified copy/cut operations use the fallback mechanism correctly in non-secure HTTP browser contexts.
  • UI evidence: N/A

Risk and compatibility

  • Public API or stored data: N/A
  • Database or driver compatibility: N/A
  • Network, privacy, or security: N/A
  • Community / Local / Pro boundary: N/A
  • Backward compatibility: N/A

Reviewer map

  • Start here: chat2db-community-client/src/components/SQLEditor/editor/SQLEditorWithOperation/index.tsx
  • Failure condition: N/A
  • Rollback or disable path: Revert changes in SQLEditorWithOperation/index.tsx

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

AI assistance: Code refactoring and build verification assisted by Antigravity AI pair programmer.

@iamraydoan
iamraydoan force-pushed the fix/editor-clipboard-http-context branch from c78da6f to 48bcebc Compare July 30, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

[Bug] Editor copy and cut operations fail when hosted over non-HTTPS (HTTP) environments

2 participants