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

Color button throws an error when activated on a content containing HTML comments #2296

Closed
jswiderski opened this issue Aug 8, 2018 · 2 comments
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:firefox The issue can only be reproduced in the Firefox browser. status:confirmed An issue confirmed by the development team. support An issue reported by a commercially licensed client. target:minor Any docs related issue that can be merged into a master or major branch. type:bug A bug.
Milestone

Comments

@jswiderski
Copy link
Contributor

jswiderski commented Aug 8, 2018

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Open https://codepen.io/mlewand/pen/eLpPvJ
  2. Open the console.
  3. Focus the editor.
  4. Select all the contents (ctrl/cmd+a).
  5. Click "Background Color" button in the toolbar.

Expected result

Panel gets opened.

Actual result

Panel gets opened but JS Error gets thrown as well.
Message: element.getComputedStyle is not a function
URI: /ckeditor/plugins/colorbutton/plugin.js
Line: 176
Code: currentColor = normalizeColor( element.getComputedStyle( type == 'back' ? 'background-color' : 'color' ) );

Other details

  • Browser: Edge, Chrome, Firefox (seems to work fine in IE11)
  • OS: Win10
  • CKEditor version: 4.10.0
  • Installed CKEditor plugins: There is a link to build.

NOTE: Problem doesn't occur if we add Paste From Word (PFW) plugin to the build. While having PFW may seem mandatory when pasting content from MS applications, I don't think JS error should be thrown.

@jswiderski jswiderski added type:bug A bug. status:confirmed An issue confirmed by the development team. support An issue reported by a commercially licensed client. browser:chrome The issue can only be reproduced in the Chrome browser. browser:firefox The issue can only be reproduced in the Firefox browser. browser:edge The issue can only be reproduced in the Edge (edgeHTML engine based) browser. labels Aug 8, 2018
@mlewand mlewand changed the title Pasting content from MS Outlook and then using Color button results in JS error Color button throws an error when activated on a content containing HTML comments Aug 27, 2018
@mlewand
Copy link
Contributor

mlewand commented Aug 27, 2018

The reason why is this happening is that Outlook leaves some comments in the pasted markup, and colorbutton plugin breaks when iterating over comments. This clearly should not break the plugin.

As such it is not colorbutton bug, not related really to the Outlook. I'll update the issue appropriately.

It didn't happen with PFW plugin as it cleared the HTlML comments.

@mlewand mlewand added this to the 4.10.1 milestone Aug 27, 2018
@mlewand mlewand added the target:minor Any docs related issue that can be merged into a master or major branch. label Aug 27, 2018
@mlewand
Copy link
Contributor

mlewand commented Aug 27, 2018

The issue has been merged into upcoming 4.10.1 release. I have created a codepen fork that hotlinks nightly preview of upcoming minor release, you can find it here: https://codepen.io/mlewand/pen/ZMWaYW

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:firefox The issue can only be reproduced in the Firefox browser. status:confirmed An issue confirmed by the development team. support An issue reported by a commercially licensed client. target:minor Any docs related issue that can be merged into a master or major branch. type:bug A bug.
Projects
None yet
Development

No branches or pull requests

2 participants