|
|
|
@ -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) |
|
|
|
} |
|
|
|
|
|
|
|
|