error pages

This commit is contained in:
long2ice
2021-05-05 14:46:26 +08:00
parent 3935adba00
commit 473faac93b
31 changed files with 390 additions and 246 deletions

View File

@@ -2,7 +2,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jsoneditor@9.4.0/dist/jsoneditor.min.css">
<div class="form-label">{{ label }}</div>
<div id="{{ name }}" class="form-group mb-3"></div>
<input {% if not null %}required{% endif %} type="text" name="{{ name }}" value='{{ value|safe }}' hidden>
<input {% if not null %}required{% endif %} type="text" name="{{ name }}" value="{{ value|safe }}" hidden>
<style>
.jsoneditor {
border: 1px solid #dadcde;
@@ -21,12 +21,15 @@
let options = {{options|safe}};
if (Object.keys(options).length === 0) {
options = {
modes: ['tree', 'view', 'form', 'code', 'text', 'preview']
modes: ['tree', 'view', 'form', 'code', 'text', 'preview'],
}
}
options.onChangeText = function (json) {
$('input[name={{ name }}]').val(json);
}
const editor = new JSONEditor(container, options)
editor.set({{ value|safe }})
{% if value %}
editor.set({{ value|safe }})
{% endif %}
editor.expandAll();
</script>