symposion_app/pinaxcon/widgets.py

18 lines
472 B
Python
Raw Normal View History

from django import forms
2017-03-05 07:34:15 +00:00
class AceMarkdownEditor(forms.Textarea):
def render(self, name, value, attrs):
original = super(AceMarkdownEditor, self).render(name, value, attrs)
ret = '''
%s
<script>
window.addEventListener("load", () => {
editor = loadEditor("%s");
}, 0);
</script>
''' % (original, attrs["id"])
return ret