diff --git a/docs/src/demos/Examples/Default/React/index-nope.jsx b/docs/src/demos/Examples/Default/React/index-nope.jsx index d654737d..171c75a0 100644 --- a/docs/src/demos/Examples/Default/React/index-nope.jsx +++ b/docs/src/demos/Examples/Default/React/index-nope.jsx @@ -1,143 +1,51 @@ -import * as React from 'react' -import ReactDOM from 'react-dom' -import { EditorState } from 'prosemirror-state' -import { EditorView } from 'prosemirror-view' -import { Node, Schema } from 'prosemirror-model' -// import applyDevTools from 'prosemirror-dev-tools' -// import styled from 'styled-components' +// export default () => { +// const editor = useEditor({ +// content: '
hello react
', +// onTransaction() { +// // console.log('update', this) +// }, +// extensions: [ +// ...defaultExtensions(), +// // Paragraph.extend({ +// // addNodeView() { +// // return reactNodeView(() => { +// // // useEffect(() => { +// // // console.log('effect') +// // // }, []); -// Here we have the (too simple) React component which -// we'll be rendering content into. -// -class Underlined extends React.Component { - constructor(props) { - super(props) - this.hole = React.createRef() - } - // We'll put the content into what we render using - // this function, which appends a given node to - // a ref HTMLElement, if present. - // - append(node) { - if (this.hole) { - this.hole.current.appendChild(node) - } - } +// // return ( +// //+// // +// //
+// // ) +// // }) +// // return ReactNodeViewRenderer(() => { +// // // useEffect(() => { +// // // console.log('effect') +// // // }, []); - render() { - // Just really wanted to prove I could get React AND - // styled-component abilities at the same time. - // - // const UnderlinedText = styled.p` - // text-decoration: underline; - // ` +// // return ( +// //+// // +// //
+// // ) +// // }) +// // }, +// // }), +// ] +// }) - // The styled components version is basically just a wrapper to do SCSS styling. - // Questionable if it's even needed for such simple styling and because you can't clearly see the - // DOM structure from the code (hence making `& > ${Component}` selectors quite unintuitive) - // return - return - } -} - -// This class is our actual interactor for ProseMirror itself. -// It glues DOM rendering, React, and ProseMirror nodes together. -// -class Underline { - constructor(node) { - // We'll use this to access our Underlined component's - // instance methods. - // - this.ref = React.createRef() - - // Here, we'll provide a container to render React into. - // Coincidentally, this is where ProseMirror will put its - // generated contentDOM. React will throw out that content - // once rendered, and at the same time we'll append it into - // the component tree, like a fancy shell game. This isn't - // obvious to the user, but would it be more obvious on an - // expensive render? - // - this.dom = document.createElement('span') - - // Finally, we provide an element to render content into. - // We will be moving this node around as we need to. - // - this.contentDOM = document.createElement('span') - - // Better way of doing this would be portals https://reactjs.org/docs/portals.html - ReactDOM.render( -hello react
', extensions: [ ...defaultExtensions(), - Paragraph.extend({ - addNodeView() { - return reactNodeView(() => { - // useEffect(() => { - // console.log('effect') - // }, []); - - return ( -- -
- ) - }) - return ReactNodeViewRenderer(() => { - // useEffect(() => { - // console.log('effect') - // }, []); - - return ( -- -
- ) - }) - }, - }), - ] + ], + content: ` ++ this is a basic basic example of tiptap. Sure, there are all kind of basic text styles you’d probably expect from a text editor. But wait until you see the lists: +
++ Isn’t that great? And all of that is editable. But wait, there’s more. Let’s try a code block: +
+body {
+ display: none;
+}
+ + I know, I know, this is impressive. It’s only the tip of the iceberg though. Give it a try and click a little bit around. Don’t forget to check the other examples too. +
++ Wow, that’s amazing. Good work, boy! 👏 ++ `, }) return ( -
+ — Mom +