@ampless/plugin-youtube 1.0.0-alpha.8 → 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/editor.js CHANGED
@@ -190,7 +190,8 @@ var tiptapNodeToHtml = {
190
190
  const videoId = String(node.attrs?.videoId ?? "").trim();
191
191
  if (!videoId) return null;
192
192
  const attrs = placeholderAttrs(node.attrs ?? {});
193
- return `<div ${attrsToHtmlString(attrs)}><span>YouTube: ${escapeAttr(videoId)}</span></div>`;
193
+ const url = `https://youtu.be/${videoId}`;
194
+ return `<div ${attrsToHtmlString(attrs)}><a href="${escapeAttr(url)}">${escapeAttr(url)}</a></div>`;
194
195
  }
195
196
  };
196
197
  export {
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-alpha.8",
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-alpha.47"
35
+ "ampless": "^1.0.0-beta.51"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@tiptap/core": "^3.23.6",