@social-mail/social-mail-client 1.2.87 → 1.2.88
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/dist/admin/AdminAppIndex.pack.js +123 -43
- package/dist/admin/AdminAppIndex.pack.js.map +1 -1
- package/dist/admin/AdminAppIndex.pack.min.js +7 -7
- package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
- package/dist/common/controls/html/InlineHtmlEditorWithToolbar.d.ts +3 -0
- package/dist/common/controls/html/InlineHtmlEditorWithToolbar.d.ts.map +1 -1
- package/dist/common/controls/html/InlineHtmlEditorWithToolbar.js +15 -1
- package/dist/common/controls/html/InlineHtmlEditorWithToolbar.js.map +1 -1
- package/dist/public/channel/ChannelView.pack.js +10 -2
- package/dist/public/channel/ChannelView.pack.js.map +1 -1
- package/dist/public/channel/ChannelView.pack.min.js +1 -1
- package/dist/public/channel/ChannelView.pack.min.js.map +1 -1
- package/dist/services/files/LocalFileService.js +1 -1
- package/dist/services/files/LocalFileService.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/web/AppIndex.pack.js +123 -43
- package/dist/web/AppIndex.pack.js.map +1 -1
- package/dist/web/AppIndex.pack.min.js +7 -7
- package/dist/web/AppIndex.pack.min.js.map +1 -1
- package/dist/web/page/mails/ComposeMailPage.d.ts.map +1 -1
- package/dist/web/page/mails/ComposeMailPage.js +5 -2
- package/dist/web/page/mails/ComposeMailPage.js.map +1 -1
- package/dist/web/page/mails/mini-compose/MiniComposeBox.d.ts +9 -2
- package/dist/web/page/mails/mini-compose/MiniComposeBox.d.ts.map +1 -1
- package/dist/web/page/mails/mini-compose/MiniComposeBox.js +89 -32
- package/dist/web/page/mails/mini-compose/MiniComposeBox.js.map +1 -1
- package/dist/web/page/mails/service/ConversationService.d.ts.map +1 -1
- package/dist/web/page/mails/service/ConversationService.js +10 -2
- package/dist/web/page/mails/service/ConversationService.js.map +1 -1
- package/node_modules/@web-atoms/web-controls/dist/html-editor/InlineHtmlEditor.d.ts.map +1 -1
- package/node_modules/@web-atoms/web-controls/dist/html-editor/InlineHtmlEditor.js +3 -5
- package/node_modules/@web-atoms/web-controls/dist/html-editor/InlineHtmlEditor.js.map +1 -1
- package/node_modules/@web-atoms/web-controls/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@web-atoms/web-controls/package.json +1 -1
- package/node_modules/@web-atoms/web-controls/src/html-editor/InlineHtmlEditor.tsx +3 -9
- package/package.json +2 -2
- package/src/common/controls/html/InlineHtmlEditorWithToolbar.tsx +18 -2
- package/src/services/files/LocalFileService.tsx +1 -1
- package/src/web/page/mails/ComposeMailPage.tsx +3 -0
- package/src/web/page/mails/mini-compose/MiniComposeBox.tsx +79 -18
- package/src/web/page/mails/service/ConversationService.tsx +10 -2
|
@@ -29,6 +29,7 @@ import Insert from "./Insert";
|
|
|
29
29
|
import TimeSpan from "@web-atoms/date-time/dist/TimeSpan";
|
|
30
30
|
import ToggleEmoji from "./ToggleEmoji";
|
|
31
31
|
import Attach from "./Atttach";
|
|
32
|
+
import PopupService from "@web-atoms/core/dist/web/services/PopupService";
|
|
32
33
|
|
|
33
34
|
const css = styled.css `
|
|
34
35
|
display: grid;
|
|
@@ -143,6 +144,7 @@ export default class MiniComposeBox extends AtomControl {
|
|
|
143
144
|
presenter={Bind.presenter((c) => this.editor = c )}
|
|
144
145
|
content={this.typedMessage}
|
|
145
146
|
style-min-height="50px"
|
|
147
|
+
attachments={Bind.oneWay(() => this.draft.attachments)}
|
|
146
148
|
/>
|
|
147
149
|
<i
|
|
148
150
|
data-element="send"
|
|
@@ -174,11 +176,57 @@ export default class MiniComposeBox extends AtomControl {
|
|
|
174
176
|
}
|
|
175
177
|
|
|
176
178
|
@Action({ onEvent: "filesAvailable"})
|
|
177
|
-
async filesAvailable({ files, extra }) {
|
|
179
|
+
async filesAvailable({ files, extra }: { files: IUploadedFile[], extra: any }) {
|
|
180
|
+
|
|
181
|
+
if (extra.stream) {
|
|
182
|
+
await this.streamFiles({ files, extra });
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const size = files.reduce((pv, cv) => pv + cv.file.size , 0);
|
|
187
|
+
if (size > 20*1024*1024) {
|
|
188
|
+
if (!extra.stream) {
|
|
189
|
+
throw new Error(`Total size of attachments cannot be more than 20MB.`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
178
193
|
if (extra.insert) {
|
|
194
|
+
this.ensureDraft();
|
|
179
195
|
// insert into the email..
|
|
196
|
+
const firstChild = this.editor.editor.firstElementChild;
|
|
197
|
+
for (const iterator of files) {
|
|
198
|
+
if (/^image\//.test(iterator.contentType)) {
|
|
199
|
+
const af = this.createAppFile(iterator);
|
|
200
|
+
const img = firstChild.ownerDocument.createElement("img");
|
|
201
|
+
img.src = iterator.url;
|
|
202
|
+
img.setAttribute("data-content-id", af.contentID);
|
|
203
|
+
this.draft.attachments.add(af);
|
|
204
|
+
firstChild.appendChild(img);
|
|
205
|
+
const newLine = document.createElement("div");
|
|
206
|
+
newLine.appendChild(document.createElement("br"));
|
|
207
|
+
firstChild.appendChild(newLine);
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (/^(video|audio)\//.test(iterator.contentType)) {
|
|
211
|
+
const af = this.createAppFile(iterator);
|
|
212
|
+
const img = firstChild.ownerDocument.createElement("video");
|
|
213
|
+
img.src = iterator.url;
|
|
214
|
+
img.setAttribute("data-content-id", af.contentID);
|
|
215
|
+
this.draft.attachments.add(af);
|
|
216
|
+
firstChild.appendChild(img);
|
|
217
|
+
const newLine = document.createElement("div");
|
|
218
|
+
newLine.appendChild(document.createElement("br"));
|
|
219
|
+
firstChild.appendChild(newLine);
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return;
|
|
180
224
|
}
|
|
181
|
-
this.addFiles(... files);
|
|
225
|
+
await this.addFiles(... files);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
async streamFiles({ files, extra }: { files: IUploadedFile[], extra: any }) {
|
|
229
|
+
// do nothing...
|
|
182
230
|
}
|
|
183
231
|
|
|
184
232
|
@Action({
|
|
@@ -191,10 +239,13 @@ export default class MiniComposeBox extends AtomControl {
|
|
|
191
239
|
}
|
|
192
240
|
|
|
193
241
|
@Action({ onEvent: CommonEvents.onDraftDeleted })
|
|
194
|
-
async
|
|
242
|
+
async recreateDraft() {
|
|
243
|
+
this.draft = null;
|
|
195
244
|
this.draft ??= Email.create({
|
|
245
|
+
subject: "",
|
|
196
246
|
attachments: []
|
|
197
247
|
});
|
|
248
|
+
this.draft.attachments ??= [];
|
|
198
249
|
}
|
|
199
250
|
|
|
200
251
|
@Action({ onEvent: "input", defer: 500, blockMultipleExecution: true })
|
|
@@ -250,28 +301,38 @@ export default class MiniComposeBox extends AtomControl {
|
|
|
250
301
|
@Action({})
|
|
251
302
|
async sendAudioMessage() {
|
|
252
303
|
const uploadedFile = await AudioRecorder.show<IUploadedFile>();
|
|
253
|
-
this.
|
|
254
|
-
attachments: []
|
|
255
|
-
});
|
|
304
|
+
this.ensureDraft();
|
|
256
305
|
this.draft.mdBody = this.typedMessage;
|
|
257
|
-
this.addFiles(uploadedFile);
|
|
306
|
+
await this.addFiles(uploadedFile);
|
|
258
307
|
await this.save();
|
|
259
308
|
}
|
|
260
309
|
|
|
261
|
-
private addFiles(... files: IUploadedFile[]) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
for (const
|
|
265
|
-
attachments.add(
|
|
266
|
-
appFileID,
|
|
267
|
-
contentType: file.type,
|
|
268
|
-
name: file.name,
|
|
269
|
-
contentID: appFileID.toString(36),
|
|
270
|
-
url
|
|
271
|
-
}));
|
|
310
|
+
private async addFiles(... files: IUploadedFile[]) {
|
|
311
|
+
this.ensureDraft();
|
|
312
|
+
const attachments = this.draft.attachments;
|
|
313
|
+
for (const file of files) {
|
|
314
|
+
attachments.add(this.createAppFile(file));
|
|
272
315
|
}
|
|
273
316
|
}
|
|
274
317
|
|
|
318
|
+
private createAppFile(file: IUploadedFile): IAppFile {
|
|
319
|
+
return AppFile.create({
|
|
320
|
+
appFileID: file.appFileID,
|
|
321
|
+
contentType: file.file.type,
|
|
322
|
+
name: file.file.name,
|
|
323
|
+
contentID: file.appFileID.toString(36),
|
|
324
|
+
url: file.url
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
private ensureDraft() {
|
|
329
|
+
this.draft ??= Email.create({
|
|
330
|
+
subject: "",
|
|
331
|
+
attachments: []
|
|
332
|
+
});
|
|
333
|
+
this.draft.attachments ??= [];
|
|
334
|
+
}
|
|
335
|
+
|
|
275
336
|
private async save() {
|
|
276
337
|
this.draft = await this.conversationService.draft({ ... this.mailboxContact, email: this.draft }, true);
|
|
277
338
|
}
|
|
@@ -34,11 +34,19 @@ export const renderMail = AtomControl.registerProperty("data-html", "html", (c,
|
|
|
34
34
|
}
|
|
35
35
|
msg.innerHTML = html;
|
|
36
36
|
for (const iterator of descendentElementIterator(msg)) {
|
|
37
|
-
|
|
37
|
+
let cid = iterator.getAttribute("data-content-id");
|
|
38
|
+
if (cid) {
|
|
39
|
+
const a = mail.attachments.find((x) => x.contentID === cid);
|
|
40
|
+
if (a) {
|
|
41
|
+
iterator.setAttribute("src", a.url);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if(/^(IMG|VIDEO)$/.test(iterator.tagName)) {
|
|
38
46
|
const src = iterator.getAttribute("src");
|
|
39
47
|
if (src) {
|
|
40
48
|
if (src.startsWith("cid:")) {
|
|
41
|
-
|
|
49
|
+
cid = src.substring(4);
|
|
42
50
|
const a = mail.attachments.find((x) => x.contentID === cid);
|
|
43
51
|
if (a) {
|
|
44
52
|
iterator.setAttribute("src", `/api/files/${a.appFileID}/${a.fileContentID}/${a.name}`);
|