Skip to content

feat: migrate to ep_plugin_helpers padToggle for User + Pad Wide settings#191

Merged
JohnMcLear merged 4 commits intomasterfrom
feat/migrate-to-pad-toggle
May 7, 2026
Merged

feat: migrate to ep_plugin_helpers padToggle for User + Pad Wide settings#191
JohnMcLear merged 4 commits intomasterfrom
feat/migrate-to-pad-toggle

Conversation

@JohnMcLear
Copy link
Copy Markdown
Member

Summary

  • Switch from the hand-rolled eejsBlock_mySettings checkbox to padToggle from ep_plugin_helpers ^0.3.0.
  • Renders two checkboxes — User Settings (per-user, cookie) and Pad Wide Settings (per-pad, broadcast, honored by enforceSettings) — instead of just the user-side one. Matches every native Etherpad toggle.
  • Helper owns checkbox rendering, cookie persistence, broadcast sync, enforce semantics, i18n via data-l10n-id, and screen-reader fallback inside <label>.
  • Hand-rolled templates/toc_entry.ejs deleted; ?toc= URL override still works as a hard override on top.
  • Bump to 0.4.0 for the helper-and-core-patch peer requirement.

Dependencies

Test plan

  • Existing TOC numbering tests still pass (6/6).
  • Live two-checkbox render verified on patched Etherpad: options-toc + padsettings-options-toc, both with data-l10n-id=ep_table_of_contents.toc and screen-reader fallback "Show Table of Contents" inside .
  • Two-browser broadcast + enforce verified in Playwright once core patch + helper publish.

🤖 Generated with Claude Code

@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
Copy link
Copy Markdown
Member Author

CI status note

backend / with Plugins and frontend / test-frontend are failing with Error: Version '^0.3.0 not found — pnpm can't resolve ep_plugin_helpers@^0.3.0 because that version isn't on the npm registry yet (the helper PR ether/ep_plugin_helpers#8 must merge and publish first).

This is the dependency I called out in the PR description: this PR can't go green until the helper publishes 0.3.0. Nothing to fix on this branch; will re-run CI once the helper is on npm.

🤖 Generated with Claude Code

JohnMcLear and others added 4 commits May 7, 2026 16:55
…ings

The hand-rolled User Settings checkbox only let each user toggle the TOC
for themselves — there was no way for the pad creator to set a pad-wide
default and there was no entry in the Pad Wide Settings panel, so this
plugin lived in only half of Etherpad's native settings model.

Switch to padToggle: same single checkbox in User Settings, plus a
parallel checkbox in Pad Wide Settings that broadcasts to every connected
client and is honored by enforceSettings. The hand-rolled toc_entry.ejs
template, manual click wiring, and stale settings.ep_toc.disable_by_default
plumbing are all gone — the helper owns checkbox rendering, cookie
persistence, broadcast sync, enforce, and i18n. The ?toc= URL override
keeps working as a hard override on top.

ep_plugin_helpers ^0.3.0 introduces padToggle. Pad-wide column degrades
to a no-op on Etherpad cores without the ep_* padOptions passthrough
patch (< 2.7.4); user-side toggle is unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Importing the top-level `ep_plugin_helpers` from client code (postAceInit.js)
made esbuild crawl every getter in index.js and try to bundle settings-toggle
+ eejs for the browser, which fails because those are server-only. The
helper now ships separate sub-paths and we use them explicitly:

  // server (this file)
  const {padToggle} = require('ep_plugin_helpers/pad-toggle-server');
  // client (postAceInit)
  const {padToggle} = require('ep_plugin_helpers/pad-toggle');

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ep_plugin_helpers padToggle now requires defaultLabel so the rendered
<label> contains text screen readers can announce before html10n loads
or if the translation fetch fails. Bump to 0.4.0 to signal the
ep_plugin_helpers ^0.3.0 peer requirement and the padToggle migration.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JohnMcLear JohnMcLear force-pushed the feat/migrate-to-pad-toggle branch from cb7241d to 81deb39 Compare May 7, 2026 15:55
@JohnMcLear JohnMcLear merged commit 800e3e7 into master May 7, 2026
5 checks passed
@JohnMcLear JohnMcLear deleted the feat/migrate-to-pad-toggle branch May 7, 2026 16:11
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