@social-mail/social-mail-client 1.2.130 → 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,114 +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
- previous.removeAttribute("contentEditable");
42512
- this.commit();
42513
- }
42514
- e.preventDefault();
42515
- this.setSelection(target);
42516
- });
42517
- this.htmlDocument.addEventListener("dblclick", e => {
42518
- const target = e.target;
42519
- e.preventDefault();
42520
- const element = target.nodeType === Node.ELEMENT_NODE ? target : target.parentElement;
42521
- if (element.tagName === "IMG") {
42522
- this.changeImage().catch(console.error);
42523
- return;
42524
- }
42525
- if (element.getAttribute("data-editable") === "false") {
42526
- return;
42527
- }
42528
- if (element.hasAttribute("data-web-atoms-view")) {
42529
- return;
42530
- }
42531
- element.setAttribute("contentEditable", "true");
42532
- this.setSelection(element);
42533
- });
42534
- this.htmlDocument.addEventListener("scroll", e => {
42535
- this.hover.update();
42536
- this.selection.update();
42537
- }, {
42538
- passive: true
42539
- });
42540
- this.htmlDocument.addEventListener("pointerover", e => {
42541
- let target = e.target;
42542
- target = target.nodeType === Node.ELEMENT_NODE && target.tagName ? target : target.parentElement;
42543
- if (this.hover.element === target) {
42544
- return;
42545
- }
42546
- this.hover.update(target);
42547
- }, {
42548
- capture: true
42549
- });
42550
- this.htmlDocument.addEventListener("keydown", e => {
42551
- if (e.ctrlKey || e.metaKey) {
42552
- switch (e.key) {
42553
- case "s":
42554
- this.contentEditor.dispatchEvent(new CustomEvent("savePage", {
42555
- bubbles: true
42556
- }));
42557
- e.preventDefault();
42558
- break;
42559
- case "z":
42560
- this.contentEditor.dispatchEvent(new CustomEvent("undo", {
42561
- bubbles: true
42562
- }));
42563
- e.preventDefault();
42564
- break;
42565
- case "y":
42566
- this.contentEditor.dispatchEvent(new CustomEvent("redo", {
42567
- bubbles: true
42568
- }));
42569
- e.preventDefault();
42570
- break;
42571
- }
42572
- }
42573
- });
42574
- InstallDragDropHelper(this);
42575
- this.htmlDocument.close();
42576
- setTimeout(() => {
42577
- this.app.runAsync(() => __awaiter(this, void 0, void 0, function* () {
42578
- yield this.setStylerSheet();
42579
- this.loadVariables();
42580
- }));
42581
- }, 10);
42582
- }));
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");
42583
42504
  }
42584
42505
  constructor(app, e) {
42585
42506
  super(app, e);
@@ -42692,7 +42613,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
42692
42613
  }, XNode.create("i", {
42693
42614
  class: "fas fa-code"
42694
42615
  }), "Variables"), XNode.create(Properties, null))));
42695
- yield this.loadContentDocument();
42616
+ this.contentEditor = this.element.querySelector(`[data-element="content-editor"]`);
42696
42617
  });
42697
42618
  }
42698
42619
  buildXNode(node) {
@@ -42844,9 +42765,22 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
42844
42765
  }
42845
42766
  }
42846
42767
  commit() {
42768
+ var _a;
42847
42769
  this.redoList.clear();
42848
42770
  const lastHtml = this.lastHtml;
42849
42771
  const clone = this.htmlDocument.documentElement.cloneNode(true);
42772
+ const body = clone.querySelector("body");
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
+ }
42850
42784
  const all = clone.querySelectorAll("*");
42851
42785
  for (let index = 0; index < all.length; index++) {
42852
42786
  const element = all[index];
@@ -42885,10 +42819,101 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
42885
42819
  undo() {
42886
42820
  this.redoList.insert(this.redoList.length, this.htmlDocument.documentElement.innerHTML);
42887
42821
  this.htmlDocument.documentElement.innerHTML = this.undoList.removeAt(this.undoList.length - 1);
42822
+ this.htmlDocument.body.contentEditable = "true";
42888
42823
  }
42889
42824
  redo() {
42890
42825
  this.undoList.insert(this.undoList.length, this.htmlDocument.documentElement.innerHTML);
42891
42826
  this.htmlDocument.documentElement.innerHTML = this.redoList.removeAt(this.redoList.length - 1);
42827
+ this.htmlDocument.body.contentEditable = "true";
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
+ }));
42892
42917
  }
42893
42918
  setStylerSheet() {
42894
42919
  return __awaiter(this, void 0, void 0, function* () {
@@ -42917,16 +42942,24 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
42917
42942
  };
42918
42943
  this.pageVariables = StylerSet.instance.vars.map(x => new StylerVariable(x.name, x.value, this.htmlDocument, onChange));
42919
42944
  }
42920
- loadContentDocument() {
42945
+ loadContentDocument(url) {
42946
+ var _a;
42921
42947
  return __awaiter(this, void 0, void 0, function* () {
42922
- this.contentEditor = this.element.querySelector(`[data-element="content-editor"]`);
42923
- while (!this.htmlDocument) {
42948
+ while (url === this.contentEditor.contentDocument.baseURI) {
42949
+ yield sleep(100);
42950
+ }
42951
+ for (;;) {
42924
42952
  this.htmlDocument = this.contentEditor.contentDocument;
42953
+ if (((_a = this.htmlDocument) === null || _a === void 0 ? void 0 : _a.readyState) === "complete") {
42954
+ break;
42955
+ }
42925
42956
  yield sleep(100);
42926
42957
  }
42958
+ this.htmlDocument.body.contentEditable = "true";
42927
42959
  });
42928
42960
  }
42929
42961
  });
42962
+ __decorate([BindableProperty, __metadata("design:type", String)], HtmlPageEditor.prototype, "baseUrl", void 0);
42930
42963
  __decorate([Action({
42931
42964
  onEvent: "delete-element"
42932
42965
  }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], HtmlPageEditor.prototype, "deleteElement", null);
@@ -43759,14 +43792,14 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
43759
43792
  this.pageContent = "";
43760
43793
  }
43761
43794
  init() {
43762
- var _a, _b;
43763
- var _c;
43795
+ var _a, _b, _c;
43796
+ var _d;
43764
43797
  return __awaiter(this, void 0, void 0, function* () {
43765
43798
  this.search = "";
43766
43799
  this.root = yield this.cloudFileService.root(this.parameters);
43767
43800
  this.title = this.root.name;
43768
43801
  this.webSite = yield this.websiteService.get(this.root.appFileID);
43769
- (_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 = [];
43770
43803
  this.root.children.remove(x => x.isDeleted || !(/^(text\/(html|css))$/i.test(x.contentType) || x.isFolder));
43771
43804
  this.root.children.sort((a, b) => a.isFolder ? -1 : 0);
43772
43805
  yield this.onItemExpanded(this.root);
@@ -43776,6 +43809,11 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
43776
43809
  }
43777
43810
  const indexHtml = this.root.children.find(x => x.name === "index.html");
43778
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
+ }
43779
43817
  this.titleRenderer = () => XNode.create("div", {
43780
43818
  "data-layout": "row"
43781
43819
  }, XNode.create("div", {
@@ -43842,7 +43880,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
43842
43880
  folder: this.root,
43843
43881
  presenter: Bind.presenter(c => this.htmlEditor = c),
43844
43882
  "event-html-page-changed": ce => this.pageContent = ce.detail,
43845
- 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)
43846
43884
  }));
43847
43885
  this.footerRenderer = () => XNode.create("div", {
43848
43886
  "data-layout": "command-row",