Skip to content

Instantly share code, notes, and snippets.

@hanspagel
Last active August 31, 2020 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanspagel/edae39ffee55fd515446702222e06f9d to your computer and use it in GitHub Desktop.
Save hanspagel/edae39ffee55fd515446702222e06f9d to your computer and use it in GitHub Desktop.
import { Mark } from 'tiptap'
import { toggleMark } from 'tiptap-commands'
export default class Superscript extends Mark {
get name() {
return 'superscript'
}
get schema() {
return {
parseDOM: [
{
tag: 'sup',
},
{
style: 'vertical-align',
getAttrs: value => value === 'super',
},
],
toDOM: () => ['sup', 0],
}
}
commands({ type }) {
return () => toggleMark(type)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment