@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.
@@ -44899,8 +44899,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
44899
44899
  mobileWidth = 480;
44900
44900
  _export("default", HtmlPageEditor = class HtmlPageEditor extends AtomControl {
44901
44901
  get htmlPage() {
44902
- var _a, _b;
44903
- return (_b = (_a = this.htmlDocument) === null || _a === void 0 ? void 0 : _a.documentElement) === null || _b === void 0 ? void 0 : _b.outerHTML;
44902
+ var _a, _b, _c;
44903
+ 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;
44904
44904
  }
44905
44905
  set htmlPage(v) {
44906
44906
  if (!this.element) {
@@ -44941,6 +44941,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
44941
44941
  this.undoList = [];
44942
44942
  this.redoList = [];
44943
44943
  this.pageVariables = [];
44944
+ this.lastCommittedHtml = null;
44945
+ this.lastCommittedBody = null;
44944
44946
  this.hover = new SelectedElement(this);
44945
44947
  this.dropTarget = new SelectedElement(this);
44946
44948
  this.maxWidth = desktopWidth;
@@ -45261,16 +45263,6 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
45261
45263
  componentScript.src = UMD.resolvePath("@social-mail/social-mail-client/component.js");
45262
45264
  componentScript.setAttribute("styler-component-script", "component-script");
45263
45265
  }
45264
- const currentHtml = clone.innerHTML;
45265
- if (!lastHtml) {
45266
- this.lastHtml = currentHtml;
45267
- return;
45268
- }
45269
- if (lastHtml === currentHtml) {
45270
- return;
45271
- }
45272
- this.undoList.add(this.lastHtml);
45273
- this.lastHtml = currentHtml;
45274
45266
  if (this.baseUrl) {
45275
45267
  if (!this.originalBaseUrl) {
45276
45268
  (_a = clone.querySelector("base")) === null || _a === void 0 ? void 0 : _a.remove();
@@ -45281,6 +45273,18 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
45281
45273
  }
45282
45274
  }
45283
45275
  }
45276
+ const currentHtml = clone.innerHTML;
45277
+ if (!lastHtml) {
45278
+ this.lastHtml = currentHtml;
45279
+ this.lastCommittedHtml = clone.outerHTML;
45280
+ this.lastCommittedBody = body.innerHTML;
45281
+ return;
45282
+ }
45283
+ if (lastHtml === currentHtml) {
45284
+ return;
45285
+ }
45286
+ this.undoList.add(this.lastHtml);
45287
+ this.lastHtml = currentHtml;
45284
45288
  this.lastCommittedHtml = clone.outerHTML;
45285
45289
  this.lastCommittedBody = body.innerHTML;
45286
45290
  this.element.dispatchEvent(new CustomEvent("htmlPageChanged", {
@@ -46854,6 +46858,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
46854
46858
  super(...arguments);
46855
46859
  this.version = 1;
46856
46860
  this.pageContent = "";
46861
+ this.lastHtml = "";
46857
46862
  }
46858
46863
  init() {
46859
46864
  var _a, _b;
@@ -46953,7 +46958,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
46953
46958
  }));
46954
46959
  this.footerRenderer = () => XNode.create("div", {
46955
46960
  "data-layout": "command-row",
46956
- "style-display": Bind.oneWay(() => !!this.pageContent)
46961
+ "style-display": Bind.oneWay(() => this.lastHtml !== this.pageContent)
46957
46962
  }, XNode.create(SaveIconTextButton, {
46958
46963
  "data-click-event": "save-page",
46959
46964
  text: "Save"
@@ -46963,6 +46968,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
46963
46968
  downloadHtml(file, cancelToken) {
46964
46969
  return __awaiter(this, void 0, void 0, function* () {
46965
46970
  const text = yield FetchBuilder.get(file.downloadUrl).cancelToken(cancelToken).responseAsText(true);
46971
+ this.lastHtml = text;
46972
+ this.pageContent = text;
46966
46973
  return text;
46967
46974
  });
46968
46975
  }
@@ -46980,7 +46987,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
46980
46987
  return __awaiter(this, void 0, void 0, function* () {
46981
46988
  const content = yield PageNavigator.pushPageForResult(CodeEditorPage, {
46982
46989
  fileName: this.selectedFile.name,
46983
- content: (_a = this.htmlEditor.lastCommittedHtml) !== null && _a !== void 0 ? _a : this.htmlEditor.htmlPage
46990
+ content: (_a = this.htmlEditor.lastCommittedHtml) !== null && _a !== void 0 ? _a : this.lastHtml
46984
46991
  });
46985
46992
  this.pageContent = content;
46986
46993
  this.htmlEditor.htmlPage = content;
@@ -47014,7 +47021,10 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
47014
47021
  }
47015
47022
  savePage() {
47016
47023
  return __awaiter(this, void 0, void 0, function* () {
47017
- const html = `<!DOCTYPE html>${this.pageContent}`;
47024
+ let html = this.pageContent;
47025
+ if (!html.trim().startsWith("<!")) {
47026
+ html = `<!DOCTYPE html>${this.pageContent}`;
47027
+ }
47018
47028
  const content = new File([html], this.selectedFile.name, {
47019
47029
  type: this.selectedFile.contentType
47020
47030
  });
@@ -47026,7 +47036,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
47026
47036
  this.selectedFile.fileContentID = result.fileContentID;
47027
47037
  this.selectedFile.downloadUrl = result.downloadUrl;
47028
47038
  this.webSite.isModified = true;
47029
- this.pageContent = "";
47039
+ this.lastHtml = html;
47040
+ this.pageContent = html;
47030
47041
  });
47031
47042
  }
47032
47043
  duplicateHtml(file) {