@social-mail/social-mail-client 1.2.521 → 1.2.523
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 +126 -165
- package/dist/admin/AdminAppIndex.pack.js.map +1 -1
- package/dist/admin/AdminAppIndex.pack.min.js +5 -5
- package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
- package/dist/site-editor/editor/HtmlPageEditor.d.ts.map +1 -1
- package/dist/site-editor/editor/HtmlPageEditor.js +12 -5
- package/dist/site-editor/editor/HtmlPageEditor.js.map +1 -1
- package/dist/site-editor/editor/WebSitePageEditor.d.ts.map +1 -1
- package/dist/site-editor/editor/WebSitePageEditor.js +5 -3
- package/dist/site-editor/editor/WebSitePageEditor.js.map +1 -1
- package/dist/site-editor/editor/webComponentsPath.d.ts +6 -0
- package/dist/site-editor/editor/webComponentsPath.d.ts.map +1 -0
- package/dist/site-editor/editor/webComponentsPath.js +105 -0
- package/dist/site-editor/editor/webComponentsPath.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/web/AppIndex.pack.js +126 -165
- package/dist/web/AppIndex.pack.js.map +1 -1
- package/dist/web/AppIndex.pack.min.js +5 -5
- package/dist/web/AppIndex.pack.min.js.map +1 -1
- package/package.json +1 -1
- package/src/site-editor/editor/HtmlPageEditor.tsx +17 -2
- package/src/site-editor/editor/WebSitePageEditor.tsx +2 -1
- package/src/site-editor/editor/webComponentsPath.ts +101 -0
- package/dist/site-editor/editor/custom-elements/EditorCustomElements.d.ts +0 -5
- package/dist/site-editor/editor/custom-elements/EditorCustomElements.d.ts.map +0 -1
- package/dist/site-editor/editor/custom-elements/EditorCustomElements.js +0 -33
- package/dist/site-editor/editor/custom-elements/EditorCustomElements.js.map +0 -1
- package/dist/site-editor/editor/custom-elements/LanguageChooser.d.ts +0 -6
- package/dist/site-editor/editor/custom-elements/LanguageChooser.d.ts.map +0 -1
- package/dist/site-editor/editor/custom-elements/LanguageChooser.js +0 -77
- package/dist/site-editor/editor/custom-elements/LanguageChooser.js.map +0 -1
- package/dist/site-editor/editor/custom-elements/PdfViewerElement.d.ts +0 -9
- package/dist/site-editor/editor/custom-elements/PdfViewerElement.d.ts.map +0 -1
- package/dist/site-editor/editor/custom-elements/PdfViewerElement.js +0 -37
- package/dist/site-editor/editor/custom-elements/PdfViewerElement.js.map +0 -1
- package/src/site-editor/editor/custom-elements/EditorCustomElements.ts +0 -29
- package/src/site-editor/editor/custom-elements/LanguageChooser.ts +0 -84
- package/src/site-editor/editor/custom-elements/PdfViewerElement.ts +0 -33
package/package.json
CHANGED
|
@@ -47,10 +47,10 @@ import { BoxFrame } from "../blocks/BoxFrame";
|
|
|
47
47
|
import { InjectBox } from "../blocks/InjectBox";
|
|
48
48
|
import { PDFFlipBook } from "../blocks/PDFFlipBook";
|
|
49
49
|
import { PDFViewer } from "../blocks/PDFViewer";
|
|
50
|
-
import { EditorCustomElements } from "./custom-elements/EditorCustomElements";
|
|
51
50
|
import { Banner } from "../blocks/Banner";
|
|
52
51
|
import BreadCrum from "./BreadCrum";
|
|
53
52
|
import LanguageDropDown from "./LanguageDropDown";
|
|
53
|
+
import { WebComponents } from "./webComponentsPath";
|
|
54
54
|
|
|
55
55
|
styled.css `
|
|
56
56
|
display: grid;
|
|
@@ -671,8 +671,13 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
671
671
|
for (let index = 0; index < all.length; index++) {
|
|
672
672
|
const element = all[index];
|
|
673
673
|
element.removeAttribute("draggable");
|
|
674
|
+
if (element.hasAttribute("remove-when-save")) {
|
|
675
|
+
deleteAll.push(element as HTMLElement);
|
|
676
|
+
continue;
|
|
677
|
+
}
|
|
674
678
|
if (element.tagName === "INJECT") {
|
|
675
679
|
deleteAll.push(element as HTMLElement);
|
|
680
|
+
continue;
|
|
676
681
|
}
|
|
677
682
|
if (element.getAttribute("data-cursor-style") === "editing") {
|
|
678
683
|
removeAll.push(element);
|
|
@@ -755,6 +760,8 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
755
760
|
|
|
756
761
|
protected async initDocument(v: string) {
|
|
757
762
|
|
|
763
|
+
this.contentEditor.srcdoc = "about:empty";
|
|
764
|
+
|
|
758
765
|
const dom = new DOMParser();
|
|
759
766
|
const doc = dom.parseFromString(v, "text/html");
|
|
760
767
|
|
|
@@ -802,11 +809,17 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
802
809
|
|
|
803
810
|
|
|
804
811
|
this.htmlDocument = void 0;
|
|
812
|
+
|
|
805
813
|
await this.loadContentDocument();
|
|
806
814
|
this.htmlDocument.open();
|
|
807
815
|
this.htmlDocument.write(doc.documentElement.outerHTML);
|
|
808
816
|
this.htmlDocument.close();
|
|
809
817
|
|
|
818
|
+
|
|
819
|
+
await sleep(1000);
|
|
820
|
+
|
|
821
|
+
await WebComponents.run(this.contentEditor, this.htmlDocument);
|
|
822
|
+
|
|
810
823
|
this.htmlDocument.addEventListener("click", (e) => {
|
|
811
824
|
const target = e.target as HTMLAnchorElement;
|
|
812
825
|
const previous = this.selection.element;
|
|
@@ -881,7 +894,9 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
881
894
|
|
|
882
895
|
InstallDragDropHelper(this);
|
|
883
896
|
|
|
884
|
-
|
|
897
|
+
|
|
898
|
+
// EditorCustomElements.register(this.htmlDocument);
|
|
899
|
+
|
|
885
900
|
|
|
886
901
|
// this.htmlDocument.body.contentEditable = "true";
|
|
887
902
|
// this.htmlDocument.body.setAttribute("editing", "true");
|
|
@@ -11,6 +11,7 @@ import CodeEditorPage from "../../code-editor/CodeEditorPage";
|
|
|
11
11
|
import { apiPath } from "../../common/apiPath";
|
|
12
12
|
import FetchBuilder from "@web-atoms/core/dist/services/FetchBuilder";
|
|
13
13
|
import { imageUrl, srcSetUrl, viewFileUrl } from "../../common/fileUrl";
|
|
14
|
+
import { WebComponents } from "./webComponentsPath";
|
|
14
15
|
|
|
15
16
|
export default class WebSitePageEditor extends HtmlPageEditor {
|
|
16
17
|
|
|
@@ -198,7 +199,7 @@ export default class WebSitePageEditor extends HtmlPageEditor {
|
|
|
198
199
|
doc.head.appendChild(script);
|
|
199
200
|
doc.head.appendChild(doc.createTextNode("\n"));
|
|
200
201
|
}
|
|
201
|
-
script.setAttribute("src",
|
|
202
|
+
script.setAttribute("src", `${WebComponents.path}/dist/main.js`);
|
|
202
203
|
|
|
203
204
|
// install free fa script...
|
|
204
205
|
const start = "https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free";
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import sleep from "@web-atoms/core/dist/core/sleep";
|
|
2
|
+
import FetchBuilder from "@web-atoms/core/dist/services/FetchBuilder";
|
|
3
|
+
|
|
4
|
+
class CustomElementsProxy {
|
|
5
|
+
constructor(public readonly elements: { name, factory }[] = []) {
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
define(name, factory) {
|
|
10
|
+
this.elements.push({ name, factory });
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class WebComponents {
|
|
15
|
+
|
|
16
|
+
static path = `//cdn.jsdelivr.net/npm/@social-mail/web-components@1.0.103`;
|
|
17
|
+
|
|
18
|
+
static async run2(frame: HTMLIFrameElement, doc: Document) {
|
|
19
|
+
const url = this.path + "/dist/editable.js";
|
|
20
|
+
|
|
21
|
+
const sandbox = frame.getAttribute("sandbox");
|
|
22
|
+
frame.setAttribute("sandbox", "allow-scripts allow-same-origin");
|
|
23
|
+
const text = await FetchBuilder.get(url).responseAsText();
|
|
24
|
+
const win = doc.defaultView;
|
|
25
|
+
win.eval(`window.addEventListener("unsafeEval", (e) => eval(e.detail) , { once: true });`);
|
|
26
|
+
// win.eval(`window.dispatchEvent(new CustomEvent("unsafeEval", { detail: ${JSON.stringify(text)} }))`);
|
|
27
|
+
win.dispatchEvent(new CustomEvent("unsafeEval", { detail: text}));
|
|
28
|
+
frame.removeAttribute("allow");
|
|
29
|
+
frame.setAttribute("sandbox", sandbox);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static async run(frame: HTMLIFrameElement, doc: Document) {
|
|
33
|
+
const url = this.path + "/dist/editable.js";
|
|
34
|
+
|
|
35
|
+
frame.sandbox.add("allow-scripts");
|
|
36
|
+
const text = await FetchBuilder.get(url).responseAsText();
|
|
37
|
+
|
|
38
|
+
const proxy = new CustomElementsProxy();
|
|
39
|
+
const win = doc.defaultView;
|
|
40
|
+
const globals = {
|
|
41
|
+
window: win,
|
|
42
|
+
document: win.document,
|
|
43
|
+
Object: win.Object,
|
|
44
|
+
// Promise: win.Promise,
|
|
45
|
+
Promise,
|
|
46
|
+
console: win.console,
|
|
47
|
+
Boolean: win.Boolean,
|
|
48
|
+
String: win.String,
|
|
49
|
+
Number: win.Number,
|
|
50
|
+
Math: win.Math,
|
|
51
|
+
Date: win.Date,
|
|
52
|
+
Proxy: win.Proxy,
|
|
53
|
+
Map: win.Map,
|
|
54
|
+
Array: win.Array,
|
|
55
|
+
RegExp: win.RegExp,
|
|
56
|
+
PromiseRejectionEvent: win.PromiseRejectionEvent,
|
|
57
|
+
// setTimeout: win.setTimeout,
|
|
58
|
+
// setInterval: win.setInterval,
|
|
59
|
+
// clearTimeout: win.clearTimeout,
|
|
60
|
+
// clearInterval: win.clearInterval,
|
|
61
|
+
setTimeout,
|
|
62
|
+
setInterval,
|
|
63
|
+
clearTimeout,
|
|
64
|
+
clearInterval,
|
|
65
|
+
Reflect: win.Reflect,
|
|
66
|
+
requestAnimationFrame: win.requestAnimationFrame,
|
|
67
|
+
requestIdleCallback: win.requestIdleCallback,
|
|
68
|
+
Symbol: win.Symbol,
|
|
69
|
+
HTMLElement: win.HTMLElement,
|
|
70
|
+
MutationObserver: win.MutationObserver,
|
|
71
|
+
IntersectionObserver: win.IntersectionObserver,
|
|
72
|
+
customElements: proxy
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const keys = Object.keys(globals);
|
|
76
|
+
|
|
77
|
+
const init = `${keys.map((x) => `var ${x} = globalWindow[${JSON.stringify(x)}]` ).join(";\n")}`;
|
|
78
|
+
|
|
79
|
+
const script = `
|
|
80
|
+
// (function (globalWindow) {
|
|
81
|
+
"use strict";
|
|
82
|
+
${init};
|
|
83
|
+
Symbol.dispose ||= Symbol("dispose");
|
|
84
|
+
;${text}
|
|
85
|
+
// })(globalWindow);
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
// (win as any).globalWindow = globals;
|
|
89
|
+
// win.eval(script);
|
|
90
|
+
|
|
91
|
+
const fx = new doc.defaultView.Function("globalWindow", script);
|
|
92
|
+
fx.call(win, globals);
|
|
93
|
+
await sleep(10);
|
|
94
|
+
for (const { name, factory } of proxy.elements) {
|
|
95
|
+
doc.defaultView.customElements.define(name, factory);
|
|
96
|
+
}
|
|
97
|
+
frame.sandbox.remove("allow-scripts");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EditorCustomElements.d.ts","sourceRoot":"","sources":["../../../../src/site-editor/editor/custom-elements/EditorCustomElements.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB;kBACf,QAAQ;qBAcL,QAAQ;CAU5B,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
System.register(["./LanguageChooser", "./PdfViewerElement"], function (_export, _context) {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var LanguageChooser, PdfViewerElement, EditorCustomElements;
|
|
5
|
-
return {
|
|
6
|
-
setters: [function (_LanguageChooser) {
|
|
7
|
-
LanguageChooser = _LanguageChooser.default;
|
|
8
|
-
}, function (_PdfViewerElement) {
|
|
9
|
-
PdfViewerElement = _PdfViewerElement.default;
|
|
10
|
-
}],
|
|
11
|
-
execute: function () {
|
|
12
|
-
_export("EditorCustomElements", EditorCustomElements = {
|
|
13
|
-
register(doc) {
|
|
14
|
-
const root = doc.createElement("div");
|
|
15
|
-
const div = Object.getPrototypeOf(root).constructor;
|
|
16
|
-
const HTMLElement = Object.getPrototypeOf(div);
|
|
17
|
-
this.registerAll(doc, HTMLElement, PdfViewerElement, LanguageChooser);
|
|
18
|
-
},
|
|
19
|
-
registerAll(doc, e, ...types) {
|
|
20
|
-
for (const type of types) {
|
|
21
|
-
if (doc.defaultView.customElements.get(type.elementName)) {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
const newElement = class extends type {};
|
|
25
|
-
Object.setPrototypeOf(newElement, e);
|
|
26
|
-
doc.defaultView.customElements.define(type.elementName, newElement);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=EditorCustomElements.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["LanguageChooser","_LanguageChooser","default","_PdfViewerElement","PdfViewerElement","execute","_export","EditorCustomElements","register","doc","root","createElement","div","Object","getPrototypeOf","constructor","HTMLElement","registerAll","e","types","type","defaultView","customElements","get","elementName","newElement","setPrototypeOf","define"],"sources":["../../../../src/site-editor/editor/custom-elements/EditorCustomElements.ts"],"sourcesContent":[null],"mappings":";;;;;;MAAOA,eAAe,GAAAC,gBAAA,CAAAC,OAAA;IAAA,aAAAC,iBAAA;MACfC,gBAAgB,GAAAD,iBAAA,CAAAD,OAAA;IAAA;IAAAG,OAAA,WAAAA,CAAA;MAAAC,OAAA,yBAEVC,oBAAoB,GAAG;QAChCC,QAAQA,CAACC,GAAa;UAGlB,MAAMC,IAAI,GAAGD,GAAG,CAACE,aAAa,CAAC,KAAK,CAAC;UACrC,MAAMC,GAAG,GAAGC,MAAM,CAACC,cAAc,CAACJ,IAAI,CAAC,CAACK,WAAW;UACnD,MAAMC,WAAW,GAAGH,MAAM,CAACC,cAAc,CAACF,GAAG,CAAC;UAE9C,IAAI,CAACK,WAAW,CAACR,GAAG,EAAEO,WAAW,EAC7BZ,gBAAgB,EAChBJ,eAAe,CAClB;QAEL,CAAC;QAEDiB,WAAWA,CAACR,GAAa,EAAES,CAAC,EAAE,GAAIC,KAAK;UACnC,KAAK,MAAMC,IAAI,IAAID,KAAK,EAAE;YACtB,IAAGV,GAAG,CAACY,WAAW,CAACC,cAAc,CAACC,GAAG,CAACH,IAAI,CAACI,WAAW,CAAC,EAAE;cACrD;;YAEJ,MAAMC,UAAU,GAAG,cAAcL,IAAI,GAAG;YACxCP,MAAM,CAACa,cAAc,CAACD,UAAU,EAAEP,CAAC,CAAC;YACpCT,GAAG,CAACY,WAAW,CAACC,cAAc,CAACK,MAAM,CAACP,IAAI,CAACI,WAAW,EAAEC,UAAU,CAAC;;QAE3E;OACH;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LanguageChooser.d.ts","sourceRoot":"","sources":["../../../../src/site-editor/editor/custom-elements/LanguageChooser.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,WAAW;IAEpD,MAAM,CAAC,WAAW,SAAsB;IAExC,MAAM,CAAC,kBAAkB,WAAiB;IAE1C,iBAAiB;CA4EpB"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
System.register([], function (_export, _context) {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var LanguageChooser;
|
|
5
|
-
_export("default", void 0);
|
|
6
|
-
return {
|
|
7
|
-
setters: [],
|
|
8
|
-
execute: function () {
|
|
9
|
-
_export("default", LanguageChooser = class LanguageChooser extends HTMLElement {
|
|
10
|
-
connectedCallback() {
|
|
11
|
-
this.setAttribute("is-web-component", "true");
|
|
12
|
-
const getName = code => {
|
|
13
|
-
try {
|
|
14
|
-
return new Intl.DisplayNames([code], {
|
|
15
|
-
type: 'language'
|
|
16
|
-
}).of(code);
|
|
17
|
-
} catch (error) {
|
|
18
|
-
return code;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const root = this.attachShadow({
|
|
22
|
-
mode: "closed"
|
|
23
|
-
});
|
|
24
|
-
let langs = this.getAttribute("languages");
|
|
25
|
-
if (!langs) {
|
|
26
|
-
console.warn(`Attribute languages not set, set to disable language detection.`);
|
|
27
|
-
const ls = new Set();
|
|
28
|
-
for (const element of Array.from(document.querySelectorAll(`[lang]`))) {
|
|
29
|
-
const l = element.getAttribute("lang");
|
|
30
|
-
ls.add(l.trim().toLocaleLowerCase());
|
|
31
|
-
}
|
|
32
|
-
langs = Array.from(ls).join(",");
|
|
33
|
-
}
|
|
34
|
-
const container = document.createElement("div");
|
|
35
|
-
const select = document.createElement("select");
|
|
36
|
-
let defaultLanguage = document.body.getAttribute("data-lang");
|
|
37
|
-
for (const element of langs.split(/[,\s\;]/i)) {
|
|
38
|
-
const lang = element.trim();
|
|
39
|
-
if (!lang) {
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
const option = document.createElement("option");
|
|
43
|
-
option.value = lang;
|
|
44
|
-
option.textContent = getName(lang);
|
|
45
|
-
select.appendChild(option);
|
|
46
|
-
if (!defaultLanguage) {
|
|
47
|
-
defaultLanguage = lang;
|
|
48
|
-
document.body.setAttribute("data-lang", lang);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
select.oninput = () => {
|
|
52
|
-
document.body.setAttribute("data-lang", select.value);
|
|
53
|
-
};
|
|
54
|
-
const icon = document.createElement("label");
|
|
55
|
-
icon.className = "fa-solid fa-globe";
|
|
56
|
-
container.appendChild(icon);
|
|
57
|
-
container.appendChild(select);
|
|
58
|
-
container.setAttribute("style", `
|
|
59
|
-
display: flex;
|
|
60
|
-
gap: 10px;
|
|
61
|
-
padding: 5px;
|
|
62
|
-
`);
|
|
63
|
-
select.setAttribute("style", `
|
|
64
|
-
outline: none;
|
|
65
|
-
border: none;
|
|
66
|
-
cursor: pointer;
|
|
67
|
-
background-color: transparent;
|
|
68
|
-
`);
|
|
69
|
-
root.appendChild(container);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
LanguageChooser.elementName = "language-chooser";
|
|
73
|
-
LanguageChooser.observedAttributes = ["languages"];
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
//# sourceMappingURL=LanguageChooser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["LanguageChooser","_export","setters","execute","HTMLElement","connectedCallback","setAttribute","getName","code","Intl","DisplayNames","type","of","error","root","attachShadow","mode","langs","getAttribute","console","warn","ls","Set","element","Array","from","document","querySelectorAll","l","add","trim","toLocaleLowerCase","join","container","createElement","select","defaultLanguage","body","split","lang","option","value","textContent","appendChild","oninput","icon","className","elementName","observedAttributes"],"sources":["../../../../src/site-editor/editor/custom-elements/LanguageChooser.ts"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export default class PdfViewerElement extends HTMLElement {
|
|
2
|
-
static elementName: string;
|
|
3
|
-
static observedAttributes: string[];
|
|
4
|
-
img: HTMLImageElement;
|
|
5
|
-
connectedCallback(): void;
|
|
6
|
-
updatePoster(): void;
|
|
7
|
-
attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=PdfViewerElement.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PdfViewerElement.d.ts","sourceRoot":"","sources":["../../../../src/site-editor/editor/custom-elements/PdfViewerElement.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;IAErD,MAAM,CAAC,WAAW,SAAgB;IAElC,MAAM,CAAC,kBAAkB,WAAqB;IAE9C,GAAG,EAAE,gBAAgB,CAAC;IAEtB,iBAAiB;IAYjB,YAAY;IAKZ,wBAAwB,CAAC,IAAI,KAAA,EAAE,QAAQ,KAAA,EAAE,QAAQ,KAAA;CAOpD"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
System.register([], function (_export, _context) {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var PdfViewerElement;
|
|
5
|
-
_export("default", void 0);
|
|
6
|
-
return {
|
|
7
|
-
setters: [],
|
|
8
|
-
execute: function () {
|
|
9
|
-
_export("default", PdfViewerElement = class PdfViewerElement extends HTMLElement {
|
|
10
|
-
connectedCallback() {
|
|
11
|
-
this.setAttribute("is-web-component", "true");
|
|
12
|
-
const root = this.attachShadow({
|
|
13
|
-
mode: "closed"
|
|
14
|
-
});
|
|
15
|
-
const img = this.img = document.createElement("img");
|
|
16
|
-
img.setAttribute("part", "thumb");
|
|
17
|
-
root.appendChild(img);
|
|
18
|
-
this.updatePoster();
|
|
19
|
-
}
|
|
20
|
-
updatePoster() {
|
|
21
|
-
const poster = this.getAttribute("poster");
|
|
22
|
-
this.img.src = poster;
|
|
23
|
-
}
|
|
24
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
25
|
-
switch (name) {
|
|
26
|
-
case "poster":
|
|
27
|
-
this.updatePoster();
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
PdfViewerElement.elementName = "pdf-viewer";
|
|
33
|
-
PdfViewerElement.observedAttributes = ["src", "poster"];
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=PdfViewerElement.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PdfViewerElement","_export","setters","execute","HTMLElement","connectedCallback","setAttribute","root","attachShadow","mode","img","document","createElement","appendChild","updatePoster","poster","getAttribute","src","attributeChangedCallback","name","oldValue","newValue","elementName","observedAttributes"],"sources":["../../../../src/site-editor/editor/custom-elements/PdfViewerElement.ts"],"sourcesContent":[null],"mappings":";;;MAAqBA,gBAAiB;EAAAC,OAAA;EAAA;IAAAC,OAAA;IAAAC,OAAA,WAAAA,CAAA;MAAAF,OAAA,YAAjBD,gBAAiB,GAAxB,MAAOA,gBAAiB,SAAQI,WAAW;QAQrDC,iBAAiBA,CAAA;UAEb,IAAI,CAACC,YAAY,CAAC,kBAAkB,EAAE,MAAM,CAAC;UAE7C,MAAMC,IAAI,GAAG,IAAI,CAACC,YAAY,CAAC;YAAEC,IAAI,EAAE;UAAQ,CAAC,CAAC;UACjD,MAAMC,GAAG,GAAG,IAAI,CAACA,GAAG,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;UACpDF,GAAG,CAACJ,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC;UACjCC,IAAI,CAACM,WAAW,CAACH,GAAG,CAAC;UAErB,IAAI,CAACI,YAAY,EAAE;QACvB;QAEAA,YAAYA,CAAA;UACR,MAAMC,MAAM,GAAG,IAAI,CAACC,YAAY,CAAC,QAAQ,CAAC;UAC1C,IAAI,CAACN,GAAG,CAACO,GAAG,GAAGF,MAAM;QACzB;QAEAG,wBAAwBA,CAACC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;UAC7C,QAAOF,IAAI;YACP,KAAK,QAAQ;cACT,IAAI,CAACL,YAAY,EAAE;cACnB;;QAEZ;;MA7BOd,gBAAA,CAAAsB,WAAW,GAAG,YAAY;MAE1BtB,gBAAA,CAAAuB,kBAAkB,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC;IAAC;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import LanguageChooser from "./LanguageChooser";
|
|
2
|
-
import PdfViewerElement from "./PdfViewerElement";
|
|
3
|
-
|
|
4
|
-
export const EditorCustomElements = {
|
|
5
|
-
register(doc: Document) {
|
|
6
|
-
|
|
7
|
-
// change base class
|
|
8
|
-
const root = doc.createElement("div");
|
|
9
|
-
const div = Object.getPrototypeOf(root).constructor;
|
|
10
|
-
const HTMLElement = Object.getPrototypeOf(div);
|
|
11
|
-
|
|
12
|
-
this.registerAll(doc, HTMLElement,
|
|
13
|
-
PdfViewerElement,
|
|
14
|
-
LanguageChooser
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
registerAll(doc: Document, e, ... types) {
|
|
20
|
-
for (const type of types) {
|
|
21
|
-
if(doc.defaultView.customElements.get(type.elementName)) {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
const newElement = class extends type {};
|
|
25
|
-
Object.setPrototypeOf(newElement, e);
|
|
26
|
-
doc.defaultView.customElements.define(type.elementName, newElement);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
export default class LanguageChooser extends HTMLElement {
|
|
3
|
-
|
|
4
|
-
static elementName = "language-chooser";
|
|
5
|
-
|
|
6
|
-
static observedAttributes = ["languages"];
|
|
7
|
-
|
|
8
|
-
connectedCallback() {
|
|
9
|
-
|
|
10
|
-
this.setAttribute("is-web-component", "true");
|
|
11
|
-
|
|
12
|
-
const getName = (code: string) => {
|
|
13
|
-
try {
|
|
14
|
-
return (new (Intl as any).DisplayNames([code], { type: 'language' })).of(code);
|
|
15
|
-
} catch (error) {
|
|
16
|
-
return code;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const root = this.attachShadow({ mode: "closed"});
|
|
22
|
-
|
|
23
|
-
let langs = this.getAttribute("languages");
|
|
24
|
-
|
|
25
|
-
if (!langs) {
|
|
26
|
-
// detect langs...
|
|
27
|
-
console.warn(`Attribute languages not set, set to disable language detection.`);
|
|
28
|
-
const ls = new Set();
|
|
29
|
-
for (const element of Array.from(document.querySelectorAll(`[lang]`))) {
|
|
30
|
-
const l = element.getAttribute("lang");
|
|
31
|
-
ls.add(l.trim().toLocaleLowerCase());
|
|
32
|
-
}
|
|
33
|
-
langs = Array.from(ls).join(",");
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const container = document.createElement("div");
|
|
37
|
-
const select = document.createElement("select");
|
|
38
|
-
|
|
39
|
-
let defaultLanguage = document.body.getAttribute("data-lang");
|
|
40
|
-
|
|
41
|
-
// we will set body's language if not set...
|
|
42
|
-
for (const element of langs.split(/[,\s\;]/i)) {
|
|
43
|
-
const lang = element.trim();
|
|
44
|
-
if (!lang) {
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
// installLanguageStyle(lang);
|
|
48
|
-
|
|
49
|
-
const option = document.createElement("option");
|
|
50
|
-
option.value = lang;
|
|
51
|
-
option.textContent = getName(lang);
|
|
52
|
-
select.appendChild(option);
|
|
53
|
-
|
|
54
|
-
if (!defaultLanguage) {
|
|
55
|
-
defaultLanguage = lang;
|
|
56
|
-
document.body.setAttribute("data-lang", lang);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
select.oninput = () => {
|
|
61
|
-
document.body.setAttribute("data-lang", select.value);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const icon = document.createElement("label");
|
|
65
|
-
icon.className = "fa-solid fa-globe";
|
|
66
|
-
container.appendChild(icon);
|
|
67
|
-
container.appendChild(select);
|
|
68
|
-
container.setAttribute("style", `
|
|
69
|
-
display: flex;
|
|
70
|
-
gap: 10px;
|
|
71
|
-
padding: 5px;
|
|
72
|
-
`);
|
|
73
|
-
select.setAttribute("style", `
|
|
74
|
-
outline: none;
|
|
75
|
-
border: none;
|
|
76
|
-
cursor: pointer;
|
|
77
|
-
background-color: transparent;
|
|
78
|
-
`);
|
|
79
|
-
root.appendChild(container);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export default class PdfViewerElement extends HTMLElement {
|
|
2
|
-
|
|
3
|
-
static elementName = "pdf-viewer";
|
|
4
|
-
|
|
5
|
-
static observedAttributes = ["src", "poster"];
|
|
6
|
-
|
|
7
|
-
img: HTMLImageElement;
|
|
8
|
-
|
|
9
|
-
connectedCallback() {
|
|
10
|
-
|
|
11
|
-
this.setAttribute("is-web-component", "true");
|
|
12
|
-
|
|
13
|
-
const root = this.attachShadow({ mode: "closed"});
|
|
14
|
-
const img = this.img = document.createElement("img");
|
|
15
|
-
img.setAttribute("part", "thumb");
|
|
16
|
-
root.appendChild(img);
|
|
17
|
-
|
|
18
|
-
this.updatePoster();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
updatePoster() {
|
|
22
|
-
const poster = this.getAttribute("poster");
|
|
23
|
-
this.img.src = poster;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
27
|
-
switch(name) {
|
|
28
|
-
case "poster":
|
|
29
|
-
this.updatePoster();
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|