Support s tags for strikethrough for Matrix v1.10 (#12604)
* Support s tags for strikethrough for Matrix v1.10 Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update src/Linkify.tsx --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
ccf751d6b8
commit
21ae29c002
4 changed files with 6 additions and 1 deletions
|
@ -124,6 +124,7 @@ const topicSanitizeHtmlParams: IExtendedSanitizeOptions = {
|
||||||
allowedTags: [
|
allowedTags: [
|
||||||
"font", // custom to matrix for IRC-style font coloring
|
"font", // custom to matrix for IRC-style font coloring
|
||||||
"del", // for markdown
|
"del", // for markdown
|
||||||
|
"s",
|
||||||
"a",
|
"a",
|
||||||
"sup",
|
"sup",
|
||||||
"sub",
|
"sub",
|
||||||
|
|
|
@ -147,8 +147,10 @@ export const transformTags: NonNullable<IExtendedSanitizeOptions["transformTags"
|
||||||
|
|
||||||
export const sanitizeHtmlParams: IExtendedSanitizeOptions = {
|
export const sanitizeHtmlParams: IExtendedSanitizeOptions = {
|
||||||
allowedTags: [
|
allowedTags: [
|
||||||
|
// These tags are suggested by the spec https://spec.matrix.org/v1.10/client-server-api/#mroommessage-msgtypes
|
||||||
"font", // custom to matrix for IRC-style font coloring
|
"font", // custom to matrix for IRC-style font coloring
|
||||||
"del", // for markdown
|
"del", // for markdown
|
||||||
|
"s",
|
||||||
"h1",
|
"h1",
|
||||||
"h2",
|
"h2",
|
||||||
"h3",
|
"h3",
|
||||||
|
|
|
@ -22,7 +22,7 @@ import { logger } from "matrix-js-sdk/src/logger";
|
||||||
|
|
||||||
import { linkify } from "./linkify-matrix";
|
import { linkify } from "./linkify-matrix";
|
||||||
|
|
||||||
const ALLOWED_HTML_TAGS = ["sub", "sup", "del", "u", "br", "br/"];
|
const ALLOWED_HTML_TAGS = ["sub", "sup", "del", "s", "u", "br", "br/"];
|
||||||
|
|
||||||
// These types of node are definitely text
|
// These types of node are definitely text
|
||||||
const TEXT_NODES = ["text", "softbreak", "linebreak", "paragraph", "document"];
|
const TEXT_NODES = ["text", "softbreak", "linebreak", "paragraph", "document"];
|
||||||
|
|
|
@ -195,6 +195,8 @@ function parseNode(n: Node, pc: PartCreator, opts: IParseOptions, mkListItem?: (
|
||||||
return [pc.plain("**"), ...parseChildren(n, pc, opts), pc.plain("**")];
|
return [pc.plain("**"), ...parseChildren(n, pc, opts), pc.plain("**")];
|
||||||
case "DEL":
|
case "DEL":
|
||||||
return [pc.plain("<del>"), ...parseChildren(n, pc, opts), pc.plain("</del>")];
|
return [pc.plain("<del>"), ...parseChildren(n, pc, opts), pc.plain("</del>")];
|
||||||
|
case "S":
|
||||||
|
return [pc.plain("<s>"), ...parseChildren(n, pc, opts), pc.plain("</s>")];
|
||||||
case "SUB":
|
case "SUB":
|
||||||
return [pc.plain("<sub>"), ...parseChildren(n, pc, opts), pc.plain("</sub>")];
|
return [pc.plain("<sub>"), ...parseChildren(n, pc, opts), pc.plain("</sub>")];
|
||||||
case "SUP":
|
case "SUP":
|
||||||
|
|
Loading…
Reference in a new issue