diff --git a/demos/src/Marks/TextStyle/React/index.html b/demos/src/Marks/TextStyle/React/index.html new file mode 100644 index 00000000..78b272d2 --- /dev/null +++ b/demos/src/Marks/TextStyle/React/index.html @@ -0,0 +1,15 @@ + + +
+ + + + + + + + diff --git a/demos/src/Marks/TextStyle/React/index.jsx b/demos/src/Marks/TextStyle/React/index.jsx new file mode 100644 index 00000000..6f892474 --- /dev/null +++ b/demos/src/Marks/TextStyle/React/index.jsx @@ -0,0 +1,22 @@ +import React from 'react' +import { useEditor, EditorContent } from '@tiptap/react' +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' + +export default () => { + const editor = useEditor({ + extensions: [Document, Paragraph, Text, TextStyle], + content: ` +This has a <span> tag without a style attribute, so it’s thrown away.
+But this one is wrapped in a <span> tag with an inline style attribute, so it’s kept - even if it’s empty for now.
+ `, + }) + + if (!editor) { + return null + } + + return