1. 安裝
- pip install flask-ckeditor
複製代碼 2.初始化 xxx.py
- from flask_ckeditor import CKEditor, CKEditorField
- app = Flask(__name__)
- ckeditor = CKEditor(app)
複製代碼
3. template 模板檔案 如 index.html
- <body>
- ...
- <textarea class="ckeditor" cols="40" id="editor1" name="content" rows="10">{{company.content}}</textarea>
- {{ ckeditor.load() }}
- </body>
複製代碼
展示畫面:
Flask render_template 崁入 Ckeditor 編輯器
這時出現 "CKEditor 4.22.1 version is not secure"的提示訊息
在該模板html下加入代碼,即可關閉此訊息
- <style>
- .cke_notifications_area { display: none; }
- </style>
複製代碼
Flask render_template 崁入 Ckeditor 編輯器
參考文章
https://flask-ckeditor.readthedo ... c.html#installation
https://freepythonsourcecode.com/post/78 |