Skip to content

feat: padSelect helper + padToggle runtime-flag honor#10

Merged
JohnMcLear merged 1 commit into
mainfrom
feat/honor-runtime-flag
May 8, 2026
Merged

feat: padSelect helper + padToggle runtime-flag honor#10
JohnMcLear merged 1 commit into
mainfrom
feat/honor-runtime-flag

Conversation

@JohnMcLear

Copy link
Copy Markdown
Member

Summary

Two changes on this branch:

  1. feat(padToggle): honor runtime settings.enablePluginPadOptions flag (f3bd6fc) — padToggle's pad-wide block now respects the runtime settings.enablePluginPadOptions flag in addition to the compile-time padOptionsPluginPassthrough capability. Without this, admins who haven't opted in still saw the (non-functional) pad-wide checkbox.

  2. feat: padSelect helper (40c9716) — sibling to padToggle for non-boolean values chosen from a fixed list (e.g. indent size, theme, language). Same architecture: per-user cookie + pad-wide via the ep_* passthrough patch when available, with the same defensive degradation when the patch is missing. Per-option l10n via {value, label, l10nId?}. 10 unit tests covering config validation, rendering, settings.json overrides, and the clientVars block shape.

The next consumer is ep_syntax_highlighting, which now uses padSelect for its 2-vs-4-spaces indent-size picker — an exact use case padToggle couldn't cover.

Bumps version 0.3.1 → 0.4.0 (new helper export).

Test plan

  • npx mocha test/pad-select.js — 10 cases pass
  • npx mocha test/pad-toggle.js — existing tests still pass
  • Wired into ep_syntax_highlighting's indent picker; verified via Playwright probe that #options-indent-size renders in the user-settings panel with options [2, 4] and defaults to 2.

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

Sibling to padToggle but for non-boolean values chosen from a fixed list
(e.g. indent size, theme, language). Same architecture as padToggle:

- Server: padSelect({pluginName, settingId, l10nId, defaultLabel, options,
  defaultValue}). Validates config, renders <select> with one <option>
  per choice in mySettings + padSettings (latter gated on
  Etherpad >= 2.7.4 ep_* passthrough patch + admin opt-in via
  enablePluginPadOptions). Exposes loadSettings, clientVars,
  eejsBlock_mySettings, eejsBlock_padSettings.

- Client: padSelect({…}). init({onChange}) binds the dropdowns, reads
  cookie / pad option / default in priority order, fires onChange with
  the effective value (and again whenever user picks or another
  collaborator changes the pad-wide value via padoptions broadcast).
  Exposes init + handleClientMessage_CLIENT_MESSAGE.

- Per-option l10n via {value, label, l10nId?}.

Bumps ep_plugin_helpers 0.3.1 -> 0.4.0 (new helper export).

Tests: 10 cases covering config validation, rendering, settings.json
defaultValue override, clientVars block shape.
@JohnMcLear
JohnMcLear force-pushed the feat/honor-runtime-flag branch from 40c9716 to 8a6cb7d Compare May 8, 2026 09:07
@JohnMcLear
JohnMcLear merged commit 545c03b into main May 8, 2026
4 checks passed
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