Skip to content
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 incorrect upcast scan table heuristics responsible for creating heading rows. #17640

Merged
merged 4 commits into from
Dec 16, 2024

Conversation

Mati365
Copy link
Member

@Mati365 Mati365 commented Dec 13, 2024

Suggested merge commit message (convention)

Fix (table): Prevent table corruption when setting editor data with th cells following colspan rows. Closes #17556, #17404


Additional information

Our table upcasting does not recognize colspans correctly during calculation of the header rows. This PR ensures that rows that follow the rows with colspans are not longer used as table headings.

Check this HTML
	<figure class="table">
 	<table>
 		<tbody>
 			<tr>
 				<th>&nbsp;</th>
 				<td colspan="2" rowspan="2">&nbsp;</td>
 			</tr>
 			<tr>
 				<th>&nbsp;</th>
 			</tr>
 			<tr>
 				<th>&nbsp;</th>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 			</tr>
 		</tbody>
 	</table>
 </figure>
 <figure class="table">
 	<table>
 		<tbody>
 			<tr>
 				<th>&nbsp;</th>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 			</tr>
 			<tr>
 				<th>&nbsp;</th>
 				<td colspan="2" rowspan="2">&nbsp;</td>
 			</tr>
 			<tr>
 				<th>&nbsp;</th>
 			</tr>
 			<tr>
 				<th>&nbsp;</th>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 			</tr>
 		</tbody>
 	</table>
 </figure>
 <figure class="table">
 	<table>
 		<tbody>
 			<tr>
 				<th>&nbsp;</th>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 			</tr>
 			<tr>
 				<th>&nbsp;</th>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 			</tr>
 			<tr>
 				<th>&nbsp;</th>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 			</tr>
 			<tr>
 				<th>&nbsp;</th>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 			</tr>
 			<tr>
 				<th>&nbsp;</th>
 				<td colspan="2" rowspan="2">&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 			</tr>
 			<tr>
 				<th>&nbsp;</th>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 			</tr>
 			<tr>
 				<th>&nbsp;</th>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 			</tr>
 			<tr>
 				<th>&nbsp;</th>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 				<td>&nbsp;</td>
 			</tr>
 		</tbody>
 	</table>
 </figure>

Before

obraz

After

obraz

pszczesniak
pszczesniak previously approved these changes Dec 16, 2024
Copy link
Contributor

@pszczesniak pszczesniak left a comment

Choose a reason for hiding this comment

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

The fix is working as expected, didn't found any side effects 👍

@Proudloaf
Copy link

Great news that this one has been fixed, nice work! Any rough idea on when it might get released?

@Witoso
Copy link
Member

Witoso commented Dec 20, 2024

Mid-Jan or early February.

@Proudloaf
Copy link

Excellent, thanks!

@Mati365
Copy link
Member Author

Mati365 commented Dec 20, 2024

@Proudloaf While we'll release it in the stable next year, there is a way to check it on our nightly builds. Keep in mind, that it's unstable and should not be used on production.

@Proudloaf
Copy link

Fair enough, we're planning on updating to 44.1.0 very soon anyway, so once we have that stable we'll give it a go on your nightly. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

editor.getData() returns invalid table in specific case
5 participants