@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.
@@ -46415,7 +46415,6 @@ System.register([], function (_export, _context) {
46415
46415
  setTimeout(() => document.body.contentEditable = "true", 0);
46416
46416
  });
46417
46417
  setTimeout(() => {
46418
- editor.commit();
46419
46418
  document.body.querySelectorAll("*").forEach(e => e.draggable = true);
46420
46419
  }, 100);
46421
46420
  }
@@ -51408,6 +51407,9 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
51408
51407
  const lastHtml = this.lastHtml;
51409
51408
  const clone = this.htmlDocument.documentElement.cloneNode(true);
51410
51409
  const currentHtml = clone.innerHTML;
51410
+ if (lastHtml === currentHtml) {
51411
+ return;
51412
+ }
51411
51413
  const body = clone.querySelector("body");
51412
51414
  body.removeAttribute("contentEditable");
51413
51415
  body.removeAttribute("editing");
@@ -51456,9 +51458,6 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
51456
51458
  this.lastCommittedBody = body.innerHTML;
51457
51459
  return;
51458
51460
  }
51459
- if (lastHtml === currentHtml) {
51460
- return;
51461
- }
51462
51461
  this.undoList.add(this.lastHtml);
51463
51462
  this.lastHtml = currentHtml;
51464
51463
  this.lastCommittedHtml = clone.outerHTML;
@@ -51474,14 +51473,24 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
51474
51473
  }, 100);
51475
51474
  }
51476
51475
  undo() {
51476
+ if (!this.undoList.length) {
51477
+ return;
51478
+ }
51477
51479
  this.redoList.insert(this.redoList.length, this.htmlDocument.documentElement.innerHTML);
51478
- this.htmlDocument.documentElement.innerHTML = this.undoList.removeAt(this.undoList.length - 1);
51480
+ const lastHtml = this.undoList.pop();
51481
+ this.htmlDocument.documentElement.innerHTML = lastHtml;
51482
+ this.lastHtml = lastHtml;
51479
51483
  this.htmlDocument.body.contentEditable = "true";
51480
51484
  this.htmlDocument.body.setAttribute("editing", "true");
51481
51485
  }
51482
51486
  redo() {
51487
+ if (!this.redoList.length) {
51488
+ return;
51489
+ }
51483
51490
  this.undoList.insert(this.undoList.length, this.htmlDocument.documentElement.innerHTML);
51484
- this.htmlDocument.documentElement.innerHTML = this.redoList.removeAt(this.redoList.length - 1);
51491
+ const lastHtml = this.redoList.pop();
51492
+ this.htmlDocument.documentElement.innerHTML = lastHtml;
51493
+ this.lastHtml = lastHtml;
51485
51494
  this.htmlDocument.body.contentEditable = "true";
51486
51495
  this.htmlDocument.body.setAttribute("editing", "true");
51487
51496
  }
@@ -51505,7 +51514,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
51505
51514
  if (previous !== this.htmlDocument.body) {
51506
51515
  previous.removeAttribute("contentEditable");
51507
51516
  }
51508
- this.commit();
51517
+ this.queueCommit();
51509
51518
  }
51510
51519
  e.preventDefault();
51511
51520
  this.setSelection(target);
@@ -51566,6 +51575,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
51566
51575
  }
51567
51576
  }
51568
51577
  });
51578
+ this.htmlDocument.addEventListener("input", () => this.queueCommit());
51569
51579
  InstallDragDropHelper(this);
51570
51580
  this.htmlDocument.close();
51571
51581
  EditorCustomElements.register(this.htmlDocument);
@@ -51586,6 +51596,13 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
51586
51596
  }, 10);
51587
51597
  }));
51588
51598
  }
51599
+ queueCommit() {
51600
+ const id = this.lastCommitTimerID;
51601
+ if (id) {
51602
+ clearTimeout(id);
51603
+ }
51604
+ this.lastCommitTimerID = setTimeout(() => this.commit(), 1000);
51605
+ }
51589
51606
  setStylerSheet() {
51590
51607
  return __awaiter(this, void 0, void 0, function* () {
51591
51608
  const document = this.htmlDocument;