Files
tiptap/demos/src/Marks/TextStyle/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

23 lines
770 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
import TextStyle from '@tiptap/extension-text-style'
import { EditorContent, useEditor } from '@tiptap/react'
import React from 'react'
export default () => {
const editor = useEditor({
extensions: [Document, Paragraph, Text, TextStyle],
content: `
<p><span>This has a &lt;span&gt; tag without a style attribute, so its thrown away.</span></p>
<p><span style="">But this one is wrapped in a &lt;span&gt; tag with an inline style attribute, so its kept - even if its empty for now.</span></p>
`,
})
if (!editor) {
return null
}
return <EditorContent editor={editor} />
}