Skip to content

Commit

Permalink
fix(messageinput, commenteditable): fix bug that last korean characte…
Browse files Browse the repository at this point in the history
…r is entered twice
  • Loading branch information
HwangTaehyun committed Apr 12, 2021
1 parent a60d537 commit 2986e2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/components/ContentEditable/ContentEditable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export class ContentEditable extends Component {
};
};

handleKeyDown = (evt) => {
handleKeyPress = (evt) => {
const {
props: { onKeyDown },
props: { onKeyPress },
} = this;
onKeyDown(evt);
onKeyPress(evt);
};

handleInput = (evt) => {
Expand Down Expand Up @@ -111,7 +111,7 @@ export class ContentEditable extends Component {
const {
msgRef,
handleInput,
handleKeyDown,
handleKeyPress,
innerHTML,
props: { placeholder, disabled, className },
} = this,
Expand All @@ -125,7 +125,7 @@ export class ContentEditable extends Component {
disabled={disabled}
data-placeholder={ph}
onInput={handleInput}
onKeyDown={handleKeyDown}
onKeyPress={handleKeyPress}
dangerouslySetInnerHTML={innerHTML()}
></div>
);
Expand Down Expand Up @@ -158,10 +158,10 @@ ContentEditable.propTypes = {
onChange: PropTypes.func,

/**
* onKeyDown handler<br>
* onKeyPress handler<br>
* @param {String} value
*/
onKeyDown: PropTypes.func,
onKeyPress: PropTypes.func,

/** Additional classes. */
className: PropTypes.string,
Expand All @@ -174,7 +174,7 @@ ContentEditable.defaultProps = {
activateAfterChange: false,
autoFocus: false,
onChange: () => {},
onKeyDown: () => {},
onKeyPress: () => {},
};

export default ContentEditable;
4 changes: 2 additions & 2 deletions src/components/MessageInput/MessageInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function MessageInputInner(
}
};

const handleKeyDown = (evt) => {
const handleKeyPress = (evt) => {
if (evt.key === "Enter" && evt.shiftKey === false) {
evt.preventDefault();
send();
Expand Down Expand Up @@ -187,7 +187,7 @@ function MessageInputInner(
className={`${cName}__content-editor`}
disabled={disabled}
placeholder={ph}
onKeyDown={handleKeyDown}
onKeyPress={handleKeyPress}
onChange={handleChange}
activateAfterChange={activateAfterChange}
value={stateValue}
Expand Down

0 comments on commit 2986e2b

Please sign in to comment.