Tiptap: Community Extensions

Created on 1 Sep 2020  Â·  6Comments  Â·  Source: ueberdosis/tiptap

Hi everyone!

I’ve seen a ton of helpful Gists with custom extensions for tiptap. It’s amazing what you all come up with! 🥰

Unfortunately, we don’t have the capabilities to maintain all of them in the core packages, but it’s sad to see those gems hidden in some Gists. What if you - the community - could easily provide those as separate npm packages?

Advantages of packages

  • New extensions can be added without a need for approval
  • Extensions can be updated and improved by everyone
  • You can come up with extensions we don’t even understand (đź‘‹ Math integration)
  • There is more room for “experimental” extensions, that aren’t stable enough for the core package
  • We can have multiple flavors of extensions (e. g. an Image node including the Upload to S3 mechanic)

Proof of Concept

I built a tiny proof of concept for superscript and subscript, see here:
https://github.com/hanspagel/tiptap-extension-superscript
https://github.com/hanspagel/tiptap-extension-subscript

Usage:

$ yarn add tiptap-extension-superscript
import { Superscript } from 'tiptap-extension-superscript'

new Editor({
  extensions: [
    new Superscript(),
  ],
})

Examples of community Gists, code snippets, PRs and ideas

Not needed with tiptap v2

Roadmap

I think we’d need to do a few things to make that easier for everyone:

  • [x] Build a proof of concept
  • [x] Ask for feedback
  • [ ] Figure out testing
  • [ ] Publish an extension boilerplate
  • [ ] Write a guide
  • [ ] Add a list of community extensions to the README

Your feedback

What do you all think? Would you be up to contribute a community extension?

Feel free to post links to Gists of others you’d love to see published as a package.

feature request

Most helpful comment

I would love to. I am working for a project that involves rich content editor. I am trying to bring each feature one by one. Till now, I was able to get inline math and block level math integrations without any errors. There were few minor issues. But I was able to correct them.

I am more than happy to share it. But I am not writing any unit tests. Is it okay ?

All 6 comments

I would love to. I am working for a project that involves rich content editor. I am trying to bring each feature one by one. Till now, I was able to get inline math and block level math integrations without any errors. There were few minor issues. But I was able to correct them.

I am more than happy to share it. But I am not writing any unit tests. Is it okay ?

image

like this, there are so many places where the import sizes are huge. This increased just the editor component size in total. Is there any work around for this ?

image

This is an another example for such cases.

Increasing the collection with

export class CustomLink extends Link {
  get schema() {
    return {
      attrs: {
        href: {
          default: null,
        },
        'data-link-type': {
          default: 'link',
        },
        target: {
          default: null,
        },
        rel: {
          default: null,
        },
        class: {
          default: 'oct-a',
        },
      },
      inclusive: false,
      parseDOM: [
        {
          tag: 'a[href]',
          getAttrs: (dom) => {
            return {
              href: dom.getAttribute('href'),
              target: dom.getAttribute('target'),
              rel: dom.getAttribute('rel'),
              'data-link-type': dom.getAttribute('data-link-type'),
            }
          },
        },
      ],
      toDOM: (node) => {
        return [
          'a',
          {
            ...node.attrs,
            target: '__blank',
            class: 'content-link',
            rel: 'noopener noreferrer nofollow',
          },
          0,
        ]
      },
    }
  }

Leaving this here as a request: heading anchor links extension https://github.com/ueberdosis/tiptap/issues/662

Resizable image plugin: https://github.com/ueberdosis/tiptap/issues/740#issuecomment-649945319 (links to this gist)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jameswragg picture jameswragg  Â·  3Comments

chrisjbrown picture chrisjbrown  Â·  3Comments

klaasgeldof picture klaasgeldof  Â·  3Comments

connecteev picture connecteev  Â·  3Comments

dolbex picture dolbex  Â·  3Comments