Added help writing HTML in the cave editing form. Made the HTML previews optional

This commit is contained in:
Martin Green
2022-06-26 21:29:46 +01:00
parent 4e5d8d1d76
commit 47d1662033
6 changed files with 54 additions and 22 deletions

View File

@@ -134,10 +134,10 @@ class NewWebImageForm(forms.Form):
class HTMLarea(forms.Textarea):
template_name = "widgets/HTMLarea.html"
def __init__(self, *args, **kwargs):
self.iframeattrs = kwargs.pop('iframeattrs')
self.preview = kwargs.pop('preview', False)
super(forms.Textarea, self).__init__(*args, **kwargs)
def get_context(self, name, value, attrs):
c = super(forms.Textarea, self).get_context(name, value, attrs)
c["iframe"] = {"attrs": self.iframeattrs}
c["preview"] = self.preview
return c