1
0
Fork 0
mirror of synced 2024-07-13 18:26:06 +12:00

Fixing issue with HBS insert, not including curlies as required. Also fixing an issue with value not always being correctly updated.

This commit is contained in:
mike12345567 2022-02-15 11:19:59 +00:00
parent 9c99aefef3
commit 9cf3d97b4d
2 changed files with 7 additions and 3 deletions

View file

@ -51,8 +51,9 @@
})
$: codeMirrorHints = bindings?.map(x => `$("${x.readableBinding}")`)
const updateValue = value => {
valid = isValid(readableToRuntimeBinding(bindings, value))
const updateValue = val => {
valid = isValid(readableToRuntimeBinding(bindings, val))
value = val
if (valid) {
dispatch("change", value)
}

View file

@ -1,7 +1,10 @@
export function addHBSBinding(value, caretPos, binding) {
binding = typeof binding === "string" ? binding : binding.path
value = value == null ? "" : value
if (!value.includes("{{") && !value.includes("}}")) {
const left = caretPos?.start ? value.substring(0, caretPos.start) : ""
const right = caretPos?.end ? value.substring(caretPos.end) : ""
if (!left.includes("{{") || !right.includes("}}")) {
binding = `{{ ${binding} }}`
}
if (caretPos.start) {