VSDX import clips overflowing shape text at the text-block height

Aperta
#5,813 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

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
html, javascript
Ambito
frontend, web-dev

Direzione di ricerca

Start with src/main/webapp/js/diagramly/vsdx/importer.js at getTextLabel() and trace how overflow=width is rendered in src/main/webapp/mxgraph/src/util/mxSvgCanvas2D.js at createCss(). Reproduce the reported clipping by importing the attached VSDX with HeadlessEditorUi.importVisio, then decoding it into a Graph with HTML labels enabled. Done means the shape’s text remains visible below its boundary while preserving the text, wrapping width, and geometry without changing other importer cases.

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

Descrizione

bug
Preflight Checklist
  • I agree to follow the Code of Conduct.
  • I have searched the issue tracker for a matching report without finding one.

Describe the bug

In a local integration using the unmodified draw.io Visio importer and Graph, imported HTML labels use overflow=width. The resulting HTML has a height limit and overflow:hidden, so lower lines are clipped when a Visio text block extends below its shape.

The attached synthetic VSDX reproduces the clipping without our document library or private source files. It contains two shapes with generic text:

  • Shape 1: a top-aligned 3 × 0.49 inch invisible box, with a leading U+2028 blank line and four nonempty lines (Author, Review, Approval, Date). Lower lines are clipped.
  • Shape 2: a 25 × 15 mm blue box with slash-separated text. This is an additional wrapping/clipping probe; see the scope limitation below.

To Reproduce

  1. Download and extract upstream-repro.vsdx.zip.
  2. With draw.io's app.min.js and extensions.min.js loaded, import upstream-repro.vsdx using HeadlessEditorUi.importVisio.
  3. Decode the first imported page into an ordinary Graph with HTML labels enabled. Do not apply any downstream text-layout adaptations.
  4. Inspect shape 1: all four nonempty lines are in the label DOM, but the lower lines are clipped by the height/overflow rules.

This is the control used in our reproduction (the globals are supplied by the draw.io bundles; file is the attached VSDX as a browser File, and container is a visible diagram element):

const xml = await new Promise((resolve, reject) =>
  new HeadlessEditorUi().importVisio(
    file, resolve, reject, 'upstream-repro.vsdx'));

const graph = new Graph(container);
graph.setHtmlLabels(true);
const diagram = mxUtils.parseXml(xml).getElementsByTagName('diagram')[0];
const modelXml = mxUtils.parseXml(Graph.decompress(diagram.textContent));
new mxCodec(modelXml).decode(modelXml.documentElement, graph.getModel());
graph.refresh();
graph.fit(24);
graph.center(true, true);

Expected behavior

Preserve the original text, leading blank line, wrapping width and shape/text-block geometry, while allowing text that Visio renders beyond an invisible shape's lower boundary to remain visible. A native Visio-generated PDF of the original document confirms this overflow behavior. The attached reproduction was newly generated; it has not separately been opened/saved in native Visio.

Screenshots

The self-contained synthetic VSDX is attached above. Private document screenshots are intentionally omitted. In our automated control, shape 1 has 31 non-whitespace glyphs intersecting clipping boundaries before the adaptation and none afterward. The complete text is present in both models; the failure is visual clipping.

draw.io version (In the Help->About menu of the draw.io editor):

Desktop (please complete the following information):

  • OS: Windows.
  • Browser: Google Chrome, automated through Playwright.
  • Browser version: 154.0.8037.100.

Smartphone (please complete the following information):

  • Device / OS / browser / version: Not tested; desktop integration reproduction.

I tested the problem in incognito/private mode with all browser extensions switched off, write "yes" below:

  • Yes: reproduced in a fresh isolated Playwright browser context, without a user profile or extensions. The interactive browser's incognito UI was not separately tested.

Additional context

The relevant source paths appear to be:

Downstream correction approach tested

After decoding the imported model, our browser adapter:

  1. Changes overflow=width to overflow=block on nonempty imported HTML vertex labels identified by vsdxID. This retains the wrapping width while allowing vertical overflow.
  2. Adds HTML <wbr> opportunities after slash characters in visible text nodes for the slash-separated wrapping case. It handles string values and XML object values with a label attribute, without altering unrelated attributes.
  3. Refreshes the graph. Shape/text-block geometry and stored VSDX characters are unchanged. The HTML-only wbr markers are never written into VSDX text. Direct edge labels and non-HTML values are left unchanged.

The synthetic control has no clipped glyphs after adaptation, and applying the adaptation again produces identical model XML. We also checked the original case against its native PDF: all 16 overflowing text blocks and the four-line slash-separated label are visible, with unchanged geometry. Edit/export/reset checks preserve the underlying text and other package contents.

Scope limitation: The full draw.io UI was also observed clipping the original overflowing metadata text, but it wrapped a similar slash-separated label correctly. We have not isolated the full-UI version/configuration difference. Therefore, the slash-wrapping probe should not be treated as a confirmed bug in every full-editor version. The primary report is the vertical clipping, with a proven headless import/render reproduction.

This is a downstream workaround and a suggested direction for investigation, rather than a claim that changing the default globally is safe. An upstream fix would need to preserve the intended overflow semantics for other importer cases.

The attachment contains only the newly generated generic VSDX, with no private document content.

Lingua principale
JavaScript
Stelle
9.4k
Fork
1.4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

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 jgraph/drawio

Tutte le issue di jgraph/drawio

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.