From 72c1725f98700aa792db3259fc5120a15382766f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 21 May 2019 16:56:05 +0200 Subject: [PATCH 1/3] this is already done as part of _applyFormatting --- src/components/views/messages/TextualBody.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index 5356572bb9..cd12c70f85 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -136,7 +136,6 @@ module.exports = React.createClass({ if (messageWasEdited || stoppedEditing) { this._applyFormatting(); } - this.calculateUrlPreview(); } }, From 1a5bcb49087591f9133dc31c7ff366bb1a52bd88 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 21 May 2019 16:56:26 +0200 Subject: [PATCH 2/3] don't need this as we prevent unneeded updates in shouldComponentUpdate --- src/components/views/messages/TextualBody.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index cd12c70f85..91a34fdfc5 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -161,7 +161,7 @@ module.exports = React.createClass({ calculateUrlPreview: function() { //console.log("calculateUrlPreview: ShowUrlPreview for %s is %s", this.props.mxEvent.getId(), this.props.showUrlPreview); - if (this.props.showUrlPreview && !this.state.links.length) { + if (this.props.showUrlPreview) { let links = this.findLinks(this.refs.content.children); if (links.length) { // de-dup the links (but preserve ordering) From 6b1134bdf0847b41e57b40f00ea060c9c2d5637e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 22 May 2019 16:16:32 +0200 Subject: [PATCH 3/3] add matrix foundation copyright header --- src/components/views/elements/MessageEditor.js | 1 + src/components/views/messages/TextualBody.js | 1 + src/editor/autocomplete.js | 1 + src/editor/caret.js | 1 + src/editor/deserialize.js | 1 + src/editor/diff.js | 1 + src/editor/dom.js | 1 + src/editor/model.js | 1 + src/editor/parts.js | 1 + src/editor/render.js | 1 + src/editor/serialize.js | 17 +++++++++++++++++ 11 files changed, 27 insertions(+) diff --git a/src/components/views/elements/MessageEditor.js b/src/components/views/elements/MessageEditor.js index 0c249d067b..7c11c25fd6 100644 --- a/src/components/views/elements/MessageEditor.js +++ b/src/components/views/elements/MessageEditor.js @@ -1,5 +1,6 @@ /* Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index 91a34fdfc5..0af863c741 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -1,6 +1,7 @@ /* Copyright 2015, 2016 OpenMarket Ltd Copyright 2017 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/editor/autocomplete.js b/src/editor/autocomplete.js index d2f73b1dff..3de2bfad9b 100644 --- a/src/editor/autocomplete.js +++ b/src/editor/autocomplete.js @@ -1,5 +1,6 @@ /* Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/editor/caret.js b/src/editor/caret.js index 3a784aa8eb..974c8802a4 100644 --- a/src/editor/caret.js +++ b/src/editor/caret.js @@ -1,5 +1,6 @@ /* Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/editor/deserialize.js b/src/editor/deserialize.js index a7f28badb1..f5fe17e910 100644 --- a/src/editor/deserialize.js +++ b/src/editor/deserialize.js @@ -1,5 +1,6 @@ /* Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/editor/diff.js b/src/editor/diff.js index 6dc8b746e4..2c82e22793 100644 --- a/src/editor/diff.js +++ b/src/editor/diff.js @@ -1,5 +1,6 @@ /* Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/editor/dom.js b/src/editor/dom.js index 0899fd25b3..ffdb8bed68 100644 --- a/src/editor/dom.js +++ b/src/editor/dom.js @@ -1,5 +1,6 @@ /* Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/editor/model.js b/src/editor/model.js index 13066897b9..6b9c57a23c 100644 --- a/src/editor/model.js +++ b/src/editor/model.js @@ -1,5 +1,6 @@ /* Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/editor/parts.js b/src/editor/parts.js index bf792b1ab9..de23d5bef9 100644 --- a/src/editor/parts.js +++ b/src/editor/parts.js @@ -1,5 +1,6 @@ /* Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/editor/render.js b/src/editor/render.js index abc5d42fa1..caea18e3ca 100644 --- a/src/editor/render.js +++ b/src/editor/render.js @@ -1,5 +1,6 @@ /* Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/editor/serialize.js b/src/editor/serialize.js index 57cc79b375..1724e4a2b7 100644 --- a/src/editor/serialize.js +++ b/src/editor/serialize.js @@ -1,3 +1,20 @@ +/* +Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + export function htmlSerialize(model) { return model.parts.reduce((html, part) => { switch (part.type) {