Merge pull request #3108 from matrix-org/bwindels/edit-room-notif-pill

Support @room pills while editing
This commit is contained in:
Bruno Windels 2019-06-18 16:43:14 +00:00 committed by GitHub
commit 63fba611c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 136 additions and 93 deletions

View file

@ -233,7 +233,7 @@ export default class MessageEditor extends React.Component {
parts = editState.getSerializedParts().map(p => partCreator.deserializePart(p));
} else {
// otherwise, parse the body of the event
parts = parseEvent(editState.getEvent(), room, this.context.matrixClient);
parts = parseEvent(editState.getEvent(), partCreator);
}
return new EditorModel(

View file

@ -214,7 +214,13 @@ module.exports = React.createClass({
// update the current node with one that's now taken its place
node = pillContainer;
}
} else if (node.nodeType === Node.TEXT_NODE) {
} else if (
node.nodeType === Node.TEXT_NODE &&
// as applying pills happens outside of react, make sure we're not doubly
// applying @room pills here, as a rerender with the same content won't touch the DOM
// to clear the pills from the last run of pillifyLinks
!node.parentElement.classList.contains("mx_AtRoomPill")
) {
const Pill = sdk.getComponent('elements.Pill');
let currentTextNode = node;