|
|
|
@ -11,10 +11,13 @@ |
|
|
|
import { handlebarsCompletions } from "constants/completions" |
|
|
|
|
|
|
|
const dispatch = createEventDispatcher() |
|
|
|
|
|
|
|
|
|
|
|
export let bindableProperties |
|
|
|
export let value = "" |
|
|
|
export let bindingDrawer |
|
|
|
export let valid = true |
|
|
|
export let bindings = [] |
|
|
|
$: console.log('Bindings in Drawer: ', bindings) |
|
|
|
|
|
|
|
let originalValue = value |
|
|
|
let helpers = handlebarsCompletions() |
|
|
|
@ -24,7 +27,10 @@ |
|
|
|
|
|
|
|
$: categories = Object.entries(groupBy("category", bindings)) |
|
|
|
$: value && checkValid() |
|
|
|
|
|
|
|
$: bindableProperties = getBindableProperties( |
|
|
|
$currentAsset, |
|
|
|
$store.selectedComponentId |
|
|
|
) |
|
|
|
$: console.log(value) |
|
|
|
$: dispatch("update", value) |
|
|
|
$: searchRgx = new RegExp(search, "ig") |
|
|
|
@ -35,16 +41,16 @@ |
|
|
|
} |
|
|
|
|
|
|
|
function addToText(binding) { |
|
|
|
const position = getCaretPosition() |
|
|
|
const toAdd = `{{ ${binding.path} }}` |
|
|
|
if (position.start) { |
|
|
|
const position = getCaretPosition() |
|
|
|
const toAdd = `{{ ${binding.path} }}` |
|
|
|
if (position.start) { |
|
|
|
value = |
|
|
|
value.substring(0, position.start) + |
|
|
|
toAdd + |
|
|
|
value.substring(position.end, value.length) |
|
|
|
} else { |
|
|
|
value.substring(0, position.start) + |
|
|
|
toAdd + |
|
|
|
value.substring(position.end, value.length) |
|
|
|
} else { |
|
|
|
value += toAdd |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
export function cancel() { |
|
|
|
dispatch("update", originalValue) |
|
|
|
|