Trim text coming out of CompositionInput
This commit is contained in:
parent
dd1f9b055f
commit
94dde6f799
1 changed files with 6 additions and 2 deletions
|
@ -245,7 +245,10 @@ export const CompositionInput = ({
|
|||
|
||||
const updateExternalStateListeners = React.useCallback(
|
||||
(newState: EditorState) => {
|
||||
const plainText = newState.getCurrentContent().getPlainText();
|
||||
const plainText = newState
|
||||
.getCurrentContent()
|
||||
.getPlainText()
|
||||
.trim();
|
||||
const cursorBlockKey = newState.getSelection().getStartKey();
|
||||
const cursorBlockIndex = editorStateRef.current
|
||||
.getCurrentContent()
|
||||
|
@ -397,7 +400,8 @@ export const CompositionInput = ({
|
|||
const { current: state } = editorStateRef;
|
||||
const text = state.getCurrentContent().getPlainText();
|
||||
const emojidText = replaceColons(text);
|
||||
onSubmit(emojidText);
|
||||
const trimmedText = emojidText.trim();
|
||||
onSubmit(trimmedText);
|
||||
},
|
||||
[editorStateRef, onSubmit]
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue