mirror of https://github.com/vector-im/riot-web
parent
f0f20beae0
commit
802ec1169f
|
@ -404,11 +404,13 @@ export default class MessageComposerInput extends React.Component {
|
||||||
|
|
||||||
enableRichtext(enabled: boolean) {
|
enableRichtext(enabled: boolean) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
let html = mdownToHtml(this.state.editorState.getCurrentContent().getPlainText());
|
const html = mdownToHtml(this.state.editorState.getCurrentContent().getPlainText());
|
||||||
this.setEditorState(this.createEditorState(enabled, RichText.HTMLtoContentState(html)));
|
const contentState = RichText.HTMLtoContentState(html);
|
||||||
|
this.setEditorState(this.createEditorState(enabled, contentState));
|
||||||
} else {
|
} else {
|
||||||
let markdown = stateToMarkdown(this.state.editorState.getCurrentContent()),
|
let markdown = stateToMarkdown(this.state.editorState.getCurrentContent());
|
||||||
contentState = ContentState.createFromText(markdown);
|
markdown = markdown.substring(0, markdown.length - 1); // stateToMarkdown tacks on an extra newline (?!?)
|
||||||
|
const contentState = ContentState.createFromText(markdown);
|
||||||
this.setEditorState(this.createEditorState(enabled, contentState));
|
this.setEditorState(this.createEditorState(enabled, contentState));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue