diff --git a/src/public/app/components/app_context.ts b/src/public/app/components/app_context.ts index 63e3144c2..f54fd88fa 100644 --- a/src/public/app/components/app_context.ts +++ b/src/public/app/components/app_context.ts @@ -223,6 +223,8 @@ export type CommandMappings = { // Geomap deleteFromMap: { noteId: string }, openGeoLocation: { noteId: string, event: JQuery.MouseDownEvent } + + toggleZenMode: CommandData; }; type EventMappings = { @@ -325,6 +327,7 @@ type EventMappings = { }; scrollToEnd: { ntxId: string }; noteTypeMimeChanged: { noteId: string }; + zenModeChanged: { isEnabled: boolean }; }; export type EventListener = { diff --git a/src/public/app/components/root_command_executor.ts b/src/public/app/components/root_command_executor.ts index d93143a5f..eb46e3139 100644 --- a/src/public/app/components/root_command_executor.ts +++ b/src/public/app/components/root_command_executor.ts @@ -178,6 +178,13 @@ export default class RootCommandExecutor extends Component { for (const window of windows) window[action](); } + toggleZenModeCommand() { + const $body = $("body"); + $body.toggleClass("zen"); + const isEnabled = $body.hasClass("zen"); + appContext.triggerEvent("zenModeChanged", { isEnabled }); + } + firstTabCommand() { this.#goToTab(1); } diff --git a/src/public/app/layouts/desktop_layout.js b/src/public/app/layouts/desktop_layout.js index e0f695803..1ece1c156 100644 --- a/src/public/app/layouts/desktop_layout.js +++ b/src/public/app/layouts/desktop_layout.js @@ -87,6 +87,7 @@ import options from "../services/options.js"; import utils from "../services/utils.js"; import GeoMapButtons from "../widgets/floating_buttons/geo_map_button.js"; import ContextualHelpButton from "../widgets/floating_buttons/help_button.js"; +import CloseZenButton from "../widgets/close_zen_button.js"; export default class DesktopLayout { constructor(customWidgets) { @@ -262,7 +263,8 @@ export default class DesktopLayout { .child(new DeleteNotesDialog()) .child(new InfoDialog()) .child(new ConfirmDialog()) - .child(new PromptDialog()); + .child(new PromptDialog()) + .child(new CloseZenButton()) } #buildLauncherPane(isHorizontal) { diff --git a/src/public/app/widgets/buttons/global_menu.ts b/src/public/app/widgets/buttons/global_menu.ts index c7be1f964..9d04c8e56 100644 --- a/src/public/app/widgets/buttons/global_menu.ts +++ b/src/public/app/widgets/buttons/global_menu.ts @@ -133,7 +133,12 @@ const TPL = ` ${t("title_bar_buttons.window-on-top")} - + + +