From d98b7aab612d8d38e10dbd959f5ea67e74ca42c8 Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Fri, 10 Mar 2017 11:52:27 +0100 Subject: [PATCH] Wait for the value to have changed in the input (#4844) --- js/src/ui/Form/Input/input.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/js/src/ui/Form/Input/input.js b/js/src/ui/Form/Input/input.js index 44906ad93..64ec544b9 100644 --- a/js/src/ui/Form/Input/input.js +++ b/js/src/ui/Form/Input/input.js @@ -214,6 +214,7 @@ export default class Input extends Component { onChange = (event, value) => { event.persist(); + this.setValue(value, () => { this.props.onChange && this.props.onChange(event, value); }); @@ -231,12 +232,10 @@ export default class Input extends Component { } onPaste = (event) => { - const { value } = event.target; - const pasted = event.clipboardData.getData('Text'); - + // Wait for the onChange handler to be called window.setTimeout(() => { - this.onSubmit(value + pasted); - }, 0); + this.onSubmit(this.state.value); + }, 200); } onKeyDown = (event) => {