@pageboard/html 0.15.8 → 0.15.10
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/image.js +9 -8
- package/elements/inputs.js +2 -2
- package/elements/link.js +2 -2
- package/elements/menu.js +1 -1
- package/package.json +1 -1
- package/ui/image.js +18 -10
package/elements/image.js
CHANGED
|
@@ -4,11 +4,6 @@ exports.image = {
|
|
|
4
4
|
menu: 'media',
|
|
5
5
|
icon: '<i class="icon image"></i>',
|
|
6
6
|
properties: {
|
|
7
|
-
alt: {
|
|
8
|
-
title: 'Alternative text',
|
|
9
|
-
description: 'Short contextual description.\nLeave empty when used in links.',
|
|
10
|
-
type: "string"
|
|
11
|
-
},
|
|
12
7
|
url: {
|
|
13
8
|
title: 'Address',
|
|
14
9
|
anyOf: [{
|
|
@@ -126,14 +121,20 @@ exports.image = {
|
|
|
126
121
|
},
|
|
127
122
|
group: "block media",
|
|
128
123
|
tag: 'element-image',
|
|
129
|
-
contents: {
|
|
124
|
+
contents: [{
|
|
130
125
|
id: 'legend',
|
|
131
126
|
title: 'legend',
|
|
132
127
|
nodes: "inline*"
|
|
133
|
-
},
|
|
128
|
+
}, {
|
|
129
|
+
id: 'alt',
|
|
130
|
+
title: 'Alternative Text',
|
|
131
|
+
name: 'data-alt',
|
|
132
|
+
$helper: {
|
|
133
|
+
name: 'describe'
|
|
134
|
+
}
|
|
135
|
+
}],
|
|
134
136
|
html: `<element-image
|
|
135
137
|
class="[display.fit|or:none] [display.horizontal?] [display.vertical?]"
|
|
136
|
-
alt="[alt]"
|
|
137
138
|
data-src="[url]"
|
|
138
139
|
data-crop="[crop.x|or:50];[crop.y|or:50];[crop.width|or:100];[crop.height|or:100];[crop.zoom|or:100]"
|
|
139
140
|
>
|
package/elements/inputs.js
CHANGED
|
@@ -489,8 +489,8 @@ exports.input_select = {
|
|
|
489
489
|
html: `<div class="field">
|
|
490
490
|
<label block-content="label">Label</label>
|
|
491
491
|
<element-select class="ui selection dropdown [multiple]"
|
|
492
|
-
name="[name]" disabled="[disabled|
|
|
493
|
-
multiple="[multiple|
|
|
492
|
+
name="[name]" disabled="[disabled|alt:]" required="[required|alt:]"
|
|
493
|
+
multiple="[multiple|alt:]"
|
|
494
494
|
value="[value]"
|
|
495
495
|
>
|
|
496
496
|
<i class="dropdown icon"></i><div class="text"></div><select></select>
|
package/elements/link.js
CHANGED
|
@@ -29,7 +29,7 @@ exports.link = {
|
|
|
29
29
|
nullable: true,
|
|
30
30
|
$helper: {
|
|
31
31
|
name: 'datalist',
|
|
32
|
-
url: '/@api/languages'
|
|
32
|
+
url: '/@api/translate/languages'
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
id: {
|
|
@@ -75,7 +75,7 @@ exports.link_button = {
|
|
|
75
75
|
nullable: true,
|
|
76
76
|
$helper: {
|
|
77
77
|
name: 'datalist',
|
|
78
|
-
url: '/@api/languages'
|
|
78
|
+
url: '/@api/translate/languages'
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
full: {
|
package/elements/menu.js
CHANGED
package/package.json
CHANGED
package/ui/image.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const HTMLElementImageConstructor = Superclass => class extends Superclass {
|
|
2
2
|
static defaults = {
|
|
3
3
|
src: null,
|
|
4
|
-
crop: null
|
|
4
|
+
crop: null,
|
|
5
|
+
alt: null
|
|
5
6
|
};
|
|
6
7
|
|
|
7
8
|
static defaultWidth = 240;
|
|
@@ -66,26 +67,33 @@ const HTMLElementImageConstructor = Superclass => class extends Superclass {
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
patch(state) {
|
|
70
|
+
const {
|
|
71
|
+
dataset: d,
|
|
72
|
+
image,
|
|
73
|
+
dimensions: { w, h },
|
|
74
|
+
constructor,
|
|
75
|
+
currentSrc
|
|
76
|
+
} = this;
|
|
69
77
|
this.classList.remove('loading');
|
|
70
|
-
if (
|
|
78
|
+
if (currentSrc != this.options.src) {
|
|
71
79
|
this.classList.remove('error');
|
|
72
80
|
}
|
|
73
|
-
|
|
81
|
+
|
|
74
82
|
if (d.width == null || d.height == null) {
|
|
75
83
|
const meta = state.scope.$hrefs?.[this.options.src];
|
|
76
84
|
if (meta?.width) d.width = meta.width;
|
|
77
85
|
if (meta?.height) d.height = meta.height;
|
|
78
86
|
}
|
|
79
|
-
d.width ??=
|
|
80
|
-
d.height ??=
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const cur =
|
|
87
|
+
d.width ??= constructor.defaultWidth || "";
|
|
88
|
+
d.height ??= constructor.defaultHeight || "";
|
|
89
|
+
image.width = w || d.width;
|
|
90
|
+
image.height = h || d.height;
|
|
91
|
+
image.alt = d.alt ?? "";
|
|
92
|
+
const cur = currentSrc;
|
|
85
93
|
if (!cur) {
|
|
86
94
|
this.placeholder();
|
|
87
95
|
} else if (cur.startsWith('data:')) {
|
|
88
|
-
|
|
96
|
+
image.setAttribute('src', cur);
|
|
89
97
|
}
|
|
90
98
|
}
|
|
91
99
|
|