Following the following tip for overriding flask-admin fields, I am trying to get the Ace syntax highlighter working.
https://flask-admin.readthedocs.io/en/latest/advanced/#wysiwig-text-fields
The idea is to get sql server syntax highlighting on the wtforms text area.
This attempt is not working, not sure what else to include in the extra js?
class ACETextAreaWidget(TextArea):
def __call__(self, field, **kwargs):
if kwargs.get('class'):
kwargs['class'] += ' ace'
else:
kwargs.setdefault('class', 'ace')
return super(ACETextAreaWidget, self).__call__(field, **kwargs)
class ACETextAreaField(TextAreaField):
widget = ACETextAreaWidget()
class ControlAdmin(sqla.ModelView):
#extra_js = ['//cdn.ckeditor.com/4.6.0/standard/ckeditor.js']
extra_js = ['https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.7/ace.js', 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.7/mode-sqlserver.js']
from Using ACE syntax highligher for Flask-Admin field override
No comments:
Post a Comment