✨(feature) Add a tabs block with nested blocks

Aperta
#2,937 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
django, python, react, typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

✏️ 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.
Lingua principale
TypeScript
Stelle
17k
Fork
705
Merge medio
4g 13h
PR unite (30g)
47

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di suitenumerique/docs

Tutte le issue di suitenumerique/docs

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.