summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/content_editor/extensions/bullet_list.js
blob: 8d0faf7a9fe259bebe76e3a9eded91d0187da965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { BulletList } from '@tiptap/extension-bullet-list';
import { getMarkdownSource } from '../services/markdown_sourcemap';

export default BulletList.extend({
  addAttributes() {
    return {
      ...this.parent?.(),

      bullet: {
        default: '*',
        parseHTML(element) {
          const bullet = getMarkdownSource(element)?.charAt(0);

          return '*+-'.includes(bullet) ? bullet : '*';
        },
      },
    };
  },
});