summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/behaviors/markdown/schema.js
blob: 163182ab778ccbcc60bffa4c0cd9ce1824e71049 (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
import { Schema } from 'prosemirror-model';
import editorExtensions from './editor_extensions';

const nodes = editorExtensions
  .filter(extension => extension.type === 'node')
  .reduce(
    (ns, { name, schema }) => ({
      ...ns,
      [name]: schema,
    }),
    {},
  );

const marks = editorExtensions
  .filter(extension => extension.type === 'mark')
  .reduce(
    (ms, { name, schema }) => ({
      ...ms,
      [name]: schema,
    }),
    {},
  );

export default new Schema({ nodes, marks });