editor: limit fields auto identation depth level to 1

This commit is contained in:
jean-emmanuel 2017-07-14 11:52:46 +02:00
parent f3c8c85040
commit 73552c55dc
3 changed files with 21 additions and 17 deletions

View file

@ -48,7 +48,7 @@ var editObject = function(container, data, refresh){
if (i=='type' && (data.type == 'tab' || data.type == 'root')) continue
let type = typeof data[i],
value = type != 'string'?JSON.stringify(data[i], null, ' '):data[i],
value = type != 'string'?JSON.stringify(data[i], null, ' ').replace(/\n\s\s\s\s/g, ' ').replace(/\n\s\s(\}|\])/g, ' $1'):data[i],
wrapper = $('<div class="input-wrapper"></div>').appendTo(form),
label = $(`<label>${i}</label>`).appendTo(wrapper),
input