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

Commit 14349f1

Browse files
Mukesh Sonifacebook-github-bot
Mukesh Soni
authored andcommitted
updated function description for onEditInput event handler function (#2132)
Summary: Fixes #1085 Updated the comment describing the `onEditInput` event handler function. Pull Request resolved: #2132 Reviewed By: mitermayer Differential Revision: D16545276 Pulled By: mrkev fbshipit-source-id: 4f2f4263f9ee63d8c468f8f07ff0b30d9793fccb
1 parent 85aa3a3 commit 14349f1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/component/handlers/edit/editOnInput.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,18 @@ function onInputType(inputType: string, editorState: EditorState): EditorState {
3636
}
3737

3838
/**
39-
* This function is intended to handle spellcheck and autocorrect changes,
39+
* This function serves two purposes
40+
*
41+
* 1. To update the editorState and call onChange method with the new
42+
* editorState. This editorState is calculated in editOnBeforeInput but the
43+
* onChange method is not called with the new state until this method does it.
44+
* It is done to handle a specific case where certain character inputs might
45+
* be replaced with something else. E.g. snippets ('rc' might be replaced
46+
* with boilerplate code for react component). More information on the
47+
* exact problem can be found here -
48+
* https://github.com/facebook/draft-js/commit/07892ba479bd4dfc6afd1e0ed179aaf51cd138b1
49+
*
50+
* 2. intended to handle spellcheck and autocorrect changes,
4051
* which occur in the DOM natively without any opportunity to observe or
4152
* interpret the changes before they occur.
4253
*

0 commit comments

Comments
 (0)