-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Pasting image widget into table cell #694
Conversation
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.
I've pushed fixes for failing tests (simple change 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.
Here are few notes I made during the review. I went with adding my proposals in a PR based on, and targeted at this PR.
plugins/tableselection/plugin.js
Outdated
if ( tmpContainer.getChildCount() > 1 || !pastedTable ) { | ||
selectedCells[ 0 ].setHtml( tmpContainer.getHtml() ); | ||
evt.data.dataValue = tmpContainer.getHtml(); |
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.
I don't see a reason for using tmpContainer.getHtml()
since evt.data.dataValue
is already set, and actually we don't want to mess up evt.data.dataValue
if possible, since it's about to be pasted into the table cell.
plugins/tableselection/plugin.js
Outdated
|
||
// Handle mixed content (if the table is not the only child in the tmpContainer, we | ||
// are probably dealing with mixed content). We handle also non-table content here. | ||
// We just collapse selection to the first selected cell and pass non-table/mixed | ||
// content to other paste handlers (#520). |
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.
Seems to me that this comment is pretty much oudated. How about:
// In case of mixed content or non table content just insert it to a first cell, erasing the others.
?
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.
Actually this paste handler does not perform paste in such case. It just selects the first cell and ends its job – so I don't see my comment as outdated. Maybe it could be a little bit more detailed.
plugins/tableselection/plugin.js
Outdated
// content (#520). | ||
editor.once( 'afterPaste', function() { | ||
var toSelect = cellToPaste ? | ||
getCellsBetween( new CKEDITOR.dom.element( pastedTableMap[ 0 ][ 0 ] ), cellToPaste ) : |
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 a critical thing but pastedTableMap
is used before it's defined, we should avoid this kind of code.
Ok, I've merged |
@f1ames please check whether your issues have been addressed. |
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.
As for my requests, I see all tests are green now.
@mlewand should I merge it, or you will do the honors? |
Merging now :) |
…o selection is given. This will make the API more consistent. Covered change with unit tests.
This caused a bug that if pasted table was bigger than the current selection, the output would be missing some cells. Covered the change with unit test.
…tomized by tableselection. That caused user to be unable to paste a nested table into an existing table.
…rtColumn functions.
…n was present table would not be pasted and merged correctly.
Sry I was out, please do the honors 🙂 |
Looks like this PR also fixed #460 🎉. |
What is the purpose of this pull request?
Bug fix
Does your PR contain necessary tests?
All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.
This PR contains
What changes did you make?
afterPaste
handler.closes #520, #460.