Files
tiptap/demos/src/Examples/AutolinkValidation/React/index.jsx
Dominik 8c6751f0c6 add precommit hook for linting and automatic eslint fixes + update eslint packages (#2862)
* chore: add precommit hook for eslint fixes, fix linting issues
* chore: add eslint import sort plugin
2022-06-08 14:10:25 +02:00

32 lines
693 B
JavaScript

import './styles.scss'
import Link from '@tiptap/extension-link'
import { EditorContent, useEditor } from '@tiptap/react'
import StarterKit from '@tiptap/starter-kit'
import React from 'react'
export default () => {
const editor = useEditor({
extensions: [
StarterKit,
Link.configure({
validate: link => /^https?:\/\//.test(link),
}),
],
content: `
<p>Hey! Try to type in url with and without a http/s protocol. - Links without a protocol should not get auto linked</p>
`,
editorProps: {
attributes: {
spellcheck: 'false',
},
},
})
return (
<div>
<EditorContent editor={editor} />
</div>
)
}