@social-mail/social-mail-client 1.9.69 → 1.9.70

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.
@@ -57562,6 +57562,9 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
57562
57562
  }
57563
57563
  setSelection(element, commit = true) {
57564
57564
  var _a;
57565
+ if (element.tagName === "HTML") {
57566
+ element = element.querySelector("body > *:nth-child(1)");
57567
+ }
57565
57568
  const old = (_a = this.selection) === null || _a === void 0 ? void 0 : _a.element;
57566
57569
  if (old === null || old === void 0 ? void 0 : old.draggable) {
57567
57570
  old.removeAttribute("draggable");
@@ -57791,105 +57794,104 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
57791
57794
  clone.head.appendChild(stylerCss);
57792
57795
  }
57793
57796
  this.undoRedo = new UndoRedo(this.htmlDocument, this);
57794
- setTimeout(() => {
57795
- if (clone.querySelector(`[styler-layout="component"]`)) {
57796
- let componentScript = clone.querySelector("[styler-component-script]");
57797
- if (!componentScript) {
57798
- componentScript = this.htmlDocument.createElement("script");
57799
- componentScript.setAttribute("styler-component-script", "component-script");
57800
- const head = clone.querySelector("head");
57801
- head.appendChild(componentScript);
57802
- const scripts = clone.querySelectorAll("script[src]");
57803
- for (let index = 0; index < scripts.length; index++) {
57804
- const script = scripts[index];
57805
- const srcScript = script.getAttribute("src");
57806
- if (srcScript.includes("@social-mail/social-mail-client/") || srcScript.includes("/component.js")) {
57807
- script.remove();
57808
- break;
57809
- }
57797
+ yield sleep(10);
57798
+ if (clone.querySelector(`[styler-layout="component"]`)) {
57799
+ let componentScript = clone.querySelector("[styler-component-script]");
57800
+ if (!componentScript) {
57801
+ componentScript = this.htmlDocument.createElement("script");
57802
+ componentScript.setAttribute("styler-component-script", "component-script");
57803
+ const head = clone.querySelector("head");
57804
+ head.appendChild(componentScript);
57805
+ const scripts = clone.querySelectorAll("script[src]");
57806
+ for (let index = 0; index < scripts.length; index++) {
57807
+ const script = scripts[index];
57808
+ const srcScript = script.getAttribute("src");
57809
+ if (srcScript.includes("@social-mail/social-mail-client/") || srcScript.includes("/component.js")) {
57810
+ script.remove();
57811
+ break;
57810
57812
  }
57811
57813
  }
57812
- const src = socialMailComponentPath;
57813
- if (componentScript.getAttribute("src") !== src) {
57814
- componentScript.setAttribute("src", src);
57815
- }
57816
- }
57817
- let wc = clone.querySelector("script[web-components]");
57818
- if (!wc) {
57819
- wc = this.htmlDocument.createElement("script");
57820
- wc.setAttribute("web-components", "social");
57821
- wc.setAttribute("async", "true");
57822
- wc.setAttribute("defer", "true");
57823
- clone.head.appendChild(doc.createTextNode("\n"));
57824
- clone.head.appendChild(wc);
57825
- clone.head.appendChild(doc.createTextNode("\n"));
57826
- }
57827
- const wcs = `${WebComponents.path}/dist/main.js`;
57828
- if (wc.getAttribute("src") !== wcs) {
57829
- wc.setAttribute("src", wcs);
57830
- }
57831
- const sc = "//cdn.jsdelivr.net/npm/@social-mail/social-mail-client@latest/styler-lite/styler.css";
57832
- const oldStylerCss = stylerCss.getAttribute("href");
57833
- if (oldStylerCss !== sc) {
57834
- stylerCss.setAttribute("href", sc);
57835
- }
57836
- for (const node of descendentElementIterator(clone.documentElement)) {
57837
- const style = node.style;
57838
- if (style) {
57839
- for (const attributeName of node.getAttributeNames()) {
57840
- let av = node.getAttribute(attributeName);
57841
- if (av === "null") {
57842
- node.removeAttribute(attributeName);
57843
- continue;
57844
- }
57845
- if (attributeName.includes("-desktop-")) {
57846
- const a = attributeName.replace("-desktop-", "-");
57847
- node.removeAttribute(attributeName);
57848
- node.setAttribute(a, av);
57849
- continue;
57850
- }
57851
- const s = editorSuggestions[attributeName];
57852
- if (s) {
57853
- const cv = s.find(x => x.label === av);
57854
- if (cv && cv.value !== av) {
57855
- av = cv.value;
57856
- node.setAttribute(attributeName, av);
57857
- }
57858
- }
57859
- if (attributeName.startsWith("styler-all-child")) {
57860
- node.removeAttribute(attributeName);
57861
- node.setAttribute(attributeName.replace("styler-all-", "styler-"), av);
57862
- }
57814
+ }
57815
+ const src = socialMailComponentPath;
57816
+ if (componentScript.getAttribute("src") !== src) {
57817
+ componentScript.setAttribute("src", src);
57818
+ }
57819
+ }
57820
+ let wc = clone.querySelector("script[web-components]");
57821
+ if (!wc) {
57822
+ wc = this.htmlDocument.createElement("script");
57823
+ wc.setAttribute("web-components", "social");
57824
+ wc.setAttribute("async", "true");
57825
+ wc.setAttribute("defer", "true");
57826
+ clone.head.appendChild(doc.createTextNode("\n"));
57827
+ clone.head.appendChild(wc);
57828
+ clone.head.appendChild(doc.createTextNode("\n"));
57829
+ }
57830
+ const wcs = `${WebComponents.path}/dist/main.js`;
57831
+ if (wc.getAttribute("src") !== wcs) {
57832
+ wc.setAttribute("src", wcs);
57833
+ }
57834
+ const sc = "//cdn.jsdelivr.net/npm/@social-mail/social-mail-client@latest/styler-lite/styler.css";
57835
+ const oldStylerCss = stylerCss.getAttribute("href");
57836
+ if (oldStylerCss !== sc) {
57837
+ stylerCss.setAttribute("href", sc);
57838
+ }
57839
+ for (const node of descendentElementIterator(clone.documentElement)) {
57840
+ const style = node.style;
57841
+ if (style) {
57842
+ for (const attributeName of node.getAttributeNames()) {
57843
+ let av = node.getAttribute(attributeName);
57844
+ if (av === "null") {
57845
+ node.removeAttribute(attributeName);
57846
+ continue;
57863
57847
  }
57864
- const remove = [];
57865
- for (let index = 0; index < style.length; index++) {
57866
- const styleName = style[index];
57867
- if (styleName.startsWith("--styler-")) {
57868
- const stylerName = styleName.substring(2);
57869
- if (node.getAttribute(stylerName) !== "custom") {
57870
- remove.push(styleName);
57871
- }
57848
+ if (attributeName.includes("-desktop-")) {
57849
+ const a = attributeName.replace("-desktop-", "-");
57850
+ node.removeAttribute(attributeName);
57851
+ node.setAttribute(a, av);
57852
+ continue;
57853
+ }
57854
+ const s = editorSuggestions[attributeName];
57855
+ if (s) {
57856
+ const cv = s.find(x => x.label === av);
57857
+ if (cv && cv.value !== av) {
57858
+ av = cv.value;
57859
+ node.setAttribute(attributeName, av);
57872
57860
  }
57873
57861
  }
57874
- for (const n of remove) {
57875
- style.removeProperty(n);
57862
+ if (attributeName.startsWith("styler-all-child")) {
57863
+ node.removeAttribute(attributeName);
57864
+ node.setAttribute(attributeName.replace("styler-all-", "styler-"), av);
57876
57865
  }
57877
57866
  }
57878
- }
57879
- if (!clone.querySelector(`meta[charset]`)) {
57880
- clone.head.appendChild(doc.createTextNode("\n\t"));
57881
- clone.head.appendChild(ElementBuilder.create("meta", clone).attr("charset", "utf-8").element);
57882
- clone.head.appendChild(doc.createTextNode("\n"));
57883
- }
57884
- setTimeout(() => {
57885
- this.undoRedo.pause();
57886
- stylerCss.setAttribute("original-href", sc);
57887
- stylerCss.setAttribute("href", UMD.resolvePath("@social-mail/social-mail-client/styler-lite/styler.css"));
57888
- if (!clone.body.hasAttribute("styler-expansion-enabled")) {
57889
- clone.body.setAttribute("styler-expansion-enabled", "true");
57867
+ const remove = [];
57868
+ for (let index = 0; index < style.length; index++) {
57869
+ const styleName = style[index];
57870
+ if (styleName.startsWith("--styler-")) {
57871
+ const stylerName = styleName.substring(2);
57872
+ if (node.getAttribute(stylerName) !== "custom") {
57873
+ remove.push(styleName);
57874
+ }
57875
+ }
57890
57876
  }
57891
- }, 5);
57892
- }, 10);
57877
+ for (const n of remove) {
57878
+ style.removeProperty(n);
57879
+ }
57880
+ }
57881
+ }
57882
+ if (!clone.querySelector(`meta[charset]`)) {
57883
+ clone.head.appendChild(doc.createTextNode("\n\t"));
57884
+ clone.head.appendChild(ElementBuilder.create("meta", clone).attr("charset", "utf-8").element);
57885
+ clone.head.appendChild(doc.createTextNode("\n"));
57886
+ }
57887
+ yield sleep(5);
57888
+ this.undoRedo.pause();
57889
+ stylerCss.setAttribute("original-href", sc);
57890
+ stylerCss.setAttribute("href", UMD.resolvePath("@social-mail/social-mail-client/styler-lite/styler.css"));
57891
+ if (!clone.body.hasAttribute("styler-expansion-enabled")) {
57892
+ clone.body.setAttribute("styler-expansion-enabled", "true");
57893
+ }
57894
+ this.setSelection(this.htmlDocument.querySelector("body > *:nth-child(1)"));
57893
57895
  });
57894
57896
  }
57895
57897
  updateEditable(doc) {