@rapidmx/web-client 0.20.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +381 -381
  2. package/apps/admin/branding/index.tsx +39 -39
  3. package/apps/admin/data-requests/index.tsx +482 -482
  4. package/apps/admin/domains/[uid].tsx +166 -166
  5. package/apps/admin/escrow-scopes/[uid].tsx +350 -350
  6. package/apps/admin/index.tsx +129 -129
  7. package/apps/admin/mailboxes/[uid].tsx +271 -271
  8. package/apps/admin/mailboxes/new/index.tsx +30 -30
  9. package/apps/admin/plugins/index.tsx +15 -15
  10. package/apps/admin/retention-policy/index.tsx +39 -39
  11. package/apps/admin/signing-certificates/index.tsx +343 -343
  12. package/apps/escrow/audit-log/index.tsx +196 -196
  13. package/apps/escrow/matters/[uid].tsx +621 -621
  14. package/apps/shared/auth/adminAccess.ts +99 -99
  15. package/apps/shared/components/admin/layout/AdminShell.tsx +384 -384
  16. package/apps/shared/components/admin/mailboxes/EraseLeftoverDataDialog.tsx +238 -238
  17. package/apps/shared/components/admin/mailboxes/EscrowScopeCard.tsx +152 -152
  18. package/apps/shared/components/admin/mailboxes/LeftoverMailboxesSection.tsx +194 -194
  19. package/apps/shared/components/admin/settings/BrandingForm.tsx +423 -423
  20. package/apps/shared/components/admin/settings/EncryptionPolicyForm.tsx +119 -119
  21. package/apps/shared/components/admin/settings/MailboxPolicyForm.tsx +198 -198
  22. package/apps/shared/components/admin/settings/PluginsManager.tsx +2093 -2093
  23. package/apps/shared/components/admin/settings/RetentionPolicyForm.tsx +182 -182
  24. package/apps/shared/components/admin/setup/EscrowSetupStep.tsx +288 -288
  25. package/apps/shared/components/admin/setup/SetupWizard.tsx +446 -446
  26. package/apps/shared/components/admin/usePagedList.tsx +129 -129
  27. package/apps/shared/components/calendar/EventModal.tsx +206 -206
  28. package/apps/shared/components/calendar/MonthView.tsx +185 -185
  29. package/apps/shared/components/calendar/RecurrenceEditor.tsx +227 -227
  30. package/apps/shared/components/calendar/SplitDayView.tsx +144 -144
  31. package/apps/shared/components/calendar/TimeGridView.tsx +246 -246
  32. package/apps/shared/components/calendar/allDay.ts +124 -124
  33. package/apps/shared/components/contacts/ContactForm.tsx +383 -383
  34. package/apps/shared/components/contacts/ContactsToolbar.tsx +103 -103
  35. package/apps/shared/components/escrow/layout/EscrowShell.tsx +155 -155
  36. package/apps/shared/components/layout/AppShell.tsx +463 -461
  37. package/apps/shared/components/layout/KeyEnrollmentGate.tsx +398 -398
  38. package/apps/shared/components/layout/MailboxProvisioning.tsx +168 -168
  39. package/apps/shared/components/layout/ResponsiveToolbar.tsx +315 -315
  40. package/apps/shared/components/layout/ThemeSwitch.tsx +84 -84
  41. package/apps/shared/components/layout/UserMenu.tsx +439 -439
  42. package/apps/shared/components/mail/ConversationList.tsx +332 -332
  43. package/apps/shared/components/mail/ConversationThreadPane.tsx +613 -613
  44. package/apps/shared/components/mail/MailSelectionBar.tsx +240 -240
  45. package/apps/shared/components/mail/MenuButton.tsx +404 -404
  46. package/apps/shared/components/mail/MessageDetailPane.tsx +1757 -1757
  47. package/apps/shared/components/mail/compose/ComposeContext.tsx +312 -312
  48. package/apps/shared/components/mail/compose/ComposeToolbar.tsx +422 -422
  49. package/apps/shared/components/mail/compose/ComposeWindow.tsx +1705 -1681
  50. package/apps/shared/components/mail/compose/RichTextEditor.tsx +147 -147
  51. package/apps/shared/components/mail/compose/composeFlushRegistry.ts +60 -60
  52. package/apps/shared/components/mail/compose/quotedBody.ts +161 -161
  53. package/apps/shared/components/mail/reading/MessageMoreMenu.tsx +258 -258
  54. package/apps/shared/components/mail/reading/MessageSourceDialog.tsx +79 -79
  55. package/apps/shared/components/mail/reading/messageExport.ts +59 -59
  56. package/apps/shared/components/mail/reading/printMessage.ts +99 -99
  57. package/apps/shared/components/mail/reading/useMessageActions.ts +443 -443
  58. package/apps/shared/components/mail/verificationSeals.ts +125 -125
  59. package/apps/shared/components/rules/RuleBuilder.tsx +311 -311
  60. package/apps/shared/components/settings/SigningCertificateCard.tsx +344 -344
  61. package/apps/shared/keyboard/GlobalShortcuts.tsx +51 -51
  62. package/apps/shared/keyboard/ShortcutProvider.tsx +62 -62
  63. package/apps/shared/keyboard/ShortcutsDialog.tsx +84 -84
  64. package/apps/shared/keyboard/dispatch.ts +124 -124
  65. package/apps/shared/keyboard/format.ts +89 -89
  66. package/apps/shared/keyboard/keymap.ts +114 -114
  67. package/apps/shared/keyboard/registry.ts +65 -65
  68. package/apps/shared/keyboard/targets.ts +79 -79
  69. package/apps/shared/mail/folderOfType.ts +49 -49
  70. package/apps/shared/mail/folderTree.ts +143 -143
  71. package/apps/shared/mail/listAllPages.ts +39 -39
  72. package/apps/shared/mail/newMailNotifications.ts +171 -171
  73. package/apps/shared/mail/outbox/sendJob.ts +445 -445
  74. package/apps/shared/mail/outbox/sendOutcomes.ts +155 -155
  75. package/apps/shared/mail/reportNotices.ts +66 -66
  76. package/apps/shared/mail/senderBlocking.ts +141 -141
  77. package/apps/shared/mail/useMailConnection.ts +205 -205
  78. package/apps/shared/mail/useMailLiveUpdates.ts +277 -277
  79. package/apps/shared/mail/useMailboxUpdateAccess.ts +60 -60
  80. package/apps/shared/mail/useMarkMessageRead.ts +47 -47
  81. package/apps/shared/mail/useNewMailNotifications.ts +178 -178
  82. package/apps/shared/notifications/store.ts +560 -560
  83. package/apps/shared/search/LocalIndexLifecycle.tsx +114 -114
  84. package/apps/shared/search/localIndexBuilder.ts +481 -481
  85. package/apps/shared/signing/enrollmentStorage.ts +33 -33
  86. package/apps/shared/signing/enrollmentTracker.ts +385 -385
  87. package/apps/shared/signing/enrollmentView.ts +251 -251
  88. package/apps/shared/signing/useNow.ts +19 -19
  89. package/apps/shared/signing/useSigningEnrollmentWatcher.ts +90 -90
  90. package/apps/shared/styles/app.css +396 -396
  91. package/apps/www/calendar/index.tsx +581 -581
  92. package/apps/www/contacts/[uid].tsx +112 -112
  93. package/apps/www/index.tsx +3012 -3012
  94. package/apps/www/messages/[uid].tsx +139 -139
  95. package/apps/www/settings/auto-reply/index.tsx +136 -136
  96. package/apps/www/settings/blocked-senders/index.tsx +303 -303
  97. package/apps/www/settings/encryption/index.tsx +1290 -1290
  98. package/apps/www/settings/filters/[uid].tsx +179 -179
  99. package/apps/www/settings/filters/index.tsx +105 -105
  100. package/apps/www/settings/filters/new/index.tsx +165 -165
  101. package/apps/www/settings/labels/index.tsx +207 -207
  102. package/apps/www/settings/privacy/index.tsx +495 -495
  103. package/apps/www/settings/profile/index.tsx +251 -251
  104. package/apps/www/settings/read-receipts/index.tsx +150 -150
  105. package/apps/www/settings/sharing/index.tsx +259 -259
  106. package/apps/www/settings/signatures/[uid].tsx +175 -175
  107. package/apps/www/settings/signatures/index.tsx +91 -91
  108. package/apps/www/settings/signatures/new/index.tsx +138 -138
  109. package/apps/www/tasks/index.tsx +654 -654
  110. package/dist/apps/shared/components/admin/layout/AdminShell.js +2 -2
  111. package/dist/apps/shared/components/admin/settings/BrandingForm.js +3 -3
  112. package/dist/apps/shared/components/escrow/layout/EscrowShell.js +2 -2
  113. package/dist/apps/shared/components/layout/AppShell.js +4 -2
  114. package/dist/apps/shared/components/mail/compose/ComposeWindow.d.ts +7 -1
  115. package/dist/apps/shared/components/mail/compose/ComposeWindow.js +20 -1
  116. package/dist/apps/shared/components/mail/reading/printMessage.js +11 -11
  117. package/dist/apps/shared/styles/app.css +396 -396
  118. package/package.json +2 -2
@@ -1,147 +1,147 @@
1
- ///////////////////////////////////////////////////////////////////////////////
2
- // Copyright (C) 2026 Jean-Philippe Steinmetz
3
- // SPDX-License-Identifier: MPL-2.0
4
- ///////////////////////////////////////////////////////////////////////////////
5
- import React, { useEffect, useRef, useState } from "react";
6
- import { EditorContent, useEditor } from "@tiptap/react";
7
- import StarterKit from "@tiptap/starter-kit";
8
- import { TextStyleKit } from "@tiptap/extension-text-style";
9
- import TextAlign from "@tiptap/extension-text-align";
10
- import Highlight from "@tiptap/extension-highlight";
11
- import Image from "@tiptap/extension-image";
12
- import { TableKit } from "@tiptap/extension-table";
13
- import Placeholder from "@tiptap/extension-placeholder";
14
- import ComposeToolbar from "./ComposeToolbar.js";
15
-
16
- export interface RichTextEditorProps {
17
- value: string;
18
- onChange: (value: string) => void;
19
- height?: string;
20
- /** When true, the editor fills its parent's height via flexbox instead of a fixed `height` — for
21
- * embedding inside a flex-column container of variable height (the floating Compose window) where
22
- * a literal pixel height can't be computed up front. `height` is ignored when this is set. */
23
- fill?: boolean;
24
- /** Passed straight through to `ComposeToolbar` — see its own doc comment on this prop. */
25
- onUploadImage: (file: File) => Promise<string | null>;
26
- /** Focuses the editor with the caret at the very start of the document once it mounts - a reply or forward, whose
27
- * body starts with an empty paragraph above the signature and quote, so typing goes above them. Only read when
28
- * the editor is created. */
29
- autoFocusStart?: boolean;
30
- /** Called once the editor is ready, with `value` as the editor itself serializes it: TipTap drops what its schema
31
- * doesn't hold (e.g. a blockquote's `style`) and adds an empty paragraph after a trailing non-paragraph node (a
32
- * quote). That normalization happens on the editor's first transaction - even one that only moves the caret -
33
- * and isn't reported through `onChange`, so a caller can compare later edits against this instead of `value`. */
34
- onInitialized?: (value: string) => void;
35
- /**
36
- * HTML to add at the end of the document, once, as soon as there is some (it may be undefined when the editor is created and
37
- * defined later). A reply opens its editor before the quoted original has been fetched and hands the quote in through this when
38
- * it arrives - so whatever has been typed above stays, and the quote lands where it always did, under the signature.
39
- */
40
- appendHtml?: string;
41
- /** Called with the document as the editor serializes it, right after `appendHtml` was added. */
42
- onAppended?: (value: string) => void;
43
- }
44
-
45
- /**
46
- * A WYSIWYG rich-text editor for the Compose window's message body — replaces `MonacoHtmlEditor` (an HTML
47
- * *source* editor) with a real Outlook-Home-tab-style formatting experience, built on TipTap/ProseMirror.
48
- * Used by `ComposeWindow` (the floating overlay, not a dedicated page — see `ComposeContext.tsx`'s doc
49
- * comment).
50
- *
51
- * `value` seeds the editor's initial content only — like `MonacoHtmlEditor`, this never re-syncs from a
52
- * later `value` prop change; TipTap owns its own document once created. Live edits flow out as HTML (via
53
- * `editor.getHTML()`) through `onChange`.
54
- *
55
- * `immediatelyRender: false` is required for this framework's SSR: the page embedding `ComposeWindow` is
56
- * rendered server-side under plain Node before hydration (see `ReactRoute`), and TipTap's default
57
- * (`immediatelyRender: true`) tries to mount its ProseMirror view during that very first render, which
58
- * both can't work without a real DOM and produces a hydration mismatch. With it `false`, `useEditor`
59
- * returns `null` until the editor actually mounts client-side after hydration — `ComposeToolbar`/
60
- * `EditorContent` both already handle a `null` editor by rendering their disabled/empty state, so this
61
- * needs no extra loading-placeholder logic here. Unlike `MonacoHtmlEditor`, no dynamic `import()` is
62
- * needed to defer loading TipTap's modules off the SSR path — `immediatelyRender: false` alone is
63
- * sufficient here since TipTap (unlike Monaco) never touches the DOM at module-evaluation time, only when
64
- * an editor view actually mounts.
65
- */
66
- export default function RichTextEditor({
67
- value,
68
- onChange,
69
- height = "360px",
70
- fill = false,
71
- onUploadImage,
72
- autoFocusStart = false,
73
- onInitialized,
74
- appendHtml,
75
- onAppended,
76
- }: RichTextEditorProps) {
77
- const onChangeRef = useRef(onChange);
78
- onChangeRef.current = onChange;
79
- const onInitializedRef = useRef(onInitialized);
80
- onInitializedRef.current = onInitialized;
81
- const onAppendedRef = useRef(onAppended);
82
- onAppendedRef.current = onAppended;
83
- const appendedRef = useRef<string | undefined>(undefined);
84
- // Transactions before `create` (the autofocus, and the normalizing one below) aren't edits.
85
- const initializedRef = useRef(false);
86
- // Held for this editor's lifetime: TipTap focuses a tick after creating the editor, and a re-render passing a
87
- // different value in between would replace the option (via `setOptions`) before it's read.
88
- const [autofocus] = useState<"start" | false>(autoFocusStart ? "start" : false);
89
-
90
- const editor = useEditor({
91
- extensions: [
92
- StarterKit.configure({ link: { openOnClick: false } }),
93
- TextStyleKit.configure({ backgroundColor: false, lineHeight: false }),
94
- TextAlign.configure({ types: ["heading", "paragraph"] }),
95
- Highlight,
96
- Image,
97
- TableKit.configure({ table: { resizable: true } }),
98
- Placeholder.configure({ placeholder: "Write your message…" }),
99
- ],
100
- content: value,
101
- autofocus,
102
- immediatelyRender: false,
103
- editorProps: {
104
- // Ctrl/Cmd+Enter is the compose window's Send. TipTap binds it to a hard break, and a key it handles never reaches the
105
- // window's shortcut (which skips what a widget already took), so it inserted a line break and sent nothing. Returning true here
106
- // stops ProseMirror handling it without preventing the event, which goes on to the shortcut. Shift+Enter is still the hard break.
107
- handleDOMEvents: { keydown: (_view, event) => event.key === "Enter" && (event.ctrlKey || event.metaKey) },
108
- },
109
- onCreate: ({ editor: created }) => {
110
- // An empty transaction runs the schema's append-transaction normalization now, before any edit.
111
- created.view.dispatch(created.state.tr);
112
- initializedRef.current = true;
113
- onInitializedRef.current?.(created.getHTML());
114
- },
115
- onUpdate: ({ editor: updated }) => {
116
- if (initializedRef.current) {
117
- onChangeRef.current(updated.getHTML());
118
- }
119
- },
120
- });
121
-
122
- // Added once, at the end, whatever the reader has typed meanwhile (the caret stays where it is).
123
- useEffect(() => {
124
- if (!editor || appendHtml === undefined || appendedRef.current === appendHtml) {
125
- return;
126
- }
127
- appendedRef.current = appendHtml;
128
- editor.commands.insertContentAt(editor.state.doc.content.size, appendHtml);
129
- onAppendedRef.current?.(editor.getHTML());
130
- }, [editor, appendHtml]);
131
-
132
- return (
133
- <div className={["border border-border rounded-sm overflow-hidden", fill ? "h-full flex flex-col" : ""].filter(Boolean).join(" ")}>
134
- <ComposeToolbar editor={editor} onUploadImage={onUploadImage} />
135
- <EditorContent
136
- editor={editor}
137
- style={fill ? undefined : { height }}
138
- className={[
139
- "overflow-y-auto px-3 py-2 text-sm [&_.tiptap]:outline-none [&_.tiptap]:h-full",
140
- fill ? "flex-1 min-h-0" : "",
141
- ]
142
- .filter(Boolean)
143
- .join(" ")}
144
- />
145
- </div>
146
- );
147
- }
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2026 Jean-Philippe Steinmetz
3
+ // SPDX-License-Identifier: MPL-2.0
4
+ ///////////////////////////////////////////////////////////////////////////////
5
+ import React, { useEffect, useRef, useState } from "react";
6
+ import { EditorContent, useEditor } from "@tiptap/react";
7
+ import StarterKit from "@tiptap/starter-kit";
8
+ import { TextStyleKit } from "@tiptap/extension-text-style";
9
+ import TextAlign from "@tiptap/extension-text-align";
10
+ import Highlight from "@tiptap/extension-highlight";
11
+ import Image from "@tiptap/extension-image";
12
+ import { TableKit } from "@tiptap/extension-table";
13
+ import Placeholder from "@tiptap/extension-placeholder";
14
+ import ComposeToolbar from "./ComposeToolbar.js";
15
+
16
+ export interface RichTextEditorProps {
17
+ value: string;
18
+ onChange: (value: string) => void;
19
+ height?: string;
20
+ /** When true, the editor fills its parent's height via flexbox instead of a fixed `height` — for
21
+ * embedding inside a flex-column container of variable height (the floating Compose window) where
22
+ * a literal pixel height can't be computed up front. `height` is ignored when this is set. */
23
+ fill?: boolean;
24
+ /** Passed straight through to `ComposeToolbar` — see its own doc comment on this prop. */
25
+ onUploadImage: (file: File) => Promise<string | null>;
26
+ /** Focuses the editor with the caret at the very start of the document once it mounts - a reply or forward, whose
27
+ * body starts with an empty paragraph above the signature and quote, so typing goes above them. Only read when
28
+ * the editor is created. */
29
+ autoFocusStart?: boolean;
30
+ /** Called once the editor is ready, with `value` as the editor itself serializes it: TipTap drops what its schema
31
+ * doesn't hold (e.g. a blockquote's `style`) and adds an empty paragraph after a trailing non-paragraph node (a
32
+ * quote). That normalization happens on the editor's first transaction - even one that only moves the caret -
33
+ * and isn't reported through `onChange`, so a caller can compare later edits against this instead of `value`. */
34
+ onInitialized?: (value: string) => void;
35
+ /**
36
+ * HTML to add at the end of the document, once, as soon as there is some (it may be undefined when the editor is created and
37
+ * defined later). A reply opens its editor before the quoted original has been fetched and hands the quote in through this when
38
+ * it arrives - so whatever has been typed above stays, and the quote lands where it always did, under the signature.
39
+ */
40
+ appendHtml?: string;
41
+ /** Called with the document as the editor serializes it, right after `appendHtml` was added. */
42
+ onAppended?: (value: string) => void;
43
+ }
44
+
45
+ /**
46
+ * A WYSIWYG rich-text editor for the Compose window's message body — replaces `MonacoHtmlEditor` (an HTML
47
+ * *source* editor) with a real Outlook-Home-tab-style formatting experience, built on TipTap/ProseMirror.
48
+ * Used by `ComposeWindow` (the floating overlay, not a dedicated page — see `ComposeContext.tsx`'s doc
49
+ * comment).
50
+ *
51
+ * `value` seeds the editor's initial content only — like `MonacoHtmlEditor`, this never re-syncs from a
52
+ * later `value` prop change; TipTap owns its own document once created. Live edits flow out as HTML (via
53
+ * `editor.getHTML()`) through `onChange`.
54
+ *
55
+ * `immediatelyRender: false` is required for this framework's SSR: the page embedding `ComposeWindow` is
56
+ * rendered server-side under plain Node before hydration (see `ReactRoute`), and TipTap's default
57
+ * (`immediatelyRender: true`) tries to mount its ProseMirror view during that very first render, which
58
+ * both can't work without a real DOM and produces a hydration mismatch. With it `false`, `useEditor`
59
+ * returns `null` until the editor actually mounts client-side after hydration — `ComposeToolbar`/
60
+ * `EditorContent` both already handle a `null` editor by rendering their disabled/empty state, so this
61
+ * needs no extra loading-placeholder logic here. Unlike `MonacoHtmlEditor`, no dynamic `import()` is
62
+ * needed to defer loading TipTap's modules off the SSR path — `immediatelyRender: false` alone is
63
+ * sufficient here since TipTap (unlike Monaco) never touches the DOM at module-evaluation time, only when
64
+ * an editor view actually mounts.
65
+ */
66
+ export default function RichTextEditor({
67
+ value,
68
+ onChange,
69
+ height = "360px",
70
+ fill = false,
71
+ onUploadImage,
72
+ autoFocusStart = false,
73
+ onInitialized,
74
+ appendHtml,
75
+ onAppended,
76
+ }: RichTextEditorProps) {
77
+ const onChangeRef = useRef(onChange);
78
+ onChangeRef.current = onChange;
79
+ const onInitializedRef = useRef(onInitialized);
80
+ onInitializedRef.current = onInitialized;
81
+ const onAppendedRef = useRef(onAppended);
82
+ onAppendedRef.current = onAppended;
83
+ const appendedRef = useRef<string | undefined>(undefined);
84
+ // Transactions before `create` (the autofocus, and the normalizing one below) aren't edits.
85
+ const initializedRef = useRef(false);
86
+ // Held for this editor's lifetime: TipTap focuses a tick after creating the editor, and a re-render passing a
87
+ // different value in between would replace the option (via `setOptions`) before it's read.
88
+ const [autofocus] = useState<"start" | false>(autoFocusStart ? "start" : false);
89
+
90
+ const editor = useEditor({
91
+ extensions: [
92
+ StarterKit.configure({ link: { openOnClick: false } }),
93
+ TextStyleKit.configure({ backgroundColor: false, lineHeight: false }),
94
+ TextAlign.configure({ types: ["heading", "paragraph"] }),
95
+ Highlight,
96
+ Image,
97
+ TableKit.configure({ table: { resizable: true } }),
98
+ Placeholder.configure({ placeholder: "Write your message…" }),
99
+ ],
100
+ content: value,
101
+ autofocus,
102
+ immediatelyRender: false,
103
+ editorProps: {
104
+ // Ctrl/Cmd+Enter is the compose window's Send. TipTap binds it to a hard break, and a key it handles never reaches the
105
+ // window's shortcut (which skips what a widget already took), so it inserted a line break and sent nothing. Returning true here
106
+ // stops ProseMirror handling it without preventing the event, which goes on to the shortcut. Shift+Enter is still the hard break.
107
+ handleDOMEvents: { keydown: (_view, event) => event.key === "Enter" && (event.ctrlKey || event.metaKey) },
108
+ },
109
+ onCreate: ({ editor: created }) => {
110
+ // An empty transaction runs the schema's append-transaction normalization now, before any edit.
111
+ created.view.dispatch(created.state.tr);
112
+ initializedRef.current = true;
113
+ onInitializedRef.current?.(created.getHTML());
114
+ },
115
+ onUpdate: ({ editor: updated }) => {
116
+ if (initializedRef.current) {
117
+ onChangeRef.current(updated.getHTML());
118
+ }
119
+ },
120
+ });
121
+
122
+ // Added once, at the end, whatever the reader has typed meanwhile (the caret stays where it is).
123
+ useEffect(() => {
124
+ if (!editor || appendHtml === undefined || appendedRef.current === appendHtml) {
125
+ return;
126
+ }
127
+ appendedRef.current = appendHtml;
128
+ editor.commands.insertContentAt(editor.state.doc.content.size, appendHtml);
129
+ onAppendedRef.current?.(editor.getHTML());
130
+ }, [editor, appendHtml]);
131
+
132
+ return (
133
+ <div className={["border border-border rounded-sm overflow-hidden", fill ? "h-full flex flex-col" : ""].filter(Boolean).join(" ")}>
134
+ <ComposeToolbar editor={editor} onUploadImage={onUploadImage} />
135
+ <EditorContent
136
+ editor={editor}
137
+ style={fill ? undefined : { height }}
138
+ className={[
139
+ "overflow-y-auto px-3 py-2 text-sm [&_.tiptap]:outline-none [&_.tiptap]:h-full",
140
+ fill ? "flex-1 min-h-0" : "",
141
+ ]
142
+ .filter(Boolean)
143
+ .join(" ")}
144
+ />
145
+ </div>
146
+ );
147
+ }
@@ -1,60 +1,60 @@
1
- ///////////////////////////////////////////////////////////////////////////////
2
- // Copyright (C) 2026 Jean-Philippe Steinmetz
3
- // SPDX-License-Identifier: MPL-2.0
4
- ///////////////////////////////////////////////////////////////////////////////
5
-
6
- /** Saves a compose window's unsaved edits (or waits for a save already on the wire), resolving to `false` when
7
- * something the window holds is still unsaved afterwards (any other value counts as saved). Never rejects. */
8
- export type ComposeFlush = () => Promise<unknown>;
9
-
10
- const flushers = new Set<ComposeFlush>();
11
- let signingOut = false;
12
-
13
- /**
14
- * Marks the app as signing out (explicitly, or forced by a sign-out in another tab), so compose windows stop
15
- * asking the browser to confirm leaving the page - the "Leave site?" prompt would otherwise let the user cancel
16
- * the sign-out's own navigation and stay on a page whose session is being ended. Call it before flushing drafts
17
- * and navigating. `clearSigningOut()` undoes it (a sign-out that didn't leave the page after all).
18
- */
19
- export function markSigningOut(): void {
20
- signingOut = true;
21
- }
22
-
23
- /** Undoes `markSigningOut()`. */
24
- export function clearSigningOut(): void {
25
- signingOut = false;
26
- }
27
-
28
- /** Whether `markSigningOut()` has been called (and not cleared). */
29
- export function isSigningOut(): boolean {
30
- return signingOut;
31
- }
32
-
33
- /**
34
- * Registers an open compose window's draft flush, so leaving the app on purpose (Sign Out) can save the
35
- * last edits still waiting on the autosave debounce before the session ends. Returns the unregister
36
- * function. Module-level rather than React context: `AppShell` (the sign-out handler) renders the
37
- * `ComposeProvider` itself, so it can't read that provider's context.
38
- */
39
- export function registerComposeFlush(flush: ComposeFlush): () => void {
40
- flushers.add(flush);
41
- return () => {
42
- flushers.delete(flush);
43
- };
44
- }
45
-
46
- /**
47
- * Runs every registered flush and waits for all of them, but no longer than `timeoutMs`. Resolves to `true`
48
- * only when every window reported its content saved in time (a window whose save failed also shows the user
49
- * why, with Discard / Keep editing). Never rejects.
50
- */
51
- export async function flushComposeDrafts(timeoutMs: number): Promise<boolean> {
52
- let timer: ReturnType<typeof setTimeout> | undefined;
53
- const timeout = new Promise<boolean>((resolve) => {
54
- timer = setTimeout(() => resolve(false), timeoutMs);
55
- });
56
- const all = Promise.all([...flushers].map((flush) => flush().catch(() => false))).then((results) => results.every((result) => result !== false));
57
- const saved = await Promise.race([all, timeout]);
58
- clearTimeout(timer);
59
- return saved;
60
- }
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2026 Jean-Philippe Steinmetz
3
+ // SPDX-License-Identifier: MPL-2.0
4
+ ///////////////////////////////////////////////////////////////////////////////
5
+
6
+ /** Saves a compose window's unsaved edits (or waits for a save already on the wire), resolving to `false` when
7
+ * something the window holds is still unsaved afterwards (any other value counts as saved). Never rejects. */
8
+ export type ComposeFlush = () => Promise<unknown>;
9
+
10
+ const flushers = new Set<ComposeFlush>();
11
+ let signingOut = false;
12
+
13
+ /**
14
+ * Marks the app as signing out (explicitly, or forced by a sign-out in another tab), so compose windows stop
15
+ * asking the browser to confirm leaving the page - the "Leave site?" prompt would otherwise let the user cancel
16
+ * the sign-out's own navigation and stay on a page whose session is being ended. Call it before flushing drafts
17
+ * and navigating. `clearSigningOut()` undoes it (a sign-out that didn't leave the page after all).
18
+ */
19
+ export function markSigningOut(): void {
20
+ signingOut = true;
21
+ }
22
+
23
+ /** Undoes `markSigningOut()`. */
24
+ export function clearSigningOut(): void {
25
+ signingOut = false;
26
+ }
27
+
28
+ /** Whether `markSigningOut()` has been called (and not cleared). */
29
+ export function isSigningOut(): boolean {
30
+ return signingOut;
31
+ }
32
+
33
+ /**
34
+ * Registers an open compose window's draft flush, so leaving the app on purpose (Sign Out) can save the
35
+ * last edits still waiting on the autosave debounce before the session ends. Returns the unregister
36
+ * function. Module-level rather than React context: `AppShell` (the sign-out handler) renders the
37
+ * `ComposeProvider` itself, so it can't read that provider's context.
38
+ */
39
+ export function registerComposeFlush(flush: ComposeFlush): () => void {
40
+ flushers.add(flush);
41
+ return () => {
42
+ flushers.delete(flush);
43
+ };
44
+ }
45
+
46
+ /**
47
+ * Runs every registered flush and waits for all of them, but no longer than `timeoutMs`. Resolves to `true`
48
+ * only when every window reported its content saved in time (a window whose save failed also shows the user
49
+ * why, with Discard / Keep editing). Never rejects.
50
+ */
51
+ export async function flushComposeDrafts(timeoutMs: number): Promise<boolean> {
52
+ let timer: ReturnType<typeof setTimeout> | undefined;
53
+ const timeout = new Promise<boolean>((resolve) => {
54
+ timer = setTimeout(() => resolve(false), timeoutMs);
55
+ });
56
+ const all = Promise.all([...flushers].map((flush) => flush().catch(() => false))).then((results) => results.every((result) => result !== false));
57
+ const saved = await Promise.race([all, timeout]);
58
+ clearTimeout(timer);
59
+ return saved;
60
+ }