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

[Beta]: The DOCX demo's Import from Word rejects any file with an image, a footnote, a header, a text box or a partial comment, instead of importing the rest with warnings

Aperta
#5,284 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
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
api, backend, frontend

Direzione di ricerca

Read packages/platejs/src/docx/import/lib/importDocx.ts around the default lossPolicy and applyLossPolicy, then compare the import options in apps/www/src/registry/components/editor/import-toolbar-button.tsx with the export toolbar's policy. The issue leaves open whether rejecting loss is the intended import contract; clarify that behavior before changing it. Done means the documented contract and demo behavior match, and the listed DOCX cases import their body with dropped content reported as warnings if that is the chosen policy.

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 refuses a Word file as soon as it holds an embedded image, a footnote, a header, a text box or a comment without a complete range. The editor does not change, and one error toast names the first loss. Any Word file with a picture is refused, so most real documents cannot be imported. The docs' Format support table describes these parts as omitted with a diagnostic on an import that goes ahead, and the same demo's export already passes lossPolicy: 'allow'.

Reproduction

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

Repro 1: /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. Click Import, then Import from Word.
  3. Pick one of the files below.
File Source Error toast
comments.docx (one point comment) mammoth.js test data Comment 2 has no complete imported range.
footnotes.docx mammoth.js test data DOCX footnote content is not mapped into the main document.
text-box.docx mammoth.js test data DOCX text-box content was dropped.
tiny-picture.docx mammoth.js test data An embedded image was omitted during DOCX import.
sample-docx (has a header and an image) docx4j's sample documents DOCX header content is not mapped into the main document.

The mammoth.js files are in test/test-data of https://github.com/mwilliamson/mammoth.js.

For each file the editor keeps its content, and only the error toast shows. Two mammoth.js files did import: tables.docx (a 2×2 table) with no toast, and strict-format.docx (Strict OOXML) with Imported with 1 warning.

natamox retested /docs/docx by hand on 2026-10-23 (PT): Word files with comments, footnotes, text boxes, images or headers were still refused.

Expected

The body of the file imports, and the parts that cannot come in are reported as warnings.

  • The Format support table on /docs/docx says: "Embedded images during import" are handled by "Omit the resource and return a resource-omitted diagnostic". For "Multiple-section headers and footers, footnotes, and endnotes" it says "Import reports them as dropped content". For "Fields, text boxes, shapes, charts, SmartArt, and embedded objects" it says "Keep reachable plain text when conversion exposes it; report unsupported or omitted content". Each row reads as a diagnostic on an import that succeeds.
  • The page says that exportDocx "rejects content loss by default" (section "Content loss"). Neither the "Import a DOCX file" section nor the importDocx API section says the same for import. The API section lists lossPolicy among the import options without its default.
  • The same demo exports with lossPolicy: 'allow' (see Caveat).
  • The agent's notes expect the body to import with the dropped parts listed as warnings, or the demo to choose its own policy.

If rejecting by default is the intended contract of importDocx, this issue narrows to two things: the import docs should say so, and the demo should pick a policy that imports the body and shows what it dropped.

Actual

The import fails. The editor does not change, and one toast shows the first error's message. Nothing tells the user that the rest of the file could have come in.

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 system file dialog was not used.
  • natamox's hand retest on 2026-10-23 (PT). The browser is not recorded.
  • On 2026-10-23 (PT) an agent on natamox's Xiaomi 14 (Android 16, Chrome 154) exported the demo as Word and imported that file back through the system file picker. That file has no image, footnote, header or text box, and it imported.
  • 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:2068 sets lossPolicy to 'reject' when the caller passes none.
  • applyLossPolicy (:1711-1726) turns every warning that isVisibleLoss (:1705-1709) counts as a visible loss into an error under 'reject'. That covers resource-omitted and unsupported-content diagnostics.
  • Every image is removed and recorded as resource-omitted (:1572-1580). Header and footnote parts get the "not mapped into the main document" message (:1681). A comment without a complete range gets :1930. The text box diagnostic is in packages/platejs/src/docx/internal/docxPackage.ts:154.
  • The demo calls importDocx(arrayBuffer, { plugins, retainSource }) with no lossPolicy (apps/www/src/registry/components/editor/import-toolbar-button.tsx:255-258), and on failure shows the first error's message (:260-266). Its export passes lossPolicy: 'allow' (apps/www/src/registry/components/editor/export-toolbar-button.tsx:209-214).

Evidence

  • No recording. The original run recorded no video of these imports. The toast texts above are copied from the agent's notes.

Related

  • #5285: DOCX import drops underline, text color, background color, alignment, sub/superscript and blockquotes without a warning.
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.