TinyMCE editor extension for WTForms
1. Installation
Under your project environment run:
$ pip install wtf-tinymce
2. Configuring
2.1. Initializing module
Under your application initialization (e.g. app = Flask(__name__)) add module import and initialization:
from wtf_tinymce import wtf_tinymce wtf_tinymce.init_app(app)
2.2. Adding template
In your create or edit templates (or custom templates with wtforms) add import:
{% import 'wtf_tinymce/editor.html' as tinymce with context %}
and under your site footer block add template initialization like:
{% block tail %}
{{ super() }}
{{ tinymce.init_wtf_tinymce(default_content_css='css/tinymce.css') }}
{% endblock %}
Note: default_content_css is optional parameter with relative path under project static folder to your custom stylesheet for editor content.
3. Usage
from wtf_tinymce.forms.fields import TinyMceField
class MyForm(Form):
text = TinyMceField(
'My WTF TinyMCE Field label',
tinymce_options={'toolbar': 'bold italic | link | code'}
)
To optional parameter tinymce_options you can add any TinyMCE options (see official documentation https://www.tinymce.com/docs/configure/ for details.
Metadata
Release files for wtf-tinymce 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wtf-tinymce-0.1.4.tar.gz | 450.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wtf_tinymce-0.1.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 971.0 kB
Release files / wtf-tinymce-0.1.4.tar.gz
| Download URL | wtf-tinymce-0.1.4.tar.gz |
|---|---|
| Size | 450.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0875bdec368c67c2e6d1604b151f9df656ad6b4df13b062a539471db242747e2
|
|
BLAKE2b-256 checksum How to use checksums |
937b1d5447d935d86e960dfa687a4b130df03f9f2e4c10bda5256287c8ed173d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.2
|
Release files / wtf_tinymce-0.1.4-py2.py3-none-any.whl
| Download URL | wtf_tinymce-0.1.4-py2.py3-none-any.whl |
|---|---|
| Size | 520.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
4c02f8cb33d77740b72bcc27fead6f1fa0f959f891932d746df2af50006adffd
|
|
BLAKE2b-256 checksum How to use checksums |
082f07bc85be1425ccbddfa6b59ae626380ecff7e3175596be0618ea92eb2017
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.2
|