mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
[quill-editor] smb protocol added for macOS
This commit is contained in:
1 parent
ef8ebfd619
commit
1f6844d42b
1 file changed
+6
-5
@@ -3,16 +3,17 @@ 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
|
||||
|
||||
@@ -20,5 +21,5 @@ export function registerQuillUrlSanitizer() {
|
||||
}
|
||||
}
|
||||
|
||||
Quill.register(CustomLinkSanitizer, true)
|
||||
Quill.register('formats/link', CustomLinkSanitizer, true)
|
||||
}
|
||||
Reference in new issue
Block a user