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:
parent
9c99aefef3
commit
9cf3d97b4d
|
@ -51,8 +51,9 @@
|
||||||
})
|
})
|
||||||
$: codeMirrorHints = bindings?.map(x => `$("${x.readableBinding}")`)
|
$: codeMirrorHints = bindings?.map(x => `$("${x.readableBinding}")`)
|
||||||
|
|
||||||
const updateValue = value => {
|
const updateValue = val => {
|
||||||
valid = isValid(readableToRuntimeBinding(bindings, value))
|
valid = isValid(readableToRuntimeBinding(bindings, val))
|
||||||
|
value = val
|
||||||
if (valid) {
|
if (valid) {
|
||||||
dispatch("change", value)
|
dispatch("change", value)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
export function addHBSBinding(value, caretPos, binding) {
|
export function addHBSBinding(value, caretPos, binding) {
|
||||||
binding = typeof binding === "string" ? binding : binding.path
|
binding = typeof binding === "string" ? binding : binding.path
|
||||||
value = value == null ? "" : value
|
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} }}`
|
binding = `{{ ${binding} }}`
|
||||||
}
|
}
|
||||||
if (caretPos.start) {
|
if (caretPos.start) {
|
||||||
|
|
Loading…
Reference in New Issue