tiptap-react-utils
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

tiptap-react-utils

Here's a sample use of this lib:

    import { Node, NodeViewWrapper } from "@tiptap/react"
    import {getBasicNodeConfiguration, NodeProps} from "tiptap-react-utils"

    class SuperAttributes {
      count: number = 0
    }

    function Super(props: NodeProps<SuperAttributes>) {
      const increase = () => {
        props.updateAttributes({
          count: props.node.attrs.count + 1
        })
      }
      return (
        <NodeViewWrapper>
          <span> {props.node.attrs.count } </span>
          <button onClick={increase}>Increase</button>
        </NodeViewWrapper>
      )
    }


    const SuperNode = Node.create({
      ...getBasicNodeConfiguration("super-node", Super, SuperAttributes),
    })

    export default SuperNode

Package Sidebar

Install

npm i tiptap-react-utils

Weekly Downloads

2

Version

1.0.7

License

MIT

Unpacked Size

3.85 kB

Total Files

4

Last publish

Collaborators

  • kaporos