-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Reordering header rows or columns with non-headers breaks view #10463
Comments
This happens because moving elements in the model is downcasted as remove + insert and current downcast converters for tables do not handle changing headings in that situation. The easiest way, for now, is to trigger table refresh (as we do on the ckeditor5/packages/ckeditor5-table/src/converters/table-heading-rows-refresh-post-fixer.js Lines 38 to 54 in c252a2d
|
Remaining scope:
Note to @Dumluregn: Do you handle rowspan and colspans in your code that reorganizes the table? They are not going to be handled by the table's core implementation. |
BTW: Hot tip: http://localhost:8125/ckeditor5-table/tests/manual/tablemocking.html use this to generate model data. Idea: Add source editing to that test. |
Sorry for delayed response, in current implementation we handle moving rows with but not those: |
@niegowski I made all necessary updates to this solution and I did put all of it in this branch: ck/10463-table-rows-columns-reordering There is one problem with proposed postfixer fix though. It will fail if we make an Table with two heading rows:
Then if we add new row between first two heading rows: const row = writer.createElement( 'tableRow' );
writer.insert( row, table, 1 );
writer.insertElement( 'tableCell', row, 'end' );
writer.insertElement( 'tableCell', row, 'end' ); So we should have now:
But we get:
It's because in the updated postfixer: ckeditor5/packages/ckeditor5-table/src/converters/table-heading-rows-refresh-post-fixer.js Lines 38 to 46 in c252a2d
in such case we are doing Later then I'm not sure how to fix it yet though. This exact case is covered in the following automated test which will fail at the moment: ckeditor5/packages/ckeditor5-table/tests/converters/downcast.js Lines 464 to 488 in c252a2d
|
Other than that I refactored @Dumluregn tests to use our table helpers.
EDIT: after some consideration we decided to revert edits made to |
This test is invalid. It is passing now because of broken downcast conversion. There is |
@niegowski Thanks for that one. It works like a charm now. |
…eordering Fix (table): Make reordering table rows and columns possible without breaking view in tables with heading rows or heading columns. Closes #10463.
📝 Provide detailed reproduction steps (if any)
There are two cases with different behaviour, but in both the model and data downcast work fine and editing downcast is bugged.
Scenario 1 - moving the header row
writer
.✔️ Expected result
There should still be one header row and rows content should be swapped.
❌ Actual result
There is no more header rows in the editing downcast. Also the content of rows didn't swap in the view.
Scenario 2 - moving the non-header row
writer
.✔️ Expected result
There should still be one header row and rows content should be swapped.
❌ Actual result
There are two header rows in the view. Still only one in model and data downcast.
❓ Possible solution
The only broken pipeline is the editing downcast, so I'd look for the solution there.
📃 Other details
Same issues occur during header column reordering. On the
header-row-column-test
branch I've pushed some unit tests reproducing the problem.If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: