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

Widgets can not be properly pasted into a table cell #520

Closed
rathax opened this issue Jun 18, 2017 · 3 comments
Closed

Widgets can not be properly pasted into a table cell #520

rathax opened this issue Jun 18, 2017 · 3 comments
Assignees
Labels
plugin:tableselection The plugin which probably causes the issue. plugin:widget The plugin which probably causes the issue. regression This issue is a regression. status:confirmed An issue confirmed by the development team. type:bug A bug.
Milestone

Comments

@rathax
Copy link

rathax commented Jun 18, 2017

Are you reporting a feature or a bug?

bug

https://codepen.io/anon/pen/PjWVZW (inline)
http://sdk.ckeditor.com/samples/captionedimage.html (replace)

reproduction steps

  1. copy image (crtl + c)
  2. paste into a table cell
  3. reapeat

Expected result

properly pasted images which can be resized, selected and deleted with DEL / ctrl + x

Actual result

images are missing the drag and drop handler + resize handler
and alot of other unexpected behaviour like unable to write anything inside the table.

Other details

  • Browser: chrome
  • OS: win 10
  • CKEditor version: 4.7
  • Installed CKEditor plugins: enhanced image plugin
@wojtekw92 wojtekw92 added status:confirmed An issue confirmed by the development team. type:bug A bug. labels Jun 20, 2017
@wojtekw92 wojtekw92 self-assigned this Jun 20, 2017
@wojtekw92 wojtekw92 added the regression This issue is a regression. label Jun 22, 2017
@wojtekw92
Copy link
Contributor

regression is in version 4.7.0

@mlewand mlewand added this to the 4.7.2 milestone Jun 23, 2017
@wojtekw92
Copy link
Contributor

The problem occurs in tableselection plugin. This plugin has own afterPaste event handler. When we are pasting widget, this part of handler will work:

// 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.
if ( tmpContainer.getChildCount() > 1 || !pastedTable ) {
    selectedCells[ 0 ].setHtml( tmpContainer.getHtml() );
    editor.fire( 'saveSnapshot' );
    return;
}

There are two problems:

  1. Because of return we will never propagate afterPaste event
  2. We are never making initOn on widget. Widget is listening i.a. for afterInsertHtml and initialise himself on this event.

Solutions:

  1. We should propagate event in all cases.
  2. Maybe we should use insertHtmlIntoRange instead of setHtml?

@wojtekw92 wojtekw92 removed their assignment Jun 23, 2017
@wojtekw92
Copy link
Contributor

unit tests in branch: https://github.com/ckeditor/ckeditor-dev/tree/t/520

@mlewand mlewand added the plugin:tableselection The plugin which probably causes the issue. label Jun 24, 2017
@Comandeer Comandeer self-assigned this Jul 24, 2017
@mlewand mlewand added the plugin:widget The plugin which probably causes the issue. label Aug 8, 2017
@mlewand mlewand changed the title pasting images into a table cell causing issues (enhanced image) Widgets can not be properly pasted into a table cell Aug 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin:tableselection The plugin which probably causes the issue. plugin:widget The plugin which probably causes the issue. regression This issue is a regression. status:confirmed An issue confirmed by the development team. type:bug A bug.
Projects
None yet
Development

No branches or pull requests

4 participants