A simple interface to use CKEditor5 with Flask
Project description
Flask-CKEditor-Manager
Flask-CKEditor-Manager (from now on FCKM) provides a simple interface to use CKEDitor5 javascript library with Flask. Greatly inspired by Flask-CKEditor
🚧 This package is under heavy development..
Installation
Install the extension with pip:
pip install flask-ckeditor-manager
Install with poetry:
poetry add flask-ckeditor-manager
Configuration
This are some of the settings available
Config | Description | Type | Default |
---|---|---|---|
CKEDITOR_LICENSE_KEY | CKEditor License key | str | None |
CKEDITOR_EDITOR_TYPE | Editor package to be displayed | str | "classic" |
CKEDITOR_LOCAL_PATH | If custom package is present, this is the path in the static folder. | str | None |
CKEDITOR_LANGUAGE | The lengague of the editor. | str | None |
CKEDITOR_ENABLE_CSRF | Enable CSRF protection in SimpleUpload adapter | bool | None |
CKEDITOR_UPLOAD_ENDPOINT | SimpleUpload adapter endpoint. Must follow the CKEditor5 estipulations. Read more | str | None |
CKEDITOR_WATCHDOG | If watchdog plugin installed change this value to True to enable its rendering | bool | None |
Usage
Once installed the FCKM is easy to use. Let's walk through setting up a basic application. Also please note that this is a very basic guide: we will be taking shortcuts here that you should never take in a real application.
To begin we'll set up a Flask app:
from flask import Flask
app = Flask(__name__)
Setting up extension
FCM works via a CKEditorManager object. To kick things off, we'll set up the ckeditor_manager
by instantiating it and telling it about our Flask app:
from flask_ckeditor import CKEditorManager
ckeditor_manager = CKEditorManager()
ckeditor_manager.init_app(app)
Load resources
Once the extension is set up, this will make available the ckeditor
object into the templates context so you could load the javascript package easily, like this.
<head>
{{ ckeditor.load() }}
</head>
Rendering the editor
Once created you can pass the Chart
object to render_template and use it likewise.
<!-- ckeditor.load() must be called before this line -->
<textarea id="editor"></textarea>
<div class="my-classes">{{ ckeditor.config('editor') }}</div>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for flask_ckeditor_manager-0.1.35.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd9d61511339e0e694535d84eaa1090e67a0eaedfdc841203dac58dce32c6bd7 |
|
MD5 | 94cdd81d99994843d0528f4bea397bd5 |
|
BLAKE2b-256 | a3051df63ebb0b2b54305a8d8a99d29d6861c116e902cc888c0fe6d3fa6ca9fa |
Hashes for flask_ckeditor_manager-0.1.35-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48344c2b9c797b5e7158026a42df94720b621c6a5cd760dd67089ecac9966647 |
|
MD5 | a5c5dd3c998ae7417d9902eda6a937ab |
|
BLAKE2b-256 | 4a51025511415c005cfd73b11d398ef0382cbbe2a5c43993b1614db65c2794f3 |