Welcome to mirror list, hosted at ThFree Co, Russian Federation.

task_list.js « extensions « content_editor « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b7f6c857bc7a9153e56a3fbcdd2d055096ffdfff (plain)
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
26
27
28
29
30
import { mergeAttributes } from '@tiptap/core';
import { TaskList } from '@tiptap/extension-task-list';

export default TaskList.extend({
  addAttributes() {
    return {
      type: {
        default: 'ul',
        parseHTML: (element) => {
          return {
            type: element.tagName.toLowerCase() === 'ol' ? 'ol' : 'ul',
          };
        },
      },
    };
  },

  parseHTML() {
    return [
      {
        tag: '.task-list',
        priority: 100,
      },
    ];
  },

  renderHTML({ HTMLAttributes: { type, ...HTMLAttributes } }) {
    return [type, mergeAttributes(HTMLAttributes, { 'data-type': 'taskList' }), 0];
  },
});