prevent null being appended to binding box

This commit is contained in:
Martin McKeaveney 2021-02-24 17:56:14 +00:00
parent 0905d35ef2
commit 5a6306f49f
2 changed files with 18 additions and 812 deletions

View File

@ -40,13 +40,14 @@
function addToText(readableBinding) { function addToText(readableBinding) {
const position = getCaretPosition() const position = getCaretPosition()
const toAdd = `{{ ${readableBinding} }}` const toAdd = `{{ ${readableBinding} }}`
if (position.start) { if (position.start) {
value = value =
value.substring(0, position.start) + value.substring(0, position.start) +
toAdd + toAdd +
value.substring(position.end, value.length) value.substring(position.end, value.length)
} else { } else {
value += toAdd value = toAdd
} }
} }
@ -110,7 +111,8 @@
bind:getCaretPosition bind:getCaretPosition
thin thin
bind:value bind:value
placeholder="Add text, or click the objects on the left to add them to the textbox." /> placeholder="Add text, or click the objects on the left to add them to
the textbox." />
{#if !valid} {#if !valid}
<p class="syntax-error"> <p class="syntax-error">
Current Handlebars syntax is invalid, please check the guide Current Handlebars syntax is invalid, please check the guide

File diff suppressed because it is too large Load Diff