When I make a new page with a Repeater that contains an Image and:
Add two repeatable items in the admin UI and do not save the page
Click on the first item and then click "Choose Image" and select an image, the first item's image updates correctly.
Click on the second item and click it's "Choose Image" and select an image, the UI updates the first item's image and the second item's image remains in the "Choose Image" state.
Expected interaction:
Add two repeatable items in the admin UI and do not save the page
Click on the first item and then click "Choose Image" and select an image, the first item's image updates correctly.
Click on the second item and click it's "Choose Image" and select an image, the second item's image updates correctly.
In looking through the code, this piece of JS basically copies a block of HTML and does a RegExp on it to give a new ID to the fresh item wherever that ID appears, then the munged HTML gets appended into the DOM.
It seems like, however, that in the nested HTML structure, we see that the media picker/Image area of the HTML contains a different ID, which means that it will not get replaced with the RegExp. So, every media_picker in every new item in the Repeater UI has the same ID. Example, below, we can see the original ID is 70309351618500 and that will get regexp replaced everywhere. However, notice that the media_picker ID is 70309353738060 and this will therefore not get RegExp replaced.
If I edit the HTML in the browser's Inspector and make the media_picker ID match the original, the UI works as intended. I haven't traced through the code enough to figure out why the media_picker's ID is different than the main form's object ID... if anyone has an quick ideas or pointers, please comment.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
When I make a new page with a Repeater that contains an Image and:
Expected interaction:
In looking through the code, this piece of JS basically copies a block of HTML and does a RegExp on it to give a new ID to the fresh item wherever that ID appears, then the munged HTML gets appended into the DOM.
https://github.com/SpinaCMS/Spina/blob/b328be6337ab15ee39758f9ec6f7c1158b9cba0e/app/assets/javascripts/spina/admin/pages.coffee.erb#L20
It seems like, however, that in the nested HTML structure, we see that the media picker/Image area of the HTML contains a different ID, which means that it will not get replaced with the RegExp. So, every media_picker in every new item in the Repeater UI has the same ID. Example, below, we can see the original ID is 70309351618500 and that will get regexp replaced everywhere. However, notice that the media_picker ID is 70309353738060 and this will therefore not get RegExp replaced.
If I edit the HTML in the browser's Inspector and make the media_picker ID match the original, the UI works as intended. I haven't traced through the code enough to figure out why the media_picker's ID is different than the main form's object ID... if anyone has an quick ideas or pointers, please comment.