Skip to content

helpers: adopt padToggle for Spell Check setting#124

Merged
JohnMcLear merged 1 commit into
masterfrom
helpers/padToggle
May 10, 2026
Merged

helpers: adopt padToggle for Spell Check setting#124
JohnMcLear merged 1 commit into
masterfrom
helpers/padToggle

Conversation

@JohnMcLear
Copy link
Copy Markdown
Member

Summary

  • Replace manual eejsBlock_mySettings + cookie wiring with padToggle from ep_plugin_helpers. Gives parallel User Settings / Pad Wide Settings checkboxes for free and centralizes markup, storage, broadcast, enforce, and i18n.
  • Delete the eejsBlock_dd_view "Spell Check" entry. It rendered hardcoded English text inside <a href='#' onclick=…>, which was an i18n hole, an a11y hole (anchor-as-button), CSP-hostile, and bypassed the helper's state machine. The User Settings panel is the canonical home and now offers both per-user and pad-wide control.
  • Slim static/js/spellcheck.js to use padToggle.init({onChange}) instead of hand-rolled cookie restore + click binding.
  • Translate legacy ep_spellcheck.disabledByDefault: true to the helper's defaultEnabled in loadSettings so existing installs keep their current behavior.

Test plan

  • pnpm run lint
  • Server-side smoke test (Node): module loads, exports the four hooks, eejsBlock_mySettings produces valid <input>/<label> markup with data-l10n-id, legacy disabledByDefault translates to defaultEnabled.
  • CI green (backend + frontend tests)
  • Toggle off in User Settings disables spellcheck on #innerdocbody; re-enabling re-enables it.
  • On a core that supports pad-wide passthrough (Etherpad ≥ 2.7.4 + enablePluginPadOptions: true), toggling Pad Wide Settings broadcasts to other users.

🤖 Generated with Claude Code

Replaces the manual settings-panel checkbox + cookie wiring with
padToggle from ep_plugin_helpers, which gives parallel User Settings /
Pad Wide Settings checkboxes for free and owns markup, storage,
broadcast, enforce, and i18n.

Also drops the eejsBlock_dd_view "Spell Check" entry. That entry
rendered hardcoded English text inside `<a href='#' onclick=…>`,
which was an i18n hole, an a11y hole (anchor-as-button), and CSP-
hostile, and it bypassed the helper's state machine. The User
Settings panel is the canonical home for the toggle and now offers
both per-user and pad-wide control.

Backward compat: existing installs that set
`ep_spellcheck.disabledByDefault: true` keep their behavior — the
plugin's loadSettings translates the legacy key into the helper's
`defaultEnabled` before delegating.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@qodo-code-review
Copy link
Copy Markdown

ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

@JohnMcLear JohnMcLear merged commit 2489d14 into master May 10, 2026
5 checks passed
@JohnMcLear JohnMcLear deleted the helpers/padToggle branch May 10, 2026 19:49
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.

1 participant