diff --git a/README.md b/README.md index ee38acc..f8081a0 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ relay.get('option') // specific key ### Toggle -Checkbox in the settings panel with cookie persistence. +Checkbox in the User Settings panel with cookie persistence (per-user, per-pad). ```js const {toggle} = require('ep_plugin_helpers'); @@ -180,6 +180,64 @@ const state = myToggle.init(); // reads cookie, binds checkbox // state.enabled tracks current value ``` +### PadToggle + +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 (>= 2.7.4). On older cores the pad-wide column is hidden automatically and the user-side cookie toggle keeps working — plugins built on this helper run everywhere. + +```js +const {padToggle} = require('ep_plugin_helpers'); + +const t = padToggle({ + pluginName: 'ep_myplugin', // must match /^ep_[a-z0-9_]+$/ + settingId: 'my-feature', // → ids: options-my-feature, padsettings-options-my-feature + l10nId: 'ep_myplugin.myFeature', // i18n key, html10n overwrites the fallback + defaultLabel: 'My feature', // a11y fallback — rendered inside