DennisSuitters / summernote-image-attributes

Summernote plugin to edit image attributes
MIT License
89 stars 89 forks source link

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

Open VangelisP opened 1 year ago

VangelisP commented 1 year ago

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

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.

https://github.com/DiemenDesign/summernote-image-attributes/assets/14973113/33d7ed84-bee4-4ac3-b1cf-2f56a842c9a4

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

VangelisP commented 1 year ago

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?