Aleksi44 / wagtailsvg

Wagtail + SVG
https://pypi.org/project/wagtailsvg/
GNU General Public License v3.0
35 stars 24 forks source link

SvgChooserBlock doesn't show up preview svg image StreamField. #8

Open rafagarciac opened 3 years ago

rafagarciac commented 3 years ago

Hi @Aleksi44 !! I'm trying to implement this awesome package to the application with the following versions:

# requirements.txt
Django>3.1,<3.2
wagtail==2.10.2
wagtail-generic-chooser==0.1.1
# wagtailsvg==0.0.14 CUSTOM FORK

Because of wagtail version (2.10.2), I'm using a fork built-in project of this repository, in order to fix the migrations problems, change 0059_apply_collection_ordering to 0052_pagelogentry in 0001_initial.py migration file.

Everything works perfect until, I try to use SvgChooserBlock.

After integrate and build up the custom fork of wagtailsvg with version 0.0.14, I added the following StreamField to my custom page like that:

svg = StreamField([
        ('svg', SvgChooserBlock()),
    ], blank=True)

Now, the problems comes when I cannot previsualize the image inside block on StreamFieldPanel, it looks like this: Link image preview

Thank for your support. Cheers !

Aleksi44 commented 3 years ago

Hi @rafagarciac

Do you have javascript errors in the console? Can you test your project with this version:

pip install wagtailsvg==0.0.11

It is possible that the problem is related to #7 for wagtail 2.13 support.

rafagarciac commented 3 years ago

@Aleksi44 I don't have any JS errors in the console. Why would I change the wagtailsvg version to 0.0.11 since there isn't any change related to SvgChooserBlock or AdminSvgChooser which is the error where I'm getting from... 🤔 ??

The problem related to #7 is for wagtail 2.13, so I don't think is related because my Wagtail version is 2.10.2. Thanks for your quickly reply !

Aleksi44 commented 3 years ago

The SVG preview in Streamfield is handled differently in wagtail 2.13 than in previous versions.

wagtailsvg==0.0.14 uses the wagtail 2.13 implementation wagtailsvg==0.0.11 uses the implementation of older versions of wagtail

rafagarciac commented 3 years ago

I changed the wagtailsvg version from 0.0.14 to 0.0.11 and still does not work. It does not include usefull change to SvgChooserBlock or AdminSvgChooser from the version that I had. (0.0.14).

Do you think is it something related about wagtail version itself 2.10.2 ?

@Aleksi44 Any idea ? 🤔

Aleksi44 commented 3 years ago

I had the same problem when wagtail released version 2.13, you can see it here.

Some hints that might help you :

If you still can't find it, I can help you if you create a public repository to reproduce the bug.

rafagarciac commented 3 years ago

Hi @Aleksi44, I've already created a WagtailSVG Test Project, to run this project in isolation and it works perfectly !

I also I've detected that the bug I'm getting in the is related with the following wagtail package: wagtail-react-streamfield. https://github.com/wagtail/wagtail-react-streamfield and isn't related with wagtailsvg itself. 👌🏼

For the other hand, I've updated the WagtailSVG Test Project with the package wagtail-react-streamfield, in order to check what is causing this problem and try to fix it as soon as possible.

Finally, I found this related issue https://github.com/wagtail/wagtail-react-streamfield/issues/26 on wagtail-react-streamfield package.

Thanks again.

Aleksi44 commented 3 years ago

I'm glad you found the reason :) I'll leave the ticket open if it helps anyone.