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

I/6122: Handling spanned table cells in pasting scenarios #7226

Merged
merged 41 commits into from
May 20, 2020

Conversation

jodator
Copy link
Contributor

@jodator jodator commented May 19, 2020

Suggested merge commit message (convention)

Internal (table): Handle spanned table cells in pasting scenarios. Closes #6122.

Fix (table): Setting column as header will now split it col-spaned cells. Closes #6658.


Additional information

This PR:

jodator added 28 commits May 15, 2020 11:24
@jodator jodator marked this pull request as ready for review May 19, 2020 11:09
@jodator jodator requested a review from niegowski May 19, 2020 11:09
@FilipTokarski
Copy link
Member

FilipTokarski commented May 19, 2020

Not 100% sure if this is valid for this PR ( or rather I didn't catch it in the previous one ), but I'll share this here:

  • Case 1
    19_table1

  • Case 2
    19_table2

In my view ( based on how pasting this selection works in most other cases ), the expected behaviour should be something like this:

table_cases

packages/ckeditor5-table/src/tableclipboard.js Outdated Show resolved Hide resolved
packages/ckeditor5-table/src/tableclipboard.js Outdated Show resolved Hide resolved
packages/ckeditor5-table/src/tableclipboard.js Outdated Show resolved Hide resolved
Comment on lines +190 to +195
const cropDimensions = {
startRow: 0,
startColumn: 0,
endRow: Math.min( selectionHeight - 1, pasteHeight - 1 ),
endColumn: Math.min( selectionWidth - 1, pasteWidth - 1 )
};
Copy link
Contributor

Choose a reason for hiding this comment

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

We have multiple different naming conventions for startRow/endRow vs firstRow/lastRow. I think we should stick to one notation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. Unfortunately we have both in some API points and I'm not sure which one is better.

packages/ckeditor5-table/src/tableclipboard.js Outdated Show resolved Hide resolved
@niegowski
Copy link
Contributor

In my last commit I addressed most issues. 

Still to discuss:

Also I didn't reviewed tests.

@FilipTokarski
Copy link
Member

FilipTokarski commented May 20, 2020

Please refer to my next comment 👇

If there are vertically and horizontally merged cells and they intersect each other on paste:
- first pasting case removes color from orange cell and splits it into 6 cells
- second case creates new column and moves 6th cell there

20_table1

@niegowski
Copy link
Contributor

If there are vertically and horizontally merged cells and they intersect each other on paste:

  • first pasting case removes color from orange cell and splits it into 6 cells
  • second case creates new column and moves 6th cell there

Did you checked it after latest fixes?

@FilipTokarski
Copy link
Member

Sorry, my bad 🤦 Splitting rows works fine now. Only the color issue still exists in some cases:

20_table2

@jodator
Copy link
Contributor Author

jodator commented May 20, 2020

Did you checked it after latest fixes?

Please - if you fix something - add tests. I'm debugging what's happening as there was no new tests and I'm thinking why this is working now.

Test are needed for changed logic and bug fixes. I'll add those test.

@FilipTokarski
Copy link
Member

FilipTokarski commented May 20, 2020

Steps to reproduce:

  1. Create a 2x2 table and some another bigger table
  2. Select all cells in 2x2 table and merge them into one
  3. Now there are two scenarios:
    • A ) select small table by holding shift and clicking the cell, copy and paste into bigger table
    • B ) select small table as a whole, copy and paste into bigger table

In scenario A pasted content is a single cell, whereas in B it remembers that initial table width was 2 columns. Not sure if this is incorrect, but it's a bit counterintuitive, because what you see when copying in both cases, is only a one-cell-table:

20_table3

Co-authored-by: Kuba Niegowski <1232187+niegowski@users.noreply.github.com>
@jodator
Copy link
Contributor Author

jodator commented May 20, 2020

Sorry, my bad facepalm Splitting rows works fine now. Only the color issue still exists in some cases:

Moved here: #7246.

@jodator
Copy link
Contributor Author

jodator commented May 20, 2020

Select all cells in 2x2 table and merge them into one

The bug is here :) Already reported: #6609. Would be nice to fix it eventually.

@niegowski niegowski merged commit 9531af4 into master May 20, 2020
@niegowski niegowski deleted the i/6122-table-paste-spans branch May 20, 2020 10:24
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.

Setting column as header should split it col-spaned cells Handling spanned cell in pasting scenarios
3 participants