@pageboard/html 0.12.0 → 0.12.1
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/elements/form.js +1 -1
- package/elements/heading.js +4 -10
- package/elements/sitemap.js +1 -7
- package/elements/tab.js +2 -8
- package/package.json +1 -1
- package/ui/form.js +1 -1
- package/ui/heading-helper.js +7 -8
- package/ui/sitemap-helper.js +10 -4
- package/ui/sitemap.js +5 -5
- package/ui/transition.css +2 -2
- package/ui/transition.js +1 -1
package/elements/form.js
CHANGED
|
@@ -47,7 +47,7 @@ exports.query_form = {
|
|
|
47
47
|
contents: 'block+',
|
|
48
48
|
tag: 'form[method="get"]',
|
|
49
49
|
html: `<form is="element-form" method="get" name="[name]"
|
|
50
|
-
action="[redirection
|
|
50
|
+
action="[redirection|urltpl:url:parameters]"
|
|
51
51
|
autocomplete="off" class="ui form"></form>`,
|
|
52
52
|
stylesheets: [
|
|
53
53
|
'../lib/components/form.css',
|
package/elements/heading.js
CHANGED
|
@@ -55,8 +55,8 @@ exports.heading = {
|
|
|
55
55
|
group: "block",
|
|
56
56
|
icon: '<i class="icon header"></i>',
|
|
57
57
|
tag: 'h1,h2,h3,h4,h5,h6',
|
|
58
|
-
html: `<h[level] class="ui [align|or:left] aligned header" is="h[level]-helper" id="[id]" entitled="[entitled]">
|
|
59
|
-
<a aria-hidden="true" href="[$loc.pathname][$loc.search][id|pre
|
|
58
|
+
html: `<h[level] class="ui [align|or:left] aligned header" is="h[level]-helper" id="[id][linkable|prune:-]" entitled="[entitled]">
|
|
59
|
+
<a aria-hidden="true" href="[$loc.pathname][$loc.search][id|pre:%23]">[linkable|prune:*]#</a>
|
|
60
60
|
<div block-content="text">Heading</div>
|
|
61
61
|
</hn>`,
|
|
62
62
|
parse: function (dom) {
|
|
@@ -69,15 +69,9 @@ exports.heading = {
|
|
|
69
69
|
],
|
|
70
70
|
scripts: [
|
|
71
71
|
'../ui/heading.js'
|
|
72
|
-
]
|
|
73
|
-
resources: {
|
|
74
|
-
helper: '../ui/heading-helper.js'
|
|
75
|
-
},
|
|
76
|
-
install: function (scope) {
|
|
77
|
-
if (scope.$write) Pageboard.load.js(this.resources.helper, scope);
|
|
78
|
-
}
|
|
72
|
+
]
|
|
79
73
|
};
|
|
80
|
-
|
|
74
|
+
exports.editor.scripts.push('../ui/heading-helper.js');
|
|
81
75
|
|
|
82
76
|
exports.heading_nolink = {
|
|
83
77
|
...exports.heading,
|
package/elements/sitemap.js
CHANGED
|
@@ -19,12 +19,6 @@ exports.sitemap = {
|
|
|
19
19
|
scripts: [
|
|
20
20
|
'../ui/sitemap.js'
|
|
21
21
|
],
|
|
22
|
-
resources: {
|
|
23
|
-
helper: '../ui/sitemap-helper.js'
|
|
24
|
-
},
|
|
25
|
-
install: function(scope) {
|
|
26
|
-
if (scope.$write) Pageboard.load.js(this.resources.helper, scope);
|
|
27
|
-
},
|
|
28
22
|
itemModel: function(name, leaf) {
|
|
29
23
|
const schema = exports[name];
|
|
30
24
|
return {
|
|
@@ -65,6 +59,6 @@ exports.sitemap = {
|
|
|
65
59
|
};
|
|
66
60
|
}
|
|
67
61
|
};
|
|
68
|
-
|
|
62
|
+
exports.editor.scripts.push('../ui/sitemap-helper.js');
|
|
69
63
|
exports.sitepage = exports.sitemap.itemModel('page', false);
|
|
70
64
|
exports.siteredirection = exports.sitemap.itemModel('redirection', true);
|
package/elements/tab.js
CHANGED
|
@@ -30,15 +30,9 @@ exports.tabs = {
|
|
|
30
30
|
],
|
|
31
31
|
scripts: [
|
|
32
32
|
'../ui/tab.js'
|
|
33
|
-
]
|
|
34
|
-
resources: {
|
|
35
|
-
helper: '../ui/tab-helper.js'
|
|
36
|
-
},
|
|
37
|
-
install: function(scope) {
|
|
38
|
-
if (scope.$write) Pageboard.load.js(this.resources.helper, scope);
|
|
39
|
-
}
|
|
33
|
+
]
|
|
40
34
|
};
|
|
41
|
-
|
|
35
|
+
exports.editor.scripts.push('../ui/tab-helper.js');
|
|
42
36
|
|
|
43
37
|
exports.tab_item = {
|
|
44
38
|
title: "Item",
|
package/package.json
CHANGED
package/ui/form.js
CHANGED
|
@@ -323,7 +323,7 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
323
323
|
scope.$request = form.read(true);
|
|
324
324
|
form.disable();
|
|
325
325
|
|
|
326
|
-
const res = await
|
|
326
|
+
const res = await state.fetch(form.method, Page.format({
|
|
327
327
|
pathname: form.getAttribute('action'),
|
|
328
328
|
query: state.query
|
|
329
329
|
}), scope.$request).catch(err => err);
|
package/ui/heading-helper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class HTMLElementHeadingHelper extends Page.create(HTMLHeadingElement) {
|
|
2
2
|
setup(state) {
|
|
3
|
-
this.willSync = state.debounce(() => this.sync(), 100);
|
|
3
|
+
this.willSync = state.debounce(() => this.sync(state.scope), 100);
|
|
4
4
|
this.observer = new MutationObserver(records => {
|
|
5
5
|
if (records.some(mut => {
|
|
6
6
|
return mut.type == "characterData" || mut.type == "childList" && mut.addedNodes.length;
|
|
@@ -15,13 +15,14 @@ class HTMLElementHeadingHelper extends Page.create(HTMLHeadingElement) {
|
|
|
15
15
|
close() {
|
|
16
16
|
if (this.observer) this.observer.disconnect();
|
|
17
17
|
}
|
|
18
|
-
sync() {
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
21
|
-
|
|
18
|
+
sync(scope) {
|
|
19
|
+
const { editor } = scope;
|
|
20
|
+
if (!editor) return;
|
|
21
|
+
if (this.firstElementChild?.nodeName != "A") return;
|
|
22
|
+
const txt = editor.slug(this.textContent);
|
|
22
23
|
const id = txt.length <= 64 ? txt : null;
|
|
23
24
|
if (id != this.id) {
|
|
24
|
-
|
|
25
|
+
editor.blocks.mutate(this, { id });
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
}
|
|
@@ -34,5 +35,3 @@ for (let i = 1; i <= 6; i++) {
|
|
|
34
35
|
`h${i}`
|
|
35
36
|
);
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
|
package/ui/sitemap-helper.js
CHANGED
|
@@ -5,7 +5,7 @@ class HTMLElementSitepage extends Page.Element {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
patch(state) {
|
|
8
|
-
if (this.isConnected) this.syncBlock();
|
|
8
|
+
if (this.isConnected) this.syncBlock(state.scope);
|
|
9
9
|
}
|
|
10
10
|
setup(state) {
|
|
11
11
|
const content = this.querySelector('[block-content="children"]');
|
|
@@ -45,9 +45,9 @@ class HTMLElementSitepage extends Page.Element {
|
|
|
45
45
|
this.updating = false;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
syncBlock() {
|
|
48
|
+
syncBlock(scope) {
|
|
49
49
|
if (!this.parentNode || this.matches('element-sitemap')) return;
|
|
50
|
-
const editor =
|
|
50
|
+
const editor = scope.editor;
|
|
51
51
|
if (!editor || editor.closed) return;
|
|
52
52
|
const block = editor.blocks.get(this.getAttribute('block-id'));
|
|
53
53
|
if (!block.data) block.data = {};
|
|
@@ -63,5 +63,11 @@ class HTMLElementSitepage extends Page.Element {
|
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
Page.define('element-sitepage', HTMLElementSitepage);
|
|
66
|
-
|
|
66
|
+
|
|
67
|
+
Page.setup(state => {
|
|
68
|
+
if (!state.scope.$write) return;
|
|
69
|
+
state.finish(() => {
|
|
70
|
+
Page.extend('element-sitemap', HTMLElementSitepage);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
67
73
|
|
package/ui/sitemap.js
CHANGED
|
@@ -57,13 +57,13 @@ class HTMLElementSitemap extends Page.Element {
|
|
|
57
57
|
// workaround... build is called a second time with pagecut-placeholder set
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
const res = await
|
|
61
|
-
const scope =
|
|
62
|
-
|
|
60
|
+
const res = await state.fetch('get', `/.api/pages`);
|
|
61
|
+
const scope = state.scope.copy();
|
|
62
|
+
await scope.import(res);
|
|
63
63
|
const tree = this.constructor.transformResponse(res);
|
|
64
|
-
const node =
|
|
64
|
+
const node = scope.render({
|
|
65
65
|
item: tree
|
|
66
|
-
}
|
|
66
|
+
});
|
|
67
67
|
// only change block content
|
|
68
68
|
const src = node.firstElementChild;
|
|
69
69
|
const dst = this.firstElementChild;
|
package/ui/transition.css
CHANGED
|
@@ -18,14 +18,14 @@ html[data-stage] > body::after {
|
|
|
18
18
|
transition-duration:1s;
|
|
19
19
|
transition-timing-function:linear;
|
|
20
20
|
}
|
|
21
|
-
html[data-stage="
|
|
21
|
+
html[data-stage="route"] > body::after,
|
|
22
22
|
html[data-stage="ready"] > body::after,
|
|
23
23
|
html[data-stage="setup"] > body::after,
|
|
24
24
|
html[data-stage="error"] > body::after {
|
|
25
25
|
height:2px;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
html[data-stage="
|
|
28
|
+
html[data-stage="route"] > body::after {
|
|
29
29
|
width:50%;
|
|
30
30
|
}
|
|
31
31
|
html[data-stage="ready"] > body::after,
|