Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Beta]: DOCX import drops underline, text color, background color, alignment, sub/superscript and blockquotes without a warning, even from Plate's own export

Aperta
#5,285 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript

Direzione di ricerca

Start with packages/platejs/src/docx/import/lib/importDocx.ts around lines 1474–1477 to inspect the Mammoth conversion options, then read apps/www/src/registry/components/editor/import-toolbar-button.tsx around lines 34–46 for warning display. Reproduce the DOCX round trip on /docs/docx and check which formats survive import. Done means supported formats return on import, and unsupported ones are identified in the warnings.

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

Descrizione

bug plugin:docx target:beta

Testing lane

  • Repository: udecode/plate
  • Branch: next
  • Release channel: Beta
  • Exact commit/package version: NOT_ENOUGH_INFO

Summary

In the DOCX demo on /docs/docx, Import from Word keeps headings, bold, italic, strikethrough, lists, tables and links. It drops underline, text color, background color, superscript, subscript, paragraph alignment and blockquotes. A file that the same demo has just exported with underline, color, background and centering comes back without any of them, and no warning shows. For a Word file with these formats the only feedback was the toast Imported with 4 warnings., which does not say what was lost.

Reproduction

The demo on /docs/docx has Import and Export buttons in its toolbar. Import opens a menu with Import from Word, and Export one with Export as Word.

Repro 1: round trip on /docs/docx, Chromium

An agent ran this on 2026-10-21 (PT) in the Claude desktop app's built-in Chromium, at natamox's request.

  1. Open https://beta.platejs.org/docs/docx.
  2. In the demo editor, select a word. With the toolbar, underline it, give it a text color and a background color, and center its paragraph.
  3. Click Export, then Export as Word. The demo saves document.docx.
  4. Click Import, then Import from Word, and pick that document.docx.

The agent checked the exported file: its word/document.xml holds w:u, w:color, w:shd and w:jc for these formats. After step 4 the word has no underline, color or background, and the paragraph is no longer centered. No warning shows.

Repro 2: a Word file with these formats, Chromium

Same agent, browser and date. The agent imported a Chinese report in Word format that it had made for the test. The report has underline, red text, yellow shading, superscript, subscript, a centered paragraph, a right-aligned paragraph and a blockquote.

Headings, bold, italic, strikethrough, lists, the table and links came in. Underline, text color, shading, superscript, subscript, center and right alignment, and the blockquote were all lost. The only toast was Imported with 4 warnings. The file is not attached, since GitHub issues do not take .docx files.

natamox retested /docs/docx by hand on 2026-10-23 (PT): imported files still lost underline, color, shading, alignment and other formats.

Expected

  • The Format support table on /docs/docx says that "Paragraphs, headings, supported marks and properties" "Decode through the installed HTML mappings and export through the configured static renderer". In this demo, underline, text color, background color and alignment are supported: the editor applies them, and Repro 1 shows the demo's export writing them into the Word file.
  • So a file the demo exports should import back with the same formats. Where a format cannot come back, the import should report it, as the docs say it does for other content it omits. This is the expectation in the agent's notes.
  • The warnings toast should say what was dropped, not only how many warnings there were.

Actual

These formats disappear on import. Plate's own export loses them on the way back with no warning. For an outside file, the toast gives only a count.

Environment

  • Exact next commit/Beta package version: NOT_ENOUGH_INFO. The page does not show its build. The agent read the source at next 87b29efbfa on the day of the first run.
  • First run: an agent in the Claude desktop app's built-in Chromium 152.0.7977.167, desktop viewport 1024×768, on 2026-10-21 (PT). A script put each file into the page's file input. The agent read the exported file with a script and LibreOffice in headless mode; it did not open Word.
  • natamox's hand retest on 2026-10-23 (PT). The browser is not recorded.
  • Not replayed on the live Beta after 2026-10-23. The code below reads the same on next fc9ebcd16b.

Caveat

From a reading of the code on next fc9ebcd16b, not checked with a debugger:

  • packages/platejs/src/docx/import/lib/importDocx.ts:1474-1477 converts the file to HTML with mammoth, passing styleMap: ['comment-reference => sup'] and nothing else.
  • Inference: mammoth's default conversion leaves out underline, font color, highlight and alignment, so these formats are gone before Plate's HTML mappings see them, and no diagnostic can record them. This comes from mammoth's documented defaults and was not traced for each format. Why superscript, subscript and blockquotes are lost was not traced.
  • The demo's toast counts the warnings and shows only the count (apps/www/src/registry/components/editor/import-toolbar-button.tsx:34-46).

Evidence

  • No recording. The original run recorded no video of these imports. The toast text and the XML element names are copied from the agent's notes.

Related

  • #5284: The DOCX demo's Import from Word rejects any file with an image, a footnote, a header, a text box or a partial comment.
Lingua principale
TypeScript
Stelle
16.6k
Fork
993
Merge medio
20h 1m
PR unite (30g)
60

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 udecode/plate

Tutte le issue di udecode/plate

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.