@pageboard/html 0.14.27 → 0.14.29
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/embed.js +3 -2
- package/elements/heading.js +4 -2
- package/elements/layout.js +12 -1
- package/elements/link.js +9 -2
- package/elements/page.js +5 -0
- package/package.json +1 -1
- package/ui/linkable.css +2 -1
- package/ui/embed-helper.js +0 -11
- package/ui/heading-helper.js +0 -37
package/elements/embed.js
CHANGED
|
@@ -4,9 +4,11 @@ exports.embed = {
|
|
|
4
4
|
icon: '<i class="external square alternate icon"></i>',
|
|
5
5
|
properties: {
|
|
6
6
|
id: {
|
|
7
|
+
title: 'Link name',
|
|
8
|
+
description: 'Target for anchors',
|
|
7
9
|
nullable: true,
|
|
8
10
|
type: 'string',
|
|
9
|
-
|
|
11
|
+
format: 'grant'
|
|
10
12
|
},
|
|
11
13
|
linkable: {
|
|
12
14
|
title: 'Show hash link',
|
|
@@ -53,4 +55,3 @@ exports.embed = {
|
|
|
53
55
|
'../ui/linkable.css'
|
|
54
56
|
]
|
|
55
57
|
};
|
|
56
|
-
exports.editor?.scripts.push('../ui/embed-helper.js');
|
package/elements/heading.js
CHANGED
|
@@ -32,9 +32,11 @@ exports.heading = {
|
|
|
32
32
|
}]
|
|
33
33
|
},
|
|
34
34
|
id: {
|
|
35
|
+
title: 'Link name',
|
|
36
|
+
description: 'Target for anchors',
|
|
35
37
|
nullable: true,
|
|
36
38
|
type: 'string',
|
|
37
|
-
|
|
39
|
+
format: 'grant'
|
|
38
40
|
},
|
|
39
41
|
linkable: {
|
|
40
42
|
title: 'Show hash link',
|
|
@@ -60,6 +62,7 @@ exports.heading = {
|
|
|
60
62
|
</hn>`,
|
|
61
63
|
parse: function (dom) {
|
|
62
64
|
return {
|
|
65
|
+
id: dom.getAttribute('id') || null,
|
|
63
66
|
level: parseInt(dom.nodeName.substring(1))
|
|
64
67
|
};
|
|
65
68
|
},
|
|
@@ -71,7 +74,6 @@ exports.heading = {
|
|
|
71
74
|
'../ui/heading.js'
|
|
72
75
|
]
|
|
73
76
|
};
|
|
74
|
-
exports.editor?.scripts.push('../ui/heading-helper.js');
|
|
75
77
|
|
|
76
78
|
exports.heading_nolink = {
|
|
77
79
|
...exports.heading,
|
package/elements/layout.js
CHANGED
|
@@ -7,7 +7,8 @@ exports.units = {
|
|
|
7
7
|
{ const: 'ch' },
|
|
8
8
|
{ const: 'vw' },
|
|
9
9
|
{ const: 'rem' },
|
|
10
|
-
{ const: 'px' }
|
|
10
|
+
{ const: 'px' },
|
|
11
|
+
{ const: '%' }
|
|
11
12
|
],
|
|
12
13
|
default: 'em',
|
|
13
14
|
$helper: 'units'
|
|
@@ -114,6 +115,15 @@ exports.layout = {
|
|
|
114
115
|
title: "Contained"
|
|
115
116
|
}]
|
|
116
117
|
},
|
|
118
|
+
maxWidth: {
|
|
119
|
+
title: 'Max width',
|
|
120
|
+
type: 'number',
|
|
121
|
+
minimum: 0,
|
|
122
|
+
nullable: true
|
|
123
|
+
},
|
|
124
|
+
maxWidthUnits: {
|
|
125
|
+
$ref: "#/definitions/units/properties/data/properties/inline"
|
|
126
|
+
},
|
|
117
127
|
height: {
|
|
118
128
|
title: 'Height',
|
|
119
129
|
type: 'number',
|
|
@@ -374,6 +384,7 @@ exports.layout = {
|
|
|
374
384
|
style-margin-inline="[margins.inline|fail:][margins.inlineUnits]"
|
|
375
385
|
style-padding-block="[padding.block|fail:][padding.blockUnits]"
|
|
376
386
|
style-padding-inline="[padding.inline|fail:][padding.inlineUnits]"
|
|
387
|
+
style-max-width="[maxWidth|fail:][maxWidthUnits]"
|
|
377
388
|
style-height="[height|fail:][heightUnits]"
|
|
378
389
|
style-background-color="[background.color]"
|
|
379
390
|
style-background-size="[background.size]"
|
package/elements/link.js
CHANGED
|
@@ -31,13 +31,20 @@ exports.link = {
|
|
|
31
31
|
name: 'datalist',
|
|
32
32
|
url: '/.api/languages'
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
},
|
|
35
|
+
id: {
|
|
36
|
+
title: 'Link name',
|
|
37
|
+
description: 'Target for anchors',
|
|
38
|
+
nullable: true,
|
|
39
|
+
type: 'string',
|
|
40
|
+
format: 'grant'
|
|
41
|
+
},
|
|
35
42
|
},
|
|
36
43
|
contents: "text*",
|
|
37
44
|
inline: true,
|
|
38
45
|
group: "inline",
|
|
39
46
|
tag: 'a:not([block-type]),a[block-type="link"]',
|
|
40
|
-
html: '<a href="[url]" hreflang="[lang]" class="[button|alt:ui button]"></a>',
|
|
47
|
+
html: '<a href="[url]" hreflang="[lang]" class="[button|alt:ui button]" id="[id]"></a>',
|
|
41
48
|
stylesheets: [
|
|
42
49
|
'../ui/components/button.css'
|
|
43
50
|
]
|
package/elements/page.js
CHANGED
package/package.json
CHANGED
package/ui/linkable.css
CHANGED
package/ui/embed-helper.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Page.extend('element-embed', class HTMLElementEmbedHelper {
|
|
2
|
-
paint(state) {
|
|
3
|
-
if (!state.scope.$write) return;
|
|
4
|
-
const { editor } = state.scope;
|
|
5
|
-
if (!editor) return;
|
|
6
|
-
const id = editor.slug(this.title).slice(0, 32);
|
|
7
|
-
if (id != this.id) {
|
|
8
|
-
editor.blocks.mutate(this, { id });
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
});
|
package/ui/heading-helper.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
class HTMLElementHeadingHelper extends Page.create(HTMLHeadingElement) {
|
|
2
|
-
setup(state) {
|
|
3
|
-
this.willSync = state.debounce(() => this.sync(state.scope), 100);
|
|
4
|
-
this.observer = new MutationObserver(records => {
|
|
5
|
-
if (records.some(mut => {
|
|
6
|
-
return mut.type == "characterData" || mut.type == "childList" && mut.addedNodes.length;
|
|
7
|
-
})) this.willSync();
|
|
8
|
-
});
|
|
9
|
-
this.observer.observe(this, {
|
|
10
|
-
childList: true,
|
|
11
|
-
subtree: true,
|
|
12
|
-
characterData: true
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
close() {
|
|
16
|
-
if (this.observer) this.observer.disconnect();
|
|
17
|
-
}
|
|
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);
|
|
23
|
-
const id = txt.length <= 64 ? txt : null;
|
|
24
|
-
if (id != this.id) {
|
|
25
|
-
editor.blocks.mutate(this, { id });
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
for (let i = 1; i <= 6; i++) {
|
|
32
|
-
Page.define(
|
|
33
|
-
`h${i}-helper`,
|
|
34
|
-
class extends HTMLElementHeadingHelper { },
|
|
35
|
-
`h${i}`
|
|
36
|
-
);
|
|
37
|
-
}
|