1
0
Fork 0

Support mailto for custom markup

This commit is contained in:
Chocobozzz 2023-01-19 14:27:51 +01:00
parent 32fde390f4
commit a4927884b2
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 11 additions and 5 deletions

View file

@ -64,8 +64,8 @@ export class MarkdownService {
textMarkdownToHTML (options: { textMarkdownToHTML (options: {
markdown: string markdown: string
withHtml?: boolean withHtml?: boolean // default false
withEmoji?: boolean withEmoji?: boolean // default false
}) { }) {
const { markdown, withHtml = false, withEmoji = false } = options const { markdown, withHtml = false, withEmoji = false } = options
@ -76,8 +76,8 @@ export class MarkdownService {
enhancedMarkdownToHTML (options: { enhancedMarkdownToHTML (options: {
markdown: string markdown: string
withHtml?: boolean withHtml?: boolean // default false
withEmoji?: boolean withEmoji?: boolean // default false
}) { }) {
const { markdown, withHtml = false, withEmoji = false } = options const { markdown, withHtml = false, withEmoji = false } = options
@ -99,6 +99,8 @@ export class MarkdownService {
return this.render({ name: 'customPageMarkdownIt', markdown, withEmoji: true, additionalAllowedTags }) return this.render({ name: 'customPageMarkdownIt', markdown, withEmoji: true, additionalAllowedTags })
} }
// ---------------------------------------------------------------------------
processVideoTimestamps (videoShortUUID: string, html: string) { processVideoTimestamps (videoShortUUID: string, html: string) {
return html.replace(/((\d{1,2}):)?(\d{1,2}):(\d{1,2})/g, function (str, _, h, m, s) { return html.replace(/((\d{1,2}):)?(\d{1,2}):(\d{1,2})/g, function (str, _, h, m, s) {
const t = (3600 * +(h || 0)) + (60 * +(m || 0)) + (+(s || 0)) const t = (3600 * +(h || 0)) + (60 * +(m || 0)) + (+(s || 0))

View file

@ -38,7 +38,11 @@ export function getCustomMarkupSanitizeOptions (additionalAllowedTags: string[]
...additionalAllowedTags, ...additionalAllowedTags,
'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img' 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img'
], ],
allowedSchemes: base.allowedSchemes, allowedSchemes: [
...base.allowedSchemes,
'mailto'
],
allowedAttributes: { allowedAttributes: {
...base.allowedAttributes, ...base.allowedAttributes,