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:
parent
950de7c954
commit
25a8c7ea80
@ -325,6 +325,13 @@ watch(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const additionalLinkProtocols = [
|
||||||
|
'ftp',
|
||||||
|
'git',
|
||||||
|
'obsidian',
|
||||||
|
'notion',
|
||||||
|
]
|
||||||
|
|
||||||
const extensions : Extensions = [
|
const extensions : Extensions = [
|
||||||
// Starterkit:
|
// Starterkit:
|
||||||
Blockquote,
|
Blockquote,
|
||||||
@ -379,7 +386,11 @@ const extensions : Extensions = [
|
|||||||
Underline,
|
Underline,
|
||||||
Link.configure({
|
Link.configure({
|
||||||
openOnClick: false,
|
openOnClick: false,
|
||||||
validate: (href: string) => /^https?:\/\//.test(href),
|
validate: (href: string) => (new RegExp(
|
||||||
|
`^(https?|${additionalLinkProtocols.join('|')}):\\/\\/`,
|
||||||
|
'i',
|
||||||
|
)).test(href),
|
||||||
|
protocols: additionalLinkProtocols,
|
||||||
}),
|
}),
|
||||||
Table.configure({
|
Table.configure({
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user