Add a way to hide the prose-mirror menu from chat sidebar (closes #38)
This commit is contained in:
parent
3edb67b2de
commit
594c5d03d0
5 changed files with 61 additions and 0 deletions
44
module/tweaks/hideProseMirrorChatMenu.mjs
Normal file
44
module/tweaks/hideProseMirrorChatMenu.mjs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
||||
import { __ID__ } from "../consts.mjs";
|
||||
import { Logger } from "../utils/Logger.mjs";
|
||||
import { preventTweakRegistration } from "../utils/preRegisterTweak.mjs";
|
||||
|
||||
export const key = `hideProseMirrorChatMenu`;
|
||||
|
||||
export function hideProseMirrorChatMenu() {
|
||||
status[key] = SettingStatusEnum.Unknown;
|
||||
|
||||
if (game.release.generation < 14) {
|
||||
status[key] = SettingStatusEnum.Incompatible
|
||||
return;
|
||||
};
|
||||
|
||||
if (preventTweakRegistration(key)) { return };
|
||||
|
||||
// #region Registration
|
||||
Logger.log(`Registering setting: ${key}`);
|
||||
game.settings.register(__ID__, key, {
|
||||
name: `OFT.setting.${key}.name`,
|
||||
hint: `OFT.setting.${key}.hint`,
|
||||
scope: `user`,
|
||||
type: Boolean,
|
||||
default: true,
|
||||
config: true,
|
||||
requiresReload: false,
|
||||
onChange: (newValue) => {
|
||||
Logger.debug(`setting:${key} | Setting to ${newValue}`);
|
||||
document.body.classList.toggle(`${__ID__}-${key}`, newValue);
|
||||
},
|
||||
});
|
||||
// #endregion Registration
|
||||
|
||||
// #region Implementation
|
||||
if (game.settings.get(__ID__, key)) {
|
||||
Logger.log(`setting:${key} | Hiding chat prose-mirror menu`);
|
||||
document.body.classList.add(`${__ID__}-${key}`);
|
||||
};
|
||||
// #endregion Implementation
|
||||
|
||||
status[key] = SettingStatusEnum.Registered;
|
||||
};
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue