@social-mail/social-mail-client 1.2.292 → 1.2.293

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.
@@ -48737,8 +48737,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
48737
48737
  mobileWidth = 480;
48738
48738
  _export("default", HtmlPageEditor = class HtmlPageEditor extends AtomControl {
48739
48739
  get htmlPage() {
48740
- var _a, _b;
48741
- return (_b = (_a = this.htmlDocument) === null || _a === void 0 ? void 0 : _a.documentElement) === null || _b === void 0 ? void 0 : _b.outerHTML;
48740
+ var _a, _b, _c;
48741
+ return (_a = this.lastCommittedHtml) !== null && _a !== void 0 ? _a : (_c = (_b = this.htmlDocument) === null || _b === void 0 ? void 0 : _b.documentElement) === null || _c === void 0 ? void 0 : _c.outerHTML;
48742
48742
  }
48743
48743
  set htmlPage(v) {
48744
48744
  if (!this.element) {
@@ -48779,6 +48779,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
48779
48779
  this.undoList = [];
48780
48780
  this.redoList = [];
48781
48781
  this.pageVariables = [];
48782
+ this.lastCommittedHtml = null;
48783
+ this.lastCommittedBody = null;
48782
48784
  this.hover = new SelectedElement(this);
48783
48785
  this.dropTarget = new SelectedElement(this);
48784
48786
  this.maxWidth = desktopWidth;
@@ -49099,16 +49101,6 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
49099
49101
  componentScript.src = UMD.resolvePath("@social-mail/social-mail-client/component.js");
49100
49102
  componentScript.setAttribute("styler-component-script", "component-script");
49101
49103
  }
49102
- const currentHtml = clone.innerHTML;
49103
- if (!lastHtml) {
49104
- this.lastHtml = currentHtml;
49105
- return;
49106
- }
49107
- if (lastHtml === currentHtml) {
49108
- return;
49109
- }
49110
- this.undoList.add(this.lastHtml);
49111
- this.lastHtml = currentHtml;
49112
49104
  if (this.baseUrl) {
49113
49105
  if (!this.originalBaseUrl) {
49114
49106
  (_a = clone.querySelector("base")) === null || _a === void 0 ? void 0 : _a.remove();
@@ -49119,6 +49111,18 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
49119
49111
  }
49120
49112
  }
49121
49113
  }
49114
+ const currentHtml = clone.innerHTML;
49115
+ if (!lastHtml) {
49116
+ this.lastHtml = currentHtml;
49117
+ this.lastCommittedHtml = clone.outerHTML;
49118
+ this.lastCommittedBody = body.innerHTML;
49119
+ return;
49120
+ }
49121
+ if (lastHtml === currentHtml) {
49122
+ return;
49123
+ }
49124
+ this.undoList.add(this.lastHtml);
49125
+ this.lastHtml = currentHtml;
49122
49126
  this.lastCommittedHtml = clone.outerHTML;
49123
49127
  this.lastCommittedBody = body.innerHTML;
49124
49128
  this.element.dispatchEvent(new CustomEvent("htmlPageChanged", {
@@ -50542,6 +50546,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
50542
50546
  super(...arguments);
50543
50547
  this.version = 1;
50544
50548
  this.pageContent = "";
50549
+ this.lastHtml = "";
50545
50550
  }
50546
50551
  init() {
50547
50552
  var _a, _b;
@@ -50641,7 +50646,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
50641
50646
  }));
50642
50647
  this.footerRenderer = () => XNode.create("div", {
50643
50648
  "data-layout": "command-row",
50644
- "style-display": Bind.oneWay(() => !!this.pageContent)
50649
+ "style-display": Bind.oneWay(() => this.lastHtml !== this.pageContent)
50645
50650
  }, XNode.create(SaveIconTextButton, {
50646
50651
  "data-click-event": "save-page",
50647
50652
  text: "Save"
@@ -50651,6 +50656,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
50651
50656
  downloadHtml(file, cancelToken) {
50652
50657
  return __awaiter(this, void 0, void 0, function* () {
50653
50658
  const text = yield FetchBuilder.get(file.downloadUrl).cancelToken(cancelToken).responseAsText(true);
50659
+ this.lastHtml = text;
50660
+ this.pageContent = text;
50654
50661
  return text;
50655
50662
  });
50656
50663
  }
@@ -50668,7 +50675,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
50668
50675
  return __awaiter(this, void 0, void 0, function* () {
50669
50676
  const content = yield PageNavigator.pushPageForResult(CodeEditorPage, {
50670
50677
  fileName: this.selectedFile.name,
50671
- content: (_a = this.htmlEditor.lastCommittedHtml) !== null && _a !== void 0 ? _a : this.htmlEditor.htmlPage
50678
+ content: (_a = this.htmlEditor.lastCommittedHtml) !== null && _a !== void 0 ? _a : this.lastHtml
50672
50679
  });
50673
50680
  this.pageContent = content;
50674
50681
  this.htmlEditor.htmlPage = content;
@@ -50702,7 +50709,10 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
50702
50709
  }
50703
50710
  savePage() {
50704
50711
  return __awaiter(this, void 0, void 0, function* () {
50705
- const html = `<!DOCTYPE html>${this.pageContent}`;
50712
+ let html = this.pageContent;
50713
+ if (!html.trim().startsWith("<!")) {
50714
+ html = `<!DOCTYPE html>${this.pageContent}`;
50715
+ }
50706
50716
  const content = new File([html], this.selectedFile.name, {
50707
50717
  type: this.selectedFile.contentType
50708
50718
  });
@@ -50714,7 +50724,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
50714
50724
  this.selectedFile.fileContentID = result.fileContentID;
50715
50725
  this.selectedFile.downloadUrl = result.downloadUrl;
50716
50726
  this.webSite.isModified = true;
50717
- this.pageContent = "";
50727
+ this.lastHtml = html;
50728
+ this.pageContent = html;
50718
50729
  });
50719
50730
  }
50720
50731
  duplicateHtml(file) {