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

Saving images when using inline blocks causes JS errors. #1063

Open
swytch opened this issue Jun 12, 2023 · 2 comments
Open

Saving images when using inline blocks causes JS errors. #1063

swytch opened this issue Jun 12, 2023 · 2 comments

Comments

@swytch
Copy link

swytch commented Jun 12, 2023

Adding a new image / updating an image, fires a POST to a missing url and then errors in javascript. Same repo to replicate here : https://github.com/swytch/bugs.

This doesn't inhibit saving the block.

However using the nested block in the same repo, and adding an image inside will stop the image from saving. Uncaught SyntaxError: Unexpected token '<', " - which looks like it's returning the HTML for the editform instead of JSON. I think these are related, so I'm sticking both issues in here.

@GuySartorelli
Copy link
Member

Adding a new image / updating an image, fires a POST to a missing url and then errors in javascript

I can't reproduce this. Please add a series of explicit step-by-step instructions for reproducing this.

using the nested block in the same repo, and adding an image inside will stop the image from saving. Uncaught SyntaxError: Unexpected token '<', "

I can't reproduce this either. Please add a second set of step-by-step instructions for reproducing this one.

@baukezwaan
Copy link

baukezwaan commented Oct 11, 2024

We are experiencing probably the same issue. Maybe we can shed some light on how to reproduce this.

First some context / findings:

  • we are using Elemental 5.2.3 and SS 5.2.12
  • we are using Elemental in BlogPosts, so the ElementalArea is loaded not in Pages but Blog (admin/news/)
  • if we edit the same page in the pages section, the are no js-errors and the page can be saved without problems
    • so instead of /admin/news/SilverStripe-Blog-Model-BlogPost/EditForm/field/SilverStripe-Blog-Model-BlogPost/item/659/edit/
    • use the same ID in a different pages-section: /admin/pages/edit/show/659/
  • using inlineEditable solves the problem also

Reproduction steps

  • set the DNADesign\Elemental\Extensions\ElementalPageExtension on the BlogPost pagetype
  • create an Element with a text and image
  • in the CMS, create a new blogpost and add the text-image element
  • add an image and some text, save the page
  • observe the console error Uncaught SyntaxError: Unexpected token '<', "
    • the expected JSON is indeed no json, but the HTML of the form.
    • this is caused by the URL returning HTML instead of JSON /admin/news/SilverStripe-Blog-Model-BlogPost/EditForm/field/SilverStripe-Blog-Model-BlogPost/item/659/ItemEditForm/

Maybe the screencast makes it a little better to understand. The first part is editing in the Blog-section, the second part in the Pages-section (yet it is the same blogpost / page):

Screencast-Elemental-Bug.mp4

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

No branches or pull requests

3 participants