From 594c5d03d0758e18737047dbb7303923f00e8010 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 4 Apr 2026 13:58:33 -0600 Subject: [PATCH] Add a way to hide the prose-mirror menu from chat sidebar (closes #38) --- langs/en-ca.json | 4 +++ module/hooks/setup.mjs | 3 ++ module/tweaks/hideProseMirrorChatMenu.mjs | 44 +++++++++++++++++++++++ styles/hideProseMirrorChatMenu.css | 9 +++++ styles/main.css | 1 + 5 files changed, 61 insertions(+) create mode 100644 module/tweaks/hideProseMirrorChatMenu.mjs create mode 100644 styles/hideProseMirrorChatMenu.css diff --git a/langs/en-ca.json b/langs/en-ca.json index ec50645..59521bf 100644 --- a/langs/en-ca.json +++ b/langs/en-ca.json @@ -25,6 +25,10 @@ "name": "Default Hotbar Page", "hint": "(v13+) What page the hotbar will default to when loading into Foundry." }, + "hideProseMirrorChatMenu": { + "name": "Hide Chat Text Menu", + "hint": "(v14+) Hides the rich-text menu controls in the chat sidebar. This does not disable any keybinds used to style your chat message, it just hides the menu." + }, "hotbarButtonGap": { "name": "Hotbar Button Gap", "hint": "(v13+) Allows changing the amount of space between the hotbar buttons." diff --git a/module/hooks/setup.mjs b/module/hooks/setup.mjs index 12647b7..08ec5a7 100644 --- a/module/hooks/setup.mjs +++ b/module/hooks/setup.mjs @@ -6,6 +6,7 @@ import { chatImageLinks } from "../tweaks/chatImageLinks.mjs"; import { chatSidebarBackground } from "../tweaks/chatSidebarBackground.mjs"; import { customStatusIcons } from "../tweaks/customStatusIcons.mjs"; import { defaultHotbarPage } from "../tweaks/defaultHotbarPage.mjs"; +import { hideProseMirrorChatMenu } from "../tweaks/hideProseMirrorChatMenu.mjs"; import { hotbarButtonGap } from "../tweaks/hotbarButtonGap.mjs"; import { hotbarButtonSize } from "../tweaks/hotbarButtonSize.mjs"; import { preventTokenRotation } from "../tweaks/preventTokenRotation.mjs"; @@ -52,8 +53,10 @@ Hooks.on(`setup`, () => { customStatusIcons(); rearrangeSidebarTabs(); + chatImageLinks(); chatSidebarBackground(); + hideProseMirrorChatMenu(); startSidebarExpanded(); startingSidebarTab(); preventTokenRotation(); diff --git a/module/tweaks/hideProseMirrorChatMenu.mjs b/module/tweaks/hideProseMirrorChatMenu.mjs new file mode 100644 index 0000000..74460a7 --- /dev/null +++ b/module/tweaks/hideProseMirrorChatMenu.mjs @@ -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; +}; + diff --git a/styles/hideProseMirrorChatMenu.css b/styles/hideProseMirrorChatMenu.css new file mode 100644 index 0000000..7f45aa9 --- /dev/null +++ b/styles/hideProseMirrorChatMenu.css @@ -0,0 +1,9 @@ +.oft-hideProseMirrorChatMenu #chat { + .chat-input { + flex-basis: var(--chat-input-height); /* -42px */ + } + + prose-mirror .menu-container { + display: none; + } +} diff --git a/styles/main.css b/styles/main.css index bcb2caf..8b39a72 100644 --- a/styles/main.css +++ b/styles/main.css @@ -1,6 +1,7 @@ @layer resets, elements, tweaks, apps; @import url("./chatSidebarBackground.css") layer(tweaks); +@import url("./hideProseMirrorChatMenu.css") layer(tweaks); @import url("./hotbarButtonGap.css") layer(tweaks); @import url("./hotbarButtonSize.css") layer(tweaks); @import url("./repositionHotbar.css") layer(tweaks);