summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/content_editor/extensions/superscript.js
blob: b86906f01f2d298566429eaed1c3b6a2b43ec3e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { markInputRule } from '@tiptap/core';
import { Superscript } from '@tiptap/extension-superscript';
import { markInputRegex, extractMarkAttributesFromMatch } from '../services/mark_utils';

export default Superscript.extend({
  addInputRules() {
    return [
      markInputRule({
        find: markInputRegex('sup'),
        type: this.type,
        getAttributes: extractMarkAttributesFromMatch,
      }),
    ];
  },
});