1 {% extends "master.html" %}
3 <meta charset="utf-8" />
4 <title>{% block title %}JSON Editor{% endblock %}</title>
5 <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
6 <meta name="robots" content="noindex, nofollow" />
7 <link rel="shortcut icon" href="{{url_for('static', filename='favicon.png')}}" />
8 <script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
9 <link rel="stylesheet" type="text/css" media="screen" href="{{url_for('static', filename='style.css')}}" />
14 <p><strong>Achtung:</strong> Das bearbeitete JSON wird derzeit nicht gespeichert. Es muss manuell eingetragen werden.</p>
16 <div id='editor_holder'></div>
17 <button id='submit'>Submit (console.log)</button>
20 JSONEditor.defaults.options = {simplemde: {spellChecker: false}};
22 JSONEditor.defaults.languages.de = {
25 JSONEditor.defaults.languages.de_ = {
26 error_notset: 'Eigenschaft ist nicht gesetzt',
27 error_notempty: 'Wert erforderlich',
28 error_enum: 'Wert muss einem der vorgegebenen entsprechen',
29 error_anyOf: 'Wert muss mindestens nach einem der vorgegebenen Schemas gültig sein',
30 error_oneOf: 'Wert muss genau einem der vorgegebenen Schemas entsprechen. Derzeit ist es nach {{0}} Schemas gültig.',
31 error_not: 'Wert darf nach dem vorgegebenen Schema nicht gültig sein',
32 error_type_union: 'Wert muss einer der vorgegebenen Typen entsprechen',
33 error_type: 'Wert muss vom Typ {{0}} sein',
34 error_disallow_union: 'Wert darf nicht einer der vorgegebenen unerlaubten Typen sein',
35 error_disallow: 'Wert darf nicht vom Typ {{0}} sein',
36 error_multipleOf: 'Wert muss das vielfache von {{0}} sein',
37 error_maximum_excl: 'Wert muss kleiner sein als {{0}}',
38 error_maximum_incl: 'Wert darf maximal {{0}} sein',
39 error_minimum_excl: 'Wert muss größer sein als {{0}}',
40 error_minimum_incl: 'Wert muss mindestens {{0}} sein',
41 error_maxLength: 'Wert darf maximal {{0}} Zeichen lang sein',
42 error_minLength: 'Wert muss mindestens {{0}} Zeichen lang sein',
43 error_pattern: 'Wert muss dem vorgegebenen Muster {{0}} entsprechen',
44 error_additionalItems: 'In der Liste sind keine zusätzlichen Einträge erlaubt',
46 * When there are to many items in an array
47 * @variables This key takes one variable: The maximum item count
49 error_maxItems: 'Value must have at most {{0}} items',
51 * When there are not enough items in an array
52 * @variables This key takes one variable: The minimum item count
54 error_minItems: 'Value must have at least {{0}} items',
56 * When an array is supposed to have unique items but has duplicates
58 error_uniqueItems: 'Array must have unique items',
60 * When there are too many properties in an object
61 * @variables This key takes one variable: The maximum property count
63 error_maxProperties: 'Object must have at most {{0}} properties',
65 * When there are not enough properties in an object
66 * @variables This key takes one variable: The minimum property count
68 error_minProperties: 'Object must have at least {{0}} properties',
70 * When a required property is not defined
71 * @variables This key takes one variable: The name of the missing property
73 error_required: "Object is missing the required property '{{0}}'",
75 * When there is an additional property is set whereas there should be none
76 * @variables This key takes one variable: The name of the additional property
78 error_additional_properties: 'No additional properties allowed, but property {{0}} is set',
80 * When there is a propertyName that sets a max length and a property name exceeds the max length
81 * @variables This key takes one variable: The name of the invalid property
83 error_property_names_exceeds_maxlength: 'Property name {{0}} exceeds maxLength',
85 * When there is a propertyName that sets an enum and a property name matches none of the possible enum
86 * @variables This key takes one variable: The name of the invalid property
88 error_property_names_enum_mismatch: 'Property name {{0}} does not match any enum values',
90 * When there is a propertyName that sets a pattern and a property name does not match the pattern
91 * @variables This key takes one variable: The name of the invalid property
93 error_property_names_pattern_mismatch: 'Property name {{0}} does not match pattern',
95 * When the propertyName is set to false and there is at least one property
96 * @variables This key takes one variable: The name of the invalid property
98 error_property_names_false: 'Property name {{0}} fails when propertyName is false',
100 * When the propertyName specifies a maxLength that is not a number
101 * @variables This key takes one variable: The name of the current property
103 error_property_names_maxlength: 'Property name {{0}} cannot match invalid maxLength',
105 * When the propertyName specifies an enum that is not an array
106 * @variables This key takes one variable: The name of the current property
108 error_property_names_enum: 'Property name {{0}} cannot match invalid enum',
110 * When the propertyName specifies a pattern that is not a string
111 * @variables This key takes one variable: The name of the current property
113 error_property_names_pattern: 'Property name {{0}} cannot match invalid pattern',
115 * When the propertyName is unsupported
116 * @variables This key takes one variable: The name of the invalid propertyName
118 error_property_names_unsupported: 'Unsupported propertyName {{0}}',
120 * When a dependency is not resolved
121 * @variables This key takes one variable: The name of the missing property for the dependency
123 error_dependency: 'Must have property {{0}}',
125 * When a date is in incorrect format
126 * @variables This key takes one variable: The valid format
128 error_date: 'Date must be in the format {{0}}',
130 * When a time is in incorrect format
131 * @variables This key takes one variable: The valid format
133 error_time: 'Time must be in the format {{0}}',
135 * When a datetime-local is in incorrect format
136 * @variables This key takes one variable: The valid format
138 error_datetime_local: 'Datetime must be in the format {{0}}',
140 * When a integer date is less than 1 January 1970
142 error_invalid_epoch: 'Date must be greater than 1 January 1970',
144 * When an IPv4 is in incorrect format
146 error_ipv4: 'Value must be a valid IPv4 address in the form of 4 numbers between 0 and 255, separated by dots',
148 * When an IPv6 is in incorrect format
150 error_ipv6: 'Value must be a valid IPv6 address',
152 * When a hostname is in incorrect format
154 error_hostname: 'The hostname has the wrong format',
156 * Text on Delete All buttons
158 button_delete_all: 'All',
160 * Title on Delete All buttons
162 button_delete_all_title: 'Delete All',
164 * Text on Delete Last buttons
165 * @variable This key takes one variable: The title of object to delete
167 button_delete_last: 'Last {{0}}',
169 * Title on Delete Last buttons
170 * @variable This key takes one variable: The title of object to delete
172 button_delete_last_title: 'Delete Last {{0}}',
174 * Title on Add Row buttons
175 * @variable This key takes one variable: The title of object to add
177 button_add_row_title: 'Add {{0}}',
179 * Title on Move Down buttons
181 button_move_down_title: 'Move down',
183 * Title on Move Up buttons
185 button_move_up_title: 'Move up',
187 * Title on Object Properties buttons
189 button_object_properties: 'Object Properties',
191 * Title on Delete Row buttons
192 * @variable This key takes one variable: The title of object to delete
194 button_delete_row_title: '{{0}} löschen',
196 * Title on Delete Row buttons, short version (no parameter with the object title)
198 button_delete_row_title_short: 'Löschen',
200 * Title on Copy Row buttons, short version (no parameter with the object title)
202 button_copy_row_title_short: 'Copy',
204 * Title on Collapse buttons
206 button_collapse: 'Collapse',
208 * Title on Expand buttons
210 button_expand: 'Expand',
212 * Title on Flatpickr toggle buttons
214 flatpickr_toggle_button: 'Toggle',
216 * Title on Flatpickr clear buttons
218 flatpickr_clear_button: 'Clear',
220 * Choices input field placeholder text
222 choices_placeholder_text: 'Start typing to add value',
224 * Default title for array items
226 default_array_item_title: 'item',
228 * Warning when deleting a node
230 button_delete_node_warning: 'Are you sure you want to remove this node?'
237 JSONEditor.defaults.language = "de";
240 // Initialize the editor with a JSON schema
241 var editor = new JSONEditor(document.getElementById('editor_holder'), {
242 schema: {"$ref": {{schema_url|tojson}}},
247 editor.on('ready',() => {
248 fetch({{json_url|tojson}}).then(
250 return response.json();
253 editor.setValue(data);
255 ).catch(function (err) {
261 // Hook up the submit button to log to the console
262 document.getElementById('submit').addEventListener('click',function() {
263 // Get the value from the editor
264 console.log(editor.getValue());