Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit dbbcabf

Browse files
committed
switch from asymmetrical fallback form to a cleaner one mx-reply
Signed-off-by: Michael Telatynski <[email protected]>
1 parent a7f9f7a commit dbbcabf

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

src/HtmlUtils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ const sanitizeHtmlParams = {
186186
],
187187
allowedAttributes: {
188188
// custom ones first:
189-
blockquote: ['data-mx-reply'], // used to allow explicit removal of a reply fallback blockquote, value ignored
190189
font: ['color', 'data-mx-bg-color', 'data-mx-color', 'style'], // custom to matrix
191190
span: ['data-mx-bg-color', 'data-mx-color', 'style'], // custom to matrix
192191
a: ['href', 'name', 'target', 'rel'], // remote target: custom to matrix

src/components/views/elements/ReplyThread.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default class ReplyThread extends React.Component {
8181

8282
// Part of Replies fallback support
8383
static stripHTMLReply(html) {
84-
return html.replace(/^<blockquote data-mx-reply>[\s\S]+?<!--end-mx-reply--><\/blockquote>/, '');
84+
return html.replace(/^<mx-reply>[\s\S]+?<\/mx-reply>/, '');
8585
}
8686

8787
// Part of Replies fallback support
@@ -102,8 +102,8 @@ export default class ReplyThread extends React.Component {
102102
switch (ev.getContent().msgtype) {
103103
case 'm.text':
104104
case 'm.notice': {
105-
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
106-
+ `<br>${html || body}<!--end-mx-reply--></blockquote>`;
105+
html = `<mx-reply><blockquote><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
106+
+ `<br>${html || body}</blockquote></mx-reply>`;
107107
const lines = body.trim().split('\n');
108108
if (lines.length > 0) {
109109
lines[0] = `<${mxid}> ${lines[0]}`;
@@ -112,28 +112,28 @@ export default class ReplyThread extends React.Component {
112112
break;
113113
}
114114
case 'm.image':
115-
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
116-
+ `<br>sent an image.<!--end-mx-reply--></blockquote>`;
115+
html = `<mx-reply><blockquote><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
116+
+ `<br>sent an image.</blockquote></mx-reply>`;
117117
body = `> <${mxid}> sent an image.\n\n`;
118118
break;
119119
case 'm.video':
120-
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
121-
+ `<br>sent a video.<!--end-mx-reply--></blockquote>`;
120+
html = `<mx-reply><blockquote><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
121+
+ `<br>sent a video.</blockquote></mx-reply>`;
122122
body = `> <${mxid}> sent a video.\n\n`;
123123
break;
124124
case 'm.audio':
125-
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
126-
+ `<br>sent an audio file.<!--end-mx-reply--></blockquote>`;
125+
html = `<mx-reply><blockquote><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
126+
+ `<br>sent an audio file.</blockquote></mx-reply>`;
127127
body = `> <${mxid}> sent an audio file.\n\n`;
128128
break;
129129
case 'm.file':
130-
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
131-
+ `<br>sent a file.<!--end-mx-reply--></blockquote>`;
130+
html = `<mx-reply><blockquote><a href="${evLink}">In reply to</a> <a href="${userLink}">${mxid}</a>`
131+
+ `<br>sent a file.</blockquote></mx-reply>`;
132132
body = `> <${mxid}> sent a file.\n\n`;
133133
break;
134134
case 'm.emote': {
135-
html = `<blockquote data-mx-reply><a href="${evLink}">In reply to</a> * `
136-
+ `<a href="${userLink}">${mxid}</a><br>${html || body}<!--end-mx-reply--></blockquote>`;
135+
html = `<mx-reply><blockquote><a href="${evLink}">In reply to</a> * `
136+
+ `<a href="${userLink}">${mxid}</a><br>${html || body}</blockquote></mx-reply>`;
137137
const lines = body.trim().split('\n');
138138
if (lines.length > 0) {
139139
lines[0] = `* <${mxid}> ${lines[0]}`;

0 commit comments

Comments
 (0)