Skip to content

Commit b732072

Browse files
committed
Require text length greater than one for fragment paste handling
- pasting a single char should not transform it into symbol └── packages └── ui └── src └── components └── editor └── common └── prompts ├── PromptField │ ├── PromptField.module.scss │ ├── PromptField.stories.tsx │ ├── hooks │ │ ├── use-drag-drop.ts │ │ ├── use-dropdown.ts │ │ ├── use-ghost-text.ts │ │ ├── use-handlers │ │ │ ├── handle-copy.ts │ │ │ ├── handle-cut.ts │ │ │ ├── handle-input-change.ts │ │ │ ├── handle-key-down.ts │ │ │ ├── handle-paste.ts │ │ │ ├── handle-submit.ts │ │ │ ├── index.ts │ │ │ └── utils.ts │ │ └── use-keyboard-shortcuts.ts │ └── index.ts ├── Template │ ├── Template.module.scss │ ├── Template.tsx │ └── index.ts └── shared └── symbols ├── caret.ts ├── get-highlighted-text.tsx ├── index.ts ├── position-mapping.ts └── reconstruct-raw-value.ts
1 parent 0fcb188 commit b732072

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • packages/ui/src/components/editor/common/prompts/PromptField/hooks/use-handlers

‎packages/ui/src/components/editor/common/prompts/PromptField/hooks/use-handlers/handle-paste.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const create_perform_paste =
4242
!refs.is_shift_pressed_ref.current &&
4343
props.current_selection &&
4444
text == props.current_selection.text &&
45+
text.length > 1 &&
4546
props.currently_open_file_path &&
4647
is_file_in_context
4748
) {
@@ -105,6 +106,7 @@ export const create_handle_paste =
105106
const is_fragment_paste =
106107
props.current_selection &&
107108
text == props.current_selection.text &&
109+
text.length > 1 &&
108110
props.currently_open_file_path &&
109111
is_file_in_context
110112

0 commit comments

Comments
 (0)