LeeHanYeong / django-quill-editor

django-quill-editor makes Quill.js easy to use on Django Forms and admin sites
https://django-quill-editor.readthedocs.io
MIT License
202 stars 49 forks source link

Add support for Django 3.2, support for Work inside Inlines and minnor changes #48

Closed joepreludian closed 3 years ago

joepreludian commented 3 years ago

Hello Friends,

Long story

First of all, thank you for the amazing library. Reading a previous PR #30 I reallized that the project wasn't working well with Inlines. I'm creating a tool that needs to create multiple WYSIWYG inside Inlines. I noticed that @michaldyczko created a different version which supports Inlines.

I cloned his repo and tried to test myself on my brand new Django 3.2. Somehow didn't worked as I expected. So I though to pick his work in progress and try to make it work on latest version of Django. So I did it. Amongst the changes, I did the following changes, as being described below:

Strategy to get working the Editor into the Inlines;

Since Django makes use of DOM clonning, it was difficult to enable the quill Editor. So I created a strategy that makes this maneuver possible. Below there is the basic idea:

  1. First, I marked the __prefix__ object as a cloned one;
  2. I used the Django inline events in order to detect when you add a new inline, right after the js clone procedure;
  3. I pick up the container and enable it using the Wrapper function you guys developed;
  4. That's it. =)

Please feel free to change whatever you guys find necessary. I hope that my change can be useful. Thanks again and have a great weekend!

joepreludian commented 3 years ago

@LeeHanYeong and @michaldyczko Feel free to test those changes into a running example under my Fork;

  1. Just clone it;
  2. Run make test for performing the tests under testproject;
  3. If you would like to test by yourselves my admin changes, please do the following steps:
    $ cd testproject;
    $ poetry install;
    $ poetry run python manage.py migrate;
    $ poetry run python manage.py createsuperuser;
    $ poetry run python manage.py runserver;

Point your browser to: http://localhost:8000/admin/post/quillmaster/;

There is two types of Inlines: Stacket and Tabbed ones.

Have fun!

joepreludian commented 3 years ago

Hey @LeeHanYeong Could you explain me why you're still using setup.py rather than working with poetry? I would like to understand better... So I can change my PR in order to be compatible with your code. Thank you!