From fa33cd5cfbe5ca50341f1ebc7ff0151a55b44291 Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Mon, 1 Nov 2021 16:46:30 +0100 Subject: [PATCH] WIP: quotation in ext_autocomplete --- src/core/js/ext_autocomplete.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/core/js/ext_autocomplete.js b/src/core/js/ext_autocomplete.js index a45af385..2f6fa0dd 100644 --- a/src/core/js/ext_autocomplete.js +++ b/src/core/js/ext_autocomplete.js @@ -111,17 +111,6 @@ var ext_autocomplete = new function () { ["names"]))).find("Property[name],RecordType[name],Record[name]") response = response.toArray().map(x => $(x).attr("name")); - // attach quotation if white space - response = response.map((x) => { - if(x.indexOf(" ") > -1) { - if(x.indexOf("\"") > -1) { - return `'${x}'`; - } else { - return `"${x}"`; - } - } - return x; - }); response = response.concat(ext_autocomplete.CQL_WORDS); return response @@ -169,8 +158,16 @@ var ext_autocomplete = new function () { var start = newValue.slice(0, beginning_of_word + 1); var end = origJQElement[0].value.slice(cursorpos); var result = resultsFromServer.map(x => { + var x_quoted = x; + if (x.indexOf(" ") > -1) { + if(x.indexOf("\"") > -1) { + x_quoted = `'${x}'`; + } else { + x_quoted = `"${x}"`; + } + } return { - text: start + x + end, + text: start + x_quoted + end, html: x } }); -- GitLab