datocms-structured-text-utils
Version:
A set of Typescript types and helpers to work with DatoCMS Structured Text fields.
87 lines • 2.68 kB
JavaScript
var _a, _b;
export var blockquoteNodeType = 'blockquote';
export var blockNodeType = 'block';
export var inlineBlockNodeType = 'inlineBlock';
export var codeNodeType = 'code';
export var headingNodeType = 'heading';
export var inlineItemNodeType = 'inlineItem';
export var itemLinkNodeType = 'itemLink';
export var linkNodeType = 'link';
export var listItemNodeType = 'listItem';
export var listNodeType = 'list';
export var paragraphNodeType = 'paragraph';
export var rootNodeType = 'root';
export var spanNodeType = 'span';
export var thematicBreakNodeType = 'thematicBreak';
export var allowedNodeTypes = [
blockquoteNodeType,
blockNodeType,
inlineBlockNodeType,
codeNodeType,
headingNodeType,
inlineItemNodeType,
itemLinkNodeType,
linkNodeType,
listItemNodeType,
listNodeType,
paragraphNodeType,
rootNodeType,
spanNodeType,
thematicBreakNodeType,
];
export var allowedChildren = (_a = {},
_a[blockquoteNodeType] = [paragraphNodeType],
_a[blockNodeType] = [],
_a[inlineBlockNodeType] = [],
_a[codeNodeType] = [],
_a[headingNodeType] = 'inlineNodes',
_a[inlineItemNodeType] = [],
_a[itemLinkNodeType] = 'inlineNodes',
_a[linkNodeType] = 'inlineNodes',
_a[listItemNodeType] = [paragraphNodeType, listNodeType],
_a[listNodeType] = [listItemNodeType],
_a[paragraphNodeType] = 'inlineNodes',
_a[rootNodeType] = [
blockquoteNodeType,
codeNodeType,
listNodeType,
paragraphNodeType,
headingNodeType,
blockNodeType,
thematicBreakNodeType,
],
_a[spanNodeType] = [],
_a[thematicBreakNodeType] = [],
_a);
export var inlineNodeTypes = [
spanNodeType,
linkNodeType,
itemLinkNodeType,
inlineItemNodeType,
inlineBlockNodeType,
];
export var allowedAttributes = (_b = {},
_b[blockquoteNodeType] = ['children', 'attribution'],
_b[blockNodeType] = ['item'],
_b[inlineBlockNodeType] = ['item'],
_b[codeNodeType] = ['language', 'highlight', 'code'],
_b[headingNodeType] = ['level', 'children', 'style'],
_b[inlineItemNodeType] = ['item'],
_b[itemLinkNodeType] = ['item', 'children', 'meta'],
_b[linkNodeType] = ['url', 'children', 'meta'],
_b[listItemNodeType] = ['children'],
_b[listNodeType] = ['style', 'children'],
_b[paragraphNodeType] = ['children', 'style'],
_b[rootNodeType] = ['children'],
_b[spanNodeType] = ['value', 'marks'],
_b[thematicBreakNodeType] = [],
_b);
export var defaultMarks = [
'strong',
'code',
'emphasis',
'underline',
'strikethrough',
'highlight',
];
//# sourceMappingURL=definitions.js.map