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
063fd8f1d0
commit
ce28aff3f9
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue