Skip to content

fix: resolve version modal not closing#741

Merged
lane711 merged 1 commit intomainfrom
fix/issue-666
Apr 4, 2026
Merged

fix: resolve version modal not closing#741
lane711 merged 1 commit intomainfrom
fix/issue-666

Conversation

@lane711
Copy link
Copy Markdown
Collaborator

@lane711 lane711 commented Apr 3, 2026

Summary

Fixes the version history modal not closing when clicking the Close or X buttons. The closeVersionHistory function (and other modal functions) were undefined because the HTML was loaded via innerHTML, which does not execute embedded <script> tags.

Changes

  • After inserting version history HTML into the modal container via innerHTML, manually re-create <script> elements so the browser executes them
  • This makes closeVersionHistory, restoreVersion, previewVersion, and toggleChanges functions available to their onclick handlers

Testing

  • Verified the fix addresses the root cause: innerHTML does not execute script tags per the HTML spec
  • The fix uses the standard pattern of replacing script elements with newly created ones to trigger execution
  • TypeScript source change only (template literal), no type-level changes

Fixes #666

…tory function

Script tags inserted via innerHTML are not executed by the browser. After
loading version history HTML into the modal container, we now manually
re-create script elements so the browser executes them, making
closeVersionHistory and other functions available to onclick handlers.

Fixes #666
@lane711 lane711 merged commit 3cb0c35 into main Apr 4, 2026
2 checks passed
lane711 added a commit that referenced this pull request Apr 4, 2026
…tory function (#741)

Script tags inserted via innerHTML are not executed by the browser. After
loading version history HTML into the modal container, we now manually
re-create script elements so the browser executes them, making
closeVersionHistory and other functions available to onclick handlers.

Fixes #666
lane711 added a commit that referenced this pull request Apr 5, 2026
* feat: add OAuth/social login providers plugin (Phase 1)

Implements the core OAuth2 authorization code flow as a SonicJS plugin,
enabling social login via GitHub and Google providers.

Changes:
- New oauth-providers plugin with PluginBuilder SDK pattern
- OAuth2 authorization code flow with CSRF state protection
- GitHub and Google as built-in providers (provider-agnostic design)
- Account linking: auto-links OAuth to existing email accounts
- New user creation from OAuth profile data
- oauth_accounts database migration (table + indexes)
- Registered in core plugins, bootstrap service, and app routes
- No new dependencies — uses native fetch for all OAuth HTTP calls
- Cloudflare Workers compatible

Routes added:
  GET  /auth/oauth/:provider          — Redirect to provider
  GET  /auth/oauth/:provider/callback — Handle callback
  POST /auth/oauth/link               — Link OAuth to account
  POST /auth/oauth/unlink             — Unlink OAuth provider
  GET  /auth/oauth/accounts           — List linked accounts

Fixes #737

* docs(www): sync changelog with v2.9.0, v2.10.0, v2.10.1 releases

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs(www): add plugin docs, update auth/field-types/API docs + fix OTP site name

New docs pages:
- QR Code Generator plugin
- Redirect Management plugin
- Forms as Collections

Updated docs:
- Authentication: RBAC enforcement details, rate limiting, CSRF
- Field Types: collapsible fields, objectLayout
- Core Plugins: added new plugins
- API Reference: auto-discovery mention

Bug fix:
- OTP plugin email preview now reads site name from General Settings
  (was using wrong DB query, always showed 'SonicJS')

🤖 Generated with [Claude Code](https://claude.com/claude-code)

* fix: resolve version modal not closing due to missing closeVersionHistory function (#741)

Script tags inserted via innerHTML are not executed by the browser. After
loading version history HTML into the modal container, we now manually
re-create script elements so the browser executes them, making
closeVersionHistory and other functions available to onclick handlers.

Fixes #666

* fix: pass logo URL to OTP email template and preview

The OTP plugin settings page has a Logo URL field but it was never
passed to the email template or the admin preview. Now:
- logoUrl is passed from plugin settings to the email template data
- Admin preview shows the logo above 'Your Login Code' header
- Added logoUrl to OTPSettings interface

🤖 Generated with [Claude Code](https://claude.com/claude-code)

* fix: use relative imports in OAuth plugin to fix build

Change the Plugin type import in oauth-providers/index.ts from
'@sonicjs-cms/core' (circular package import) to relative '../../types'.

Change index.ts to import OAuth exports directly from the oauth-providers
subdirectory instead of from core-plugins/index.ts, which was pulling in
all core plugins and their unresolvable @sonicjs-cms/core imports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Version Modal Does Not close

1 participant