@ampless/plugin-youtube 1.0.0-alpha.4 → 1.0.0-alpha.5

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.
Files changed (2) hide show
  1. package/dist/editor.js +9 -1
  2. package/package.json +1 -1
package/dist/editor.js CHANGED
@@ -70,7 +70,15 @@ var AmplessYoutubeNode = Node.create({
70
70
  return [
71
71
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
72
  {
73
- find: YOUTUBE_URL,
73
+ // tiptap's paste rule internally calls `String.prototype.matchAll`
74
+ // which throws when the regex doesn't carry the `g` flag. Clone
75
+ // the source regex (which is anchored `^...$` for use in the
76
+ // renderer / markdown extractor) into a global form here. Anchored
77
+ // global is fine — without the `m` flag, `^...$` only anchor at the
78
+ // start / end of the **entire input**, so this matches at most
79
+ // once for the pasted input as a whole (= exactly the single-URL
80
+ // paste case we care about).
81
+ find: new RegExp(YOUTUBE_URL.source, "g"),
74
82
  handler: ({ range, match, commands }) => {
75
83
  const videoId = match[1] ?? match[2];
76
84
  if (!videoId) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampless/plugin-youtube",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.5",
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",