@social-mail/social-mail-client 1.2.87 → 1.2.89

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 (64) hide show
  1. package/component.js +6 -0
  2. package/dist/admin/AdminAppIndex.pack.js +142 -69
  3. package/dist/admin/AdminAppIndex.pack.js.map +1 -1
  4. package/dist/admin/AdminAppIndex.pack.min.js +9 -9
  5. package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
  6. package/dist/common/controls/html/InlineHtmlEditorWithToolbar.d.ts +3 -0
  7. package/dist/common/controls/html/InlineHtmlEditorWithToolbar.d.ts.map +1 -1
  8. package/dist/common/controls/html/InlineHtmlEditorWithToolbar.js +15 -1
  9. package/dist/common/controls/html/InlineHtmlEditorWithToolbar.js.map +1 -1
  10. package/dist/public/channel/BlogService.d.ts +1 -1
  11. package/dist/public/channel/BlogService.d.ts.map +1 -1
  12. package/dist/public/channel/BlogService.js +2 -2
  13. package/dist/public/channel/BlogService.js.map +1 -1
  14. package/dist/public/channel/ChannelMessageList.d.ts.map +1 -1
  15. package/dist/public/channel/ChannelMessageList.js +15 -2
  16. package/dist/public/channel/ChannelMessageList.js.map +1 -1
  17. package/dist/public/channel/ChannelView.pack.js +46 -32
  18. package/dist/public/channel/ChannelView.pack.js.map +1 -1
  19. package/dist/public/channel/ChannelView.pack.min.js +4 -4
  20. package/dist/public/channel/ChannelView.pack.min.js.map +1 -1
  21. package/dist/services/files/LocalFileService.js +1 -1
  22. package/dist/services/files/LocalFileService.js.map +1 -1
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/dist/web/AppIndex.pack.js +142 -69
  25. package/dist/web/AppIndex.pack.js.map +1 -1
  26. package/dist/web/AppIndex.pack.min.js +9 -9
  27. package/dist/web/AppIndex.pack.min.js.map +1 -1
  28. package/dist/web/page/mails/ComposeMailPage.d.ts.map +1 -1
  29. package/dist/web/page/mails/ComposeMailPage.js +5 -2
  30. package/dist/web/page/mails/ComposeMailPage.js.map +1 -1
  31. package/dist/web/page/mails/mini-compose/MiniComposeBox.d.ts +9 -2
  32. package/dist/web/page/mails/mini-compose/MiniComposeBox.d.ts.map +1 -1
  33. package/dist/web/page/mails/mini-compose/MiniComposeBox.js +89 -32
  34. package/dist/web/page/mails/mini-compose/MiniComposeBox.js.map +1 -1
  35. package/dist/web/page/mails/service/ConversationService.d.ts.map +1 -1
  36. package/dist/web/page/mails/service/ConversationService.js +10 -2
  37. package/dist/web/page/mails/service/ConversationService.js.map +1 -1
  38. package/index.js +6 -1
  39. package/node_modules/@web-atoms/core/dist/tsconfig.tsbuildinfo +1 -1
  40. package/node_modules/@web-atoms/core/dist/web/WebApp.d.ts +1 -0
  41. package/node_modules/@web-atoms/core/dist/web/WebApp.d.ts.map +1 -1
  42. package/node_modules/@web-atoms/core/dist/web/WebApp.js +3 -0
  43. package/node_modules/@web-atoms/core/dist/web/WebApp.js.map +1 -1
  44. package/node_modules/@web-atoms/core/package.json +1 -1
  45. package/node_modules/@web-atoms/core/src/web/WebApp.ts +6 -0
  46. package/node_modules/@web-atoms/module-loader/package.json +1 -1
  47. package/node_modules/@web-atoms/module-loader/umd/src/System.ts +3 -0
  48. package/node_modules/@web-atoms/module-loader/umd/src/UMDClass.ts +13 -27
  49. package/node_modules/@web-atoms/module-loader/umd.js +16 -26
  50. package/node_modules/@web-atoms/module-loader/umd.js.map +1 -1
  51. package/node_modules/@web-atoms/web-controls/dist/html-editor/InlineHtmlEditor.d.ts.map +1 -1
  52. package/node_modules/@web-atoms/web-controls/dist/html-editor/InlineHtmlEditor.js +3 -5
  53. package/node_modules/@web-atoms/web-controls/dist/html-editor/InlineHtmlEditor.js.map +1 -1
  54. package/node_modules/@web-atoms/web-controls/dist/tsconfig.tsbuildinfo +1 -1
  55. package/node_modules/@web-atoms/web-controls/package.json +1 -1
  56. package/node_modules/@web-atoms/web-controls/src/html-editor/InlineHtmlEditor.tsx +3 -9
  57. package/package.json +4 -4
  58. package/src/common/controls/html/InlineHtmlEditorWithToolbar.tsx +18 -2
  59. package/src/public/channel/BlogService.ts +2 -2
  60. package/src/public/channel/ChannelMessageList.tsx +16 -2
  61. package/src/services/files/LocalFileService.tsx +1 -1
  62. package/src/web/page/mails/ComposeMailPage.tsx +3 -0
  63. package/src/web/page/mails/mini-compose/MiniComposeBox.tsx +79 -18
  64. package/src/web/page/mails/service/ConversationService.tsx +10 -2
@@ -1828,6 +1828,9 @@ class System {
1828
1828
  setup = importsOrSetup;
1829
1829
  }
1830
1830
  const module = instance.get(name);
1831
+ if (module.isLoaded) {
1832
+ return;
1833
+ }
1831
1834
  module.dependencies.push(...imports.map((x) => instance.get(module.require.resolve(x))));
1832
1835
  module.isLoaded = true;
1833
1836
  const postResolve = new Promise((resolve, reject) => {
@@ -1928,17 +1931,12 @@ class UMDClass {
1928
1931
  AmdLoader.instance.get(path);
1929
1932
  const m = yield this.load(this.defaultApp, designMode);
1930
1933
  const app = ((_a = globalNS.webApp) !== null && _a !== void 0 ? _a : (globalNS.webApp = new (m.default)()));
1931
- app.onReady(() => __awaiter(this, void 0, void 0, function* () {
1932
- try {
1933
- const viewClass = yield AmdLoader.instance.import(path);
1934
- const view = new (viewClass.default)(app);
1935
- const element = typeof id === "string" ? document.getElementById(id) : id;
1936
- element.appendChild(view.element);
1937
- }
1938
- catch (e) {
1939
- console.error(e);
1940
- }
1941
- }));
1934
+ yield app.initPromise;
1935
+ const viewClass = yield AmdLoader.instance.import(path);
1936
+ const view = new (viewClass.default)(app);
1937
+ const element = typeof id === "string" ? document.getElementById(id) : id;
1938
+ element.appendChild(view.element);
1939
+ return view;
1942
1940
  }
1943
1941
  catch (e) {
1944
1942
  console.error(e);
@@ -1947,26 +1945,18 @@ class UMDClass {
1947
1945
  }
1948
1946
  loadView(path, designMode, appPath) {
1949
1947
  return __awaiter(this, void 0, void 0, function* () {
1948
+ var _a;
1950
1949
  try {
1951
1950
  this.mock = designMode;
1952
1951
  appPath = appPath || this.defaultApp;
1953
1952
  AmdLoader.instance.get(path);
1954
1953
  const m = yield this.load(appPath, designMode);
1955
- const app = new (m.default)();
1956
- return yield new Promise((resolve, reject) => {
1957
- app.onReady(() => __awaiter(this, void 0, void 0, function* () {
1958
- try {
1959
- const viewClass = yield AmdLoader.instance.import(path);
1960
- const view = new (viewClass.default)(app);
1961
- app.root = view;
1962
- resolve(view);
1963
- }
1964
- catch (e) {
1965
- console.error(e);
1966
- reject(e);
1967
- }
1968
- }));
1969
- });
1954
+ const app = ((_a = globalNS.webApp) !== null && _a !== void 0 ? _a : (globalNS.webApp = new (m.default)()));
1955
+ yield app.initPromise;
1956
+ const viewClass = yield AmdLoader.instance.import(path);
1957
+ const view = new (viewClass.default)(app);
1958
+ app.root = view;
1959
+ return view;
1970
1960
  }
1971
1961
  catch (er) {
1972
1962
  console.error(er);
@@ -18634,11 +18624,19 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/cor
18634
18624
  }
18635
18625
  msg.innerHTML = html;
18636
18626
  for (const iterator of descendentElementIterator(msg)) {
18637
- if (iterator.tagName === "IMG") {
18627
+ let cid = iterator.getAttribute("data-content-id");
18628
+ if (cid) {
18629
+ const a = mail.attachments.find(x => x.contentID === cid);
18630
+ if (a) {
18631
+ iterator.setAttribute("src", a.url);
18632
+ continue;
18633
+ }
18634
+ }
18635
+ if (/^(IMG|VIDEO)$/.test(iterator.tagName)) {
18638
18636
  const src = iterator.getAttribute("src");
18639
18637
  if (src) {
18640
18638
  if (src.startsWith("cid:")) {
18641
- const cid = src.substring(4);
18639
+ cid = src.substring(4);
18642
18640
  const a = mail.attachments.find(x => x.contentID === cid);
18643
18641
  if (a) {
18644
18642
  iterator.setAttribute("src", `/api/files/${a.appFileID}/${a.fileContentID}/${a.name}`);
@@ -19332,11 +19330,9 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
19332
19330
  }
19333
19331
  onContentSet() {
19334
19332
  var _a;
19335
- const start = (_a = Array.from(this.editor.querySelectorAll(this.editableSelector))) !== null && _a !== void 0 ? _a : [this.editor.firstElementChild];
19336
- if (start.length) {
19337
- for (const iterator of start) {
19338
- iterator.contentEditable = "true";
19339
- }
19333
+ const start = (_a = Array.from(this.editor.querySelectorAll(this.editableSelector))[0]) !== null && _a !== void 0 ? _a : this.editor.firstElementChild;
19334
+ if (start) {
19335
+ start.contentEditable = "true";
19340
19336
  }
19341
19337
  this.editor.dispatchEvent(new CustomEvent("contentReady", {
19342
19338
  detail: this.editor.innerHTML,
@@ -22178,7 +22174,7 @@ System.register(["tslib", "@web-atoms/core/dist/App", "@web-atoms/core/dist/core
22178
22174
  extra = JSON.parse(extra);
22179
22175
  }
22180
22176
  const sha256 = yield this.sha256(file);
22181
- if (extra.parentID) {
22177
+ if (extra === null || extra === void 0 ? void 0 : extra.parentID) {
22182
22178
  const existing = yield this.entityService.query(AppFile, "children", extra.parentID, folder ? folder + "/" + file.name : file.name, sha256).firstOrDefault();
22183
22179
  if (existing) {
22184
22180
  const {
@@ -22555,8 +22551,22 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/web-con
22555
22551
  _export("MailHtmlEditor", MailHtmlEditor = class MailHtmlEditor extends InlineHtmlEditor {
22556
22552
  constructor() {
22557
22553
  super(...arguments);
22554
+ this.files = [];
22555
+ this.attachments = [];
22558
22556
  this.autofocus = false;
22559
22557
  }
22558
+ onContentSet() {
22559
+ super.onContentSet();
22560
+ const files = this.attachments;
22561
+ const items = Array.from(this.editor.querySelectorAll(`*[data-content-id]`));
22562
+ for (const iterator of items) {
22563
+ const file = files.find(x => x.contentID === iterator.getAttribute("data-content-id"));
22564
+ if (!file) {
22565
+ continue;
22566
+ }
22567
+ iterator.setAttribute("src", file.url);
22568
+ }
22569
+ }
22560
22570
  onPasteEvent(e) {
22561
22571
  if (e.clipboardData.files.length) {
22562
22572
  e.preventDefault();
@@ -22582,7 +22592,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/web-con
22582
22592
  super.preCreate();
22583
22593
  this.element.className = css;
22584
22594
  this.sanitizeHtml = node => {
22585
- const images = Array.from(node.querySelectorAll(`img[data-content-id]`));
22595
+ const images = Array.from(node.querySelectorAll(`*[data-content-id]`));
22586
22596
  for (const image of images) {
22587
22597
  image.setAttribute("src", `cid:${image.getAttribute("data-content-id")}`);
22588
22598
  }
@@ -23858,7 +23868,8 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
23858
23868
  `.installGlobal("[data-html-editor=email-editor]");
23859
23869
  _export("default", ComposeMailPage = class ComposeMailPage extends PopupWindowPage {
23860
23870
  init() {
23861
- var _a, _b, _c;
23871
+ var _a, _b, _c, _d;
23872
+ var _e;
23862
23873
  return __awaiter(this, void 0, void 0, function* () {
23863
23874
  if (this.parameters.subject) {
23864
23875
  this.title = "Reply: " + this.parameters.subject;
@@ -23872,6 +23883,7 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
23872
23883
  recipients: [],
23873
23884
  attachments: []
23874
23885
  });
23886
+ (_c = (_e = this.model).attachments) !== null && _c !== void 0 ? _c : _e.attachments = [];
23875
23887
  if (this.parameters.social) {
23876
23888
  const senderName = this.parameters.mailbox.emailAddress.name;
23877
23889
  const senderEmail = this.parameters.mailbox.emailAddress.emailAddress;
@@ -23883,7 +23895,7 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
23883
23895
  if (this.parameters.emailAddress) {
23884
23896
  this.model.recipients.add(EmailRecipient.create({
23885
23897
  emailAddressText: this.parameters.emailAddress,
23886
- emailAddressID: (_c = this.parameters.emailAddressID) !== null && _c !== void 0 ? _c : void 0
23898
+ emailAddressID: (_d = this.parameters.emailAddressID) !== null && _d !== void 0 ? _d : void 0
23887
23899
  }));
23888
23900
  }
23889
23901
  this.renderer = XNode.create("div", null, XNode.create(Form, null, XNode.create(HorizontalFormField, {
@@ -23901,6 +23913,7 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
23901
23913
  "data-html-editor": "email-editor",
23902
23914
  presenter: Bind.presenter(c => this.editor = c),
23903
23915
  content: this.model.htmlBody,
23916
+ attachments: this.model.attachments,
23904
23917
  "style-min-height": "200px"
23905
23918
  }), XNode.create(AtomRepeater, {
23906
23919
  items: this.model.attachments,
@@ -26169,10 +26182,10 @@ System.register(["@web-atoms/core/dist/core/XNode", "@web-atoms/web-controls/dis
26169
26182
 
26170
26183
  AmdLoader.instance.setup("@social-mail/social-mail-client/dist/web/page/mails/mini-compose/Atttach");
26171
26184
 
26172
- System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/style/styled", "@web-atoms/core/dist/web/controls/AtomControl", "../../../../model/model", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dist/view-model/Action", "../../../../common/controls/audio/AudioRecorder", "../service/ConversationService", "@web-atoms/web-controls/dist/basic/AtomRepeater", "@web-atoms/core/dist/core/InjectProperty", "@web-atoms/core/dist/core/AtomBinder", "../../../../common/events/CommonEvents", "../service/MailService", "@web-atoms/date-time/dist/DateTime", "@web-atoms/core/dist/core/sleep", "../../../../common/controls/html/InlineHtmlEditorWithToolbar", "@web-atoms/web-controls/dist/html-editor/AtomHtmlEditor", "@web-atoms/web-controls/dist/html-editor/commands/Align", "@web-atoms/web-controls/dist/html-editor/commands/Bold", "@web-atoms/web-controls/dist/html-editor/commands/Italic", "@web-atoms/web-controls/dist/html-editor/commands/StrikeThrough", "@web-atoms/web-controls/dist/html-editor/commands/Underline", "@web-atoms/web-controls/dist/html-editor/commands/AddLink", "@web-atoms/web-controls/dist/html-editor/commands/Unlink", "@web-atoms/web-controls/dist/html-editor/commands/Separator", "./Insert", "@web-atoms/date-time/dist/TimeSpan", "./Atttach"], function (_export, _context) {
26185
+ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/style/styled", "@web-atoms/core/dist/web/controls/AtomControl", "../../../../model/model", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dist/view-model/Action", "../../../../common/controls/audio/AudioRecorder", "../service/ConversationService", "@web-atoms/web-controls/dist/basic/AtomRepeater", "@web-atoms/core/dist/core/InjectProperty", "../../../../common/events/CommonEvents", "../service/MailService", "@web-atoms/date-time/dist/DateTime", "@web-atoms/core/dist/core/sleep", "../../../../common/controls/html/InlineHtmlEditorWithToolbar", "@web-atoms/web-controls/dist/html-editor/AtomHtmlEditor", "@web-atoms/web-controls/dist/html-editor/commands/Align", "@web-atoms/web-controls/dist/html-editor/commands/Bold", "@web-atoms/web-controls/dist/html-editor/commands/Italic", "@web-atoms/web-controls/dist/html-editor/commands/StrikeThrough", "@web-atoms/web-controls/dist/html-editor/commands/Underline", "@web-atoms/web-controls/dist/html-editor/commands/AddLink", "@web-atoms/web-controls/dist/html-editor/commands/Unlink", "@web-atoms/web-controls/dist/html-editor/commands/Separator", "./Insert", "@web-atoms/date-time/dist/TimeSpan", "./Atttach"], function (_export, _context) {
26173
26186
  "use strict";
26174
26187
 
26175
- var __awaiter, __decorate, __metadata, XNode, styled, AtomControl, AppFile, Email, Bind, Action, AudioRecorder, ConversationService, AtomRepeater, InjectProperty, AtomBinder, CommonEvents, MailService, DateTime, sleep, MailHtmlEditor, Toolbar, Align, Bold, Italic, StrikeThrough, Underline, AddLink, Unlink, Separator, Insert, TimeSpan, Attach, MiniComposeBox, css;
26188
+ var __awaiter, __decorate, __metadata, XNode, styled, AtomControl, AppFile, Email, Bind, Action, AudioRecorder, ConversationService, AtomRepeater, InjectProperty, CommonEvents, MailService, DateTime, sleep, MailHtmlEditor, Toolbar, Align, Bold, Italic, StrikeThrough, Underline, AddLink, Unlink, Separator, Insert, TimeSpan, Attach, MiniComposeBox, css;
26176
26189
  _export("default", void 0);
26177
26190
  return {
26178
26191
  setters: [function (_tslib) {
@@ -26200,8 +26213,6 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
26200
26213
  AtomRepeater = _webAtomsWebControlsDistBasicAtomRepeater.default;
26201
26214
  }, function (_webAtomsCoreDistCoreInjectProperty) {
26202
26215
  InjectProperty = _webAtomsCoreDistCoreInjectProperty.default;
26203
- }, function (_webAtomsCoreDistCoreAtomBinder) {
26204
- AtomBinder = _webAtomsCoreDistCoreAtomBinder.AtomBinder;
26205
26216
  }, function (_commonEventsCommonEvents) {
26206
26217
  CommonEvents = _commonEventsCommonEvents.CommonEvents;
26207
26218
  }, function (_serviceMailService) {
@@ -26315,7 +26326,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
26315
26326
  "data-html-editor": "email-editor",
26316
26327
  presenter: Bind.presenter(c => this.editor = c),
26317
26328
  content: this.typedMessage,
26318
- "style-min-height": "50px"
26329
+ "style-min-height": "50px",
26330
+ attachments: Bind.oneWay(() => this.draft.attachments)
26319
26331
  }), XNode.create("i", {
26320
26332
  "data-element": "send",
26321
26333
  class: "fa-solid fa-microphone-lines mic",
@@ -26352,10 +26364,59 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
26352
26364
  extra
26353
26365
  }) {
26354
26366
  return __awaiter(this, void 0, void 0, function* () {
26355
- if (extra.insert) {}
26356
- this.addFiles(...files);
26367
+ if (extra.stream) {
26368
+ yield this.streamFiles({
26369
+ files,
26370
+ extra
26371
+ });
26372
+ return;
26373
+ }
26374
+ const size = files.reduce((pv, cv) => pv + cv.file.size, 0);
26375
+ if (size > 20 * 1024 * 1024) {
26376
+ if (!extra.stream) {
26377
+ throw new Error(`Total size of attachments cannot be more than 20MB.`);
26378
+ }
26379
+ }
26380
+ if (extra.insert) {
26381
+ this.ensureDraft();
26382
+ const firstChild = this.editor.editor.firstElementChild;
26383
+ for (const iterator of files) {
26384
+ if (/^image\//.test(iterator.contentType)) {
26385
+ const af = this.createAppFile(iterator);
26386
+ const img = firstChild.ownerDocument.createElement("img");
26387
+ img.src = iterator.url;
26388
+ img.setAttribute("data-content-id", af.contentID);
26389
+ this.draft.attachments.add(af);
26390
+ firstChild.appendChild(img);
26391
+ const newLine = document.createElement("div");
26392
+ newLine.appendChild(document.createElement("br"));
26393
+ firstChild.appendChild(newLine);
26394
+ continue;
26395
+ }
26396
+ if (/^(video|audio)\//.test(iterator.contentType)) {
26397
+ const af = this.createAppFile(iterator);
26398
+ const img = firstChild.ownerDocument.createElement("video");
26399
+ img.src = iterator.url;
26400
+ img.setAttribute("data-content-id", af.contentID);
26401
+ this.draft.attachments.add(af);
26402
+ firstChild.appendChild(img);
26403
+ const newLine = document.createElement("div");
26404
+ newLine.appendChild(document.createElement("br"));
26405
+ firstChild.appendChild(newLine);
26406
+ continue;
26407
+ }
26408
+ }
26409
+ return;
26410
+ }
26411
+ yield this.addFiles(...files);
26357
26412
  });
26358
26413
  }
26414
+ streamFiles({
26415
+ files,
26416
+ extra
26417
+ }) {
26418
+ return __awaiter(this, void 0, void 0, function* () {});
26419
+ }
26359
26420
  deleteAttachment(file) {
26360
26421
  var _a;
26361
26422
  return __awaiter(this, void 0, void 0, function* () {
@@ -26363,12 +26424,16 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
26363
26424
  (_a = this.draft) === null || _a === void 0 ? void 0 : _a.attachments.remove(file);
26364
26425
  });
26365
26426
  }
26366
- refreshDraft() {
26367
- var _a;
26427
+ recreateDraft() {
26428
+ var _a, _b;
26429
+ var _c;
26368
26430
  return __awaiter(this, void 0, void 0, function* () {
26431
+ this.draft = null;
26369
26432
  (_a = this.draft) !== null && _a !== void 0 ? _a : this.draft = Email.create({
26433
+ subject: "",
26370
26434
  attachments: []
26371
26435
  });
26436
+ (_b = (_c = this.draft).attachments) !== null && _b !== void 0 ? _b : _c.attachments = [];
26372
26437
  });
26373
26438
  }
26374
26439
  onChanged() {
@@ -26426,35 +26491,40 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
26426
26491
  });
26427
26492
  }
26428
26493
  sendAudioMessage() {
26429
- var _a;
26430
26494
  return __awaiter(this, void 0, void 0, function* () {
26431
26495
  const uploadedFile = yield AudioRecorder.show();
26432
- (_a = this.draft) !== null && _a !== void 0 ? _a : this.draft = Email.create({
26433
- attachments: []
26434
- });
26496
+ this.ensureDraft();
26435
26497
  this.draft.mdBody = this.typedMessage;
26436
- this.addFiles(uploadedFile);
26498
+ yield this.addFiles(uploadedFile);
26437
26499
  yield this.save();
26438
26500
  });
26439
26501
  }
26440
26502
  addFiles(...files) {
26441
- var _a;
26442
- var _b;
26443
- const attachments = (_a = (_b = this.draft).attachments) !== null && _a !== void 0 ? _a : _b.attachments = [];
26444
- AtomBinder.refreshValue(this, "draft");
26445
- for (const {
26446
- appFileID,
26447
- url,
26448
- file
26449
- } of files) {
26450
- attachments.add(AppFile.create({
26451
- appFileID,
26452
- contentType: file.type,
26453
- name: file.name,
26454
- contentID: appFileID.toString(36),
26455
- url
26456
- }));
26457
- }
26503
+ return __awaiter(this, void 0, void 0, function* () {
26504
+ this.ensureDraft();
26505
+ const attachments = this.draft.attachments;
26506
+ for (const file of files) {
26507
+ attachments.add(this.createAppFile(file));
26508
+ }
26509
+ });
26510
+ }
26511
+ createAppFile(file) {
26512
+ return AppFile.create({
26513
+ appFileID: file.appFileID,
26514
+ contentType: file.file.type,
26515
+ name: file.file.name,
26516
+ contentID: file.appFileID.toString(36),
26517
+ url: file.url
26518
+ });
26519
+ }
26520
+ ensureDraft() {
26521
+ var _a, _b;
26522
+ var _c;
26523
+ (_a = this.draft) !== null && _a !== void 0 ? _a : this.draft = Email.create({
26524
+ subject: "",
26525
+ attachments: []
26526
+ });
26527
+ (_b = (_c = this.draft).attachments) !== null && _b !== void 0 ? _b : _c.attachments = [];
26458
26528
  }
26459
26529
  save() {
26460
26530
  return __awaiter(this, void 0, void 0, function* () {
@@ -26475,7 +26545,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
26475
26545
  }), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], MiniComposeBox.prototype, "deleteAttachment", null);
26476
26546
  __decorate([Action({
26477
26547
  onEvent: CommonEvents.onDraftDeleted
26478
- }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MiniComposeBox.prototype, "refreshDraft", null);
26548
+ }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MiniComposeBox.prototype, "recreateDraft", null);
26479
26549
  __decorate([Action({
26480
26550
  onEvent: "input",
26481
26551
  defer: 500,
@@ -28437,6 +28507,9 @@ System.register(["../App", "../core/AtomOnce", "../core/AtomUri", "../di/Service
28437
28507
  this.url = new AtomUri(location.href);
28438
28508
  });
28439
28509
  });
28510
+ this.initPromise = new Promise((resolve, reject) => {
28511
+ this.onReady(resolve);
28512
+ });
28440
28513
  }
28441
28514
  updateDefaultStyle(textContent) {
28442
28515
  if (this.styleElement) {