-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: saving tables #942
fix: saving tables #942
Conversation
cab26e5
to
b45927f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I fully understand the content logic, but generally makes sense to me so I'm good with this!
@@ -35,7 +40,10 @@ const visitor = (table: Table, index: number, parent: Parents) => { | |||
}; | |||
|
|||
visit(table, 'tableCell', tableCellVisitor); | |||
if (!hasFlowContent) return; | |||
if (!hasFlowContent) { | |||
table.type = 'table'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhh is this where the tableau
error was coming from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I added a custom table component, silly-ly named tableau
, to handle block content. I believe I ran into some weirdness the last time I tried to override a built in type.
And yea, I forgot to add a compiler or transform it or anything.
Well, it's mostly just looking for any block content in a table cell. Except for the case when the editor likes to wrap the table cell content in a |
This PR was released!🚀 Changes included in v6.75.0-beta.76 |
🧰 Changes
Fixes saving 'complex' tables.
In a prior PR, I added a new node type
tableau
to represent tables with block content. This mostly worked for the editor, but not when doingmdx(mdast(doc))
. This PR adds a transformer, so the atableau
is converted to a JSX table just like regulartable
's.This also adds the check so, if a
tableau
no longer has block content, it's saved as markdown!🧬 QA & Testing
Hard to test outside the main app.