From 3cbe3e14b3fc68966e930c64e0fe962640697061 Mon Sep 17 00:00:00 2001 From: Jath Palasubramaniam Date: Mon, 18 Jul 2016 23:07:33 +1000 Subject: [PATCH] Pasting into a participant field now preserves any text already there (Issue #2410) 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 61f0b3ddfa..8361bc43e1 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