Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit d949433

Browse files
mrkevfacebook-github-bot
authored andcommitted
Use object shorthand in DraftEditorCompositionHandler
Summary: We were getting lint errors. This shouldn't change behaviour at all. Reviewed By: claudiopro Differential Revision: D22360887 fbshipit-source-id: 6d5c3b62d64ff69c02788de570ddebfd860dabc6
1 parent 3be4d37 commit d949433

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/component/handlers/composition/DraftEditorCompositionHandler.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const DraftEditorCompositionHandler = {
6262
* A `compositionstart` event has fired while we're still in composition
6363
* mode. Continue the current composition session to prevent a re-render.
6464
*/
65-
onCompositionStart: function(editor: DraftEditor): void {
65+
onCompositionStart(editor: DraftEditor): void {
6666
stillComposing = true;
6767
startDOMObserver(editor);
6868
},
@@ -81,7 +81,7 @@ const DraftEditorCompositionHandler = {
8181
* twice could break the DOM, we only use the first event. Example: Arabic
8282
* Google Input Tools on Windows 8.1 fires `compositionend` three times.
8383
*/
84-
onCompositionEnd: function(editor: DraftEditor): void {
84+
onCompositionEnd(editor: DraftEditor): void {
8585
resolved = false;
8686
stillComposing = false;
8787
setTimeout(() => {
@@ -98,7 +98,7 @@ const DraftEditorCompositionHandler = {
9898
* the arrow keys are used to commit, prevent default so that the cursor
9999
* doesn't move, otherwise it will jump back noticeably on re-render.
100100
*/
101-
onKeyDown: function(editor: DraftEditor, e: SyntheticKeyboardEvent<>): void {
101+
onKeyDown(editor: DraftEditor, e: SyntheticKeyboardEvent<>): void {
102102
if (!stillComposing) {
103103
// If a keydown event is received after compositionend but before the
104104
// 20ms timer expires (ex: type option-E then backspace, or type A then
@@ -119,7 +119,7 @@ const DraftEditorCompositionHandler = {
119119
* characters that we do not want. `preventDefault` allows the composition
120120
* to be committed while preventing the extra characters.
121121
*/
122-
onKeyPress: function(editor: DraftEditor, e: SyntheticKeyboardEvent<>): void {
122+
onKeyPress(_editor: DraftEditor, e: SyntheticKeyboardEvent<>): void {
123123
if (e.which === Keys.RETURN) {
124124
e.preventDefault();
125125
}
@@ -140,7 +140,7 @@ const DraftEditorCompositionHandler = {
140140
* Resetting innerHTML will move focus to the beginning of the editor,
141141
* so we update to force it back to the correct place.
142142
*/
143-
resolveComposition: function(editor: DraftEditor): void {
143+
resolveComposition(editor: DraftEditor): void {
144144
if (stillComposing) {
145145
return;
146146
}

0 commit comments

Comments
 (0)