From 63399e5d6903ef5d3bd9f16e15bdad2419fd410d Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Fri, 2 Dec 2016 11:21:53 +0100 Subject: [PATCH] Properly populate parent span field also for newly added annotations (#3 e) --- flat/style/flat.editor.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/flat/style/flat.editor.js b/flat/style/flat.editor.js index ed50f0a..a206efc 100644 --- a/flat/style/flat.editor.js +++ b/flat/style/flat.editor.js @@ -991,6 +991,15 @@ function addeditorfield(index) { var ho_result = renderhigherorderfields(editfields, editoraddablefields[index]); //will always be empty but sets a proper placeholder we can use s = s + ho_result.output; + var nestablespan = folia_nestablespan(editoraddablefields[index].type); + if (nestablespan.length > 0) { + editoraddablefields[index].layerparent = structure[editedelementid].parent; + while ((structure[editoraddablefields[index].layerparent].type == 'correction') || (structure[editoraddablefields[index].layerparent].type == 'part')) { + editoraddablefields[index].layerparent = structure[editoraddablefields[index].layerparent].parent; + } + s = s + renderparentspanfield(editfields, editoraddablefields[index], nestablespan); + } + s = s + ""; $('#editrowplaceholder')[0].outerHTML = s;