Skip to content

fix(composer): keep layout attributes and styles of tables - #14095

Open
Berthe01 wants to merge 1 commit into
nextcloud:mainfrom
Berthe01:fix/composer-keep-table-layout
Open

Berthe01 wants to merge 1 commit into
nextcloud:mainfrom
Berthe01:fix/composer-keep-table-layout

Conversation

@Berthe01

@Berthe01 Berthe01 commented Nov 9, 2026

Copy link
Copy Markdown

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (Claude Code)

``

Title

fix(composer): keep layout attributes and styles of tables

Description

Problem

HTML signatures generated by signature management tools (Signitic, Exclaimer, CodeTwo…) and
many pasted contents use table-based layouts. Since tables are supported by the composer
(GeneralHtmlSupport allow list), the table elements survive, but every attribute and inline
style of table, tr, td… is dropped
, because the allow list only lists their names.

As a result, a message sent from Mail loses the layout of the signature:

  • cellspacing="0" / cellpadding="0" are dropped, so recipients' clients apply their default
    cell spacing at every nesting level (visible gaps);
  • column widths (width), heights and vertical alignment (valign, vertical-align) are lost;
  • cell borders and padding (e.g. a vertical separator border-left between a logo and contact
    details) disappear.

Measured on a real generated signature (4 nested tables, 14 cells): the signature stored in Mail
contains 14 cells with styles/attributes; the sent message contains the 14 cells with none of
them
(0 style, 0 width/valign). Text, images, links and colours are kept.

Change

Allow, on table, tbody, thead, tfoot, tr, td and th:

  • the presentational attributes width, height, align, valign, bgcolor, border,
    cellpadding, cellspacing, colspan, rowspan;
  • inline styles (styles: true), as already done for a and img.

Security considerations

  • Only presentational attributes are listed explicitly; event handlers (on*) stay disallowed
    (covered by the new test).
  • Inline styles were already allowed on a and img; this extends the same rule to table
    elements. GeneralHtmlSupport keeps filtering what it does not know.

Tests

  • New unit test: an HTML table goes through the editor configured like the composer in HTML
    mode; layout attributes and styles are preserved, onclick is not.
  • Manually: insert a table based signature, send a message, inspect the source of the received
    message (before: no attribute/style on cells; after: preserved).

Verified locally (node 24, 2026-11-09): the new test fails on main and passes with the change;
the whole unit suite passes (68 files, 555 tests); no new ESLint warning (the only warning in
TextEditor.spec.js, an unused wrapper in "shallow mounts", already exists on main).

Note for reviewers: GeneralHtmlSupport loads widget plugins that expect editor.ui.focusTracker,
which VirtualTestEditor does not provide; the test adds a minimal UI stub for that reason.``

@welcome

welcome Bot commented Nov 9, 2026

Copy link
Copy Markdown

Thanks for opening your first pull request in this repository! ✌️

@kesselb

kesselb commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution! Two small things:

  1. Please remove the comment above the new table rule in src/components/TextEditor.vue; the explanation belongs in the commit message.
  2. The PR description mentions Claude Code, so please add an Assisted-by: trailer to the commit.

@kesselb kesselb added bug 2. developing AI assisted This PR contains AI-assisted commits labels Nov 9, 2026
Table based layouts, such as email signatures generated by signature
management tools, depend on presentational attributes (cellpadding,
cellspacing, width, valign...) and on inline styles of table elements.
The GeneralHtmlSupport allow list only listed the table element names,
so all their attributes and styles were dropped and the layout was lost
on send: cell spacing, column widths, alignment and borders.

Allow on table, tbody, thead, tfoot, tr, td and th the presentational
attributes width, height, align, valign, bgcolor, border, cellpadding,
cellspacing, colspan and rowspan, and inline styles, as already done
for a and img. Event handlers stay disallowed.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Berthe01 <one.eloka@gmail.com>
@Berthe01
Berthe01 force-pushed the fix/composer-keep-table-layout branch from 5b965c4 to e51400b Compare November 9, 2026 19:09
@Berthe01

Berthe01 commented Nov 9, 2026

Copy link
Copy Markdown
Author

Thanks kesselb !

Done: the comment is removed, its explanation is now in the commit message, and the commit carries the Assisted-by: Claude Code:claude-opus-5-5 trailer.

Regards,

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing AI assisted This PR contains AI-assisted commits bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants