Every extension
autolink
URLs become links as they are typed and as they are pasted.
Typing: once a space follows something that looks like a URL, the URL gets the link mark and the space is inserted as usual. Pasting a URL over a selection links the selection to it; pasting one with nothing selected inserts it already linked. Needs the `link` mark in the editor.
Adding it
import { createEditor, document, paragraph, text, autolink } from '@matrajs/core'
const editor = createEditor({
extensions: [document, paragraph, text, autolink({ … })],
element: document.querySelector('#editor'),
})
There is no separate package · autolink is already in @matrajs/core, and an extension you do not import is not in your bundle. document, paragraph and text are the floor every document needs.
Options
| Field | Type | |
|---|---|---|
onPaste | boolean | Turn a pasted URL into a link, or link the selection to it. Default true. |
onType | boolean | Turn a URL into a link once a space is typed after it. Default true. |