Skip to content

Commit

Permalink
feat(editor): 支持数据源模板输入宽选中文本后编辑(在有数据源变量时还有问题)
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen committed Jun 11, 2024
1 parent 094635c commit a30e8a3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/editor/src/fields/DataSourceInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down

0 comments on commit a30e8a3

Please sign in to comment.