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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_ckeditor_manager-0.1.42.tar.gz.
File metadata
- Download URL: flask_ckeditor_manager-0.1.42.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.9.6 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1c0231841fd6ab7ab414c2deafe64eff86d541980fb5721b2544307b461dae4
|
|
| MD5 |
17947e2c42db1c60b40d91d51162683f
|
|
| BLAKE2b-256 |
5c48d642c168585649991b9af63541243d3673b9e9d22e1ecc8400d06f3b0b10
|
File details
Details for the file flask_ckeditor_manager-0.1.42-py3-none-any.whl.
File metadata
- Download URL: flask_ckeditor_manager-0.1.42-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.9.6 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38b2151dda0aab4be2a6402db82a9e6ebbfd8fb8fdf1525f6fb560a7cd88e298
|
|
| MD5 |
1fe0dac67a398f313da725f512e1a0f3
|
|
| BLAKE2b-256 |
b4575a4f69f6bb4b402919a4b47dc11a3f68b1a43658f6ff5a5889eb5ece6b7a
|