Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ versioning follows [SemVer](https://semver.org/).

<!-- Generated by `scripts/build-changelog.mjs`; edit `changelog/X.Y.Z.md`. -->

## [2.3.0](https://github.com/FicSysFR/jsonforms_builder/compare/2.2.0...2.3.0) - 2026-11-20

### ✨ Features

- `options.blockEditor` turns the WYSIWYG renderer into a page edited block by block, Notion
style: a gutter handle on every top-level block (`+` inserts a block below and opens the `/`
palette, the grip drags the block or opens its menu: turn into, clear formatting, duplicate,
copy text, move up/down, delete), a hint on the empty block holding the cursor, no fixed
toolbar and no border. The bubble menu and `/` palette turn on unless set explicitly, and
`dragHandle`, `placeholders` and `bordered` tune the mode. No node type is added, so stored
`json`, `html` and `markdown` values are unchanged. The handle is built on ProseMirror alone:
unlike Nuxt UI's `UEditorDragHandle`, it needs no `@tiptap/y-tiptap`, `yjs` or `y-protocols`.
- `buildWysiwygBlockMenu`, `runWysiwygBlockAction`, `createWysiwygBlockPlaceholder`,
`findWysiwygBlockAt`, `insertWysiwygBlockAfter` and `resolveWysiwygBlockEditor` are exported
from `/advanced` for custom editors.

### 📝 Documentation

- Guides (FR/EN): block editing section, `blockEditor` option, `nuxt-wysiwyg-blocks` playground
example.

## [2.2.0](https://github.com/FicSysFR/jsonforms_builder/compare/2.1.0...2.2.0) - 2026-11-20

### ⚠️ Behavior changes
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ WYSIWYG options (`options.wysiwyg: true`):
| `image` | `false` to disable, or `{ upload, accept, maxSize, resize, bubble, … }` |
| `extensions` / `handlers` | extra TipTap extensions / Nuxt UI handlers (host versions win) |
| `features` | tables, task lists, alignment, colors, highlight, link panel, find & replace, source mode, preview — all on; `false` or `{ table: false, … }` to opt out |
| `bubbleMenu` / `slashCommands` | formatting bubble on selection / `/` palette (default `false`) |
| `bubbleMenu` / `slashCommands` | formatting bubble on selection / `/` palette (default `false`, `true` with `blockEditor`) |
| `blockEditor` | Notion-style block editing: gutter `+` / drag / block menu, per-block hints, no fixed toolbar nor border (default `false`) |
| `ai` | optional AI assistant, inert unless `ai.enabled === true` |

```ts
Expand Down
26 changes: 26 additions & 0 deletions changelog/2.3.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
version: 2.3.0
date: 2026-11-20
title: Notion-style block editing for the WYSIWYG renderer
previous: 2.2.0
prerelease: false
---

### ✨ Features

- `options.blockEditor` turns the WYSIWYG renderer into a page edited block by block, Notion
style: a gutter handle on every top-level block (`+` inserts a block below and opens the `/`
palette, the grip drags the block or opens its menu: turn into, clear formatting, duplicate,
copy text, move up/down, delete), a hint on the empty block holding the cursor, no fixed
toolbar and no border. The bubble menu and `/` palette turn on unless set explicitly, and
`dragHandle`, `placeholders` and `bordered` tune the mode. No node type is added, so stored
`json`, `html` and `markdown` values are unchanged. The handle is built on ProseMirror alone:
unlike Nuxt UI's `UEditorDragHandle`, it needs no `@tiptap/y-tiptap`, `yjs` or `y-protocols`.
- `buildWysiwygBlockMenu`, `runWysiwygBlockAction`, `createWysiwygBlockPlaceholder`,
`findWysiwygBlockAt`, `insertWysiwygBlockAfter` and `resolveWysiwygBlockEditor` are exported
from `/advanced` for custom editors.

### 📝 Documentation

- Guides (FR/EN): block editing section, `blockEditor` option, `nuxt-wysiwyg-blocks` playground
example.
6 changes: 4 additions & 2 deletions docs/en/guide/options/string.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,9 @@ Requires `allRenderers` (not just `nuxtUiRenderers`).
| `toolbar` | `Array` \| `false` | built-in toolbar | Replaces the toolbar (`EditorToolbarItem[][]`) or hides it. |
| `placeholder` | `String` | — | Editor placeholder. |
| `features` | `false` \| `Object` | all on | Tables, task lists, alignment, colors, highlight, link, find & replace, source, preview. |
| `bubbleMenu` | `Boolean` | `false` | Formatting bubble on selection. |
| `slashCommands` | `Boolean` | `false` | `/` command palette. |
| `bubbleMenu` | `Boolean` | `false` (`true` with `blockEditor`) | Formatting bubble on selection. |
| `slashCommands` | `Boolean` | `false` (`true` with `blockEditor`) | `/` command palette. |
| `blockEditor` | `Boolean` \| `Object` | `false` | Notion-style block editing: `+` / drag / block menu handle, per-block hints, no fixed toolbar nor border. See [Block editing](/en/guide/wysiwyg-ai#block-editing). |
| `ai` | `Object` | — | Optional AI assistant (`enabled`, `endpoint` or `transport`, `actions`…). |
| `editor` | `Object` | — | Pass-through → `UEditor`. |

Expand Down Expand Up @@ -372,3 +373,4 @@ image has no Markdown equivalent and is not kept. Source mode then edits the raw
- [Autocomplete API](/en/playground#/?section=docs&example=nuxt-autocomplete)
- [WYSIWYG](/en/playground#/?section=docs&example=nuxt-wysiwyg)
- [WYSIWYG + AI](/en/playground#/?section=docs&example=nuxt-wysiwyg-ai)
- [Block WYSIWYG](/en/playground#/?section=docs&example=nuxt-wysiwyg-blocks)
1 change: 1 addition & 0 deletions docs/en/guide/playground-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Any example whose `name` starts with `nuxt-` automatically lands in **Documentat
| [Autocomplete API](/en/playground#/?section=docs&example=nuxt-autocomplete) | `UInputMenu` | `api.*`, `minLength`, `suggestion` |
| [WYSIWYG](/en/playground#/?section=docs&example=nuxt-wysiwyg) | `UEditor` | `wysiwyg`, `contentType` (`json` \| `html`) |
| [WYSIWYG + AI](/en/playground#/?section=docs&example=nuxt-wysiwyg-ai) | `UEditor` + AI | `bubbleMenu`, `slashCommands`, `ai` (local transport) |
| [Block WYSIWYG](/en/playground#/?section=docs&example=nuxt-wysiwyg-blocks) | `UEditor` (block mode) | `blockEditor` |

### Numbers & booleans

Expand Down
44 changes: 42 additions & 2 deletions docs/en/guide/wysiwyg-ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,55 @@ off by default.
| `features.findReplace` | `Boolean` | `true` | Find & replace (optional case sensitivity). |
| `features.sourceMode` | `Boolean` | `true` | Raw HTML or JSON editing; applied content goes through the Tiptap schema. |
| `features.preview` | `Boolean` | `true` | Read-only preview. |
| `bubbleMenu` | `Boolean` | `false` | Formatting bubble on text selection. |
| `slashCommands` | `Boolean` | `false` | `/` command palette. |
| `bubbleMenu` | `Boolean` | `false` (`true` with `blockEditor`) | Formatting bubble on text selection. |
| `slashCommands` | `Boolean` | `false` (`true` with `blockEditor`) | `/` command palette. |
| `blockEditor` | `Boolean` \| `Object` | `false` | Block editing (see below). |
| `ai` | `WysiwygAiOptions` | — | AI assistant (see below). |

A host extension passed through `options.extensions` (e.g. its own `Table`) wins over the
built-in extension of the same name. A custom `toolbar` is never altered; its items can use
the built-in `kind`s: `textColor`, `highlight`, `table`, `tableAction`, `findReplace`,
`sourceMode`, `preview`, `ai`.

## Block editing

`blockEditor: true` turns the field into a page edited block by block, Notion style:

- on hover, a handle shows in the left gutter of every block: `+` adds a block below (and
opens the `/` palette when it is on), the `⋮⋮` grip is **dragged** to move the block or
**clicked** to open its menu: *Turn into* (paragraph, headings, lists, quote, code),
*Clear formatting*, *Duplicate*, *Copy text*, *Move up*, *Move down*, *Delete*;
- the empty block holding the cursor shows a hint (`Heading 2` on a heading, "type '/'"
elsewhere); the host `placeholder` stays while the document is empty;
- the fixed toolbar gives way to the formatting bubble and the `/` palette;
- the page loses its border and keeps a left gutter for the handle (hidden below `sm`).

The handle acts on top-level blocks: a list or a table moves as a whole. It relies on
ProseMirror alone and adds no dependency (no `@tiptap/y-tiptap`, unlike `UEditorDragHandle`).

Tiptap's Markdown shortcuts stay on (`# `, `- `, `1. `, `[ ] `, `> `, ` ``` `). Every explicit
option wins: `toolbar`, `bubbleMenu`, `slashCommands`, `density`, `padding`, `minHeight` and
`blockSpacing`. Locked (read-only, disabled) or in preview, the editor shows neither handle
nor hint.

| Option | Type | Default | Description |
|---|---|---|---|
| `blockEditor` | `Boolean` \| `Object` | `false` | Turns block editing on. |
| `blockEditor.dragHandle` | `Boolean` | `true` | Gutter handle: `+`, drag and drop, block menu. |
| `blockEditor.placeholders` | `Boolean` | `true` | Hint on the empty block holding the cursor. |
| `blockEditor.bordered` | `Boolean` | `false` | Keeps the field border around the page. |

```json
{
"type": "Control",
"scope": "#/properties/page",
"options": { "wysiwyg": true, "contentType": "json", "blockEditor": true }
}
```

No new node type is added: the content stays the same in `json`, `html` or `markdown` and
reads back with or without `blockEditor`.

## AI assistant

```ts
Expand Down
6 changes: 4 additions & 2 deletions docs/guide/options/string.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,9 @@ Nécessite `allRenderers` (pas seulement `nuxtUiRenderers`).
| `toolbar` | `Array` \| `false` | barre intégrée | Remplace la barre d’outils (`EditorToolbarItem[][]`) ou la masque. |
| `placeholder` | `String` | — | Placeholder de l’éditeur. |
| `features` | `false` \| `Object` | tout activé | Tableaux, listes de tâches, alignement, couleurs, surlignage, lien, rechercher/remplacer, source, aperçu. |
| `bubbleMenu` | `Boolean` | `false` | Bulle de mise en forme sur sélection. |
| `slashCommands` | `Boolean` | `false` | Palette de commandes `/`. |
| `bubbleMenu` | `Boolean` | `false` (`true` avec `blockEditor`) | Bulle de mise en forme sur sélection. |
| `slashCommands` | `Boolean` | `false` (`true` avec `blockEditor`) | Palette de commandes `/`. |
| `blockEditor` | `Boolean` \| `Object` | `false` | Édition par blocs façon Notion : poignée `+` / glisser / menu du bloc, indices par bloc, sans barre fixe ni bordure. Voir [Édition par blocs](/guide/wysiwyg-ai#edition-par-blocs). |
| `ai` | `Object` | — | Assistant IA optionnel (`enabled`, `endpoint` ou `transport`, `actions`…). |
| `editor` | `Object` | — | Pass-through → `UEditor`. |

Expand Down Expand Up @@ -373,4 +374,5 @@ d'une image redimensionnée n'a pas d'équivalent Markdown et n'est pas conserv
- [File Upload](/playground#/?section=docs&example=nuxt-file-upload)
- [Autocomplete API](/playground#/?section=docs&example=nuxt-autocomplete)
- [WYSIWYG](/playground#/?section=docs&example=nuxt-wysiwyg)
- [WYSIWYG par blocs](/playground#/?section=docs&example=nuxt-wysiwyg-blocks)
- [WYSIWYG + IA](/playground#/?section=docs&example=nuxt-wysiwyg-ai)
1 change: 1 addition & 0 deletions docs/guide/playground-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Tout exemple dont le `name` commence par `nuxt-` atterrit automatiquement dans *
| [Autocomplete API](/playground#/?section=docs&example=nuxt-autocomplete) | `UInputMenu` | `api.*`, `minLength`, `suggestion` |
| [WYSIWYG](/playground#/?section=docs&example=nuxt-wysiwyg) | `UEditor` | `wysiwyg`, `contentType` (`json` \| `html`) |
| [WYSIWYG + IA](/playground#/?section=docs&example=nuxt-wysiwyg-ai) | `UEditor` + IA | `bubbleMenu`, `slashCommands`, `ai` (transport local) |
| [WYSIWYG par blocs](/playground#/?section=docs&example=nuxt-wysiwyg-blocks) | `UEditor` (mode bloc) | `blockEditor` |

### Nombres & booléens

Expand Down
46 changes: 44 additions & 2 deletions docs/guide/wysiwyg-ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,57 @@ sont désactivés par défaut.
| `features.findReplace` | `Boolean` | `true` | Rechercher / remplacer (sensible à la casse en option). |
| `features.sourceMode` | `Boolean` | `true` | Édition brute du HTML ou du JSON ; le contenu appliqué passe par le schéma Tiptap. |
| `features.preview` | `Boolean` | `true` | Aperçu en lecture seule. |
| `bubbleMenu` | `Boolean` | `false` | Bulle de mise en forme sur sélection de texte. |
| `slashCommands` | `Boolean` | `false` | Palette de commandes `/`. |
| `bubbleMenu` | `Boolean` | `false` (`true` avec `blockEditor`) | Bulle de mise en forme sur sélection de texte. |
| `slashCommands` | `Boolean` | `false` (`true` avec `blockEditor`) | Palette de commandes `/`. |
| `blockEditor` | `Boolean` \| `Object` | `false` | Édition par blocs (voir ci-dessous). |
| `ai` | `WysiwygAiOptions` | — | Assistant IA (voir ci-dessous). |

Une extension fournie par l'hôte via `options.extensions` (par exemple sa propre `Table`)
prend le pas sur l'extension intégrée du même nom. Une `toolbar` personnalisée n'est jamais
modifiée ; ses éléments peuvent utiliser les `kind` intégrés : `textColor`, `highlight`,
`table`, `tableAction`, `findReplace`, `sourceMode`, `preview`, `ai`.

## Édition par blocs

`blockEditor: true` transforme le champ en page éditée bloc par bloc, à la manière de Notion :

- au survol, une poignée apparaît dans la marge gauche de chaque bloc : `+` ajoute un bloc en
dessous (et ouvre la palette `/` si elle est active), la poignée `⋮⋮` se **glisse** pour
déplacer le bloc ou se **clique** pour ouvrir son menu : *Transformer en* (paragraphe,
titres, listes, citation, code), *Effacer la mise en forme*, *Dupliquer*, *Copier le texte*,
*Monter*, *Descendre*, *Supprimer* ;
- le bloc vide qui porte le curseur affiche un indice (`Titre 2` sur un titre, « tapez « / » »
ailleurs) ; le `placeholder` de l'hôte reste affiché tant que le document est vide ;
- la barre d'outils fixe disparaît au profit de la bulle de mise en forme et de la palette `/` ;
- la page n'a plus de bordure et garde une marge gauche pour la poignée (masquée sous `sm`).

La poignée agit sur les blocs de premier niveau : une liste ou un tableau se déplace en entier.
Elle ne repose que sur ProseMirror et n'ajoute aucune dépendance (pas de `@tiptap/y-tiptap`,
contrairement à `UEditorDragHandle`).

Les raccourcis Markdown de Tiptap restent actifs (`# `, `- `, `1. `, `[ ] `, `> `, ` ``` `).
Chaque option explicite l'emporte : `toolbar`, `bubbleMenu`, `slashCommands`, `density`,
`padding`, `minHeight` et `blockSpacing`. Verrouillé (lecture seule, désactivé) ou en aperçu,
l'éditeur n'affiche ni poignée ni indice.

| Option | Type | Défaut | Description |
|---|---|---|---|
| `blockEditor` | `Boolean` \| `Object` | `false` | Active l'édition par blocs. |
| `blockEditor.dragHandle` | `Boolean` | `true` | Poignée de marge : `+`, glisser-déposer, menu du bloc. |
| `blockEditor.placeholders` | `Boolean` | `true` | Indice sur le bloc vide qui porte le curseur. |
| `blockEditor.bordered` | `Boolean` | `false` | Garde la bordure du champ autour de la page. |

```json
{
"type": "Control",
"scope": "#/properties/page",
"options": { "wysiwyg": true, "contentType": "json", "blockEditor": true }
}
```

Aucun nouveau type de nœud n'est ajouté : le contenu reste identique en `json`, `html` ou
`markdown` et se relit avec ou sans `blockEditor`.

## Assistant IA

```ts
Expand Down
11 changes: 9 additions & 2 deletions playground/docs-api/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,12 +608,18 @@ const WYSIWYG: ApiPropGroup = {
{
name: 'bubbleMenu',
type: 'Boolean',
description: 'Bulle de mise en forme sur sélection (défaut false).',
description: 'Bulle de mise en forme sur sélection (défaut false, true avec blockEditor).',
},
{
name: 'slashCommands',
type: 'Boolean',
description: 'Palette de commandes / (défaut false).',
description: 'Palette de commandes / (défaut false, true avec blockEditor).',
},
{
name: 'blockEditor',
type: 'Boolean | Object',
description:
'Édition par blocs façon page : poignée + / glisser / menu du bloc, placeholders par bloc, sans barre fixe ni bordure (dragHandle, placeholders, bordered).',
},
{
name: 'ai',
Expand Down Expand Up @@ -731,6 +737,7 @@ export const API_BY_EXAMPLE: Record<string, ApiPropGroup[]> = {
'nuxt-array': [COMMON_OPTIONS, ARRAY],
'nuxt-wysiwyg': [COMMON_OPTIONS, WYSIWYG],
'nuxt-wysiwyg-ai': [COMMON_OPTIONS, WYSIWYG],
'nuxt-wysiwyg-blocks': [COMMON_OPTIONS, WYSIWYG],
'nuxt-layouts': [COMMON_OPTIONS, LAYOUTS],
'nuxt-pin-input': [COMMON_OPTIONS, PIN],
'nuxt-color': [COMMON_OPTIONS, COLOR],
Expand Down
97 changes: 97 additions & 0 deletions playground/examples/items/nuxt-wysiwyg-blocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { registerExamples } from '../register'

export const data = {
page: {
type: 'doc',
content: [
{
type: 'heading',
attrs: { level: 1 },
content: [{ type: 'text', text: 'Compte-rendu de chantier' }],
},
{
type: 'paragraph',
content: [
{ type: 'text', text: 'Survolez un bloc : ' },
{ type: 'text', marks: [{ type: 'bold' }], text: '+' },
{ type: 'text', text: ' ajoute un bloc en dessous, la poignée ' },
{ type: 'text', marks: [{ type: 'bold' }], text: '⋮⋮' },
{ type: 'text', text: ' le déplace ou ouvre son menu. Tapez « / » sur une ligne vide.' },
],
},
{
type: 'heading',
attrs: { level: 2 },
content: [{ type: 'text', text: 'Actions' }],
},
{
type: 'taskList',
content: [
{
type: 'taskItem',
attrs: { checked: true },
content: [
{ type: 'paragraph', content: [{ type: 'text', text: 'Vérifier les accès' }] },
],
},
{
type: 'taskItem',
attrs: { checked: false },
content: [
{ type: 'paragraph', content: [{ type: 'text', text: 'Commander le matériel' }] },
],
},
],
},
{
type: 'blockquote',
content: [
{
type: 'paragraph',
content: [
{ type: 'text', text: 'Sélectionnez du texte pour la bulle de mise en forme.' },
],
},
],
},
{ type: 'paragraph' },
],
},
}

export const schema = {
type: 'object',
properties: {
page: {
type: 'object',
title: 'Page',
description: 'options.blockEditor: true — édition par blocs, sans barre d’outils fixe.',
},
},
}

export const uischema = {
type: 'VerticalLayout',
elements: [
{
type: 'Control',
scope: '#/properties/page',
options: {
wysiwyg: true,
contentType: 'json',
blockEditor: true,
placeholder: 'Commencez à écrire…',
},
},
],
}

registerExamples([
{
name: 'nuxt-wysiwyg-blocks',
label: 'Nuxt UI — WYSIWYG par blocs',
data,
schema,
uischema,
},
])
14 changes: 14 additions & 0 deletions src/advanced/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ export {
buildWysiwygToolbar,
} from './wysiwyg/toolbar'
export { WYSIWYG_SLASH_FILTER_FIELDS, buildWysiwygSlashItems } from './wysiwyg/slash/commands'
export {
DISABLED_WYSIWYG_BLOCK_EDITOR,
WYSIWYG_BLOCK_LAYOUT,
buildWysiwygBlockMenu,
createWysiwygBlockPlaceholder,
findWysiwygBlockAt,
insertWysiwygBlockAfter,
resolveWysiwygBlockEditor,
runWysiwygBlockAction,
type ResolvedWysiwygBlockEditor,
type WysiwygBlockAction,
type WysiwygBlockType,
type WysiwygBlockEditorOptions,
} from './wysiwyg/block'
export {
WYSIWYG_TABLE_ACTIONS,
createWysiwygHandlers,
Expand Down
Loading
Loading