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

Dropped widget is not marked as focused on 'selectionChange' after drop #1462

Open
f1ames opened this issue Jan 16, 2018 · 1 comment
Open
Labels
browser:chrome The issue can only be reproduced in the Chrome browser. browser:edge The issue can only be reproduced in the Edge (edgeHTML engine based) browser. browser:ie The issue can only be reproduced in the Internet Explorer browser. browser:opera The issue can only be reproduced in the Opera browser. browser:safari The issue can only be reproduced in the Safari browser. plugin:widget The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. type:bug A bug.
Milestone

Comments

@f1ames
Copy link
Contributor

f1ames commented Jan 16, 2018

Are you reporting a feature request or a bug?

Bug

Check if the issue is already reported

Related issue probably: https://dev.ckeditor.com/ticket/14427

Provide detailed reproduction steps (if any)

  1. Go to https://sdk.ckeditor.com/samples/captionedimage.html (or any sample with widgets).
  2. Paste the following code in the browser dev console (listens to selectionChange event and logs focused widget):
var editor = CKEDITOR.instances.editor1; editor.on( 'selectionChange', function() { console.log( 'focused_widget', editor.widgets.focused ); }, null, null, 9999 );
  1. Drag and drop any widget inside editor.

Expected result

After dropping the widget, when selectionChange is fired widget repository contains focused widget. If you look at SDK it even gives such code sample for CKEDITOR.editor.widgets.focused.

Actual result

There is no focused widget in widget repository.

Other details

  • Browser: All (except FF)
  • OS: All
  • CKEditor version: 4.5.0 (before 4.5.0 selectionChange event was not fired on widget drop)
  • Installed CKEditor plugins: widget (tested with image2 and embed widgets)
@f1ames f1ames added type:bug A bug. status:confirmed An issue confirmed by the development team. browser:chrome The issue can only be reproduced in the Chrome browser. browser:safari The issue can only be reproduced in the Safari browser. browser:opera The issue can only be reproduced in the Opera browser. browser:edge The issue can only be reproduced in the Edge (edgeHTML engine based) browser. browser:ie The issue can only be reproduced in the Internet Explorer browser. plugin:widget The plugin which probably causes the issue. labels Jan 16, 2018
@mlewand mlewand added this to the Backlog milestone Jan 16, 2018
@mlewand mlewand added the target:minor Any docs related issue that can be merged into a master or major branch. label Jan 16, 2018
@f1ames f1ames self-assigned this Jan 16, 2018
@f1ames
Copy link
Contributor Author

f1ames commented Jan 17, 2018

To give a little more perspective on this issue, it is caused by the fact that dropped/pasted widget initialization is executed on selectionCheck (which is fired right before selectionCheck). While the widget html is already there (but not perceived as a widget yet), the widget instance (based on inserted html) is initiated after so it is not available on selectionChange.

This causes some issues:

  • listening on selectionChange and checking editor.widgets.focused will not work for dropping widgets,
  • commands are refreshed on selectionChange so while widget is dropped the widget related commands will be refreshed with selection not containing widget thus having invalid state (visible in e.g. balloontoolbar).

@f1ames f1ames removed their assignment Apr 26, 2019
@f1ames f1ames removed the target:minor Any docs related issue that can be merged into a master or major branch. label Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser:chrome The issue can only be reproduced in the Chrome browser. browser:edge The issue can only be reproduced in the Edge (edgeHTML engine based) browser. browser:ie The issue can only be reproduced in the Internet Explorer browser. browser:opera The issue can only be reproduced in the Opera browser. browser:safari The issue can only be reproduced in the Safari browser. plugin:widget The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. type:bug A bug.
Projects
None yet
Development

No branches or pull requests

2 participants