Fixing issue with value being set in binding panel as per review comments of aptkingston.
This commit is contained in:
parent
381070a95c
commit
6445cefee7
|
@ -23,6 +23,10 @@
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export let bindings
|
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 value = ""
|
||||||
export let valid
|
export let valid
|
||||||
export let allowJS = false
|
export let allowJS = false
|
||||||
|
@ -53,7 +57,6 @@
|
||||||
|
|
||||||
const updateValue = val => {
|
const updateValue = val => {
|
||||||
valid = isValid(readableToRuntimeBinding(bindings, val))
|
valid = isValid(readableToRuntimeBinding(bindings, val))
|
||||||
value = val
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
dispatch("change", value)
|
dispatch("change", value)
|
||||||
}
|
}
|
||||||
|
@ -61,7 +64,7 @@
|
||||||
|
|
||||||
// Adds a HBS helper to the expression
|
// Adds a HBS helper to the expression
|
||||||
const addHelper = helper => {
|
const addHelper = helper => {
|
||||||
hbsValue = addHBSBinding(value, getCaretPosition(), helper.text)
|
hbsValue = addHBSBinding(hbsValue, getCaretPosition(), helper.text)
|
||||||
updateValue(hbsValue)
|
updateValue(hbsValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue