mirror of
https://github.com/ether/etherpad-lite.git
synced 2026-05-05 04:06:37 +02:00
Add showAuthorColors pad option to default authorship colors off
Adds a new padOptions.showAuthorColors setting (default: true) that lets admins default authorship colors to off for new users. Users can still toggle colors on via the checkbox — their cookie preference always overrides the server default. - Settings.ts: add showAuthorColors to padOptions type and defaults - pad.ts: process showAuthorColors from padOptions, apply as default, ensure cookie preference (true or false) overrides server setting - settings.json.template + settings.json.docker: document the option - SocketIOMessage.ts: add to PadOption type Fixes #5563 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
55f1124ba7
commit
fda2ece848
@ -273,6 +273,7 @@
|
||||
*/
|
||||
"padOptions": {
|
||||
"noColors": "${PAD_OPTIONS_NO_COLORS:false}",
|
||||
"showAuthorColors": "${PAD_OPTIONS_SHOW_AUTHOR_COLORS:true}",
|
||||
"showControls": "${PAD_OPTIONS_SHOW_CONTROLS:true}",
|
||||
"showChat": "${PAD_OPTIONS_SHOW_CHAT:true}",
|
||||
"showLineNumbers": "${PAD_OPTIONS_SHOW_LINE_NUMBERS:true}",
|
||||
|
||||
@ -252,6 +252,7 @@
|
||||
*/
|
||||
"padOptions": {
|
||||
"noColors": false,
|
||||
"showAuthorColors": true,
|
||||
"showControls": true,
|
||||
"showChat": true,
|
||||
"showLineNumbers": true,
|
||||
|
||||
@ -192,6 +192,7 @@ export type SettingsType = {
|
||||
defaultPadText: string,
|
||||
padOptions: {
|
||||
noColors: boolean,
|
||||
showAuthorColors: boolean,
|
||||
showControls: boolean,
|
||||
showChat: boolean,
|
||||
showLineNumbers: boolean,
|
||||
@ -398,6 +399,7 @@ const settings: SettingsType = {
|
||||
*/
|
||||
padOptions: {
|
||||
noColors: false,
|
||||
showAuthorColors: true,
|
||||
showControls: true,
|
||||
showChat: true,
|
||||
showLineNumbers: true,
|
||||
|
||||
@ -69,6 +69,13 @@ const getParameters = [
|
||||
$('#clearAuthorship').hide();
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'showAuthorColors',
|
||||
checkVal: 'false',
|
||||
callback: (val) => {
|
||||
settings.showAuthorColorsDisabled = true;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'showControls',
|
||||
checkVal: 'true',
|
||||
@ -461,7 +468,10 @@ const pad = {
|
||||
chat.chatAndUsers(true); // stick it to the screen
|
||||
$('#options-chatandusers').prop('checked', true); // set the checkbox to on
|
||||
}
|
||||
if (padcookie.getPref('showAuthorshipColors') === false) {
|
||||
const authorColorsPref = padcookie.getPref('showAuthorshipColors');
|
||||
if (authorColorsPref === true) {
|
||||
pad.changeViewOption('showAuthorColors', true);
|
||||
} else if (authorColorsPref === false) {
|
||||
pad.changeViewOption('showAuthorColors', false);
|
||||
}
|
||||
if (padcookie.getPref('showLineNumbers') === false) {
|
||||
@ -555,6 +565,13 @@ const pad = {
|
||||
this.changeViewOption('noColors', true);
|
||||
}
|
||||
|
||||
// If showAuthorColors is set to false in padOptions, default colors off.
|
||||
// The user can still toggle them on via the checkbox; the cookie will
|
||||
// override this default on subsequent visits.
|
||||
if (settings.showAuthorColorsDisabled === true) {
|
||||
this.changeViewOption('showAuthorColors', false);
|
||||
}
|
||||
|
||||
// RTL override is applied in postAceInit (after padeditor.init resolves)
|
||||
// to avoid a race where setViewOptions(initialViewOptions) overwrites it.
|
||||
|
||||
@ -783,6 +800,7 @@ const init = () => pad.init();
|
||||
const settings = {
|
||||
LineNumbersDisabled: false,
|
||||
noColors: false,
|
||||
showAuthorColorsDisabled: false,
|
||||
useMonospaceFontGlobal: false,
|
||||
globalUserName: false,
|
||||
globalUserColor: false,
|
||||
|
||||
@ -239,6 +239,7 @@ export type PadOptionsMessage = {
|
||||
|
||||
export type PadOption = {
|
||||
"noColors"?: boolean,
|
||||
"showAuthorColors"?: boolean,
|
||||
"showControls"?: boolean,
|
||||
"showChat"?: boolean,
|
||||
"showLineNumbers"?: boolean,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user