From d73f547f556d98013d76fefcc95069f321015e4c Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 15 May 2019 15:55:03 +0100 Subject: [PATCH] reapply pills, link preview, code highlighting, ... after edit --- src/components/views/messages/TextualBody.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index deb3c5cc0f..34769c060f 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -88,7 +88,10 @@ module.exports = React.createClass({ componentDidMount: function() { this._unmounted = false; + this._applyFormatting(); + }, + _applyFormatting() { // pillifyLinks BEFORE linkifyElement because plain room/user URLs in the composer // are still sent as plaintext URLs. If these are ever pillified in the composer, // we should be pillify them here by doing the linkifying BEFORE the pillifying. @@ -123,7 +126,11 @@ module.exports = React.createClass({ } }, - componentDidUpdate: function() { + componentDidUpdate: function(prevProps) { + const messageWasEdited = prevProps.replacingEventId !== this.props.replacingEventId; + if (messageWasEdited) { + this._applyFormatting(); + } this.calculateUrlPreview(); },