Fixing issue with value being set in binding panel as per review comments of aptkingston.

This commit is contained in:
mike12345567 2022-02-15 13:49:20 +00:00
parent 381070a95c
commit 6445cefee7
1 changed files with 5 additions and 2 deletions

View File

@ -23,6 +23,10 @@
const dispatch = createEventDispatcher()
export let bindings
// jsValue/hbsValue are the state of the value that is being built
// within this binding panel - the value should not be updated until
// the binding panel is saved. This is the default value of the
// expression when the binding panel is opened, but shouldn't be updated.
export let value = ""
export let valid
export let allowJS = false
@ -53,7 +57,6 @@
const updateValue = val => {
valid = isValid(readableToRuntimeBinding(bindings, val))
value = val
if (valid) {
dispatch("change", value)
}
@ -61,7 +64,7 @@
// Adds a HBS helper to the expression
const addHelper = helper => {
hbsValue = addHBSBinding(value, getCaretPosition(), helper.text)
hbsValue = addHBSBinding(hbsValue, getCaretPosition(), helper.text)
updateValue(hbsValue)
}