@ampless/plugin-youtube 1.0.0-alpha.9 → 1.0.0-beta.14
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/dist/index.js +15 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -24,6 +24,21 @@ function youtubePlugin(opts = {}) {
|
|
|
24
24
|
const startRaw = node.attrs?.start;
|
|
25
25
|
const start = typeof startRaw === "number" && Number.isFinite(startRaw) ? startRaw : void 0;
|
|
26
26
|
return /* @__PURE__ */ jsx(YouTubeEmbed, { videoId, start });
|
|
27
|
+
},
|
|
28
|
+
// Opt into the public html walker so `format: 'html'` posts expand
|
|
29
|
+
// the canonical placeholder div (emitted by the admin's tiptap→html
|
|
30
|
+
// switch) into the same `<YouTubeEmbed>` the tiptap / markdown
|
|
31
|
+
// walkers render. Attribute names match `placeholderAttrs()` in
|
|
32
|
+
// ./editor.tsx (the canonical definition site).
|
|
33
|
+
htmlPlaceholder: {
|
|
34
|
+
flagAttr: "data-ampless-youtube",
|
|
35
|
+
attrsFromElement: (attribs) => {
|
|
36
|
+
const start = Number(attribs["data-start"]);
|
|
37
|
+
return {
|
|
38
|
+
videoId: attribs["data-video-id"] ?? "",
|
|
39
|
+
start: Number.isFinite(start) ? start : void 0
|
|
40
|
+
};
|
|
41
|
+
}
|
|
27
42
|
}
|
|
28
43
|
},
|
|
29
44
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ampless/plugin-youtube",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta.14",
|
|
4
4
|
"description": "YouTube embed plugin for ampless — renders youtube.com / youtu.be URLs inline as iframes in tiptap + markdown posts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@tiptap/core": "^3",
|
|
34
34
|
"react": "^18 || ^19",
|
|
35
|
-
"ampless": "1.0.0-
|
|
35
|
+
"ampless": "^1.0.0-beta.51"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@tiptap/core": "^3.23.6",
|