@social-mail/social-mail-client 1.2.511 → 1.2.516
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.
- package/dist/admin/AdminAppIndex.pack.js +174 -82
- package/dist/admin/AdminAppIndex.pack.js.map +1 -1
- package/dist/admin/AdminAppIndex.pack.min.js +7 -7
- package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
- package/dist/services/websites/WebSiteService.d.ts.map +1 -1
- package/dist/services/websites/WebSiteService.js +3 -3
- package/dist/services/websites/WebSiteService.js.map +1 -1
- package/dist/site-editor/editor/HtmlPageEditor.d.ts +6 -3
- package/dist/site-editor/editor/HtmlPageEditor.d.ts.map +1 -1
- package/dist/site-editor/editor/HtmlPageEditor.js +99 -60
- package/dist/site-editor/editor/HtmlPageEditor.js.map +1 -1
- package/dist/site-editor/editor/LanguageDropDown.d.ts +2 -0
- package/dist/site-editor/editor/LanguageDropDown.d.ts.map +1 -0
- package/dist/site-editor/editor/LanguageDropDown.js +31 -0
- package/dist/site-editor/editor/LanguageDropDown.js.map +1 -0
- package/dist/site-editor/editor/WebSitePageEditor.d.ts +1 -1
- package/dist/site-editor/editor/WebSitePageEditor.d.ts.map +1 -1
- package/dist/site-editor/editor/WebSitePageEditor.js +16 -16
- package/dist/site-editor/editor/WebSitePageEditor.js.map +1 -1
- package/dist/site-editor/styler/properties/stylerPosition.js +16 -1
- package/dist/site-editor/styler/properties/stylerPosition.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/web/AppIndex.pack.js +174 -82
- package/dist/web/AppIndex.pack.js.map +1 -1
- package/dist/web/AppIndex.pack.min.js +7 -7
- package/dist/web/AppIndex.pack.min.js.map +1 -1
- package/node_modules/@web-atoms/web-controls/dist/basic/Select.d.ts.map +1 -1
- package/node_modules/@web-atoms/web-controls/dist/basic/Select.js +5 -1
- package/node_modules/@web-atoms/web-controls/dist/basic/Select.js.map +1 -1
- package/node_modules/@web-atoms/web-controls/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@web-atoms/web-controls/package.json +1 -1
- package/node_modules/@web-atoms/web-controls/src/basic/Select.tsx +5 -1
- package/package.json +2 -2
- package/src/services/websites/WebSiteService.ts +3 -2
- package/src/site-editor/editor/HtmlPageEditor.tsx +206 -129
- package/src/site-editor/editor/LanguageDropDown.tsx +19 -0
- package/src/site-editor/editor/WebSitePageEditor.tsx +16 -16
- package/src/site-editor/styler/properties/stylerPosition.ts +6 -6
|
@@ -50,6 +50,7 @@ import { PDFViewer } from "../blocks/PDFViewer";
|
|
|
50
50
|
import { EditorCustomElements } from "./custom-elements/EditorCustomElements";
|
|
51
51
|
import { Banner } from "../blocks/Banner";
|
|
52
52
|
import BreadCrum from "./BreadCrum";
|
|
53
|
+
import LanguageDropDown from "./LanguageDropDown";
|
|
53
54
|
|
|
54
55
|
styled.css `
|
|
55
56
|
display: grid;
|
|
@@ -202,6 +203,8 @@ const desktopWidth = 992;
|
|
|
202
203
|
const tabletWidth = 768;
|
|
203
204
|
const mobileWidth = 480;
|
|
204
205
|
|
|
206
|
+
const languageSymbol = Symbol.for("language");
|
|
207
|
+
|
|
205
208
|
export default class HtmlPageEditor extends AtomControl {
|
|
206
209
|
|
|
207
210
|
public htmlDocument: Document;
|
|
@@ -222,6 +225,8 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
222
225
|
public lastCommittedHtml: string = null;
|
|
223
226
|
public lastCommittedBody: string = null;
|
|
224
227
|
|
|
228
|
+
public languages = null;
|
|
229
|
+
|
|
225
230
|
// public get htmlPageUrl() {
|
|
226
231
|
// return this.htmlDocument.baseURI.toString();
|
|
227
232
|
// }
|
|
@@ -257,28 +262,36 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
257
262
|
return;
|
|
258
263
|
}
|
|
259
264
|
void this.ready.then(() => {
|
|
260
|
-
|
|
261
|
-
const doc = dom.parseFromString(v, "text/html");
|
|
262
|
-
let baseElement = doc.querySelector("base");
|
|
263
|
-
if (baseElement?.getAttribute("href")?.startsWith("/api/site/")) {
|
|
264
|
-
baseElement.remove();
|
|
265
|
-
baseElement = null;
|
|
266
|
-
}
|
|
267
|
-
if (baseElement) {
|
|
268
|
-
const href = baseElement.getAttribute("href");
|
|
269
|
-
if (href !== this.baseUrl) {
|
|
270
|
-
this.originalBaseUrl = href;
|
|
271
|
-
baseElement.setAttribute("href", this.baseUrl);
|
|
272
|
-
}
|
|
273
|
-
} else {
|
|
274
|
-
baseElement = doc.createElement("base");
|
|
275
|
-
baseElement.setAttribute("href", this.baseUrl);
|
|
276
|
-
doc.head.insertAdjacentElement("afterbegin", baseElement);
|
|
277
|
-
}
|
|
278
|
-
return this.initDocument(doc.documentElement.outerHTML);
|
|
265
|
+
return this.initDocument(v);
|
|
279
266
|
});
|
|
280
267
|
}
|
|
281
268
|
|
|
269
|
+
public get language() {
|
|
270
|
+
return this[languageSymbol];
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
public set language(v: string) {
|
|
274
|
+
if (v === this[languageSymbol]) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
this[languageSymbol] = v;
|
|
278
|
+
localStorage.setItem("editing-lang", v);
|
|
279
|
+
if(this.htmlDocument?.body) {
|
|
280
|
+
this.htmlDocument.body.setAttribute("editing-lang", v);
|
|
281
|
+
}
|
|
282
|
+
AtomBinder.refreshValue(this, "language");
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// public get languages() {
|
|
286
|
+
// const l = this.htmlDocument?.querySelector("language-chooser");
|
|
287
|
+
// const all = { label: "Lang", value: "all"};
|
|
288
|
+
// if (!l) {
|
|
289
|
+
// return [all];
|
|
290
|
+
// }
|
|
291
|
+
// return [all, ... l.getAttribute("languages")?.split(/[\,\;\s]+/).filter((x) => x).map((x) => ({ label: x, value: x}))];
|
|
292
|
+
// }
|
|
293
|
+
|
|
294
|
+
|
|
282
295
|
private lastHtml: string;
|
|
283
296
|
private ready: Promise<void>;
|
|
284
297
|
private contentEditor: HTMLIFrameElement;
|
|
@@ -318,6 +331,7 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
318
331
|
<i
|
|
319
332
|
data-click-event="edit-code"
|
|
320
333
|
class="fa-solid fa-code"/>
|
|
334
|
+
<LanguageDropDown/>
|
|
321
335
|
</EditorToolbar>
|
|
322
336
|
</div>
|
|
323
337
|
<EditorToolbar data-element="left">
|
|
@@ -642,6 +656,7 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
642
656
|
const body = clone.querySelector("body");
|
|
643
657
|
body.removeAttribute("contentEditable");
|
|
644
658
|
body.removeAttribute("editing");
|
|
659
|
+
body.removeAttribute("editing-lang");
|
|
645
660
|
const all = clone.querySelectorAll("*");
|
|
646
661
|
const deleteAll = [] as HTMLElement[];
|
|
647
662
|
const removeAll = [];
|
|
@@ -689,6 +704,10 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
689
704
|
this.lastCommittedBody = body.innerHTML;
|
|
690
705
|
return;
|
|
691
706
|
}
|
|
707
|
+
const currentCommitedHtml = clone.outerHTML;
|
|
708
|
+
if (this.lastCommittedHtml === currentCommitedHtml) {
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
692
711
|
this.undoList.add(this.lastHtml);
|
|
693
712
|
this.lastHtml = currentHtml;
|
|
694
713
|
this.lastCommittedHtml = clone.outerHTML;
|
|
@@ -727,110 +746,150 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
727
746
|
this.htmlDocument.body.setAttribute("editing", "true");
|
|
728
747
|
}
|
|
729
748
|
|
|
730
|
-
protected initDocument(v: string) {
|
|
731
|
-
void this.ready.then(async () => {
|
|
732
|
-
this.htmlDocument = void 0;
|
|
733
|
-
await this.loadContentDocument();
|
|
734
|
-
this.htmlDocument.open();
|
|
735
|
-
this.htmlDocument.write(v);
|
|
736
|
-
this.htmlDocument.addEventListener("click", (e) => {
|
|
737
|
-
const target = e.target as HTMLAnchorElement;
|
|
738
|
-
const previous = this.selection.element;
|
|
739
|
-
if (previous?.isContentEditable) {
|
|
740
|
-
let start = target;
|
|
741
|
-
while (start) {
|
|
742
|
-
if (previous === target) {
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
start = start.parentElement as any;
|
|
746
|
-
}
|
|
747
|
-
if (previous !== this.htmlDocument.body) {
|
|
748
|
-
previous.removeAttribute("contentEditable");
|
|
749
|
-
}
|
|
750
|
-
this.queueCommit();
|
|
751
|
-
}
|
|
752
|
-
e.preventDefault();
|
|
753
|
-
this.setSelection(target);
|
|
754
|
-
});
|
|
755
|
-
|
|
756
|
-
this.htmlDocument.addEventListener("dblclick", (e) => {
|
|
757
|
-
const target = e.target as Node;
|
|
758
|
-
e.preventDefault();
|
|
759
|
-
const element: HTMLElement = target.nodeType === Node.ELEMENT_NODE ? target as HTMLElement : target.parentElement;
|
|
760
|
-
if (/^(IMG|INJECT|VIDEO|PDF)/.test(element.tagName)) {
|
|
761
|
-
this.changeImage().catch(console.error);
|
|
762
|
-
return;
|
|
763
|
-
}
|
|
764
|
-
if (element.getAttribute("data-editable") === "false") {
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
if (element.hasAttribute("data-web-atoms-view")) {
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
770
|
-
this.setSelection(element as any);
|
|
771
|
-
});
|
|
749
|
+
protected async initDocument(v: string) {
|
|
772
750
|
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
751
|
+
const dom = new DOMParser();
|
|
752
|
+
const doc = dom.parseFromString(v, "text/html");
|
|
753
|
+
|
|
754
|
+
doc.body.contentEditable = "true";
|
|
755
|
+
doc.body.setAttribute("editing", "true");
|
|
777
756
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
757
|
+
this.updateBaseUrl(doc);
|
|
758
|
+
|
|
759
|
+
await this.setStylerSheet(doc);
|
|
760
|
+
|
|
761
|
+
const lc = doc.querySelector("language-chooser");
|
|
762
|
+
const languageStyles = [];
|
|
763
|
+
if (lc) {
|
|
764
|
+
const languages = [ { label: "Lang", value: "all"}];
|
|
765
|
+
const list = lc.getAttribute("languages");
|
|
766
|
+
if (list) {
|
|
767
|
+
for (const token of list.split(/[\,\;\s]+/)) {
|
|
768
|
+
const lang = token.trim();
|
|
769
|
+
if (!lang) {
|
|
770
|
+
continue;
|
|
771
|
+
}
|
|
772
|
+
languageStyles.push(`body[editing-lang=${lang}] *[lang]:not([lang=${lang}]) { display: none; }`);
|
|
773
|
+
languages.push({ label: lang, value: lang});
|
|
783
774
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
775
|
+
}
|
|
776
|
+
this.languages = languages;
|
|
777
|
+
const current = localStorage.getItem("editing-lang");
|
|
778
|
+
if(current) {
|
|
779
|
+
doc.body.setAttribute("editing-lang", current);
|
|
780
|
+
this[languageSymbol] = current;
|
|
781
|
+
AtomBinder.refreshValue(this, "language");
|
|
782
|
+
} else {
|
|
783
|
+
this[languageSymbol] = "all";
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
const cursorStyle = doc.createElement("style");
|
|
788
|
+
cursorStyle.textContent = `* {
|
|
789
|
+
caret-color: currentColor !important;
|
|
790
|
+
}
|
|
791
|
+
${languageStyles.join("\n")}
|
|
792
|
+
`;
|
|
793
|
+
cursorStyle.setAttribute("data-cursor-style", "editing");
|
|
794
|
+
doc.head.append(cursorStyle);
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
this.htmlDocument = void 0;
|
|
798
|
+
await this.loadContentDocument();
|
|
799
|
+
this.htmlDocument.open();
|
|
800
|
+
this.htmlDocument.write(doc.documentElement.outerHTML);
|
|
801
|
+
this.htmlDocument.close();
|
|
802
|
+
|
|
803
|
+
this.htmlDocument.addEventListener("click", (e) => {
|
|
804
|
+
const target = e.target as HTMLAnchorElement;
|
|
805
|
+
const previous = this.selection.element;
|
|
806
|
+
if (previous?.isContentEditable) {
|
|
807
|
+
let start = target;
|
|
808
|
+
while (start) {
|
|
809
|
+
if (previous === target) {
|
|
810
|
+
return;
|
|
802
811
|
}
|
|
812
|
+
start = start.parentElement as any;
|
|
803
813
|
}
|
|
804
|
-
|
|
814
|
+
if (previous !== this.htmlDocument.body) {
|
|
815
|
+
previous.removeAttribute("contentEditable");
|
|
816
|
+
}
|
|
817
|
+
this.queueCommit();
|
|
818
|
+
}
|
|
819
|
+
e.preventDefault();
|
|
820
|
+
this.setSelection(target);
|
|
821
|
+
});
|
|
822
|
+
|
|
823
|
+
this.htmlDocument.addEventListener("dblclick", (e) => {
|
|
824
|
+
const target = e.target as Node;
|
|
825
|
+
e.preventDefault();
|
|
826
|
+
const element: HTMLElement = target.nodeType === Node.ELEMENT_NODE ? target as HTMLElement : target.parentElement;
|
|
827
|
+
if (/^(IMG|INJECT|VIDEO|PDF)/.test(element.tagName)) {
|
|
828
|
+
this.changeImage().catch(console.error);
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
if (element.getAttribute("data-editable") === "false") {
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
if (element.hasAttribute("data-web-atoms-view")) {
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
this.setSelection(element as any);
|
|
838
|
+
});
|
|
805
839
|
|
|
806
|
-
|
|
840
|
+
this.htmlDocument.addEventListener("scroll", (e) => {
|
|
841
|
+
this.hover.update();
|
|
842
|
+
this.selection.update();
|
|
843
|
+
}, { passive: true });
|
|
807
844
|
|
|
808
|
-
|
|
845
|
+
this.htmlDocument.addEventListener("pointerover", (e) => {
|
|
846
|
+
let target = e.target as HTMLElement;
|
|
847
|
+
target = target.nodeType === Node.ELEMENT_NODE && target.tagName ? target : target.parentElement;
|
|
848
|
+
if (this.hover.element === target) {
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
this.hover.update(target);
|
|
852
|
+
}, { capture: true });
|
|
853
|
+
|
|
854
|
+
this.htmlDocument.addEventListener("keydown", (e) => {
|
|
855
|
+
if(e.ctrlKey || e.metaKey) {
|
|
856
|
+
switch(e.key) {
|
|
857
|
+
case "s":
|
|
858
|
+
this.contentEditor.dispatchEvent(new CustomEvent("savePage", { bubbles: true }));
|
|
859
|
+
e.preventDefault();
|
|
860
|
+
break;
|
|
861
|
+
case "z":
|
|
862
|
+
this.contentEditor.dispatchEvent(new CustomEvent("undo", { bubbles: true }));
|
|
863
|
+
e.preventDefault();
|
|
864
|
+
break;
|
|
865
|
+
case "y":
|
|
866
|
+
this.contentEditor.dispatchEvent(new CustomEvent("redo", { bubbles: true }));
|
|
867
|
+
e.preventDefault();
|
|
868
|
+
break;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
});
|
|
809
872
|
|
|
810
|
-
|
|
873
|
+
this.htmlDocument.addEventListener("input", () => this.queueCommit());
|
|
811
874
|
|
|
812
|
-
|
|
875
|
+
InstallDragDropHelper(this);
|
|
813
876
|
|
|
814
|
-
|
|
815
|
-
this.htmlDocument.body.setAttribute("editing", "true");
|
|
877
|
+
EditorCustomElements.register(this.htmlDocument);
|
|
816
878
|
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
caret-color: currentColor !important;
|
|
820
|
-
}`;
|
|
821
|
-
cursorStyle.setAttribute("data-cursor-style", "editing");
|
|
822
|
-
this.htmlDocument.head.append(cursorStyle);
|
|
879
|
+
// this.htmlDocument.body.contentEditable = "true";
|
|
880
|
+
// this.htmlDocument.body.setAttribute("editing", "true");
|
|
823
881
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
882
|
+
// const cursorStyle = this.htmlDocument.createElement("style");
|
|
883
|
+
// cursorStyle.textContent = `* {
|
|
884
|
+
// caret-color: currentColor !important;
|
|
885
|
+
// }`;
|
|
886
|
+
// cursorStyle.setAttribute("data-cursor-style", "editing");
|
|
887
|
+
// this.htmlDocument.head.append(cursorStyle);
|
|
829
888
|
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
});
|
|
889
|
+
// install styler...
|
|
890
|
+
setTimeout(() => {
|
|
891
|
+
this.commit();
|
|
892
|
+
},10);
|
|
834
893
|
}
|
|
835
894
|
|
|
836
895
|
protected queueCommit() {
|
|
@@ -841,32 +900,50 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
841
900
|
this.lastCommitTimerID = setTimeout(() => this.commit(), 1000);
|
|
842
901
|
}
|
|
843
902
|
|
|
844
|
-
protected async setStylerSheet() {
|
|
845
|
-
|
|
846
|
-
let style = document.querySelector(`[styler-style-sheet]`);
|
|
903
|
+
protected async setStylerSheet(doc = this.htmlDocument) {
|
|
904
|
+
let style = doc.querySelector(`[styler-style-sheet]`);
|
|
847
905
|
if (!style) {
|
|
848
|
-
style =
|
|
906
|
+
style = doc.createElement("style");
|
|
849
907
|
style.setAttribute("styler-style-sheet", "inline");
|
|
850
|
-
|
|
908
|
+
doc.head.appendChild(style);
|
|
851
909
|
}
|
|
852
910
|
style.textContent = StylerSet.instance.toString();
|
|
853
911
|
}
|
|
854
912
|
|
|
855
|
-
protected loadVariables() {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
913
|
+
// protected loadVariables() {
|
|
914
|
+
// const onChange = () => {
|
|
915
|
+
// const document = this.htmlDocument;
|
|
916
|
+
// let style = document.querySelector("[styler-style-variables]");
|
|
917
|
+
// if (!style) {
|
|
918
|
+
// style = document.createElement("style");
|
|
919
|
+
// style.setAttribute("styler-style-variables", "override");
|
|
920
|
+
// document.head.appendChild(style);
|
|
921
|
+
// }
|
|
922
|
+
// style.textContent = `:root {
|
|
923
|
+
// ${this.pageVariables.map((x) => `${x.propertyName}: ${x.currentValue};`).join("\n\t")}
|
|
924
|
+
// }`;
|
|
925
|
+
// };
|
|
926
|
+
// this.pageVariables = StylerSet.instance.vars.map((x) => new StylerVariable(x.name, x.value, this.htmlDocument, onChange));
|
|
927
|
+
|
|
928
|
+
// }
|
|
869
929
|
|
|
930
|
+
private updateBaseUrl(doc: Document) {
|
|
931
|
+
let baseElement = doc.querySelector("base");
|
|
932
|
+
if (baseElement?.getAttribute("href")?.startsWith("/api/site/")) {
|
|
933
|
+
baseElement.remove();
|
|
934
|
+
baseElement = null;
|
|
935
|
+
}
|
|
936
|
+
if (baseElement) {
|
|
937
|
+
const href = baseElement.getAttribute("href");
|
|
938
|
+
if (href !== this.baseUrl) {
|
|
939
|
+
this.originalBaseUrl = href;
|
|
940
|
+
baseElement.setAttribute("href", this.baseUrl);
|
|
941
|
+
}
|
|
942
|
+
} else {
|
|
943
|
+
baseElement = doc.createElement("base");
|
|
944
|
+
baseElement.setAttribute("href", this.baseUrl);
|
|
945
|
+
doc.head.insertAdjacentElement("afterbegin", baseElement);
|
|
946
|
+
}
|
|
870
947
|
}
|
|
871
948
|
|
|
872
949
|
private async loadContentDocument() {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
|
|
3
|
+
import Bind from "@web-atoms/core/dist/core/Bind";
|
|
4
|
+
import XNode from "@web-atoms/core/dist/core/XNode";
|
|
5
|
+
import styled from "@web-atoms/core/dist/style/styled";
|
|
6
|
+
import Select from "@web-atoms/web-controls/dist/basic/Select";
|
|
7
|
+
import HtmlPageEditor from "./HtmlPageEditor";
|
|
8
|
+
|
|
9
|
+
export default function LanguageDropDown() {
|
|
10
|
+
return <Select
|
|
11
|
+
style-max-width="80px"
|
|
12
|
+
style-border="none"
|
|
13
|
+
style-display={Bind.oneWay((c: HtmlPageEditor) => !!c.languages )}
|
|
14
|
+
items={Bind.oneWay((c: HtmlPageEditor) => c.languages ?? void 0)}
|
|
15
|
+
labelPath={(x) => x.label}
|
|
16
|
+
valuePath={(x) => x.value}
|
|
17
|
+
value={Bind.twoWaysImmediate((c: HtmlPageEditor) => c.language)}
|
|
18
|
+
/>;
|
|
19
|
+
}
|
|
@@ -146,14 +146,14 @@ export default class WebSitePageEditor extends HtmlPageEditor {
|
|
|
146
146
|
});
|
|
147
147
|
file = await this.cloudFileService.getFile(file.appFileID);
|
|
148
148
|
}
|
|
149
|
-
await this.addStyleSheet(file, "styles/vars.css");
|
|
149
|
+
await this.addStyleSheet(this.htmlDocument, file, "styles/vars.css");
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
protected async setStylerSheet() {
|
|
152
|
+
protected async setStylerSheet(doc: Document) {
|
|
153
153
|
|
|
154
154
|
|
|
155
155
|
// inject injected component....
|
|
156
|
-
for(const e of Array.from(
|
|
156
|
+
for(const e of Array.from(doc.querySelectorAll("inject"))) {
|
|
157
157
|
let src = e.getAttribute("src");
|
|
158
158
|
if(src.startsWith("/")) {
|
|
159
159
|
src = src.substring(1);
|
|
@@ -177,7 +177,7 @@ export default class WebSitePageEditor extends HtmlPageEditor {
|
|
|
177
177
|
|
|
178
178
|
const stylerCSS = await this.createFile("styler.css", StylerSet.instance.toString());
|
|
179
179
|
|
|
180
|
-
await this.addStyleSheet(stylerCSS, "styles/styler.css");
|
|
180
|
+
await this.addStyleSheet(doc, stylerCSS, "styles/styler.css");
|
|
181
181
|
|
|
182
182
|
let vars = await this.cloudFileService.children(this.folder.appFileID, "styles/vars.css")
|
|
183
183
|
.firstOrDefault();
|
|
@@ -186,32 +186,32 @@ export default class WebSitePageEditor extends HtmlPageEditor {
|
|
|
186
186
|
${StylerSet.instance.varsCss}
|
|
187
187
|
}`);
|
|
188
188
|
}
|
|
189
|
-
await this.addStyleSheet(vars, "styles/vars.css");
|
|
189
|
+
await this.addStyleSheet(doc, vars, "styles/vars.css");
|
|
190
190
|
|
|
191
|
-
let script =
|
|
191
|
+
let script = doc.querySelector("script[web-components]");
|
|
192
192
|
if (!script) {
|
|
193
|
-
script =
|
|
193
|
+
script = doc.createElement("script");
|
|
194
194
|
script.setAttribute("web-components", "social");
|
|
195
195
|
script.setAttribute("async", "true");
|
|
196
196
|
script.setAttribute("defer", "true");
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
doc.head.appendChild(doc.createTextNode("\n"));
|
|
198
|
+
doc.head.appendChild(script);
|
|
199
|
+
doc.head.appendChild(doc.createTextNode("\n"));
|
|
200
200
|
}
|
|
201
201
|
script.setAttribute("src", "//cdn.jsdelivr.net/npm/@social-mail/web-components@1.0.88/dist/components.webpack.js");
|
|
202
202
|
|
|
203
203
|
// install free fa script...
|
|
204
204
|
const start = "https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free";
|
|
205
|
-
if(!Array.from(
|
|
206
|
-
const css =
|
|
205
|
+
if(!Array.from(doc.querySelectorAll(`link[rel=stylesheet]`)).find((x) => x.getAttribute("href").startsWith(start))) {
|
|
206
|
+
const css = doc.createElement("link");
|
|
207
207
|
css.setAttribute("rel", "stylesheet");
|
|
208
208
|
css.setAttribute("href", start + "@6.6.0/css/all.min.css");
|
|
209
|
-
|
|
209
|
+
doc.head.appendChild(css);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
|
|
214
|
-
private async addStyleSheet(file: IAppFile, path: string) {
|
|
214
|
+
private async addStyleSheet(doc: Document, file: IAppFile, path: string) {
|
|
215
215
|
|
|
216
216
|
// get path...
|
|
217
217
|
const filePath = this.selectedFile.path.substring(this.folder.path.length);
|
|
@@ -221,7 +221,7 @@ export default class WebSitePageEditor extends HtmlPageEditor {
|
|
|
221
221
|
folder--;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
const document =
|
|
224
|
+
const document = doc;
|
|
225
225
|
const href = "./" + path;
|
|
226
226
|
let link: HTMLLinkElement;
|
|
227
227
|
for (const iterator of Array.from(document.querySelectorAll(`link[rel="stylesheet"][styler-css]`))) {
|
|
@@ -232,7 +232,7 @@ export default class WebSitePageEditor extends HtmlPageEditor {
|
|
|
232
232
|
}
|
|
233
233
|
if (!link){
|
|
234
234
|
link ??= document.createElement("link");
|
|
235
|
-
document.head.appendChild(
|
|
235
|
+
document.head.appendChild(doc.createTextNode("\n"));
|
|
236
236
|
document.head.appendChild(link);
|
|
237
237
|
link.rel = "stylesheet";
|
|
238
238
|
link.setAttribute("styler-css", file.name);
|
|
@@ -10,12 +10,12 @@ export const stylerPosition = {
|
|
|
10
10
|
stylerBottom: new StylerProperty("styler-bottom", createVarSet("bottom", sizeVarList)),
|
|
11
11
|
|
|
12
12
|
stylerZIndex: new StylerProperty("styler-z-index", createSet("z-index", [
|
|
13
|
-
"none",
|
|
14
|
-
"last",
|
|
15
|
-
"back",
|
|
16
|
-
"front",
|
|
17
|
-
"first"
|
|
18
|
-
])),
|
|
13
|
+
{ name: "none", value: "unset" },
|
|
14
|
+
{ name: "last", value: "-100000" },
|
|
15
|
+
{ name: "back", value: "-100" },
|
|
16
|
+
{ name: "front", value: "100" },
|
|
17
|
+
{ name: "first", value: "100000" },
|
|
18
|
+
], true, true)),
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
StylerSets.register("high", styled.css `
|