@postalsys/ee-client 1.5.0 → 1.6.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.
- package/README.md +8 -1
- package/index.js +55 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -157,7 +157,7 @@ Load a page of messages from a folder. Pass `nextPageCursor` / `prevPageCursor`
|
|
|
157
157
|
|
|
158
158
|
### `loadMessage(messageId: string): Promise<Message>`
|
|
159
159
|
|
|
160
|
-
Load a single message. HTML is requested with `webSafeHtml=true`, so EmailEngine returns it pre-processed with inline images embedded for safe display, and the message is marked as seen.
|
|
160
|
+
Load a single message. HTML is requested with `webSafeHtml=true`, so EmailEngine returns it pre-processed with inline images embedded for safe display, and the message is marked as seen. Web-safe HTML also folds quoted thread history (reply history, forwarded content, disclaimers) into a `<details class="ee-collapsed-thread">` element - see [Quoted thread history](#quoted-thread-history).
|
|
161
161
|
|
|
162
162
|
### `markAsRead(messageId: string, seen?: boolean): Promise<boolean>`
|
|
163
163
|
|
|
@@ -204,9 +204,16 @@ When a `container` is provided the client builds a full webmail interface:
|
|
|
204
204
|
- Folder tree with special-folder ordering (Inbox, Drafts, Sent, Trash, Junk, Archive) and nested folders
|
|
205
205
|
- Paginated message list with a selectable page size (persisted to `localStorage`)
|
|
206
206
|
- Message viewer with mark read/unread, delete, move-to-folder, download original, and attachment downloads
|
|
207
|
+
- Quoted thread history collapsed behind a "Show quoted text" control
|
|
207
208
|
- Compose modal (floating button) for sending plain-text mail
|
|
208
209
|
- Dark mode toggle with the preference persisted to `localStorage`
|
|
209
210
|
|
|
211
|
+
### Quoted thread history
|
|
212
|
+
|
|
213
|
+
EmailEngine's web-safe HTML wraps the quoted tail of a reply - reply history, forwarded content, disclaimers - in a single `<details class="ee-collapsed-thread">` element with an empty `<summary class="ee-collapsed-thread-toggle">`, leaving the label to the renderer. The message viewer labels that summary ("Show quoted text" / "Hide quoted text") and styles it as a button, so only what the sender actually wrote is visible until the reader asks for the rest. Messages with no quoted tail carry no such element and render unchanged.
|
|
214
|
+
|
|
215
|
+
Operators can turn the folding off server side with `EENGINE_DISABLE_THREAD_COLLAPSE=true`; older EmailEngine versions simply never emit the element.
|
|
216
|
+
|
|
210
217
|
### Custom dialogs
|
|
211
218
|
|
|
212
219
|
Provide `confirmMethod` and `alertMethod` to route confirmations and alerts through your own modal system instead of the browser defaults - useful when integrating with a UI framework:
|
package/index.js
CHANGED
|
@@ -488,10 +488,11 @@ export class EmailEngineClient {
|
|
|
488
488
|
const style = document.createElement('style');
|
|
489
489
|
style.textContent = `
|
|
490
490
|
.ee-client {
|
|
491
|
+
--ee-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
491
492
|
display: flex;
|
|
492
493
|
height: 100%;
|
|
493
494
|
min-height: 400px;
|
|
494
|
-
font-family: -
|
|
495
|
+
font-family: var(--ee-font);
|
|
495
496
|
font-size: 14px;
|
|
496
497
|
line-height: 1.5;
|
|
497
498
|
color: #333;
|
|
@@ -685,7 +686,8 @@ export class EmailEngineClient {
|
|
|
685
686
|
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
|
686
687
|
}
|
|
687
688
|
|
|
688
|
-
.ee-button
|
|
689
|
+
.ee-button,
|
|
690
|
+
.ee-collapsed-thread-toggle {
|
|
689
691
|
padding: 4px 10px;
|
|
690
692
|
border: 1px solid #ddd;
|
|
691
693
|
background: white;
|
|
@@ -702,7 +704,8 @@ export class EmailEngineClient {
|
|
|
702
704
|
height: 24px;
|
|
703
705
|
}
|
|
704
706
|
|
|
705
|
-
.ee-button:hover:not(:disabled)
|
|
707
|
+
.ee-button:hover:not(:disabled),
|
|
708
|
+
.ee-collapsed-thread-toggle:hover {
|
|
706
709
|
background: #f0f0f0;
|
|
707
710
|
}
|
|
708
711
|
|
|
@@ -744,7 +747,30 @@ export class EmailEngineClient {
|
|
|
744
747
|
max-width: 100%;
|
|
745
748
|
height: auto;
|
|
746
749
|
}
|
|
747
|
-
|
|
750
|
+
|
|
751
|
+
/* Quoted thread history, folded away by EmailEngine - see _labelCollapsedThreads() */
|
|
752
|
+
.ee-collapsed-thread {
|
|
753
|
+
margin-top: 12px;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
.ee-collapsed-thread-toggle {
|
|
757
|
+
display: inline-block;
|
|
758
|
+
height: auto;
|
|
759
|
+
/* The message brings its own fonts along; the control keeps the client's */
|
|
760
|
+
font-family: var(--ee-font);
|
|
761
|
+
user-select: none;
|
|
762
|
+
list-style: none;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/* Same, for Safari before it supported list-style on a summary */
|
|
766
|
+
.ee-collapsed-thread-toggle::-webkit-details-marker {
|
|
767
|
+
display: none;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
.ee-collapsed-thread[open] > .ee-collapsed-thread-toggle {
|
|
771
|
+
margin-bottom: 12px;
|
|
772
|
+
}
|
|
773
|
+
|
|
748
774
|
.ee-attachments {
|
|
749
775
|
margin-top: 16px;
|
|
750
776
|
padding-top: 16px;
|
|
@@ -1184,13 +1210,15 @@ export class EmailEngineClient {
|
|
|
1184
1210
|
border-color: #333;
|
|
1185
1211
|
}
|
|
1186
1212
|
|
|
1187
|
-
.ee-dark-mode .ee-button
|
|
1213
|
+
.ee-dark-mode .ee-button,
|
|
1214
|
+
.ee-dark-mode .ee-collapsed-thread-toggle {
|
|
1188
1215
|
background: #333;
|
|
1189
1216
|
border-color: #444;
|
|
1190
1217
|
color: #e0e0e0;
|
|
1191
1218
|
}
|
|
1192
1219
|
|
|
1193
|
-
.ee-dark-mode .ee-button:hover
|
|
1220
|
+
.ee-dark-mode .ee-button:hover,
|
|
1221
|
+
.ee-dark-mode .ee-collapsed-thread-toggle:hover {
|
|
1194
1222
|
background: #444;
|
|
1195
1223
|
border-color: #555;
|
|
1196
1224
|
}
|
|
@@ -1610,6 +1638,8 @@ export class EmailEngineClient {
|
|
|
1610
1638
|
`;
|
|
1611
1639
|
viewer.innerHTML = html;
|
|
1612
1640
|
|
|
1641
|
+
this._labelCollapsedThreads(viewer);
|
|
1642
|
+
|
|
1613
1643
|
viewer.querySelector('[data-action="toggle-read"]').addEventListener('click', () => {
|
|
1614
1644
|
const currentlyUnseen = msg.unseen;
|
|
1615
1645
|
this.markAsRead(msg.id, currentlyUnseen);
|
|
@@ -1650,6 +1680,25 @@ export class EmailEngineClient {
|
|
|
1650
1680
|
// Message content scrolling is now handled in loadMessage method
|
|
1651
1681
|
}
|
|
1652
1682
|
|
|
1683
|
+
// EmailEngine's web-safe HTML folds quoted thread history (reply history, forwarded content,
|
|
1684
|
+
// disclaimers) into a <details class="ee-collapsed-thread"> whose <summary> it leaves empty on
|
|
1685
|
+
// purpose, for the renderer to label. The fold is closed until the reader opens it.
|
|
1686
|
+
//
|
|
1687
|
+
// A sender can put the same markup in their own HTML - it survives sanitization - so every
|
|
1688
|
+
// match is relabelled rather than trusted, and the control always reads as one of these two
|
|
1689
|
+
// labels instead of whatever text came with the message.
|
|
1690
|
+
_labelCollapsedThreads(viewer) {
|
|
1691
|
+
viewer.querySelectorAll('details.ee-collapsed-thread > summary.ee-collapsed-thread-toggle').forEach(toggle => {
|
|
1692
|
+
const details = toggle.parentElement;
|
|
1693
|
+
const applyLabel = () => {
|
|
1694
|
+
toggle.textContent = details.open ? 'Hide quoted text' : 'Show quoted text';
|
|
1695
|
+
};
|
|
1696
|
+
|
|
1697
|
+
applyLabel();
|
|
1698
|
+
details.addEventListener('toggle', applyLabel);
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1653
1702
|
createLayout() {
|
|
1654
1703
|
if (typeof document === 'undefined' || !this.container) {
|
|
1655
1704
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postalsys/ee-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "EmailEngine client library for browser and Node.js applications",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"node": ">=14.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"eslint": "^8.57.
|
|
46
|
-
"prettier": "^3.
|
|
45
|
+
"eslint": "^8.57.1",
|
|
46
|
+
"prettier": "^3.9.5"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"node-fetch": "^3.0.0"
|