diff --git a/packages/editor/src/fields/DataSourceInput.vue b/packages/editor/src/fields/DataSourceInput.vue index 8ffdc7bfa..55b8e23ef 100644 --- a/packages/editor/src/fields/DataSourceInput.vue +++ b/packages/editor/src/fields/DataSourceInput.vue @@ -106,9 +106,17 @@ watch( ); const mouseupHandler = async () => { + const selection = globalThis.document.getSelection(); + const anchorOffset = selection?.anchorOffset || 0; + const focusOffset = selection?.focusOffset || 0; + isFocused.value = true; await nextTick(); autocomplete.value?.focus(); + + if (focusOffset && input.value) { + input.value.setSelectionRange(anchorOffset, focusOffset); + } }; const blurHandler = () => {