Skip to main content

FlaskでQuillリッチテキストエディタを簡単に使える拡張

Project description

Flask-Quill

Flask アプリで Quill リッチテキストエディタを簡単に使える拡張です。

インストール

pip install flask_quill

使い方

  1. Flask アプリに拡張を登録(Bootstrap5 も利用する場合)
from flask import Flask, render_template
from flask_quill import Quill
from flask_bootstrap import Bootstrap5

app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret'
quill = Quill(app)
bootstrap5 = Bootstrap5(app)
  1. WTForms でフィールドを定義
from flask_wtf import FlaskForm
from wtforms import SubmitField
from wtforms.validators import DataRequired
from flask_quill.fields import QuillField

class PostForm(FlaskForm):
    body = QuillField('本文', validators=[DataRequired()])
    submit = SubmitField('送信')
  1. テンプレートでエディタを表示(Bootstrap5 の render_form を利用)
{{ quill.load() }}
{{ quill.config(name='body') }}
{{ render_form(form, novalidate=True, button_map={"submit": "primary"}) }}
  • Bootstrap5 の render_form と組み合わせて使えます。
  • Quill エディタの内容は自動的に textarea に反映され、サーバーに送信されます。

ライセンス

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_quill-0.2.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_quill-0.2.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file flask_quill-0.2.0.tar.gz.

File metadata

  • Download URL: flask_quill-0.2.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for flask_quill-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7c7ead2277104325f2134db3221d3924cd27948ac58fe6694a5b56ea4aef9f68
MD5 a57588aa235d124b6856d6129100676c
BLAKE2b-256 2dc992ebe4d3b2f9b87dd2b0cdcb477aa6c5a78648c007cacffe33302f83511b

See more details on using hashes here.

File details

Details for the file flask_quill-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: flask_quill-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for flask_quill-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a6196d221574e3025cd3d4526abd131bd3f55b97e3181d994e4472d5b2a3b00b
MD5 12b1fe879a4a28f700e662c20845ad4b
BLAKE2b-256 d3d9285ceba74adf9da7829de3f38a6173477edc81bbb3ecd9ca5c795fba208e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page