From 88dddb628dcd72e895261f786ae9c000d8484346 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 18 Jul 2018 11:50:13 +0100 Subject: [PATCH] in MD mode forgo any Magic Rich Pasting conversion as its confusing Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/MessageComposerInput.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 16551f8446..af342a0b99 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -977,19 +977,20 @@ export default class MessageComposerInput extends React.Component { case 'files': return this.props.onFilesPasted(transfer.files); case 'html': { - // FIXME: https://github.com/ianstormtaylor/slate/issues/1497 means - // that we will silently discard nested blocks (e.g. nested lists) :( - const fragment = this.html.deserialize(transfer.html); if (this.state.isRichTextEnabled) { + // FIXME: https://github.com/ianstormtaylor/slate/issues/1497 means + // that we will silently discard nested blocks (e.g. nested lists) :( + const fragment = this.html.deserialize(transfer.html); return change .setOperationFlag("skip", false) .setOperationFlag("merge", false) .insertFragment(fragment.document); } else { + // in MD mode we don't want the rich content pasted as the magic was annoying people so paste plain return change .setOperationFlag("skip", false) .setOperationFlag("merge", false) - .insertText(this.md.serialize(fragment)); + .insertText(transfer.text); } } case 'text':