@social-mail/social-mail-client 1.2.417 → 1.2.419

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.
@@ -41460,7 +41460,6 @@ System.register([], function (_export, _context) {
41460
41460
  setTimeout(() => document.body.contentEditable = "true", 0);
41461
41461
  });
41462
41462
  setTimeout(() => {
41463
- editor.commit();
41464
41463
  document.body.querySelectorAll("*").forEach(e => e.draggable = true);
41465
41464
  }, 100);
41466
41465
  }
@@ -46453,6 +46452,9 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
46453
46452
  const lastHtml = this.lastHtml;
46454
46453
  const clone = this.htmlDocument.documentElement.cloneNode(true);
46455
46454
  const currentHtml = clone.innerHTML;
46455
+ if (lastHtml === currentHtml) {
46456
+ return;
46457
+ }
46456
46458
  const body = clone.querySelector("body");
46457
46459
  body.removeAttribute("contentEditable");
46458
46460
  body.removeAttribute("editing");
@@ -46501,9 +46503,6 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
46501
46503
  this.lastCommittedBody = body.innerHTML;
46502
46504
  return;
46503
46505
  }
46504
- if (lastHtml === currentHtml) {
46505
- return;
46506
- }
46507
46506
  this.undoList.add(this.lastHtml);
46508
46507
  this.lastHtml = currentHtml;
46509
46508
  this.lastCommittedHtml = clone.outerHTML;
@@ -46519,14 +46518,24 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
46519
46518
  }, 100);
46520
46519
  }
46521
46520
  undo() {
46521
+ if (!this.undoList.length) {
46522
+ return;
46523
+ }
46522
46524
  this.redoList.insert(this.redoList.length, this.htmlDocument.documentElement.innerHTML);
46523
- this.htmlDocument.documentElement.innerHTML = this.undoList.removeAt(this.undoList.length - 1);
46525
+ const lastHtml = this.undoList.pop();
46526
+ this.htmlDocument.documentElement.innerHTML = lastHtml;
46527
+ this.lastHtml = lastHtml;
46524
46528
  this.htmlDocument.body.contentEditable = "true";
46525
46529
  this.htmlDocument.body.setAttribute("editing", "true");
46526
46530
  }
46527
46531
  redo() {
46532
+ if (!this.redoList.length) {
46533
+ return;
46534
+ }
46528
46535
  this.undoList.insert(this.undoList.length, this.htmlDocument.documentElement.innerHTML);
46529
- this.htmlDocument.documentElement.innerHTML = this.redoList.removeAt(this.redoList.length - 1);
46536
+ const lastHtml = this.redoList.pop();
46537
+ this.htmlDocument.documentElement.innerHTML = lastHtml;
46538
+ this.lastHtml = lastHtml;
46530
46539
  this.htmlDocument.body.contentEditable = "true";
46531
46540
  this.htmlDocument.body.setAttribute("editing", "true");
46532
46541
  }
@@ -46550,7 +46559,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
46550
46559
  if (previous !== this.htmlDocument.body) {
46551
46560
  previous.removeAttribute("contentEditable");
46552
46561
  }
46553
- this.commit();
46562
+ this.queueCommit();
46554
46563
  }
46555
46564
  e.preventDefault();
46556
46565
  this.setSelection(target);
@@ -46611,6 +46620,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
46611
46620
  }
46612
46621
  }
46613
46622
  });
46623
+ this.htmlDocument.addEventListener("input", () => this.queueCommit());
46614
46624
  InstallDragDropHelper(this);
46615
46625
  this.htmlDocument.close();
46616
46626
  EditorCustomElements.register(this.htmlDocument);
@@ -46631,6 +46641,13 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
46631
46641
  }, 10);
46632
46642
  }));
46633
46643
  }
46644
+ queueCommit() {
46645
+ const id = this.lastCommitTimerID;
46646
+ if (id) {
46647
+ clearTimeout(id);
46648
+ }
46649
+ this.lastCommitTimerID = setTimeout(() => this.commit(), 1000);
46650
+ }
46634
46651
  setStylerSheet() {
46635
46652
  return __awaiter(this, void 0, void 0, function* () {
46636
46653
  const document = this.htmlDocument;