Changed markdown renderer to only parse emoticons twice
Этот коммит содержится в:
@@ -11,6 +11,7 @@ export class MattermostMarkdownRenderer extends marked.Renderer {
|
|||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
this.heading = this.heading.bind(this);
|
this.heading = this.heading.bind(this);
|
||||||
|
this.paragraph = this.paragraph.bind(this);
|
||||||
this.text = this.text.bind(this);
|
this.text = this.text.bind(this);
|
||||||
|
|
||||||
this.formattingOptions = formattingOptions;
|
this.formattingOptions = formattingOptions;
|
||||||
@@ -53,7 +54,11 @@ export class MattermostMarkdownRenderer extends marked.Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
paragraph(text) {
|
paragraph(text) {
|
||||||
let outText = TextFormatting.doFormatText(text, this.options);
|
let outText = text;
|
||||||
|
|
||||||
|
if (!('emoticons' in this.options) || this.options.emoticon) {
|
||||||
|
outText = TextFormatting.doFormatEmoticons(text);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.formattingOptions.singleline) {
|
if (this.formattingOptions.singleline) {
|
||||||
return `<p class="markdown__paragraph-inline">${outText}</p>`;
|
return `<p class="markdown__paragraph-inline">${outText}</p>`;
|
||||||
|
|||||||
@@ -69,6 +69,15 @@ export function doFormatText(text, options) {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function doFormatEmoticons(text) {
|
||||||
|
const tokens = new Map();
|
||||||
|
|
||||||
|
let output = Emoticons.handleEmoticons(text, tokens);
|
||||||
|
output = replaceTokens(output, tokens);
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
export function sanitizeHtml(text) {
|
export function sanitizeHtml(text) {
|
||||||
let output = text;
|
let output = text;
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user