Rich Editor

/views/components/edit/RichEdit.html (779 B)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{% import (
"{{{ .Package }}}/app/util"
) %}

{% func RichEditor(key string, id string, columns []*util.FieldDesc, value []any, placeholder ...string) %}{% stripspace %}
{% code if value == nil { value = []any{} } %}
<div class="rich-editor" data-key="{%s key %}" data-columns="{%j util.ToJSONCompact(columns) %}">
{%= Textarea(key, id, 8, util.ToJSON(value), placeholder...) %}
</div>
{% endstripspace %}{% endfunc %}

{% func RichEditorTable(key string, id string, title string, columns []*util.FieldDesc, value []any, placeholder ...string) %}{% stripspace %}
<tr>
<th class="shrink"><label for="{%s id %}">{%s title %}</label></th>
<td>
{%= RichEditor(key, id, columns, value, placeholder...) %}
</td>
</tr>
{% endstripspace %}{% endfunc %}