helloflask / flask-ckeditor

CKEditor integration for Flask, including image upload, code syntax highlight, and more.
https://flask-ckeditor.readthedocs.io
MIT License
197 stars 67 forks source link

Code Snippet plugin not working in rendered HTML #78

Closed skwzrd closed 6 months ago

skwzrd commented 6 months ago

The code snippet plugin works in the WTForm field's CKEditor, but not the saved and rendered HTML. atelier-dune.dark.css is retrieved from the server, but it doesn't do anything. There is no language-python CSS class in the rendered HTML.

Configs,

CKEDITOR_FILE_UPLOADER = "upload"
CKEDITOR_ENABLE_CODESNIPPET = True
CKEDITOR_CODE_THEME = "atelier-dune.dark"
CKEDITOR_PKG_TYPE = 'standard'
CKEDITOR_SERVE_LOCAL = True # Local means my own server, not a CDN

Templates with a form - only appears on pages with a CKEditor in a form,

<script src="{{ url_for('static', filename='ckeditor/standard/ckeditor.js') }}"></script>
{{ ckeditor.config(name='text', file_uploader=url_for('bp_post.upload')) }}

Template layout - appears on every rendered HTML page since any page could contain a code snippet,

// in HTML <head> node
<link href="{{ url_for('static', filename='ckeditor/standard/plugins/codesnippet/lib/highlight/styles/atelier-dune.dark.css') }}" rel="stylesheet">

The WTForm field,

Screenshot from 2024-01-06 01-46-39

The rendered HTML,

Screenshot from 2024-01-06 01-47-07