Source code for editor_js.widgets

import json
from django import forms
from django.urls import reverse

[docs] class EditorJsIframeWidget(forms.Widget): template_name = 'editor_js/admin/widgets/editor_js_widget.html'
[docs] def get_context(self, name, value, attrs): context = super().get_context(name, value, attrs) config = context['widget']['attrs'].pop('config', {}) context['widget']['config_json'] = json.dumps(config) context['widget']['iframe_src'] = reverse('editor_js_iframe') return context
[docs] class Media: # iframe resizer js = ( # iframe resizer 'https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.9/iframeResizer.min.js', )