Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating submitSendBoxSaga.js to send sendBoxValue.trim() #2331

Merged
merged 10 commits into from
Aug 21, 2019
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Fixed

- Fix [#2328](https://github.com/microsoft/BotFramework-WebChat/issues/2328). Updating submitSendBoxSaga.js to send sendBoxValue.trim(), by [@jimmyjames177414](https://github.com/jimmyjames177414) in PR [#2331](https://github.com/microsoft/BotFramework-WebChat/pull/2331)
- Fix [#2160](https://github.com/microsoft/BotFramework-WebChat/issues/2160). Clear suggested actions after clicking on a suggested actions of type `openUrl`, by [@tdurnford](https://github.com/tdurnford) in PR [#2190](https://github.com/microsoft/BotFramework-WebChat/pull/2190)
- Fix [#1954](https://github.com/microsoft/BotFramework-WebChat/issues/1954). Estimate clock skew and adjust timestamp for outgoing activity, by [@compulim](https://github.com/compulim) in PR [#2208](https://github.com/microsoft/BotFramework-WebChat/pull/2208)
- Fix [#2240](https://github.com/microsoft/BotFramework-WebChat/issues/2240). Fix microphone button should be re-enabled after error, by [@compulim](https://github.com/compulim) in PR [#2241](https://github.com/microsoft/BotFramework-WebChat/pull/2241)
Expand Down
15 changes: 6 additions & 9 deletions packages/component/src/SendBox/SendButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@ import SendIcon from './Assets/SendIcon';

const connectSendButton = (...selectors) =>
connectToWebChat(
({ disabled, language, sendBoxValue, setSendBox, submitSendBox }) => ({
click: () => {
setSendBox(sendBoxValue.trim());
submitSendBox();
},
({ disabled, language, submitSendBox }) => ({
disabled,
language
language,
submitSendBox
}),
...selectors
);

const SendButton = ({ click, disabled, language }) => (
jimmyjames177414 marked this conversation as resolved.
Show resolved Hide resolved
<IconButton alt={localize('Send', language)} disabled={disabled} onClick={click}>
<IconButton alt={localize('Send', language)} disabled={disabled} onClick={submitSendBox}>
<SendIcon />
</IconButton>
);
Expand All @@ -30,9 +27,9 @@ SendButton.defaultProps = {
};

SendButton.propTypes = {
click: PropTypes.func.isRequired,
disabled: PropTypes.bool,
language: PropTypes.string.isRequired
language: PropTypes.string.isRequired,
submitSendBox: PropTypes.func.isRequired
};

export default connectSendButton()(SendButton);
Expand Down
1 change: 0 additions & 1 deletion packages/component/src/SendBox/TextBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const connectSendTextBox = (...selectors) =>
event.preventDefault();

if (sendBoxValue) {
setSendBox(sendBoxValue.trim());
scrollToEnd();
submitSendBox();
focusSendBox();
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/sagas/submitSendBoxSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function* submitSendBox() {
const sendBoxValue = yield select(sendBoxValueSelector);

if (sendBoxValue) {
yield put(sendMessage(sendBoxValue, method));
yield put(sendMessage(sendBoxValue.trim(), method));
yield put(setSendBox(''));
}
});
Expand Down