Skip to content

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

Merged
JohnMcLear merged 1 commit into
mainfrom
feat/migrate-to-pad-toggle
May 7, 2026
Merged

feat: migrate to ep_plugin_helpers padToggle for User + Pad Wide settings#386
JohnMcLear merged 1 commit into
mainfrom
feat/migrate-to-pad-toggle

Conversation

@JohnMcLear
Copy link
Copy Markdown
Member

Summary

  • Migrate the hand-rolled "Show Comments" User Settings checkbox to ep_plugin_helpers padToggle so the same toggle now appears in both the User Settings panel and the Pad Wide Settings panel — matching how native Etherpad toggles (sticky chat, line numbers, etc.) work.
  • Pad-wide value rides Etherpad's existing padoptions COLLABROOM rail (broadcast to every connected client, persisted, honored by enforceSettings).
  • The helper owns checkbox rendering, cookie persistence, broadcast sync, enforce, and i18n. The hand-rolled templates/settings.ejs, manual click wiring, and direct padcookie plumbing are gone.

Compatibility

Changes

  • index.js — register padToggle server hooks (loadSettings, eejsBlock_mySettings, eejsBlock_padSettings); merge helper's clientVars into existing clientVars so displayCommentAsIcon / highlightSelectedText and the helper's ep_plugin_helpers.padToggle.ep_comments_page block both ship to the client.
  • static/js/index.js — replace the padcookie.getPref('comments') + manual #options-comments change handler with commentsToggle.init({onChange: applyVisibility}). Re-export handleClientMessage_CLIENT_MESSAGE so the helper refreshes when another user toggles the pad-wide checkbox.
  • ep.json — register loadSettings, eejsBlock_padSettings, and client_hooks.handleClientMessage_CLIENT_MESSAGE.
  • package.json — add "ep_plugin_helpers": "^0.3.0" dep, bump 11.0.30 → 11.1.0.
  • templates/settings.ejs — deleted (only contained the migrated <input>+<label>).

Sub-path imports used per the helper's docs: server ep_plugin_helpers/pad-toggle-server, client ep_plugin_helpers/pad-toggle. Importing the top-level ep_plugin_helpers from client code drags settings/toggle (which reach eejs/Settings) into the esbuild bundle and breaks it.

Test plan

  • CI backend tests pass (l10n.js, padCopy.js, padRemove.js, readOnlyPad.js, relative_time.js).
  • CI frontend tests pass.
  • On a patched Etherpad core (>= 2.7.4): both checkboxes render, toggling User Settings persists per-user via cookie, toggling Pad Wide Settings broadcasts to all clients and is honored by enforceSettings.
  • On an un-patched core: only User Settings renders; cookie toggle behaves identically to before this PR.
  • Comments pane shows/hides via the resolved effective value on initial load.

🤖 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.

…ings

The hand-rolled User Settings checkbox only let each user toggle the
comments pane 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
templates/settings.ejs, manual click wiring, and direct padcookie
plumbing are all gone — the helper owns checkbox rendering, cookie
persistence, broadcast sync, enforce, and i18n.

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>
@JohnMcLear JohnMcLear force-pushed the feat/migrate-to-pad-toggle branch from cd89087 to 5a23e20 Compare May 7, 2026 19:03
@JohnMcLear JohnMcLear merged commit 76e60d6 into main May 7, 2026
2 checks passed
@JohnMcLear JohnMcLear deleted the feat/migrate-to-pad-toggle branch May 7, 2026 19:03
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