From 1392887c831d92fbcb2c1c57d2aceade08860934 Mon Sep 17 00:00:00 2001 From: jathpala Date: Tue, 19 Jul 2016 05:32:46 +1000 Subject: [PATCH] Pasting into a participant field now preserves any text already there (Issue #2410) (#2635) This modifies the behavious when pasting into the to, cc or bcc fields of a new draft. Any text already in the input field is not automatically deleted. Rather the pasted text is added to the already existing text. If the new contents of the email field now matches as an email address (based on RegExpUtils.emailRegex().test()), then the address is immediately tokenized. If the new input text doesn't match as an email, just append the new text and wait for further input. --- src/components/tokenizing-text-field.cjsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/tokenizing-text-field.cjsx b/src/components/tokenizing-text-field.cjsx index 61f0b3ddf..8361bc43e 100644 --- a/src/components/tokenizing-text-field.cjsx +++ b/src/components/tokenizing-text-field.cjsx @@ -528,8 +528,13 @@ class TokenizingTextField extends React.Component _onPaste: (event) => data = event.clipboardData.getData('text/plain') - @_addInputValue(data) - event.preventDefault() + newInputValue = @state.inputValue + data + if RegExpUtils.emailRegex().test(newInputValue) + @_addInputValue(newInputValue, skipNameLookup: true) + event.preventDefault() + else + @_refreshCompletions(newInputValue) + # Managing Suggestions