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

build_serializer_config.js « services « content_editor « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 75e2b0f9ebadd95656a71fe987c61e6d1b844084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const buildSerializerConfig = (extensions = []) =>
  extensions
    .filter(({ serializer }) => serializer)
    .reduce(
      (serializers, { serializer, tiptapExtension: { name, type } }) => {
        const collection = `${type}s`;

        return {
          ...serializers,
          [collection]: {
            ...serializers[collection],
            [name]: serializer,
          },
        };
      },
      {
        nodes: {},
        marks: {},
      },
    );

export default buildSerializerConfig;