From 4b969634083bb370da4f9457099fe6a03b8eb541 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 13 Jul 2017 13:27:49 +0100 Subject: [PATCH] Send HTML if there are any entities present in the composer This is so that pasted HTML links that are represented as entities are sent as HTML. --- src/components/views/rooms/MessageComposerInput.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 8ba5289eb4..5149d5a790 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -591,6 +591,14 @@ export default class MessageComposerInput extends React.Component { } }); } + if (!shouldSendHTML) { + const hasAnEntity = blocks.some((block) => { + return block.getCharacterList().filter((c) => { + return c.getEntity(); + }).size > 0; + }); + shouldSendHTML = hasAnEntity; + } if (shouldSendHTML) { contentHTML = HtmlUtils.processHtmlForSending( RichText.contentStateToHTML(contentState),