helloflask / flask-ckeditor

CKEditor integration for Flask, including image upload, code syntax highlight, and more.
https://flask-ckeditor.readthedocs.io
MIT License
197 stars 67 forks source link

Where does the CKEditor Bundle go? #79

Closed skwzrd closed 1 week ago

skwzrd commented 6 months ago

Where should the CKEditor standard bundle go? The only way I've gotten this Flask extension to work (without inserting my own \<script>s and \<link>s into HTML) is by editing the source code to

class CKEditor(object):
    def __init__(self, app=None):
        if app is not None:
            self.init_app(app)

    def init_app(self, app):
        blueprint = Blueprint(
            'ckeditor',
            __name__,
            static_folder='static',
            # static_url_path='/ckeditor' + app.static_url_path # removing this line
        )

and placing the standard bundle in /static/. i.e. /static/standard/ckeditor.js, static/standard/plugins/, etc.

I've tried placing the bundle in virtually every folder. What's really weird is, despite the bundle being present in a certain directory, the request for a resource will 404.

baron commented 6 months ago

Not sure this helps you but maybe it will help someone else but if you want to bundle your own ckeditor by adding more plugins then you need to load the ckeditor from static like this:

{{ ckeditor.load(custom_url=url_for('static', filename='ckeditor/ckeditor.js')) }}

but you also need to pack the assets yourself if you download the unoptimized version.

greyli commented 1 week ago

Fixed in the 1.0.0 version, please try to update it with:

pip install -U flask-ckeditor

Thanks!