UNPKG

@atlaskit/adf-schema

Version:

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

29 lines (27 loc) 686 B
export function addItems(builtInItems, config) { var customSpecs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; if (!config) { return {}; } /** * Add built-in Node / Mark specs */ var items = builtInItems.reduce(function (items, _ref) { var name = _ref.name, spec = _ref.spec; if (config.indexOf(name) !== -1) { items[name] = customSpecs[name] || spec; } return items; }, {}); /** * Add Custom Node / Mark specs */ return Object.keys(customSpecs).reduce(function (items, name) { if (items[name]) { return items; } items[name] = customSpecs[name]; return items; }, items); }