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

Quill Image Resize not working in QuillForm QUILL_CONFIGS #45

Open hert22 opened 3 years ago

hert22 commented 3 years ago

Hey, so I need to be able to adjust the size of images in the quill editor. I can successfully achieve this by having the following code in a script tag in my HTML and then calling it...

``

However, I'm using the QuillForm and QuillFieldForm so I can save them to a database which means in order to customize my toolbar I need to write the following code in my settings.py under the title QUILL_CONFIGS...

QUILL_CONFIGS = { 'default': { 'theme': 'snow', 'modules': { 'syntax': True, 'imageResize': { }, 'toolbar': [ [ {'font': []}, {'header': []}, {'align': []}, 'bold', 'italic', 'underline', 'strike', 'blockquote', {'color': []}, {'background': []}, ], ['code-block', 'link'], ['clean'], ['link', 'image'], ], } } }

The problem is that the resizing no longer works in the QUILL_CONFIGS.

I need help seeing if there is a way I can still use QuillForm and QuillFieldForm AND have the ability to resize images. Is this even the best way? Any help is much apreciated.

hert22 commented 3 years ago

The QUILL_CONFIG should be formatted like this...

QUILL_CONFIGS = { 'default': { 'theme': 'snow', 'modules': {

'syntax': True,

        'imageResize': True,
        'toolbar': [
            [
                {'font': []},
                {'header': []},
                {'align': []},
                'bold', 'italic', 'underline', 'strike', 'blockquote',
                {'color': []},
                {'background': []},
            ],
            ['code-block', 'link'],
            ['clean'],
            ['link', 'image'],
            ['imageResize'],
        ],
    }
}

}

I don't know why it changed