Skip to content

Commit 0f23edb

Browse files
committed
fix formatting
1 parent 8a1fe7d commit 0f23edb

File tree

1 file changed

+5
-1
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/variables-input

1 file changed

+5
-1
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/variables-input/variables-input.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,18 @@ export function VariablesInput({
187187
const handleTagSelect = (newValue: string) => {
188188
if (!activeFieldId) return
189189

190+
const assignment = assignments.find((a) => a.id === activeFieldId)
191+
const originalValue = assignment?.value || ''
192+
const textAfterCursor = originalValue.slice(cursorPosition)
193+
190194
updateAssignment(activeFieldId, { value: newValue })
191195
setShowTags(false)
192196

193197
setTimeout(() => {
194198
const inputEl = valueInputRefs.current[activeFieldId]
195199
if (inputEl) {
196200
inputEl.focus()
197-
const newCursorPos = newValue.length
201+
const newCursorPos = newValue.length - textAfterCursor.length
198202
inputEl.setSelectionRange(newCursorPos, newCursorPos)
199203
}
200204
}, 10)

0 commit comments

Comments
 (0)