mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
Merge branch 'main' of https://bitbucket.org/studiotem/jandl-taskmanager-app into production
This commit is contained in:
commit
650f4dd3ef
1 file changed
+6
-5
@@ -3,16 +3,17 @@ import { Quill } from '@vueup/vue-quill'
|
|||||||
export function registerQuillUrlSanitizer() {
|
export function registerQuillUrlSanitizer() {
|
||||||
const Link = Quill.import('formats/link')
|
const Link = Quill.import('formats/link')
|
||||||
|
|
||||||
|
// Extend the protocol whitelist
|
||||||
|
Link.PROTOCOL_WHITELIST.push('smb', 'fmp', 'radar', 'rdar', 'sms', '\\')
|
||||||
|
|
||||||
class CustomLinkSanitizer extends Link {
|
class CustomLinkSanitizer extends Link {
|
||||||
static sanitize(url) {
|
static sanitize(url) {
|
||||||
const sanitizedUrl = super.sanitize(url)
|
const sanitizedUrl = super.sanitize(url)
|
||||||
|
|
||||||
if (!sanitizedUrl || sanitizedUrl === 'about:blank') return sanitizedUrl
|
if (!sanitizedUrl || sanitizedUrl === 'about:blank') return sanitizedUrl
|
||||||
|
|
||||||
const protocolWhhitelist = ['http', 'https', 'mailto', 'tel', 'radar', 'rdar', 'smb', 'sms']
|
const protocolWhitelist = Link.PROTOCOL_WHITELIST
|
||||||
const hasWhitelistedProtocol = protocolWhhitelist.some(function(protocol) {
|
const hasWhitelistedProtocol = protocolWhitelist.some(protocol => sanitizedUrl.startsWith(protocol))
|
||||||
return sanitizedUrl.startsWith(protocol)
|
|
||||||
})
|
|
||||||
|
|
||||||
if (hasWhitelistedProtocol) return sanitizedUrl
|
if (hasWhitelistedProtocol) return sanitizedUrl
|
||||||
|
|
||||||
@@ -20,5 +21,5 @@ export function registerQuillUrlSanitizer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Quill.register(CustomLinkSanitizer, true)
|
Quill.register('formats/link', CustomLinkSanitizer, true)
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user