feat(extension-link): add validate option to link extension

#2779
This commit is contained in:
Dominik Biedebach
2022-05-13 11:36:46 +02:00
committed by Dominik
parent ccc37d5f24
commit 23e67adfa7
10 changed files with 276 additions and 9 deletions

View File

@@ -64,6 +64,18 @@ Link.configure({
})
```
### validate
A function that validates every autolinked link. If it exists, it will be called with the link href as argument. If it returns `false`, the link will be removed.
Can be used to set rules for example excluding or including certain domains, tlds, etc.
```js
// only autolink urls with a protocol
Link.configure({
validate: href => /^https?:\/\//.test(href),
})
```
## Commands
### setLink()