From 34248c6819d5c7312ea2d27bd1daaddede312421 Mon Sep 17 00:00:00 2001 From: Elizabeth Date: Thu, 12 May 2016 14:39:18 -0700 Subject: [PATCH] Property labels support periods The keys used for labels now are the result of the path minus the the parent path. --- src/editor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/editor.js b/src/editor.js index 3ca319d2e..279038199 100644 --- a/src/editor.js +++ b/src/editor.js @@ -46,8 +46,12 @@ JSONEditor.AbstractEditor = Class.extend({ this.path = options.path || 'root'; this.formname = options.formname || this.path.replace(/\.([^.]+)/g,'[$1]'); if(this.jsoneditor.options.form_name_root) this.formname = this.formname.replace(/^root\[/,this.jsoneditor.options.form_name_root+'['); - this.key = this.path.split('.').pop(); this.parent = options.parent; + if (options.parent) { + this.key = this.path.split(".").slice(options.parent.path.split(".").length).join("."); + } else { + this.key = this.path; + } this.link_watchers = [];