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

Odd behaviour when we got 2 (or more) images on the editor #77

Open
VangelisP opened this issue Aug 29, 2023 · 1 comment
Open

Odd behaviour when we got 2 (or more) images on the editor #77

VangelisP opened this issue Aug 29, 2023 · 1 comment

Comments

@VangelisP
Copy link

This is what happened, at least in my case (Summernote v0.8.20) :

  • Added 2 images
  • Added a link URL on the first image
  • Double clicked the image attributes on the 2nd image. The Link URL is prepopulated with the URL of the first image. At this point, the actual HTML code is not being altered. However, If i accidentally press OK on the dialog form, the HTML code will be updated with the same Link URL of the first image.

My belief is that the plugin reads the imgLink data (thus the URL and the rest of the variables) of the first image it can find and populates the dialog form without checking which image it should be reading.

Here is a short video of it. The first image had the Link URL https://google.com while the second image had that property empty.

summernote-image-attr-plugin.mp4

Upon saving the second image's dialog form, code was being updated (it shouldn't have the URL at all!)

@VangelisP
Copy link
Author

VangelisP commented Aug 29, 2023

Mm, this is odd, I did manage to find the issue (or so I think!)

The lines that fill in the values here: https://github.com/DiemenDesign/summernote-image-attributes/blob/master/summernote-image-attributes.js#L298-L303

should have .val('') instead of .val() ,
for example: $linkHref.val(); should become $linkHref.val('');

Do we actually trying to get the values on those lines or set them as empty ? Maybe I misunderstood.

Doing that, I've managed to get the plugin to behave properly on multiple images. Can someone confirm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant