Skip to content

Conversation

@mejo-
Copy link
Member

@mejo- mejo- commented Aug 1, 2025

📝 Summary

🖼️ Screenshots

🏡 Editor Serialized Markdown
image image

🚧 TODO

  • Allow block+ as content for tableCell. For some reason, allowing blockquotes results in all cell rows being serialized to markdown as blockquote. I didn't find out yet why this is the case (fixed magically, probably something upstream in Tiptap)
  • Parsing single-line block elements (like lists with one item, blockquotes with one line) from markdown is broken
  • Single-line table rows take more vertical space now
  • 2x return used to create/jump to next row. This is currently broken. Do we want it back? (we don't)
  • Optionally remove our custom newline special-handling with <br> in table cells (let's keep it to not break backwards-compatibility when parsing existing tables)
  • Reset sessions on app update
  • Custom paste handler breaks pasting into code blocks. We need to replace it with a paste handler that prevents nested tables and allows everything else
  • Prevent nested tables via filterTransaction (as suggested here)

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests

@mejo- mejo- self-assigned this Aug 1, 2025
@mejo- mejo- force-pushed the feat/multiline_tables branch 3 times, most recently from b6526cb to c619227 Compare August 1, 2025 13:16
@codecov
Copy link

codecov bot commented Aug 1, 2025

@mejo- mejo- force-pushed the feat/multiline_tables branch from c619227 to b18ab8b Compare August 3, 2025 17:59
@mejo- mejo- marked this pull request as ready for review August 3, 2025 17:59
@mejo- mejo- requested a review from max-nextcloud as a code owner August 3, 2025 17:59
@mejo- mejo- force-pushed the feat/multiline_tables branch 2 times, most recently from ac21086 to 8e40758 Compare August 14, 2025 14:36
@mejo- mejo- changed the title Multiline tables with paragraphs, lists, code blocks and images Multiline tables with block node content Aug 14, 2025
@max-nextcloud
Copy link
Collaborator

@mejo- Did you figure out what prevents nesting a table in a table right now?

@mejo-
Copy link
Member Author

mejo- commented Aug 17, 2025

@mejo- Did you figure out what prevents nesting a table in a table right now?

Not exactly, but I guess it's rather a broken can() (or however this command to check whether the feature is possible at current cursor position is called). Pasting a table into a table cell works currently. That's why I added the two TODO points to make it technically impossible to add nested tables (via filterTransaction) and to filter out nested tables in handlePaste().

@Aveyron-RetD
Copy link

Will this fix as well, rich previews added with the smart picker ?
#7582

@janbaum
Copy link
Contributor

janbaum commented Sep 26, 2025

2x return used to create/jump to next row. This is currently broken. Do we want it back?

Just wanted to say that I would love this being broken 🫠

@juliusknorr juliusknorr moved this to 💡 To discuss in 📝 Office team Nov 5, 2025
@juliusknorr juliusknorr moved this from 💡 To discuss to 📄 To do (~10 entries) in 📝 Office team Nov 6, 2025
@mejo- mejo- force-pushed the feat/multiline_tables branch 4 times, most recently from bba037a to 48ccc4c Compare November 25, 2025 17:11
@mejo- mejo- force-pushed the feat/multiline_tables branch 3 times, most recently from 12cb94a to 30e25f0 Compare December 3, 2025 11:10
Comment on lines +100 to +134
if (!tablePaste) {
return slice
}

if (
slice.content.childCount === 1
&& slice.content.firstChild?.type.name === 'table'
) {
const tableChild = slice.content.firstChild.firstChild
if (
(tableChild.childCount === 1
&& tableChild.type.name === 'tableRow')
|| tableChild.type.name === 'tableHeadRow'
) {
const rowChild = tableChild.firstChild
if (
(rowChild.childCount === 1
&& rowChild.type.name === 'tableCell')
|| rowChild.type.name === 'tableHeader'
) {
return new Slice(rowChild.content, 0, 0)
}
}
}

console.warn('Nested tables are not supported')
alert(
t(
'text',
'A table was pasted into a table. Nested tables are not supported.',
),
)

const newSlice = new Slice(Fragment.empty, 0, 0)
return newSlice
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to rule out multi cell pastes?
Would that effectively lead to nested tables or just paste the cells at the current cursor position?

The latter seems like it might be useful and if it's already the current behavior would be nice to keep it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it a try by selecting two cells and pasting them and it resulted in a full new table being added to the cell, i.e. a nested table. If that's what you mean (also what we talked about last week), then I fear that's not possible out of the box and not working already now.

Copy link
Collaborator

@max-nextcloud max-nextcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good code wise. Have not tested it yet though.

mejo- added 18 commits December 8, 2025 17:34
Allow paragraphs, lists, code blocks and images in table cells for now.

Signed-off-by: Jonas <[email protected]>
Table cells with lists or code blocks are hardcoded to left alignment
though, as everything else would break markdown parsing later.

Signed-off-by: Jonas <[email protected]>
Dashes in nodes names are not nice and this PR changes the editor schema
anyway.

Signed-off-by: Jonas <[email protected]>
Unnecessary and breaks serializing e.g. nested lists.

Signed-off-by: Jonas <[email protected]>
Also add tests for tables with complex nested structures in their cells.

Signed-off-by: Jonas <[email protected]>
With multiline table cells, we don't want to jump into next table row
any longer when pressing <Return> two times in a row.

Signed-off-by: Jonas <[email protected]>
Single line block node cell content is not valid markdown.

Signed-off-by: Jonas <[email protected]>
The editor schema changed as table cells now support block node content.

Signed-off-by: Jonas <[email protected]>
Check pasted content for possibly nested table when pasting to a table
cell. Show an alert if nested table is detected.

Add some extra logic to detect if just one table cell got selected and
copied, which results in a table with one row and cell in the clipboard.
Unwrap the cell content in this case and paste it.

Add `filterTransaction` to prevent applying a transaction that would
result in nested tables. This is meant as an extra low-level protection
against nested tables.

Signed-off-by: Jonas <[email protected]>
We don't support headerless tables in the editor schema anyway, so let's
not add partial support for them that results in markdown being altered.

Signed-off-by: Jonas <[email protected]>
@mejo- mejo- force-pushed the feat/multiline_tables branch from 30e25f0 to 3258953 Compare December 8, 2025 16:35
@mejo- mejo- force-pushed the feat/multiline_tables branch from 3258953 to b625cbb Compare December 8, 2025 17:13
@mejo- mejo- merged commit ab7ed54 into main Dec 11, 2025
69 checks passed
@mejo- mejo- deleted the feat/multiline_tables branch December 11, 2025 14:47
@github-project-automation github-project-automation bot moved this from 📄 To do (~10 entries) to ☑️ Done in 📝 Office team Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Text rich editor column smart picker content breaks tables Inserting Images into Table Cells Pasting an image into a table splits it

6 participants