@ampless/plugin-x-embed 1.0.0-alpha.3 → 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.
package/dist/editor.d.ts CHANGED
@@ -23,5 +23,13 @@ declare const AmplessTweetNode: Node<any, any>;
23
23
  declare const tweetEditor: {
24
24
  extension: Node<any, any>;
25
25
  };
26
+ /**
27
+ * Canonical named export consumed by the codegen'd
28
+ * `_editor-bootstrap.tsx`. Plugins MUST export this symbol from
29
+ * their `./editor` module (= the subpath declared in
30
+ * `package.json#amplessPlugin.editorExports`) for the
31
+ * auto-wiring to find them.
32
+ */
33
+ declare const editorExtension: Node<any, any>;
26
34
 
27
- export { AmplessTweetNode, tweetEditor };
35
+ export { AmplessTweetNode, editorExtension, tweetEditor };
package/dist/editor.js CHANGED
@@ -60,7 +60,15 @@ var AmplessTweetNode = Node.create({
60
60
  return [
61
61
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
62
  {
63
- find: TWEET_URL,
63
+ // tiptap's paste rule internally calls `String.prototype.matchAll`
64
+ // which throws when the regex doesn't carry the `g` flag. Clone
65
+ // the source regex (which is anchored `^...$` for use in the
66
+ // renderer / markdown extractor) into a global form here. Anchored
67
+ // global is fine — without the `m` flag, `^...$` only anchor at the
68
+ // start / end of the **entire input**, so this matches at most
69
+ // once for the pasted input as a whole (= exactly the single-URL
70
+ // paste case we care about).
71
+ find: new RegExp(TWEET_URL.source, "g"),
64
72
  handler: ({ range, match, commands }) => {
65
73
  const tweetId = match[1];
66
74
  if (!tweetId) return;
@@ -77,7 +85,9 @@ var AmplessTweetNode = Node.create({
77
85
  var tweetEditor = {
78
86
  extension: AmplessTweetNode
79
87
  };
88
+ var editorExtension = AmplessTweetNode;
80
89
  export {
81
90
  AmplessTweetNode,
91
+ editorExtension,
82
92
  tweetEditor
83
93
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampless/plugin-x-embed",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.5",
4
4
  "description": "x.com (Twitter) embed plugin for ampless — renders tweet URLs inline as blockquotes hydrated by widgets.js",
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.43"
35
+ "ampless": "1.0.0-alpha.44"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@tiptap/core": "^3.23.6",
@@ -61,7 +61,8 @@
61
61
  "displayName": {
62
62
  "en": "x.com (Twitter) embeds",
63
63
  "ja": "x.com (Twitter) 埋め込み"
64
- }
64
+ },
65
+ "editorExports": "./editor"
65
66
  },
66
67
  "scripts": {
67
68
  "build": "tsup",