Settings > General > Composing has a new switch, "Open the composer full screen". With it on, every new composer, whether a new message, reply, forward or reopened draft, starts maximized. Restore still shrinks it to a window. A draft put back after an undone or failed send keeps the size it had. It's off by default, and on a phone, where the composer already fills the screen, it changes nothing. One new string, translated in all nine catalogs. The count falling back to English stays at 16 in every language. Fixes #401
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { useCompose } from "@/store/compose";
|
||||
import { useMail } from "@/store/mail";
|
||||
import { DEFAULT_SETTINGS, useSettings } from "@/store/settings";
|
||||
|
||||
/**
|
||||
* "Open the composer full screen" (#401): the size a new composer starts at.
|
||||
*
|
||||
* Only new composers follow it. A draft put back after an undone or failed
|
||||
* send keeps the size it had, since that is the window somebody was already
|
||||
* looking at.
|
||||
*/
|
||||
|
||||
beforeEach(() => {
|
||||
useCompose.setState({ drafts: [], activeKey: null, pendingSends: {} });
|
||||
useMail.setState({ accountId: "a1", identities: [] as never });
|
||||
useSettings.setState({ settings: { ...DEFAULT_SETTINGS } });
|
||||
});
|
||||
|
||||
const opened = () => {
|
||||
const key = useCompose.getState().open();
|
||||
return useCompose.getState().drafts.find((d) => d.key === key)!;
|
||||
};
|
||||
|
||||
describe("the size a new composer opens at", () => {
|
||||
it("is the usual window by default", () => {
|
||||
expect(opened().maximized).toBe(false);
|
||||
});
|
||||
|
||||
it("is full screen with the setting on", () => {
|
||||
useSettings.setState((s) => ({ settings: { ...s.settings, composeMaximized: true } }));
|
||||
expect(opened().maximized).toBe(true);
|
||||
});
|
||||
|
||||
it("can still be restored to a window once open", () => {
|
||||
useSettings.setState((s) => ({ settings: { ...s.settings, composeMaximized: true } }));
|
||||
const d = opened();
|
||||
useCompose.getState().update(d.key, { maximized: false });
|
||||
expect(useCompose.getState().drafts.find((x) => x.key === d.key)!.maximized).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -137,7 +137,7 @@ function blankDraft(init: Partial<Draft> = {}): Draft {
|
||||
showBcc: false,
|
||||
showReplyTo: false,
|
||||
minimized: false,
|
||||
maximized: false,
|
||||
maximized: s.composeMaximized,
|
||||
dirty: false,
|
||||
savedAt: null,
|
||||
saving: false,
|
||||
|
||||
@@ -251,6 +251,11 @@ export interface Settings {
|
||||
archiveOnReply: boolean;
|
||||
autoAdvance: "newer" | "older" | "list";
|
||||
spellcheck: boolean;
|
||||
/**
|
||||
* Open every new composer full screen (#401). Desktop only: on a phone the
|
||||
* composer fills the screen already and has no size to choose.
|
||||
*/
|
||||
composeMaximized: boolean;
|
||||
sendAndArchive: boolean;
|
||||
/** Width (px) of the message list when the reading pane is on the right. */
|
||||
listPaneWidth: number;
|
||||
@@ -376,6 +381,7 @@ export const DEFAULT_SETTINGS: Settings = {
|
||||
archiveOnReply: false,
|
||||
autoAdvance: "list",
|
||||
spellcheck: true,
|
||||
composeMaximized: false,
|
||||
sendAndArchive: false,
|
||||
listPaneWidth: 520,
|
||||
listPaneHeight: 340,
|
||||
|
||||
Reference in New Issue
Block a user