UNPKG

@atlaskit/adf-schema

Version:

Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs

18 lines (17 loc) 515 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toJSON = void 0; var OPTIONAL_ATTRS = ['title', 'id', 'collection', 'occurrenceKey', '__confluenceMetadata']; var toJSON = exports.toJSON = function toJSON(mark) { return { type: mark.type.name, attrs: Object.keys(mark.attrs).reduce(function (attrs, key) { if (OPTIONAL_ATTRS.indexOf(key) === -1 || mark.attrs[key] !== null) { attrs[key] = mark.attrs[key]; } return attrs; }, {}) }; };