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

table.js « nodes « markdown « behaviors « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a7fcb9227cd26bdbf19d0156ec0ceb7b68f478fe (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
/* eslint-disable class-methods-use-this */

import { Node } from 'tiptap';

// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class Table extends Node {
  get name() {
    return 'table';
  }

  get schema() {
    return {
      content: 'table_head table_body',
      group: 'block',
      isolating: true,
      parseDOM: [{ tag: 'table' }],
      toDOM: () => ['table', 0],
    };
  }

  toMarkdown(state, node) {
    state.renderContent(node);
    state.closeBlock(node);
  }
}