Fix to ensure runtimeTime binding is used is automation js modal
This commit is contained in:
parent
6bd6ee779b
commit
9b4c22727f
|
@ -31,7 +31,7 @@
|
|||
import ModalBindableInput from "components/common/bindings/ModalBindableInput.svelte"
|
||||
import CodeEditor from "components/common/CodeEditor/CodeEditor.svelte"
|
||||
import BindingSidePanel from "components/common/bindings/BindingSidePanel.svelte"
|
||||
import { BindingHelpers } from "components/common/bindings/utils"
|
||||
import { BindingHelpers, BindingType } from "components/common/bindings/utils"
|
||||
import {
|
||||
bindingsToCompletions,
|
||||
hbAutocomplete,
|
||||
|
@ -576,6 +576,7 @@
|
|||
{
|
||||
js: true,
|
||||
dontDecode: true,
|
||||
type: BindingType.RUNTIME,
|
||||
}
|
||||
)}
|
||||
mode="javascript"
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { decodeJSBinding } from "@budibase/string-templates"
|
||||
import { hbInsert, jsInsert } from "components/common/CodeEditor"
|
||||
|
||||
export const BindingType = {
|
||||
READABLE: "readableBinding",
|
||||
RUNTIME: "runtimeBinding",
|
||||
}
|
||||
|
||||
export class BindingHelpers {
|
||||
constructor(getCaretPosition, insertAtPos, { disableWrapping } = {}) {
|
||||
this.getCaretPosition = getCaretPosition
|
||||
|
@ -25,16 +30,20 @@ export class BindingHelpers {
|
|||
}
|
||||
|
||||
// Adds a data binding to the expression
|
||||
onSelectBinding(value, binding, { js, dontDecode }) {
|
||||
onSelectBinding(
|
||||
value,
|
||||
binding,
|
||||
{ js, dontDecode, type = BindingType.READABLE }
|
||||
) {
|
||||
const { start, end } = this.getCaretPosition()
|
||||
if (js) {
|
||||
const jsVal = dontDecode ? value : decodeJSBinding(value)
|
||||
const insertVal = jsInsert(jsVal, start, end, binding.readableBinding, {
|
||||
const insertVal = jsInsert(jsVal, start, end, binding[type], {
|
||||
disableWrapping: this.disableWrapping,
|
||||
})
|
||||
this.insertAtPos({ start, end, value: insertVal })
|
||||
} else {
|
||||
const insertVal = hbInsert(value, start, end, binding.readableBinding)
|
||||
const insertVal = hbInsert(value, start, end, binding[type])
|
||||
this.insertAtPos({ start, end, value: insertVal })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue