From 9404dd30c5bd72861488f23260b08028d8a0c8e5 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 23 Jun 2017 18:19:06 +0100 Subject: [PATCH 1/2] Use for strikeout We've swapped to commonmark, which uses instead of ~~ for strikeout, so make the RTE insert when we apply strikeout. Also, when ~~ is inserted, transform them into for simplicity. This means giving an input of ~~test~~ is effectively the same as giving an input of test. --- src/Markdown.js | 3 +++ src/components/views/rooms/MessageComposerInput.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Markdown.js b/src/Markdown.js index 4a46ce4f24..134520b775 100644 --- a/src/Markdown.js +++ b/src/Markdown.js @@ -62,6 +62,9 @@ function is_multi_line(node) { */ export default class Markdown { constructor(input) { + // Support GH-style strikeout + input = input.replace(/~~(.*?)~~/g, '$1'); + this.input = input; const parser = new commonmark.Parser(); diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 4d7c0f7a80..5ea92d18ce 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -397,7 +397,7 @@ export default class MessageComposerInput extends React.Component { 'bold': (text) => `**${text}**`, 'italic': (text) => `*${text}*`, 'underline': (text) => `_${text}_`, // there's actually no valid underline in Markdown, but *shrug* - 'strike': (text) => `~~${text}~~`, + 'strike': (text) => `${text}`, 'code-block': (text) => `\`\`\`\n${text}\n\`\`\``, 'blockquote': (text) => text.split('\n').map((line) => `> ${line}\n`).join(''), 'unordered-list-item': (text) => text.split('\n').map((line) => `\n- ${line}`).join(''), From d4034105a413bd012ada2c7a56a08c8f3544716a Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 26 Jun 2017 10:10:31 +0100 Subject: [PATCH 2/2] Revert support for ~~gh strikeout~~ --- src/Markdown.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Markdown.js b/src/Markdown.js index 134520b775..4a46ce4f24 100644 --- a/src/Markdown.js +++ b/src/Markdown.js @@ -62,9 +62,6 @@ function is_multi_line(node) { */ export default class Markdown { constructor(input) { - // Support GH-style strikeout - input = input.replace(/~~(.*?)~~/g, '$1'); - this.input = input; const parser = new commonmark.Parser();