Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 333x 116x 696x | import { Heading } from '@tiptap/extension-heading'; import { textblockTypeInputRule } from '@tiptap/core'; export default Heading.extend({ addOptions() { return { ...this.parent?.(), HTMLAttributes: { dir: 'auto', }, }; }, addInputRules() { return this.options.levels.map((level) => { return textblockTypeInputRule({ // make sure heading regex doesn't conflict with issue references find: new RegExp(`^(#{1,${level}})[ \t]$`), type: this.type, getAttributes: { level }, }); }); }, }); |