1
0

feat(editor): support custom protocol for links

Resolves https://github.com/go-vikunja/vikunja/issues/306

(cherry picked from commit e2a87036e070305291fd7ac1cfc9fe02c847b697)
This commit is contained in:
kolaente 2024-08-12 11:42:43 +02:00
parent 950de7c954
commit 25a8c7ea80
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B

View File

@ -325,6 +325,13 @@ watch(
},
)
const additionalLinkProtocols = [
'ftp',
'git',
'obsidian',
'notion',
]
const extensions : Extensions = [
// Starterkit:
Blockquote,
@ -379,7 +386,11 @@ const extensions : Extensions = [
Underline,
Link.configure({
openOnClick: false,
validate: (href: string) => /^https?:\/\//.test(href),
validate: (href: string) => (new RegExp(
`^(https?|${additionalLinkProtocols.join('|')}):\\/\\/`,
'i',
)).test(href),
protocols: additionalLinkProtocols,
}),
Table.configure({
resizable: true,