@pageboard/html 0.12.9 → 0.12.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/embed.js +1 -1
- package/package.json +1 -1
- package/ui/embed.js +5 -8
- package/ui/media.js +5 -8
package/elements/embed.js
CHANGED
|
@@ -40,7 +40,7 @@ exports.embed = {
|
|
|
40
40
|
};
|
|
41
41
|
},
|
|
42
42
|
tag: 'iframe,element-embed',
|
|
43
|
-
html: `<element-embed data-
|
|
43
|
+
html: `<element-embed data-src="[url]" data-query="[query|as:query]" id="[id]">
|
|
44
44
|
<a aria-hidden="true" class="linkable" href="[$loc.pathname][$loc.search][id|pre:%23]">[linkable|prune:*]#</a>
|
|
45
45
|
<iframe loading="lazy" allowfullscreen frameborder="0" scrolling="no"></iframe>
|
|
46
46
|
</element-embed>`,
|
package/package.json
CHANGED
package/ui/embed.js
CHANGED
|
@@ -14,14 +14,11 @@ class HTMLElementEmbed extends Page.Element {
|
|
|
14
14
|
return this.querySelector('iframe')?.src ?? "about:blank";
|
|
15
15
|
}
|
|
16
16
|
patch(state) {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} else {
|
|
23
|
-
console.warn("Missing href", this.options.src);
|
|
24
|
-
}
|
|
17
|
+
const { src } = this.options;
|
|
18
|
+
if (!src) return;
|
|
19
|
+
const { width, height, source } = state.scope.$hrefs?.[src] ?? {};
|
|
20
|
+
if (source) this.dataset.source = source;
|
|
21
|
+
if (width && height) this.style.paddingBottom = `calc(${height} / ${width} * 100%)`;
|
|
25
22
|
}
|
|
26
23
|
consent(state) {
|
|
27
24
|
const consent = state.scope.$consent;
|
package/ui/media.js
CHANGED
|
@@ -34,14 +34,11 @@ class HTMLElementVideo extends HTMLElementMediaConstructor(Page.create(HTMLVideo
|
|
|
34
34
|
patch(state) {
|
|
35
35
|
super.patch(state);
|
|
36
36
|
const { url } = this.options;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} else {
|
|
43
|
-
console.warn("Missing href", url);
|
|
44
|
-
}
|
|
37
|
+
if (!url) return;
|
|
38
|
+
const { title, width, height } = state.scope.$hrefs?.[url] ?? {};
|
|
39
|
+
if (title) this.title = title;
|
|
40
|
+
if (width) this.width = width;
|
|
41
|
+
if (height) this.height = height;
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
44
|
Page.define('element-video', HTMLElementVideo, 'video');
|