ckeditor / ckeditor4

The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.
https://ckeditor.com/ckeditor-4
Other
5.79k stars 2.48k forks source link

Don't show image2 resize handler when you mouseover a widget thas has an image #3928

Open spacevoyager78 opened 4 years ago

spacevoyager78 commented 4 years ago

Type of report

Feature request

Provide description of the new feature

I'm not sure if it's a bug or it's by design, but if you use image2 plugin and you enter an image inside a widget, when you mouseover into the widget, the resize handler of the image is being shown without the mouse pointer being actually on top of the image. Is there a way to make the handler appear only when you're on top of the image just like the drag and drop handler does? I've made a jsfiddle to illustrate it: https://jsfiddle.net/4p86sdvy/ The smiley that's inside the simplebox widget shows its resize handler when you mouseover the widget.

spacevoyager78 commented 4 years ago

I've figured it out. Line 60 from https://github.com/ckeditor/ckeditor4/blob/major/plugins/image2/plugin.js is: '.cke_widget_wrapper:hover .cke_image_resizer,' + that lines affects the resize handler, but the problem is that it's a descendant selector, so if you are inside another widget, the widget already has class .cke_widget_wrapper, so when you hover on top of it, the resize handler of the nested image is shown. If you change it to a child selector like this: '.cke_widget_wrapper:hover > .cke_image_resizer,' + the resize handler is shown only when you hover on top of the image.

spacevoyager78 commented 4 years ago

Current status is that image resize handler of image2 plugin is shown if image is nested inside another widget and you hover on top of the outer widget: https://imgur.com/0l3cIRc If a developer commits the change I propose (child selector instead of descendant selector) the resize handler will be shown only when you hover on top of the inner image2 widget and not when you hover on top of the outer widget like this: https://imgur.com/mp382Bw What do you think?

Dumluregn commented 4 years ago

Hello! Thank you for bringing our attention to this. On one hand it's quite an edge case as in our codebase we don't use nested widgets anywhere and as you noticed resizer is working fine now so it's more a discretionary change than even a feature request. Still, it seems a little odd to me that drag handler and resizer are behaving differently (as drag handler has > selector already), so we could make it consistent and show and hide both simultaneously.

spacevoyager78 commented 4 years ago

Thank you! I'm looking forward to it, so as to not have to tweak it myself with every new version. BTW, in my second link with my corrected example, I had disabled the drag handler in the image2 addon, that's why it didn't appear when I hovered directly on top of the smiley.