@bobfrankston/rmfmail 1.2.229 → 1.2.230
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.
- package/client/app.bundle.js +349 -66
- package/client/app.bundle.js.map +4 -4
- package/client/app.js +16 -2
- package/client/app.js.map +1 -1
- package/client/app.ts +14 -1
- package/client/components/calendar-sidebar.js +1 -1
- package/client/components/calendar-sidebar.js.map +1 -1
- package/client/components/calendar-sidebar.ts +1 -1
- package/client/components/context-menu.js +12 -1
- package/client/components/context-menu.js.map +1 -1
- package/client/components/context-menu.ts +36 -1
- package/client/components/edit-menu.js +339 -0
- package/client/components/edit-menu.js.map +1 -0
- package/client/components/edit-menu.ts +343 -0
- package/client/components/folder-tree.js +2 -2
- package/client/components/folder-tree.js.map +1 -1
- package/client/components/folder-tree.ts +2 -2
- package/client/components/message-list.js +3 -1
- package/client/components/message-list.js.map +1 -1
- package/client/components/message-list.ts +3 -1
- package/client/compose/compose.bundle.js +258 -83
- package/client/compose/compose.bundle.js.map +4 -4
- package/client/compose/compose.js +5 -28
- package/client/compose/compose.js.map +1 -1
- package/client/compose/compose.ts +4 -13
- package/client/compose/edit-commands.js +15 -89
- package/client/compose/edit-commands.js.map +1 -1
- package/client/compose/edit-commands.ts +17 -77
- package/package.json +1 -1
- /package/packages/mailx-imap/{node_modules.npmglobalize-stash-146480 → node_modules.npmglobalize-stash-38284}/.package-lock.json +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-commands.js","sourceRoot":"","sources":["edit-commands.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"edit-commands.js","sourceRoot":"","sources":["edit-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAoB,MAAM,4BAA4B,CAAC;AAI3F;kFACkF;AAClF,MAAM,UAAU,mBAAmB,CAAC,EAAO,EAAE,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QACvD,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;QACtC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE;QAC1C,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,EAAE;QAChD,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE;QACjD,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;QACvC,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE;KACtD,CAAC;IACF,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACpE,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Editor FORMATTING commands for compose menus.
|
|
3
|
+
*
|
|
4
|
+
* The clipboard half of these menus moved to components/edit-menu.ts, which
|
|
5
|
+
* every menu in the app now shares — compose's editors, compose's recipient
|
|
6
|
+
* fields, and each main-window surface. What stays here is what's specific to
|
|
7
|
+
* a rich editor: bold/italic/link/clear, and the word-expansion they act on.
|
|
3
8
|
*
|
|
4
9
|
* These exist because mailx has THREE right-click menus over the same editor
|
|
5
10
|
* and they kept drifting apart:
|
|
@@ -20,8 +25,16 @@
|
|
|
20
25
|
* branching happens once, here, instead of in each menu.
|
|
21
26
|
*/
|
|
22
27
|
|
|
28
|
+
import { editMenuItems, runClipboard, type ClipboardId } from "../components/edit-menu.js";
|
|
29
|
+
|
|
23
30
|
export type EditCommandId = "cut" | "copy" | "paste" | "bold" | "italic" | "underline" | "strike" | "link" | "clear";
|
|
24
31
|
|
|
32
|
+
/** Kept as the compose-side name for the shared implementation: the native
|
|
33
|
+
* menu dispatcher (`__msgerContextCommand`) and the spell menus both call it. */
|
|
34
|
+
export function runClipboardCommand(ne: any, id: ClipboardId): Promise<void> {
|
|
35
|
+
return runClipboard({ engine: ne }, id);
|
|
36
|
+
}
|
|
37
|
+
|
|
25
38
|
function isTinyEditor(ne: any): boolean {
|
|
26
39
|
return !!ne && typeof ne.execCommand === "function" && !!ne.selection;
|
|
27
40
|
}
|
|
@@ -49,72 +62,6 @@ function expandToWord(ne: any): void {
|
|
|
49
62
|
}
|
|
50
63
|
}
|
|
51
64
|
|
|
52
|
-
function escapeHtml(s: string): string {
|
|
53
|
-
return s.replace(/[&<>]/g, c => ({ "&": "&", "<": "<", ">": ">" }[c] as string));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Cut / Copy / Paste through the async Clipboard API.
|
|
58
|
-
*
|
|
59
|
-
* NOT document.execCommand: that needs transient user activation, which a
|
|
60
|
-
* native-menu callback (dispatched from Rust via ExecuteScript) does not
|
|
61
|
-
* carry. Clipboard WRITE is allowed for a focused document; clipboard READ is
|
|
62
|
-
* permission-gated and can legitimately be refused — which is why this
|
|
63
|
-
* rejects with a real message instead of returning quietly. Callers surface
|
|
64
|
-
* it; a menu item that silently does nothing is worse than no menu item.
|
|
65
|
-
*/
|
|
66
|
-
export async function runClipboardCommand(ne: any, id: "cut" | "copy" | "paste"): Promise<void> {
|
|
67
|
-
const isTiny = isTinyEditor(ne);
|
|
68
|
-
if (id === "paste") {
|
|
69
|
-
let html = "";
|
|
70
|
-
let text = "";
|
|
71
|
-
if (navigator.clipboard?.read) {
|
|
72
|
-
for (const item of await navigator.clipboard.read()) {
|
|
73
|
-
if (item.types.includes("text/html")) html = await (await item.getType("text/html")).text();
|
|
74
|
-
if (item.types.includes("text/plain")) text = await (await item.getType("text/plain")).text();
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
77
|
-
text = await navigator.clipboard.readText();
|
|
78
|
-
}
|
|
79
|
-
// Prefer HTML so formatting survives, as Ctrl+V would. Plain text has
|
|
80
|
-
// to be escaped and line-broken by hand or it lands as raw markup.
|
|
81
|
-
const content = html || (text ? escapeHtml(text).replace(/\r?\n/g, "<br>") : "");
|
|
82
|
-
if (!content) return;
|
|
83
|
-
if (isTiny) { ne.execCommand("mceInsertContent", false, content); return; }
|
|
84
|
-
if (ne?.clipboard?.dangerouslyPasteHTML) {
|
|
85
|
-
const sel = ne.getSelection(true);
|
|
86
|
-
ne.clipboard.dangerouslyPasteHTML(sel?.index ?? 0, content);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
throw new Error("editor doesn't support paste");
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
expandToWord(ne);
|
|
93
|
-
let html = "";
|
|
94
|
-
let text = "";
|
|
95
|
-
if (isTiny) {
|
|
96
|
-
html = ne.selection.getContent({ format: "html" });
|
|
97
|
-
text = ne.selection.getContent({ format: "text" });
|
|
98
|
-
} else {
|
|
99
|
-
text = window.getSelection()?.toString() || "";
|
|
100
|
-
}
|
|
101
|
-
if (!text && !html) return;
|
|
102
|
-
if (html && typeof ClipboardItem === "function" && navigator.clipboard?.write) {
|
|
103
|
-
await navigator.clipboard.write([new ClipboardItem({
|
|
104
|
-
"text/html": new Blob([html], { type: "text/html" }),
|
|
105
|
-
"text/plain": new Blob([text], { type: "text/plain" }),
|
|
106
|
-
})]);
|
|
107
|
-
} else {
|
|
108
|
-
await navigator.clipboard.writeText(text);
|
|
109
|
-
}
|
|
110
|
-
if (id !== "cut") return;
|
|
111
|
-
if (isTiny) { ne.execCommand("Delete"); return; }
|
|
112
|
-
if (typeof ne?.deleteText === "function") {
|
|
113
|
-
const sel = ne.getSelection();
|
|
114
|
-
if (sel?.length) ne.deleteText(sel.index, sel.length);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
65
|
/** Bold / Italic / Underline / Strikethrough / Link / Clear formatting, acting
|
|
119
66
|
* on the selection or, with a collapsed caret, the word under it. */
|
|
120
67
|
export function runFormatCommand(ne: any, id: EditCommandId): void {
|
|
@@ -152,19 +99,12 @@ export function standardEditItems(
|
|
|
152
99
|
getEditor: () => any,
|
|
153
100
|
opts: { onError?: (msg: string) => void; showSource?: () => void } = {},
|
|
154
101
|
): Array<{ label: string; action: () => void; separator?: boolean }> {
|
|
155
|
-
const report = opts.onError || ((m: string) => console.warn(`[edit-commands] ${m}`));
|
|
156
|
-
const clip = (id: "cut" | "copy" | "paste") => () => {
|
|
157
|
-
void runClipboardCommand(getEditor(), id).catch((e: any) => {
|
|
158
|
-
const key = id === "cut" ? "Ctrl+X" : id === "copy" ? "Ctrl+C" : "Ctrl+V";
|
|
159
|
-
report(`${id[0].toUpperCase()}${id.slice(1)} failed: ${e?.message || e}. ${key} still works.`);
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
102
|
const fmt = (id: EditCommandId) => () => runFormatCommand(getEditor(), id);
|
|
103
|
+
// Clipboard block comes from the shared implementation — the same one the
|
|
104
|
+
// main window's menus use, so the two can't drift apart again.
|
|
163
105
|
const items: Array<{ label: string; action: () => void; separator?: boolean }> = [
|
|
164
106
|
{ label: "", action: () => { /* */ }, separator: true },
|
|
165
|
-
{
|
|
166
|
-
{ label: "Copy", action: clip("copy") },
|
|
167
|
-
{ label: "Paste", action: clip("paste") },
|
|
107
|
+
...editMenuItems({ engine: getEditor() }, { onError: opts.onError }),
|
|
168
108
|
{ label: "", action: () => { /* */ }, separator: true },
|
|
169
109
|
{ label: "Bold", action: fmt("bold") },
|
|
170
110
|
{ label: "Italic", action: fmt("italic") },
|
package/package.json
CHANGED