@social-mail/social-mail-client 1.2.44 → 1.2.46
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/component.js +82 -0
- package/dist/admin/AdminAppIndex.pack.js +53 -6
- package/dist/admin/AdminAppIndex.pack.js.map +1 -1
- package/dist/admin/AdminAppIndex.pack.min.js +3 -3
- package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
- package/dist/site-editor/blocks/Components.d.ts +2 -0
- package/dist/site-editor/blocks/Components.d.ts.map +1 -0
- package/dist/site-editor/blocks/Components.js +23 -0
- package/dist/site-editor/blocks/Components.js.map +1 -0
- package/dist/site-editor/editor/HtmlPageEditor.d.ts.map +1 -1
- package/dist/site-editor/editor/HtmlPageEditor.js +26 -5
- package/dist/site-editor/editor/HtmlPageEditor.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/web/AppIndex.pack.js +53 -6
- package/dist/web/AppIndex.pack.js.map +1 -1
- package/dist/web/AppIndex.pack.min.js +3 -3
- package/dist/web/AppIndex.pack.min.js.map +1 -1
- package/index.js +9 -2
- package/package.json +1 -1
- package/src/site-editor/blocks/Components.tsx +10 -0
- package/src/site-editor/editor/HtmlPageEditor.tsx +23 -2
package/index.js
CHANGED
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
|
|
23
23
|
const view = script.getAttribute("data-view");
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
let host = script.getAttribute("data-host");
|
|
26
|
+
|
|
27
|
+
const replace = script.getAttribute("data-replace");
|
|
26
28
|
|
|
27
29
|
const packed = JSON.parse(script.getAttribute("data-packed") ?? "true");
|
|
28
30
|
const min = JSON.parse(script.getAttribute("data-min") ?? "true");
|
|
@@ -61,11 +63,16 @@
|
|
|
61
63
|
};
|
|
62
64
|
UMD.setupRoot(package, packageRoot);
|
|
63
65
|
UMD.lang = "en-US";
|
|
66
|
+
if (replace) {
|
|
67
|
+
host = document.createElement("section");
|
|
68
|
+
script.parentElement.replaceChild(section, script);
|
|
69
|
+
}
|
|
70
|
+
|
|
64
71
|
if (host) {
|
|
65
72
|
UMD.hostView(host, viewName, 0).then(done);
|
|
66
73
|
} else {
|
|
67
74
|
UMD.loadView(viewName, 0).then(done);
|
|
68
|
-
}
|
|
75
|
+
}
|
|
69
76
|
});
|
|
70
77
|
|
|
71
78
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import XNode from "@web-atoms/core/dist/core/XNode";
|
|
2
|
+
import { Block } from "./Block";
|
|
3
|
+
|
|
4
|
+
export const BlogComponent = Block({
|
|
5
|
+
className: "fad fa-blog",
|
|
6
|
+
title: "Add Blog Component",
|
|
7
|
+
factory: () => <section data-web-atoms-view="blog-view" style="margin: 10px; padding: 10px; background: gray; border-radius: 10px; color: white;">
|
|
8
|
+
Blog View
|
|
9
|
+
</section>
|
|
10
|
+
});
|
|
@@ -24,6 +24,8 @@ import { ImageCard } from "../blocks/ImageCard";
|
|
|
24
24
|
import { TextBox } from "../blocks/TextBox";
|
|
25
25
|
import { Card } from "../blocks/Card";
|
|
26
26
|
import { List } from "../blocks/List";
|
|
27
|
+
import { BlogComponent } from "../blocks/Components";
|
|
28
|
+
import { UMD } from "@web-atoms/core/dist/core/types";
|
|
27
29
|
|
|
28
30
|
styled.css `
|
|
29
31
|
display: grid;
|
|
@@ -206,11 +208,18 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
206
208
|
const target = e.target as Node;
|
|
207
209
|
e.preventDefault();
|
|
208
210
|
const element: HTMLElement = target.nodeType === Node.ELEMENT_NODE ? target as HTMLElement : target.parentElement;
|
|
209
|
-
element.setAttribute("contentEditable", "true");
|
|
210
|
-
this.setSelection(element as any);
|
|
211
211
|
if (element.tagName === "IMG") {
|
|
212
212
|
this.changeImage().catch(console.error);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (element.getAttribute("data-editable") === "false") {
|
|
216
|
+
return;
|
|
213
217
|
}
|
|
218
|
+
if (element.hasAttribute("data-web-atoms-view")) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
element.setAttribute("contentEditable", "true");
|
|
222
|
+
this.setSelection(element as any);
|
|
214
223
|
});
|
|
215
224
|
|
|
216
225
|
this.htmlDocument.addEventListener("scroll", (e) => {
|
|
@@ -313,6 +322,7 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
313
322
|
<Columns2/>
|
|
314
323
|
<Columns3/>
|
|
315
324
|
<List/>
|
|
325
|
+
<BlogComponent/>
|
|
316
326
|
</EditorToolbar>
|
|
317
327
|
<div data-element="editor"
|
|
318
328
|
style-max-width={Bind.oneWay(() => this.maxWidth > 768 ? "" : this.maxWidth + "px" )}>
|
|
@@ -513,6 +523,17 @@ export default class HtmlPageEditor extends AtomControl {
|
|
|
513
523
|
const element = all[index];
|
|
514
524
|
element.removeAttribute("draggable");
|
|
515
525
|
}
|
|
526
|
+
// replace script tags...
|
|
527
|
+
const blogView = clone.querySelector(`section[data-web-atoms-view="blog-view"]`);
|
|
528
|
+
if (blogView) {
|
|
529
|
+
const blogScript = this.htmlDocument.createElement("script");
|
|
530
|
+
blogScript.src = UMD.resolvePath("@social-mail/social-mail-client/component.js");
|
|
531
|
+
blogScript.setAttribute("data-package", "@social-mail/social-mail-client");
|
|
532
|
+
blogScript.setAttribute("data-package-root", UMD.resolvePath("@social-mail/social-mail-client/"));
|
|
533
|
+
blogScript.setAttribute("data-replace", "true");
|
|
534
|
+
blogScript.setAttribute("data-view", "dist/public/channel/ChannelView");
|
|
535
|
+
blogView.parentElement.replaceChild(blogScript, blogView);
|
|
536
|
+
}
|
|
516
537
|
const currentHtml = clone.innerHTML;
|
|
517
538
|
if (!lastHtml) {
|
|
518
539
|
this.lastHtml = currentHtml;
|