Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

[FIX] Rocket.Chat 3.0.12 Livechat issue about Korean IME #403 #538

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/components/Composer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,17 @@ const replaceCaret = (el) => {
}
};

let inputLock = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you implement a global variable rather than an internal state variable?


export class Composer extends Component {
handleRef = (el) => {
this.el = el;
}

handleInput = (onChange) => () => {
onChange && onChange(this.el.innerText);
if (!inputLock) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!inputLock) {
if (inputLock) {
return;
}
onChange && onChange(this.el.innerText);

onChange && onChange(this.el.innerText);
}
}

handleKeypress = (onSubmit) => (event) => {
Expand Down Expand Up @@ -246,6 +250,16 @@ export class Composer extends Component {
onClick: this.handleClick,
}
)}

oncompositionstart={(e)=>{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
oncompositionstart={(e)=>{
onCompositionStart={(e)=>{

Use camelCase to write event names: https://reactjs.org/docs/events.html#composition-events

inputLock = true;
}}

oncompositionend={(e)=>{
inputLock = false;
onChange && onChange(this.el.innerText);
}}

className={createClassName(styles, 'composer__input')}
/>
{post}
Expand Down