processwire / processwire-requests

ProcessWire feature requests.
40 stars 0 forks source link

Image caption (inside ckeditor) stays in place when image location changes #348

Open apeisa opened 6 years ago

apeisa commented 6 years ago

Short description of the issue

When you add image inside ckeditor, you can add visible image caption that is used inside

in markup. When you later go and reposition image (using drag and drop for example), caption doesn't follow but stays on original position.

Expected behavior

I would expect figcaption to follow wherever image is dragged into a new position.

Actual behavior

Figcaption doesn't follow into a new position when image is dragged inside ckeditor.

Optional: Suggestion for a possible fix

I think this might help: https://docs.ckeditor.com/ckeditor4/latest/guide/dev_captionedimage.html

Steps to reproduce the issue

  1. Edit page where you have ckeditor-field with images possible
  2. Add image inside that ckeditor field. Edit image, check "caption" and add some text
  3. Drag image into a new position

Setup/Environment

  • ProcessWire version: 3.0.96
  • (Optional) PHP version: 7.0
ryancramerdesign commented 6 years ago

As far as I know, images with captions have to be moved like a text block in CKE. Meaning, you'd click the image, then expand the selection to include the figure by clicking "figure" in the selection status bar at the bottom of the editor. Then cut and paste into the new location. This seems to work in testing here.

I agree it would be nice to just drag and drop the image and have it drag along the figure/caption with it, but I think the ability to drag multi-part elements like this is limited to CKE widgets. That's how that optional EnhancedImage plugin for CKE does it. But we aren't using widgets for our CKE plugins, and I don't think our image plugin can be redeveloped as a widget short of starting over with it. It's a lot more complicated to do that (EnhancedImage plugin is 1700+ lines of code vs. ours which is 350 lines of code). We'll have to rebuild our CKE plugins for CKEditor 5 anyway, so that'll probably be a good time for us to look into making figure/image/figcaption draggable together.

netcarver commented 5 years ago

@ryancramerdesign @apeisa Given the age of this issue and the dependency on CKE, should this issue be closed?

teppokoivula commented 5 years ago

Perhaps move this to requests repository?

I guess this is technically "working as it should" (and it's indeed a CKEditor thing), but this is also a definite pain point with our RTE and hopefully something we can dig into at some point.

Just for the record this is just one of various issues that the figure feature has: figcaption has also some layout issues, you can easily get "stuck" in it, and if a figure is the last element it's quite difficult to insert anything after it (etc.)

A bigger rewrite might indeed be a necessity in the future, though whether CKE5 specifically will ever make sense for us is a whole another story.