From c4d5c4f390390ca1381f97bc64487cf418124f32 Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Wed, 28 Dec 2016 14:31:32 +0100 Subject: [PATCH] Fixed editing class and respanning at same time (isssue #97) --- flat/style/flat.editor.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/flat/style/flat.editor.js b/flat/style/flat.editor.js index 5022f33..ce98f03 100644 --- a/flat/style/flat.editor.js +++ b/flat/style/flat.editor.js @@ -1286,7 +1286,7 @@ function gather_changes() { } - if ((!editdata[i].changed) && (JSON.stringify(editdata[i].targets) != JSON.stringify(editdata[i].targets_begin)) && (editdata[i].editform != 'new')) { + if ((JSON.stringify(editdata[i].targets) != JSON.stringify(editdata[i].targets_begin)) && (editdata[i].editform != 'new')) { //detect changes in span, and set the changed flag editdata[i].changed = true; editdata[i].respan = true; @@ -1603,7 +1603,7 @@ function build_queries(addtoqueue) { query += "SUBSTITUTE w WITH text \"" + escape_fql_value(editdata[i].text) + "\""; } } - if (editdata[i].respan) { //isspan && editdata[i].id && (action == "EDIT")) { + if ((editdata[i].respan) && (action != "SUBSTITUTE")) { //isspan && editdata[i].id && (action == "EDIT")) { //we edit a span annotation, edittargets reflects the new span: if (editdata[i].targets.length > 0) { query += " RESPAN "; @@ -1617,6 +1617,8 @@ function build_queries(addtoqueue) { query += forids; } returntype = "ancestor-focus"; + } else if (action == "SUBSTIUTE") { + editdata[i].respan = false; }