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')}}" />
13 <div id='editor_holder'></div>
14 <button id='submit'>Submit (console.log)</button>
17 JSONEditor.defaults.options = {simplemde: {spellChecker: false}};
19 JSONEditor.defaults.languages.de = {
22 JSONEditor.defaults.languages.de_ = {
23 error_notset: 'Eigenschaft ist nicht gesetzt',
24 error_notempty: 'Wert erforderlich',
25 error_enum: 'Wert muss einem der vorgegebenen entsprechen',
26 error_anyOf: 'Wert muss mindestens nach einem der vorgegebenen Schemas gültig sein',
27 error_oneOf: 'Wert muss genau einem der vorgegebenen Schemas entsprechen. Derzeit ist es nach {{0}} Schemas gültig.',
28 error_not: 'Wert darf nach dem vorgegebenen Schema nicht gültig sein',
29 error_type_union: 'Wert muss einer der vorgegebenen Typen entsprechen',
30 error_type: 'Wert muss vom Typ {{0}} sein',
31 error_disallow_union: 'Wert darf nicht einer der vorgegebenen unerlaubten Typen sein',
32 error_disallow: 'Wert darf nicht vom Typ {{0}} sein',
33 error_multipleOf: 'Wert muss das vielfache von {{0}} sein',
34 error_maximum_excl: 'Wert muss kleiner sein als {{0}}',
35 error_maximum_incl: 'Wert darf maximal {{0}} sein',
36 error_minimum_excl: 'Wert muss größer sein als {{0}}',
37 error_minimum_incl: 'Wert muss mindestens {{0}} sein',
38 error_maxLength: 'Wert darf maximal {{0}} Zeichen lang sein',
39 error_minLength: 'Wert muss mindestens {{0}} Zeichen lang sein',
40 error_pattern: 'Wert muss dem vorgegebenen Muster {{0}} entsprechen',
41 error_additionalItems: 'In der Liste sind keine zusätzlichen Einträge erlaubt',
43 * When there are to many items in an array
44 * @variables This key takes one variable: The maximum item count
46 error_maxItems: 'Value must have at most {{0}} items',
48 * When there are not enough items in an array
49 * @variables This key takes one variable: The minimum item count
51 error_minItems: 'Value must have at least {{0}} items',
53 * When an array is supposed to have unique items but has duplicates
55 error_uniqueItems: 'Array must have unique items',
57 * When there are too many properties in an object
58 * @variables This key takes one variable: The maximum property count
60 error_maxProperties: 'Object must have at most {{0}} properties',
62 * When there are not enough properties in an object
63 * @variables This key takes one variable: The minimum property count
65 error_minProperties: 'Object must have at least {{0}} properties',
67 * When a required property is not defined
68 * @variables This key takes one variable: The name of the missing property
70 error_required: "Object is missing the required property '{{0}}'",
72 * When there is an additional property is set whereas there should be none
73 * @variables This key takes one variable: The name of the additional property
75 error_additional_properties: 'No additional properties allowed, but property {{0}} is set',
77 * When there is a propertyName that sets a max length and a property name exceeds the max length
78 * @variables This key takes one variable: The name of the invalid property
80 error_property_names_exceeds_maxlength: 'Property name {{0}} exceeds maxLength',
82 * When there is a propertyName that sets an enum and a property name matches none of the possible enum
83 * @variables This key takes one variable: The name of the invalid property
85 error_property_names_enum_mismatch: 'Property name {{0}} does not match any enum values',
87 * When there is a propertyName that sets a pattern and a property name does not match the pattern
88 * @variables This key takes one variable: The name of the invalid property
90 error_property_names_pattern_mismatch: 'Property name {{0}} does not match pattern',
92 * When the propertyName is set to false and there is at least one property
93 * @variables This key takes one variable: The name of the invalid property
95 error_property_names_false: 'Property name {{0}} fails when propertyName is false',
97 * When the propertyName specifies a maxLength that is not a number
98 * @variables This key takes one variable: The name of the current property
100 error_property_names_maxlength: 'Property name {{0}} cannot match invalid maxLength',
102 * When the propertyName specifies an enum that is not an array
103 * @variables This key takes one variable: The name of the current property
105 error_property_names_enum: 'Property name {{0}} cannot match invalid enum',
107 * When the propertyName specifies a pattern that is not a string
108 * @variables This key takes one variable: The name of the current property
110 error_property_names_pattern: 'Property name {{0}} cannot match invalid pattern',
112 * When the propertyName is unsupported
113 * @variables This key takes one variable: The name of the invalid propertyName
115 error_property_names_unsupported: 'Unsupported propertyName {{0}}',
117 * When a dependency is not resolved
118 * @variables This key takes one variable: The name of the missing property for the dependency
120 error_dependency: 'Must have property {{0}}',
122 * When a date is in incorrect format
123 * @variables This key takes one variable: The valid format
125 error_date: 'Date must be in the format {{0}}',
127 * When a time is in incorrect format
128 * @variables This key takes one variable: The valid format
130 error_time: 'Time must be in the format {{0}}',
132 * When a datetime-local is in incorrect format
133 * @variables This key takes one variable: The valid format
135 error_datetime_local: 'Datetime must be in the format {{0}}',
137 * When a integer date is less than 1 January 1970
139 error_invalid_epoch: 'Date must be greater than 1 January 1970',
141 * When an IPv4 is in incorrect format
143 error_ipv4: 'Value must be a valid IPv4 address in the form of 4 numbers between 0 and 255, separated by dots',
145 * When an IPv6 is in incorrect format
147 error_ipv6: 'Value must be a valid IPv6 address',
149 * When a hostname is in incorrect format
151 error_hostname: 'The hostname has the wrong format',
153 * Text on Delete All buttons
155 button_delete_all: 'All',
157 * Title on Delete All buttons
159 button_delete_all_title: 'Delete All',
161 * Text on Delete Last buttons
162 * @variable This key takes one variable: The title of object to delete
164 button_delete_last: 'Last {{0}}',
166 * Title on Delete Last buttons
167 * @variable This key takes one variable: The title of object to delete
169 button_delete_last_title: 'Delete Last {{0}}',
171 * Title on Add Row buttons
172 * @variable This key takes one variable: The title of object to add
174 button_add_row_title: 'Add {{0}}',
176 * Title on Move Down buttons
178 button_move_down_title: 'Move down',
180 * Title on Move Up buttons
182 button_move_up_title: 'Move up',
184 * Title on Object Properties buttons
186 button_object_properties: 'Object Properties',
188 * Title on Delete Row buttons
189 * @variable This key takes one variable: The title of object to delete
191 button_delete_row_title: '{{0}} löschen',
193 * Title on Delete Row buttons, short version (no parameter with the object title)
195 button_delete_row_title_short: 'Löschen',
197 * Title on Copy Row buttons, short version (no parameter with the object title)
199 button_copy_row_title_short: 'Copy',
201 * Title on Collapse buttons
203 button_collapse: 'Collapse',
205 * Title on Expand buttons
207 button_expand: 'Expand',
209 * Title on Flatpickr toggle buttons
211 flatpickr_toggle_button: 'Toggle',
213 * Title on Flatpickr clear buttons
215 flatpickr_clear_button: 'Clear',
217 * Choices input field placeholder text
219 choices_placeholder_text: 'Start typing to add value',
221 * Default title for array items
223 default_array_item_title: 'item',
225 * Warning when deleting a node
227 button_delete_node_warning: 'Are you sure you want to remove this node?'
234 JSONEditor.defaults.language = "de";
237 // Initialize the editor with a JSON schema
238 var editor = new JSONEditor(document.getElementById('editor_holder'), {
239 schema: {"$ref": {{schema_url|tojson}}},
244 editor.on('ready',() => {
245 fetch({{json_url|tojson}}).then(
247 return response.json();
250 editor.setValue(data);
252 ).catch(function (err) {
258 // Hook up the submit button to log to the console
259 document.getElementById('submit').addEventListener('click',function() {
260 // Get the value from the editor
261 console.log(editor.getValue());