0001-misc-avoid-javascript-in-MiniRichTextWidget-template.patch
tests/test_widgets.py | ||
---|---|---|
17 | 17 |
FileWithPreviewWidget, |
18 | 18 |
Form, |
19 | 19 |
MapWidget, |
20 |
MiniRichTextWidget, |
|
20 | 21 |
OptGroup, |
21 | 22 |
PasswordEntryWidget, |
22 | 23 |
SingleSelectHintWidget, |
... | ... | |
515 | 516 |
assert widget.parse() == '<p><img src="/test/"></p>' |
516 | 517 | |
517 | 518 | |
519 |
def test_mini_rich_text_widget(): |
|
520 |
widget = MiniRichTextWidget('test') |
|
521 |
form = MockHtmlForm(widget) |
|
522 |
assert 'data-godo-schema="basic"' in form.as_html |
|
523 | ||
524 | ||
518 | 525 |
def test_select_hint_widget(): |
519 | 526 |
widget = SingleSelectHintWidget( |
520 | 527 |
'test', options=[('apple', 'Apple', 'apple'), ('pear', 'Pear', 'pear'), ('peach', 'Peach', 'peach')] |
wcs/qommon/templates/qommon/forms/widgets/mini-rich-text.html | ||
---|---|---|
2 | 2 |
{% block widget-control %} |
3 | 3 |
<textarea style="width: 100%" id="form_{{widget.get_name_for_id}}" name="{{widget.name}}" |
4 | 4 |
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}" {% endfor %} |
5 |
>{{widget.value|default:""}}</textarea> |
|
6 |
<script type="module"> |
|
7 |
import Godo from "/static/xstatic/js/godo.js?{{version_hash}}"; |
|
8 |
new Godo(document.getElementById('form_{{widget.get_name_for_id}}'), {schema: 'basic'}); |
|
9 |
</script> |
|
5 |
data-godo-schema="basic">{{widget.value|default:""}} |
|
6 |
</textarea> |
|
7 |
<script type="module" src="/static/xstatic/js/godo.js?{{version_hash}}"></script> |
|
10 | 8 |
{% endblock %} |
11 |
- |