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
|
|
@ -25,6 +25,10 @@
|
||||||
"name": "Default Hotbar Page",
|
"name": "Default Hotbar Page",
|
||||||
"hint": "(v13+) What page the hotbar will default to when loading into Foundry."
|
"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": {
|
"hotbarButtonGap": {
|
||||||
"name": "Hotbar Button Gap",
|
"name": "Hotbar Button Gap",
|
||||||
"hint": "(v13+) Allows changing the amount of space between the hotbar buttons."
|
"hint": "(v13+) Allows changing the amount of space between the hotbar buttons."
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { chatImageLinks } from "../tweaks/chatImageLinks.mjs";
|
||||||
import { chatSidebarBackground } from "../tweaks/chatSidebarBackground.mjs";
|
import { chatSidebarBackground } from "../tweaks/chatSidebarBackground.mjs";
|
||||||
import { customStatusIcons } from "../tweaks/customStatusIcons.mjs";
|
import { customStatusIcons } from "../tweaks/customStatusIcons.mjs";
|
||||||
import { defaultHotbarPage } from "../tweaks/defaultHotbarPage.mjs";
|
import { defaultHotbarPage } from "../tweaks/defaultHotbarPage.mjs";
|
||||||
|
import { hideProseMirrorChatMenu } from "../tweaks/hideProseMirrorChatMenu.mjs";
|
||||||
import { hotbarButtonGap } from "../tweaks/hotbarButtonGap.mjs";
|
import { hotbarButtonGap } from "../tweaks/hotbarButtonGap.mjs";
|
||||||
import { hotbarButtonSize } from "../tweaks/hotbarButtonSize.mjs";
|
import { hotbarButtonSize } from "../tweaks/hotbarButtonSize.mjs";
|
||||||
import { preventTokenRotation } from "../tweaks/preventTokenRotation.mjs";
|
import { preventTokenRotation } from "../tweaks/preventTokenRotation.mjs";
|
||||||
|
|
@ -52,8 +53,10 @@ Hooks.on(`setup`, () => {
|
||||||
|
|
||||||
customStatusIcons();
|
customStatusIcons();
|
||||||
rearrangeSidebarTabs();
|
rearrangeSidebarTabs();
|
||||||
|
|
||||||
chatImageLinks();
|
chatImageLinks();
|
||||||
chatSidebarBackground();
|
chatSidebarBackground();
|
||||||
|
hideProseMirrorChatMenu();
|
||||||
startSidebarExpanded();
|
startSidebarExpanded();
|
||||||
startingSidebarTab();
|
startingSidebarTab();
|
||||||
preventTokenRotation();
|
preventTokenRotation();
|
||||||
|
|
|
||||||
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;
|
||||||
|
};
|
||||||
|
|
||||||
9
styles/hideProseMirrorChatMenu.css
Normal file
9
styles/hideProseMirrorChatMenu.css
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
.oft-hideProseMirrorChatMenu #chat {
|
||||||
|
.chat-input {
|
||||||
|
flex-basis: var(--chat-input-height); /* -42px */
|
||||||
|
}
|
||||||
|
|
||||||
|
prose-mirror .menu-container {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
@layer resets, elements, tweaks, apps;
|
@layer resets, elements, tweaks, apps;
|
||||||
|
|
||||||
@import url("./chatSidebarBackground.css") layer(tweaks);
|
@import url("./chatSidebarBackground.css") layer(tweaks);
|
||||||
|
@import url("./hideProseMirrorChatMenu.css") layer(tweaks);
|
||||||
@import url("./hotbarButtonGap.css") layer(tweaks);
|
@import url("./hotbarButtonGap.css") layer(tweaks);
|
||||||
@import url("./hotbarButtonSize.css") layer(tweaks);
|
@import url("./hotbarButtonSize.css") layer(tweaks);
|
||||||
@import url("./repositionHotbar.css") layer(tweaks);
|
@import url("./repositionHotbar.css") layer(tweaks);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue