@bobfrankston/rmfmail 1.2.198 → 1.2.199
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/compose/compose.bundle.js +49 -1
- package/client/compose/compose.bundle.js.map +3 -3
- package/client/compose/editor.js +34 -0
- package/client/compose/editor.js.map +1 -1
- package/client/compose/editor.ts +29 -0
- package/client/compose/paste-markdown.js +0 -0
- package/client/compose/paste-markdown.js.map +1 -1
- package/client/compose/paste-markdown.ts +0 -0
- package/client/package.json +1 -1
- package/package.json +9 -9
- /package/packages/mailx-imap/{node_modules.npmglobalize-stash-64668 → node_modules.npmglobalize-stash-58008}/.package-lock.json +0 -0
|
@@ -3593,8 +3593,30 @@ function wireMarkdownPaste(target, insertHtml) {
|
|
|
3593
3593
|
return;
|
|
3594
3594
|
if (cb.getData("text/html"))
|
|
3595
3595
|
return;
|
|
3596
|
-
|
|
3596
|
+
const fileItem = Array.from(cb.items).find((it) => it.kind === "file");
|
|
3597
|
+
if (fileItem) {
|
|
3598
|
+
const file = fileItem.getAsFile();
|
|
3599
|
+
const name = (file?.name || "").toLowerCase();
|
|
3600
|
+
const isMd = fileItem.type === "text/markdown" || name.endsWith(".md") || name.endsWith(".markdown");
|
|
3601
|
+
const isHtmlFile = fileItem.type === "text/html" || name.endsWith(".html") || name.endsWith(".htm");
|
|
3602
|
+
const isTxt = fileItem.type === "text/plain" || name.endsWith(".txt");
|
|
3603
|
+
if (file && (isMd || isHtmlFile || isTxt)) {
|
|
3604
|
+
e.preventDefault();
|
|
3605
|
+
e.stopImmediatePropagation();
|
|
3606
|
+
file.text().then((text) => {
|
|
3607
|
+
if (isMd)
|
|
3608
|
+
insertHtml(markdownToEmailHtml(text));
|
|
3609
|
+
else if (isHtmlFile || looksLikeHtml(text))
|
|
3610
|
+
insertHtml(sanitizeHtmlSource(text));
|
|
3611
|
+
else if (looksLikeMarkdown(text))
|
|
3612
|
+
insertHtml(markdownToEmailHtml(text));
|
|
3613
|
+
else
|
|
3614
|
+
insertHtml(esc(text).replace(/\r?\n/g, "<br>"));
|
|
3615
|
+
}).catch(() => {
|
|
3616
|
+
});
|
|
3617
|
+
}
|
|
3597
3618
|
return;
|
|
3619
|
+
}
|
|
3598
3620
|
const plain = cb.getData("text/plain");
|
|
3599
3621
|
if (!plain)
|
|
3600
3622
|
return;
|
|
@@ -3989,6 +4011,32 @@ function createQuillEditor(container2) {
|
|
|
3989
4011
|
return;
|
|
3990
4012
|
}
|
|
3991
4013
|
}
|
|
4014
|
+
for (const item of Array.from(cb.items)) {
|
|
4015
|
+
if (item.kind !== "file")
|
|
4016
|
+
continue;
|
|
4017
|
+
const file = item.getAsFile();
|
|
4018
|
+
if (!file)
|
|
4019
|
+
continue;
|
|
4020
|
+
const name = (file.name || "").toLowerCase();
|
|
4021
|
+
const isMd = item.type === "text/markdown" || name.endsWith(".md") || name.endsWith(".markdown");
|
|
4022
|
+
const isHtmlFile = item.type === "text/html" || name.endsWith(".html") || name.endsWith(".htm");
|
|
4023
|
+
const isTxt = item.type === "text/plain" || name.endsWith(".txt");
|
|
4024
|
+
if (!isMd && !isHtmlFile && !isTxt)
|
|
4025
|
+
continue;
|
|
4026
|
+
consume();
|
|
4027
|
+
file.text().then((text) => {
|
|
4028
|
+
const html2 = isMd ? markdownToEmailHtml(text) : isHtmlFile ? sanitizeHtmlSource(text) : looksLikeHtml(text) ? sanitizeHtmlSource(text) : looksLikeMarkdown(text) ? markdownToEmailHtml(text) : null;
|
|
4029
|
+
const range = q.getSelection(true) || { index: q.getLength(), length: 0 };
|
|
4030
|
+
if (range.length > 0)
|
|
4031
|
+
q.deleteText(range.index, range.length);
|
|
4032
|
+
if (html2 !== null)
|
|
4033
|
+
q.clipboard.dangerouslyPasteHTML(range.index, html2);
|
|
4034
|
+
else
|
|
4035
|
+
q.insertText(range.index, text);
|
|
4036
|
+
}).catch(() => {
|
|
4037
|
+
});
|
|
4038
|
+
return;
|
|
4039
|
+
}
|
|
3992
4040
|
const html = cb.getData("text/html");
|
|
3993
4041
|
const plain = cb.getData("text/plain");
|
|
3994
4042
|
if (html) {
|