Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,13 @@ const state = myToggle.init(); // reads cookie, binds checkbox

Parallel checkboxes in **both** the User Settings panel and the Pad Wide Settings panel — matching how native settings (sticky chat, line numbers, etc.) work. The pad-wide value rides Etherpad's existing `padoptions` broadcast/persist rail, so changes propagate to every connected client and are remembered across reloads. The pad creator can `enforceSettings` to lock the user-side checkbox for everyone.

Requires Etherpad with the `ep_*` padOptions passthrough patch ([PR #7698](https://github.com/ether/etherpad/pull/7698), shipped in `>= 3.0.0`) AND the runtime flag `settings.enablePluginPadOptions` not set to `false` (default `true` on current cores; earlier 3.x releases shipped it default `false` so operators on those versions need to flip it explicitly). When pad-wide is unavailable the column is hidden automatically and the user-side cookie toggle keeps working — plugins built on this helper run everywhere. The console warning logged on degradation names the specific cause so an admin can tell whether to upgrade the core or to flip the runtime flag.
Requires Etherpad with the `ep_*` padOptions passthrough patch ([PR #7698](https://github.com/ether/etherpad/pull/7698), shipped in `>= 3.0.0`) AND `settings.enablePluginPadOptions === true`. Current cores default the flag to `true` (see ether/etherpad#7841); earlier 3.x releases shipped it default `false` so operators on those versions need the explicit opt-in below. When pad-wide is unavailable the column is hidden automatically and the user-side cookie toggle keeps working — plugins built on this helper run everywhere. The console warning logged on degradation names the specific cause so an admin can tell whether to upgrade the core or to flip the runtime flag.

```json
// settings.json — only needed on older 3.x cores that shipped this opt-in,
// or to explicitly disable the passthrough on current cores.
// settings.json — explicit opt-in for older 3.x cores that shipped this
// flag default-false. Omit on current cores (it's already the default).
// To explicitly disable the passthrough on a current core, set it to
// `false` here instead.
{
"enablePluginPadOptions": true
}
Expand Down
7 changes: 4 additions & 3 deletions pad-select-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ const padSelectServer = (rawConfig) => {
padWideSupported: isPadWideActive(),
// Granular flags so the client's degradation warning can
// name the specific cause — missing patch (Etherpad <
// 3.0.0) vs. explicit operator opt-out
// (settings.enablePluginPadOptions = false). See
// pad-toggle-server.js for the same rationale.
// 3.0.0) vs. runtime flag not enabled
// (settings.enablePluginPadOptions !== true; either absent
// on older 3.x cores or explicitly false on current ones).
// See pad-toggle-server.js for the same rationale.
patchPresent: padOptionsPluginPassthrough,
runtimeEnabled: runtimeFlagEnabled,
options,
Expand Down
8 changes: 4 additions & 4 deletions pad-toggle-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ const padToggleServer = (rawConfig) => {
const {pluginName, settingId, l10nId, defaultLabel, defaultEnabled} = validateConfig(rawConfig);
let cachedDefaultEnabled = defaultEnabled;
// Etherpad >= 3.0.0 introduced settings.enablePluginPadOptions as a runtime
// gate on the ep_* passthrough (default true since the flag-flip; older 3.x
// gate on the ep_* passthrough (default true on current cores; older 3.x
// releases shipped with it default false). We grab it from loadSettings so
// eejsBlock_padSettings + clientVars correctly no-op when an admin has
// opted out, even though PluginCapabilities reports the patch is present
// in the core.
// eejsBlock_padSettings + clientVars correctly no-op when the flag isn't
// enabled (absent on pre-flip cores, or explicitly false), even though
// PluginCapabilities reports the patch is present in the core.
let runtimeFlagEnabled = false;

const isPadWideActive = () => padOptionsPluginPassthrough && runtimeFlagEnabled;
Expand Down