-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Django field for Quill input #655
Conversation
…into quill-widget
… validation, added tests
@shapiromatron I added two more commits that I believe are helpful, but can be safely reverted if you disagree.
|
…dget # Conflicts: # hawc/apps/lit/templates/lit/search_copy_selector.html # hawc/apps/riskofbias/forms.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really well done! Glad to merge this one in; sorry it took so long...
@@ -95,6 +92,9 @@ def helper(self): | |||
|
|||
|
|||
class ImportForm(SearchForm): | |||
class Meta(SearchForm.Meta): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, that's a nice trick
@@ -107,6 +107,9 @@ | |||
<script type="text/javascript" src="{% static 'vendor/jqueryui/1.10.3/jquery-ui.min.js' %}"></script> | |||
<script type="text/javascript" src="{% static 'vendor/htmx/1.6.1/htmx.min.js' %}"></script> | |||
{% render_bundle 'main' %} | |||
{% if form %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is very nice. we do have to watch out to make sure that we still need to add form.media
on any htmx stuff, but that makes sense conceptually so i like this pattern
@@ -98,4 +99,7 @@ export default function() { | |||
q.stc.enableModals(); | |||
} | |||
}); | |||
|
|||
// restore original focus | |||
$(focusedItem).focus(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi; I added this, now I think quill doesn't mess with which form field is focused on anymore
".who.int", | ||
"sciencedirect.com", | ||
"doi.org", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also added doi.org as a valid URL
QuillField / QuillWidget
Added a new
QuillField
field andQuillWidget
widget for use in Django forms. This removes the need to manually quillify anytextarea
s where we want HTML content, and allows for a centralized place to clean and validate incoming HTML data.Cleaning/validating
Cleaning is now performed on passed in HTML to resolve any rendering issues and to make sure any content doesn't look out of place within the app.
Validation is done on links, since this is something that can't be handled automatically through cleaning; if a link is given that doesn't fall within our constraints, then a validation error is given:
Notes:
Bugs: