mirror of https://github.com/vector-im/riot-web
make slate actually work as a textarea
parent
a2233a48c2
commit
190f6d9483
|
@ -237,18 +237,13 @@ export default class MessageComposerInput extends React.Component {
|
||||||
|
|
||||||
return EditorState.moveFocusToEnd(editorState);
|
return EditorState.moveFocusToEnd(editorState);
|
||||||
*/
|
*/
|
||||||
if (value) {
|
if (value instanceof Value) {
|
||||||
// create from the existing value...
|
return value;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// ...or create a new one.
|
// ...or create a new one.
|
||||||
|
return Plain.deserialize('')
|
||||||
}
|
}
|
||||||
|
|
||||||
return Value.create({
|
|
||||||
document: Document.create({
|
|
||||||
nodes: [],
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
@ -398,7 +393,7 @@ export default class MessageComposerInput extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by Draft to change editor contents
|
// Called by Draft to change editor contents
|
||||||
onEditorContentChanged = (editorState: EditorState) => {
|
onEditorContentChanged = (change: Change) => {
|
||||||
/*
|
/*
|
||||||
editorState = RichText.attachImmutableEntitiesToEmoji(editorState);
|
editorState = RichText.attachImmutableEntitiesToEmoji(editorState);
|
||||||
|
|
||||||
|
@ -458,7 +453,7 @@ export default class MessageComposerInput extends React.Component {
|
||||||
*/
|
*/
|
||||||
/* Since a modification was made, set originalEditorState to null, since newState is now our original */
|
/* Since a modification was made, set originalEditorState to null, since newState is now our original */
|
||||||
this.setState({
|
this.setState({
|
||||||
editorState,
|
editorState: change.value,
|
||||||
originalEditorState: null,
|
originalEditorState: null,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue