✨(feature) Add a tabs block with nested blocks

Abierto
#2,937 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
django, python, react, typescript

Línea de trabajo

Read the BlockNote example examples/06-custom-schema/14-tabs-block and the issue’s implementation notes. The work touches doc-editor/components/custom-blocks/, BlockNoteSuggestionMenu.tsx, doc-export/blocks-mapping/, and servers/y-provider/src/blockSpecs/; first check the BlockNote 0.56 layout block API and its export mappings. Done means nested tabs work with collaboration, local tab selection, document conversion and PDF, DOCX and ODT export, with the listed acceptance criteria satisfied.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

✏️ Needs design editor frontend

Problem to solve

In order to group related content in one place (for example a procedure per operating system) the ability to nest content into tabs where each tab can hold any blocks would a cool addition to Docs.
Today Docs only has columns, so this content has to be stacked one part after another, which makes documents long and hard to scan.

BlockNote 0.56 adds layout blocks (a preview feature): custom blocks that hold and arrange other blocks. This makes a tabs block possible.

Acceptance criteria

Given a user edits a document
When they insert a "Tabs" block from the slash menu
Then a tab set appears with one open tab holding an empty paragraph
And they can add paragraphs, headings, lists, images or code blocks inside the tab

Given a tab set
When the user adds, renames, reorders or deletes a tab
Then the change is saved in the document and shown to collaborators
And deleting the last tab keeps the tab set with a new empty tab

Given two users view the same tab set
When one of them opens another tab
Then only their own view changes, and it is not an undo step
And when their caret moves into a hidden tab (arrow keys, Backspace, paste), that tab opens

Given a document with a tab set
When it is exported to PDF, DOCX or ODT
Then every tab is exported as its label followed by its content

Event tracking

  • editor_block_inserted: a user inserts a tabs block (block_type)

There is no editor event in Docs today (only $pageview). Name to be confirmed.

Out of scope

  • A link to a specific tab (anchor in the URL) but will be needed in the future

To be verified

  • whether a tabs block can hold columns or another tabs block;

Implementation

  • Depends on the bump of BlockNote from 0.54.0 to 0.56. Layout blocks are a preview API and can change in a later release.
  • Start from the BlockNote example examples/06-custom-schema/14-tabs-block: tabs is layoutOnly with children.allow: ["tab"] and dissolve: false, and tab is placeable: "namedOnly". The open tab is kept in localStorage by block id, outside the Yjs document. New block in doc-editor/components/custom-blocks/, plus a slash menu item in BlockNoteSuggestionMenu.tsx.
  • Layout blocks need { withChildren } export mappings (a plain function mapping makes export fail), added in doc-export/blocks-mapping/, plus a spec in servers/y-provider/src/blockSpecs/ for the conversion service.
Lenguaje dominante
TypeScript
Estrellas
17k
Forks
705
Merge medio
4 d 13 h
PR fusionados (30 d)
47

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de suitenumerique/docs

Todos los issues de suitenumerique/docs

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.