@social-mail/social-mail-client 1.2.131 → 1.2.132

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.
@@ -40221,6 +40221,10 @@ System.register(["./Styler", "./properties/stylerBorder", "./properties/layouts/
40221
40221
  ${properties.join("\n")}
40222
40222
 
40223
40223
  ${StylerSets.high.join("\n")}
40224
+
40225
+ * {
40226
+ caret-color: #40404080 !important;
40227
+ }
40224
40228
 
40225
40229
  `;
40226
40230
  }
@@ -42275,10 +42279,10 @@ System.register(["@web-atoms/core/dist/core/XNode", "./Block", "@web-atoms/core/
42275
42279
 
42276
42280
  AmdLoader.instance.setup("@social-mail/social-mail-client/dist/site-editor/blocks/PriceBox");
42277
42281
 
42278
- System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/core/sleep", "@web-atoms/core/dist/style/styled", "@web-atoms/core/dist/view-model/Action", "@web-atoms/core/dist/web/controls/AtomControl", "../drag-drop/DragDropHelper", "../toolbars/UndoRedoToolbar", "../blocks/WrapGrid", "../toolbars/EditorToolbar", "../properties/Properties", "../styler/StylerSet", "./SelectedElement", "@web-atoms/core/dist/core/AtomBinder", "../styler/Styler", "../blocks/ImageBox", "../blocks/RowBox", "../blocks/ColumnBox", "../blocks/VerticalImageBox", "../blocks/Image", "../blocks/ImageCard", "../blocks/TextBox", "../blocks/Card", "../blocks/List", "../blocks/Components", "@web-atoms/core/dist/core/types", "../blocks/Buttons", "../blocks/Columns2", "../blocks/Columns3", "../blocks/RightImageBox", "@web-atoms/core/dist/web/core/AtomUI", "../blocks/PriceBox"], function (_export, _context) {
42282
+ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/core/sleep", "@web-atoms/core/dist/style/styled", "@web-atoms/core/dist/view-model/Action", "@web-atoms/core/dist/web/controls/AtomControl", "../drag-drop/DragDropHelper", "../toolbars/UndoRedoToolbar", "../blocks/WrapGrid", "../toolbars/EditorToolbar", "../properties/Properties", "../styler/StylerSet", "./SelectedElement", "@web-atoms/core/dist/core/AtomBinder", "../styler/Styler", "../blocks/ImageBox", "../blocks/RowBox", "../blocks/ColumnBox", "../blocks/VerticalImageBox", "../blocks/Image", "../blocks/ImageCard", "../blocks/TextBox", "../blocks/Card", "../blocks/List", "../blocks/Components", "@web-atoms/core/dist/core/types", "../blocks/Buttons", "../blocks/Columns2", "../blocks/Columns3", "../blocks/RightImageBox", "@web-atoms/core/dist/web/core/AtomUI", "../blocks/PriceBox", "@web-atoms/core/dist/core/BindableProperty"], function (_export, _context) {
42279
42283
  "use strict";
42280
42284
 
42281
- var __awaiter, __decorate, __metadata, Bind, XNode, sleep, styled, Action, AtomControl, InstallDragDropHelper, UndoRedoToolbar, WrapGrid, EditorToolbar, Properties, StylerSet, SelectedElement, AtomBinder, StylerVariable, ImageBox, RowBox, ColumnBox, VerticalImageBox, Image, ImageCard, TextBox, Card, List, BlogComponent, UMD, ImageLink, LinkButton, Columns2, Columns3, RightImageBox, descendentElementIterator, PriceTable, HtmlPageEditor, desktopWidth, tabletWidth, mobileWidth;
42285
+ var __awaiter, __decorate, __metadata, Bind, XNode, sleep, styled, Action, AtomControl, InstallDragDropHelper, UndoRedoToolbar, WrapGrid, EditorToolbar, Properties, StylerSet, SelectedElement, AtomBinder, StylerVariable, ImageBox, RowBox, ColumnBox, VerticalImageBox, Image, ImageCard, TextBox, Card, List, BlogComponent, UMD, ImageLink, LinkButton, Columns2, Columns3, RightImageBox, descendentElementIterator, PriceTable, BindableProperty, HtmlPageEditor, desktopWidth, tabletWidth, mobileWidth;
42282
42286
  _export("default", void 0);
42283
42287
  return {
42284
42288
  setters: [function (_tslib) {
@@ -42350,6 +42354,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
42350
42354
  descendentElementIterator = _webAtomsCoreDistWebCoreAtomUI.descendentElementIterator;
42351
42355
  }, function (_blocksPriceBox) {
42352
42356
  PriceTable = _blocksPriceBox.PriceTable;
42357
+ }, function (_webAtomsCoreDistCoreBindableProperty) {
42358
+ BindableProperty = _webAtomsCoreDistCoreBindableProperty.BindableProperty;
42353
42359
  }],
42354
42360
  execute: function () {
42355
42361
  styled.css`
@@ -42472,116 +42478,29 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
42472
42478
  tabletWidth = 768;
42473
42479
  mobileWidth = 480;
42474
42480
  _export("default", HtmlPageEditor = class HtmlPageEditor extends AtomControl {
42475
- get htmlPage() {
42476
- var _a, _b;
42477
- return (_b = (_a = this.htmlDocument) === null || _a === void 0 ? void 0 : _a.documentElement) === null || _b === void 0 ? void 0 : _b.outerHTML;
42481
+ get htmlPageUrl() {
42482
+ return this.htmlDocument.baseURI.toString();
42478
42483
  }
42479
- set htmlPage(v) {
42484
+ set htmlPageUrl(v) {
42480
42485
  if (!this.element) {
42481
42486
  return;
42482
42487
  }
42483
42488
  if (!this.ready) {
42484
42489
  setTimeout(() => {
42485
- this.htmlPage = v;
42490
+ this.htmlPageUrl = v;
42486
42491
  }, 100);
42487
42492
  return;
42488
42493
  }
42489
- void this.ready.then(() => __awaiter(this, void 0, void 0, function* () {
42490
- if (!this.htmlDocument) {
42491
- return;
42492
- }
42493
- const iframe = this.element;
42494
- if (this.htmlDocument !== iframe.contentDocument) {
42495
- this.htmlDocument = void 0;
42496
- yield this.loadContentDocument();
42497
- }
42498
- this.htmlDocument.open();
42499
- this.htmlDocument.write(v);
42500
- this.htmlDocument.addEventListener("click", e => {
42501
- const target = e.target;
42502
- const previous = this.selection.element;
42503
- if (previous === null || previous === void 0 ? void 0 : previous.isContentEditable) {
42504
- let start = target;
42505
- while (start) {
42506
- if (previous === target) {
42507
- return;
42508
- }
42509
- start = start.parentElement;
42510
- }
42511
- if (previous !== this.htmlDocument.body) {
42512
- previous.removeAttribute("contentEditable");
42513
- }
42514
- this.commit();
42515
- }
42516
- e.preventDefault();
42517
- this.setSelection(target);
42518
- });
42519
- this.htmlDocument.addEventListener("dblclick", e => {
42520
- const target = e.target;
42521
- e.preventDefault();
42522
- const element = target.nodeType === Node.ELEMENT_NODE ? target : target.parentElement;
42523
- if (element.tagName === "IMG") {
42524
- this.changeImage().catch(console.error);
42525
- return;
42526
- }
42527
- if (element.getAttribute("data-editable") === "false") {
42528
- return;
42529
- }
42530
- if (element.hasAttribute("data-web-atoms-view")) {
42531
- return;
42532
- }
42533
- this.setSelection(element);
42534
- });
42535
- this.htmlDocument.addEventListener("scroll", e => {
42536
- this.hover.update();
42537
- this.selection.update();
42538
- }, {
42539
- passive: true
42540
- });
42541
- this.htmlDocument.addEventListener("pointerover", e => {
42542
- let target = e.target;
42543
- target = target.nodeType === Node.ELEMENT_NODE && target.tagName ? target : target.parentElement;
42544
- if (this.hover.element === target) {
42545
- return;
42546
- }
42547
- this.hover.update(target);
42548
- }, {
42549
- capture: true
42550
- });
42551
- this.htmlDocument.addEventListener("keydown", e => {
42552
- if (e.ctrlKey || e.metaKey) {
42553
- switch (e.key) {
42554
- case "s":
42555
- this.contentEditor.dispatchEvent(new CustomEvent("savePage", {
42556
- bubbles: true
42557
- }));
42558
- e.preventDefault();
42559
- break;
42560
- case "z":
42561
- this.contentEditor.dispatchEvent(new CustomEvent("undo", {
42562
- bubbles: true
42563
- }));
42564
- e.preventDefault();
42565
- break;
42566
- case "y":
42567
- this.contentEditor.dispatchEvent(new CustomEvent("redo", {
42568
- bubbles: true
42569
- }));
42570
- e.preventDefault();
42571
- break;
42572
- }
42573
- }
42574
- });
42575
- InstallDragDropHelper(this);
42576
- this.htmlDocument.close();
42577
- this.htmlDocument.body.contentEditable = "true";
42578
- setTimeout(() => {
42579
- this.app.runAsync(() => __awaiter(this, void 0, void 0, function* () {
42580
- yield this.setStylerSheet();
42581
- this.loadVariables();
42582
- }));
42583
- }, 10);
42584
- }));
42494
+ console.log("Loading url");
42495
+ this.contentEditor.setAttribute("src", v);
42496
+ this.initDocument();
42497
+ }
42498
+ get htmlPage() {
42499
+ var _a, _b;
42500
+ return (_b = (_a = this.htmlDocument) === null || _a === void 0 ? void 0 : _a.documentElement) === null || _b === void 0 ? void 0 : _b.outerHTML;
42501
+ }
42502
+ set htmlPage(v) {
42503
+ throw new Error("Use url");
42585
42504
  }
42586
42505
  constructor(app, e) {
42587
42506
  super(app, e);
@@ -42694,7 +42613,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
42694
42613
  }, XNode.create("i", {
42695
42614
  class: "fas fa-code"
42696
42615
  }), "Variables"), XNode.create(Properties, null))));
42697
- yield this.loadContentDocument();
42616
+ this.contentEditor = this.element.querySelector(`[data-element="content-editor"]`);
42698
42617
  });
42699
42618
  }
42700
42619
  buildXNode(node) {
@@ -42846,11 +42765,22 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
42846
42765
  }
42847
42766
  }
42848
42767
  commit() {
42768
+ var _a;
42849
42769
  this.redoList.clear();
42850
42770
  const lastHtml = this.lastHtml;
42851
42771
  const clone = this.htmlDocument.documentElement.cloneNode(true);
42852
42772
  const body = clone.querySelector("body");
42853
42773
  body.removeAttribute("contentEditable");
42774
+ if (this.baseUrl) {
42775
+ if (!this.originalBaseUrl) {
42776
+ (_a = clone.querySelector("base")) === null || _a === void 0 ? void 0 : _a.remove();
42777
+ } else {
42778
+ const baseUrl = clone.querySelector("base");
42779
+ if (baseUrl) {
42780
+ baseUrl.setAttribute("href", this.originalBaseUrl);
42781
+ }
42782
+ }
42783
+ }
42854
42784
  const all = clone.querySelectorAll("*");
42855
42785
  for (let index = 0; index < all.length; index++) {
42856
42786
  const element = all[index];
@@ -42896,6 +42826,95 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
42896
42826
  this.htmlDocument.documentElement.innerHTML = this.redoList.removeAt(this.redoList.length - 1);
42897
42827
  this.htmlDocument.body.contentEditable = "true";
42898
42828
  }
42829
+ initDocument() {
42830
+ void this.ready.then(() => __awaiter(this, void 0, void 0, function* () {
42831
+ yield this.loadContentDocument(this.contentEditor.contentDocument.baseURI);
42832
+ console.log("Attaching events");
42833
+ this.htmlDocument.addEventListener("click", e => {
42834
+ const target = e.target;
42835
+ const previous = this.selection.element;
42836
+ if (previous === null || previous === void 0 ? void 0 : previous.isContentEditable) {
42837
+ let start = target;
42838
+ while (start) {
42839
+ if (previous === target) {
42840
+ return;
42841
+ }
42842
+ start = start.parentElement;
42843
+ }
42844
+ if (previous !== this.htmlDocument.body) {
42845
+ previous.removeAttribute("contentEditable");
42846
+ }
42847
+ this.commit();
42848
+ }
42849
+ e.preventDefault();
42850
+ this.setSelection(target);
42851
+ });
42852
+ this.htmlDocument.addEventListener("dblclick", e => {
42853
+ const target = e.target;
42854
+ e.preventDefault();
42855
+ const element = target.nodeType === Node.ELEMENT_NODE ? target : target.parentElement;
42856
+ if (element.tagName === "IMG") {
42857
+ this.changeImage().catch(console.error);
42858
+ return;
42859
+ }
42860
+ if (element.getAttribute("data-editable") === "false") {
42861
+ return;
42862
+ }
42863
+ if (element.hasAttribute("data-web-atoms-view")) {
42864
+ return;
42865
+ }
42866
+ this.setSelection(element);
42867
+ });
42868
+ this.htmlDocument.addEventListener("scroll", e => {
42869
+ this.hover.update();
42870
+ this.selection.update();
42871
+ }, {
42872
+ passive: true
42873
+ });
42874
+ this.htmlDocument.addEventListener("pointerover", e => {
42875
+ let target = e.target;
42876
+ target = target.nodeType === Node.ELEMENT_NODE && target.tagName ? target : target.parentElement;
42877
+ if (this.hover.element === target) {
42878
+ return;
42879
+ }
42880
+ this.hover.update(target);
42881
+ }, {
42882
+ capture: true
42883
+ });
42884
+ this.htmlDocument.addEventListener("keydown", e => {
42885
+ if (e.ctrlKey || e.metaKey) {
42886
+ switch (e.key) {
42887
+ case "s":
42888
+ this.contentEditor.dispatchEvent(new CustomEvent("savePage", {
42889
+ bubbles: true
42890
+ }));
42891
+ e.preventDefault();
42892
+ break;
42893
+ case "z":
42894
+ this.contentEditor.dispatchEvent(new CustomEvent("undo", {
42895
+ bubbles: true
42896
+ }));
42897
+ e.preventDefault();
42898
+ break;
42899
+ case "y":
42900
+ this.contentEditor.dispatchEvent(new CustomEvent("redo", {
42901
+ bubbles: true
42902
+ }));
42903
+ e.preventDefault();
42904
+ break;
42905
+ }
42906
+ }
42907
+ });
42908
+ InstallDragDropHelper(this);
42909
+ this.htmlDocument.body.contentEditable = "true";
42910
+ setTimeout(() => {
42911
+ this.app.runAsync(() => __awaiter(this, void 0, void 0, function* () {
42912
+ yield this.setStylerSheet();
42913
+ this.loadVariables();
42914
+ }));
42915
+ }, 10);
42916
+ }));
42917
+ }
42899
42918
  setStylerSheet() {
42900
42919
  return __awaiter(this, void 0, void 0, function* () {
42901
42920
  const document = this.htmlDocument;
@@ -42923,17 +42942,24 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
42923
42942
  };
42924
42943
  this.pageVariables = StylerSet.instance.vars.map(x => new StylerVariable(x.name, x.value, this.htmlDocument, onChange));
42925
42944
  }
42926
- loadContentDocument() {
42945
+ loadContentDocument(url) {
42946
+ var _a;
42927
42947
  return __awaiter(this, void 0, void 0, function* () {
42928
- this.contentEditor = this.element.querySelector(`[data-element="content-editor"]`);
42929
- while (!this.htmlDocument) {
42948
+ while (url === this.contentEditor.contentDocument.baseURI) {
42949
+ yield sleep(100);
42950
+ }
42951
+ for (;;) {
42930
42952
  this.htmlDocument = this.contentEditor.contentDocument;
42953
+ if (((_a = this.htmlDocument) === null || _a === void 0 ? void 0 : _a.readyState) === "complete") {
42954
+ break;
42955
+ }
42931
42956
  yield sleep(100);
42932
42957
  }
42933
42958
  this.htmlDocument.body.contentEditable = "true";
42934
42959
  });
42935
42960
  }
42936
42961
  });
42962
+ __decorate([BindableProperty, __metadata("design:type", String)], HtmlPageEditor.prototype, "baseUrl", void 0);
42937
42963
  __decorate([Action({
42938
42964
  onEvent: "delete-element"
42939
42965
  }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], HtmlPageEditor.prototype, "deleteElement", null);
@@ -43766,14 +43792,14 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
43766
43792
  this.pageContent = "";
43767
43793
  }
43768
43794
  init() {
43769
- var _a, _b;
43770
- var _c;
43795
+ var _a, _b, _c;
43796
+ var _d;
43771
43797
  return __awaiter(this, void 0, void 0, function* () {
43772
43798
  this.search = "";
43773
43799
  this.root = yield this.cloudFileService.root(this.parameters);
43774
43800
  this.title = this.root.name;
43775
43801
  this.webSite = yield this.websiteService.get(this.root.appFileID);
43776
- (_a = (_c = this.root).children) !== null && _a !== void 0 ? _a : _c.children = [];
43802
+ (_a = (_d = this.root).children) !== null && _a !== void 0 ? _a : _d.children = [];
43777
43803
  this.root.children.remove(x => x.isDeleted || !(/^(text\/(html|css))$/i.test(x.contentType) || x.isFolder));
43778
43804
  this.root.children.sort((a, b) => a.isFolder ? -1 : 0);
43779
43805
  yield this.onItemExpanded(this.root);
@@ -43783,6 +43809,11 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
43783
43809
  }
43784
43810
  const indexHtml = this.root.children.find(x => x.name === "index.html");
43785
43811
  this.selectedFile = indexHtml;
43812
+ let baseUrl = void 0;
43813
+ const firstHost = (_c = this.webSite.hosts) === null || _c === void 0 ? void 0 : _c[0];
43814
+ if (firstHost) {
43815
+ baseUrl = `https://draft-${firstHost.host}`;
43816
+ }
43786
43817
  this.titleRenderer = () => XNode.create("div", {
43787
43818
  "data-layout": "row"
43788
43819
  }, XNode.create("div", {
@@ -43849,7 +43880,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
43849
43880
  folder: this.root,
43850
43881
  presenter: Bind.presenter(c => this.htmlEditor = c),
43851
43882
  "event-html-page-changed": ce => this.pageContent = ce.detail,
43852
- htmlPage: Bind.oneWayAsync((s, e, cancelToken) => this.selectedFile ? FetchBuilder.get(this.selectedFile.downloadUrl).cancelToken(cancelToken).responseAsText(true) : void 0)
43883
+ htmlPageUrl: Bind.oneWay(() => "/api/site/draft/" + this.webSite.folderID + "/" + this.selectedFile.name)
43853
43884
  }));
43854
43885
  this.footerRenderer = () => XNode.create("div", {
43855
43886
  "data-layout": "command-row",