feat(BlockEditor): add notion native json paste support
- import `notionJsonToBlocks` in `Block.client.js` and prioritize `text/_notion-blocks-v3-production` mime over `text/html` on paste - implement `notionJsonToBlocks` and `notionValueToBlock` in `clipboard.js` to convert notion block json to editor blocks, preserving native types (`to_do`, `sub_sub_header`, etc.) - update README to document the notion mime priority in paste handling
This commit is contained in:
@@ -234,8 +234,11 @@ Le presse-papier transporte deux MIME en parallèle : `text/html` (structure
|
||||
`<hr>`, `<figure><img>`). Pour les sélections multi-blocs (focus
|
||||
défocus), on passe par l'API async `navigator.clipboard.write` avec un
|
||||
`ClipboardItem` qui inclut les deux MIME.
|
||||
- **Paste dans un bloc** : `Block.handlePaste` lit `text/html` en
|
||||
priorité et appelle `htmlToBlocks`. Si un seul paragraphe est produit,
|
||||
- **Paste dans un bloc** : `Block.handlePaste` lit d'abord la MIME
|
||||
propriétaire `text/_notion-blocks-v3-production` (parsée par
|
||||
`notionJsonToBlocks`) — Notion conserve ses types natifs (`to_do`,
|
||||
`sub_sub_header`, …) là où le HTML aplatit `to_do` en `<ul><li>`. À
|
||||
défaut, retombe sur `text/html` parsé par `htmlToBlocks`. Si un seul paragraphe est produit,
|
||||
son contenu inline est splicé au caret. Sinon le bloc courant est
|
||||
coupé en deux et les blocs collés sont insérés entre les deux moitiés
|
||||
(avec fusion tête/queue si extrémités = paragraphe).
|
||||
|
||||
Reference in New Issue
Block a user