ampless 1.0.0-alpha.45 → 1.0.0-alpha.46

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.
@@ -848,6 +848,12 @@ export default createAdminLayout(admin, { editorBootstrap: EditorBootstrap })
848
848
 
849
849
  `installAdminEditorExtensions` は idempotent で、render 時に client component 内で呼ばれる。admin の `<TiptapEditor>` は毎回 render 時に登録済みリストを built-in extensions の末尾に spread する。
850
850
 
851
+ ### markdown → tiptap の復元
852
+
853
+ editor Node が markdown へ bare URL line として serialise される場合、逆方向の復元は paste rule ではなく `Node.parseHTML()` で扱う必要がある。admin の `markdown → tiptap` format switch は、まず markdown を HTML に変換する。GFM autolink により bare URL line は `<p><a href="https://...">https://...</a></p>` になり、その HTML を tiptap が document として parse する。paste rule は user paste / typing event 用なので、この HTML parse 経路では発火しない。
854
+
855
+ embed 系 Node は、上記 paragraph shape 用の high-priority parse rule を追加し、必要に応じて他の HTML-to-tiptap 経路向けに `a[href]` rule も追加する。paragraph rule は「paragraph が単一 link だけを含み、その link text が `href` と同じ」場合だけ match させる。これにより parser は paragraph 全体を block embed Node に置換でき、embed の前に空 paragraph が残らない。`getAttrs` は URL を検証し、match しない link では `false` を返して通常の Link mark にフォールバックさせる。
856
+
851
857
  ### active source と完全無効化
852
858
 
853
859
  **エディタ配線の active source は `package.json#dependencies`**(= `node_modules`)であり、`cms.config.ts` ではない。
@@ -1104,6 +1104,24 @@ export default createAdminLayout(admin, { editorBootstrap: EditorBootstrap })
1104
1104
  inside a client component. The admin's `<TiptapEditor>` spreads the
1105
1105
  registered list onto its built-in extensions on every render.
1106
1106
 
1107
+ ### Markdown to tiptap restoration
1108
+
1109
+ If an editor Node serializes to markdown as a bare URL line, the reverse
1110
+ direction must be handled by `Node.parseHTML()`, not by paste rules. The
1111
+ admin's `markdown → tiptap` format switch first converts markdown to HTML;
1112
+ GFM autolinks emit a bare URL line as
1113
+ `<p><a href="https://...">https://...</a></p>`, then tiptap parses that
1114
+ HTML into a document. Paste rules only run for user paste / typing events,
1115
+ so they do not fire on this HTML parse path.
1116
+
1117
+ Embed-style Nodes should add a high-priority parse rule for the paragraph
1118
+ shape above, and may also add an `a[href]` rule for other HTML-to-tiptap
1119
+ paths. The paragraph rule should only match when the paragraph contains a
1120
+ single link whose text equals its `href`; that lets the parser replace the
1121
+ whole paragraph with the block embed Node instead of leaving an empty
1122
+ paragraph before the embed. `getAttrs` should validate the URL and return
1123
+ `false` for non-matching links so the normal Link mark remains in place.
1124
+
1107
1125
  ### Active source and full disable
1108
1126
 
1109
1127
  **The active source for editor wiring is `package.json#dependencies`**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ampless",
3
- "version": "1.0.0-alpha.45",
3
+ "version": "1.0.0-alpha.46",
4
4
  "description": "Serverless CMS for AWS Amplify",
5
5
  "license": "MIT",
6
6
  "type": "module",