diff --git a/app/src/plugins/app/_config/quill.util.ts b/app/src/plugins/app/_config/quill.util.ts index f05a829..162c7ab 100644 --- a/app/src/plugins/app/_config/quill.util.ts +++ b/app/src/plugins/app/_config/quill.util.ts @@ -3,22 +3,23 @@ import { Quill } from '@vueup/vue-quill' export function registerQuillUrlSanitizer() { const Link = Quill.import('formats/link') + // Extend the protocol whitelist + Link.PROTOCOL_WHITELIST.push('smb', 'fmp', 'radar', 'rdar', 'sms', '\\') + class CustomLinkSanitizer extends Link { static sanitize(url) { const sanitizedUrl = super.sanitize(url) if (!sanitizedUrl || sanitizedUrl === 'about:blank') return sanitizedUrl - const protocolWhhitelist = ['http', 'https', 'mailto', 'tel', 'radar', 'rdar', 'smb', 'sms'] - const hasWhitelistedProtocol = protocolWhhitelist.some(function(protocol) { - return sanitizedUrl.startsWith(protocol) - }) + const protocolWhitelist = Link.PROTOCOL_WHITELIST + const hasWhitelistedProtocol = protocolWhitelist.some(protocol => sanitizedUrl.startsWith(protocol)) if (hasWhitelistedProtocol) return sanitizedUrl return `https://${sanitizedUrl}` - } + } } - Quill.register(CustomLinkSanitizer, true) + Quill.register('formats/link', CustomLinkSanitizer, true) } \ No newline at end of file