pass full formattedEvent to event component

master
f0x 6 years ago
parent 738dbbc0b1
commit e297ee04b6

@ -24,7 +24,6 @@ let Event = create({
let state = ""
let reply = ""
let element = "unsupported event: " + event.type
let parsedBody
if (event.local) {
state = " local"
@ -32,9 +31,7 @@ let Event = create({
if (event.type == "m.room.message") {
let msgtype = event.content.msgtype;
let formattedEvent = parseEvent(event)
parsedBody = formattedEvent.body
let parsedReply = formattedEvent.parsedReply
if (parsedReply.isReply) {
@ -60,7 +57,7 @@ let Event = create({
</div>
)
}
element = React.createElement(defaultValue(elements[msgtype], elements["m.text"]), {body: parsedBody, event: event, client: this.props.client})
element = React.createElement(defaultValue(elements[msgtype], elements["m.text"]), {formattedEvent: formattedEvent, event: event, client: this.props.client})
}
return (

@ -11,19 +11,19 @@ let Event = create({
render: function() {
let event = this.props.event
let formattedEvent = this.props.formattedEvent
let eventBody
if (event.content.format == "org.matrix.custom.html") {
//let html = riot.sanitize(event.content.formatted_body)
if (formattedEvent.html) {
eventBody = <div
className={this.props.nested ? "nested" : "body"}
dangerouslySetInnerHTML={{__html: this.props.body}}
className="body"
dangerouslySetInnerHTML={{__html: formattedEvent.body}}
/>
} else {
eventBody =
<div className={this.props.nested ? "nested" : "body"}>
{this.props.body}
<div className="body">
{formattedEvent.body}
</div>
}

Loading…
Cancel
Save