diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index b40ce1aa6a..e8ad96ea69 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -279,7 +279,7 @@ {context} addHelper={onSelectHelper} addBinding={onSelectBinding} - mode={editorMode} + js={editorMode === EditorModes.JS} /> {:else if sidePanel === SidePanels.Evaluation} { + let code = binding.valueHTML if (!context || !binding.value || binding.value === "") { - return + code = null } stopHidingPopover() popoverAnchor = target hoverTarget = { helper: false, - code: binding.valueHTML, + code, + binding: binding.readableBinding, } popover.show() } @@ -92,7 +94,7 @@ hoverTarget = { helper: true, description: helper.description, - code: getHelperExample(helper, mode.name === "javascript"), + code: getHelperExample(helper, js), } popover.show() } @@ -112,6 +114,15 @@ hideTimeout = null } } + + const getReadableBindingLabel = readableBinding => { + console.log(js) + if (js) { + return `$("${readableBinding}")` + } else { + return `{{ ${readableBinding} }}` + } + }
+ {#if hoverTarget.binding} +
{getReadableBindingLabel(hoverTarget.binding)}
+ {/if} {#if hoverTarget.description}
@@ -246,7 +260,7 @@ class="binding" on:mouseenter={e => showHelperPopover(helper, e.target)} on:mouseleave={hidePopover} - on:click={() => addHelper(helper, mode.name === "javascript")} + on:click={() => addHelper(helper, js)} > {helper.displayText} @@ -404,7 +418,8 @@ text-overflow: ellipsis; overflow: hidden; } - .binding-popover.helper pre { + .binding-popover.helper pre, + .binding-popover pre.binding { color: var(--spectrum-global-color-blue-700); } .binding-popover pre :global(span) {