UNPKG

@atlaskit/adf-schema

Version:

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

79 lines (73 loc) 2.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.layoutSectionWithSingleColumn = exports.layoutSectionFull = exports.layoutSection = void 0; var _nodeTypes = require("../../next-schema/generated/nodeTypes"); /** * @name layoutSection_node */ /** * Need duplicate `type` and `marks` to make both validator and json-schema satisfied */ /** * @name layoutSection_full_node */ /** * @stage 0 * @name layoutSection_with_single_column_node */ var layoutSection = exports.layoutSection = (0, _nodeTypes.layoutSection)({ parseDOM: [{ context: 'layoutSection//|layoutColumn//', tag: 'div[data-layout-section]', skip: true }, { tag: 'div[data-layout-section]' }], toDOM: function toDOM() { var attrs = { 'data-layout-section': 'true' }; return ['div', attrs, 0]; } }); var layoutSectionFull = exports.layoutSectionFull = (0, _nodeTypes.layoutSectionFull)({ parseDOM: [{ context: 'layoutSection//|layoutColumn//', tag: 'div[data-layout-section]', skip: true }, { tag: 'div[data-layout-section]' }], toDOM: function toDOM() { var attrs = { 'data-layout-section': 'true' }; return ['div', attrs, 0]; } }); // stage-0 support for columnRuleStyle attribute and 1-5 columns var layoutSectionWithSingleColumn = exports.layoutSectionWithSingleColumn = (0, _nodeTypes.layoutSectionWithSingleColumnStage0)({ parseDOM: [{ context: 'layoutSection//|layoutColumn//', tag: 'div[data-layout-section]', skip: true }, { tag: 'div[data-layout-section]', getAttrs: function getAttrs(dom) { var columnRuleStyle = dom.getAttribute('data-column-rule-style'); return columnRuleStyle ? { columnRuleStyle: columnRuleStyle } : {}; } }], toDOM: function toDOM(node) { var columnRuleStyle = node.attrs.columnRuleStyle; var attrs = { 'data-layout-section': 'true', 'data-column-rule-style': columnRuleStyle || undefined }; return ['div', attrs, 0]; } });