UNPKG

@nacelle/rich-text-utils

Version:

A set of Typescript types and helpers to work with Rich Text fields.

81 lines 2.42 kB
export const blockquoteNodeType = 'blockquote'; export const blockNodeType = 'block'; export const codeNodeType = 'code'; export const headingNodeType = 'heading'; export const inlineEntryNodeType = 'inlineEntry'; export const entryLinkNodeType = 'entryLink'; export const linkNodeType = 'link'; export const listItemNodeType = 'listItem'; export const listNodeType = 'list'; export const paragraphNodeType = 'paragraph'; export const rootNodeType = 'root'; export const spanNodeType = 'span'; export const thematicBreakNodeType = 'thematicBreak'; export const allowedNodeTypes = [ blockquoteNodeType, blockNodeType, codeNodeType, headingNodeType, inlineEntryNodeType, entryLinkNodeType, linkNodeType, listItemNodeType, listNodeType, paragraphNodeType, rootNodeType, spanNodeType, thematicBreakNodeType, ]; export const allowedChildren = { [blockquoteNodeType]: [paragraphNodeType], [blockNodeType]: [], [codeNodeType]: [], [headingNodeType]: 'inlineNodes', [inlineEntryNodeType]: [], [entryLinkNodeType]: 'inlineNodes', [linkNodeType]: 'inlineNodes', [listItemNodeType]: [paragraphNodeType, listNodeType], [listNodeType]: [listItemNodeType], [paragraphNodeType]: 'inlineNodes', [rootNodeType]: [ blockquoteNodeType, codeNodeType, listNodeType, paragraphNodeType, headingNodeType, blockNodeType, thematicBreakNodeType, ], [spanNodeType]: [], [thematicBreakNodeType]: [], }; export const inlineNodeTypes = [ spanNodeType, linkNodeType, entryLinkNodeType, inlineEntryNodeType, ]; export const allowedAttributes = { [blockquoteNodeType]: ['children', 'attribution'], [blockNodeType]: ['entry'], [codeNodeType]: ['language', 'highlight', 'code'], [headingNodeType]: ['level', 'children'], [inlineEntryNodeType]: ['entry'], [entryLinkNodeType]: ['entry', 'children', 'meta'], [linkNodeType]: ['url', 'children', 'meta'], [listItemNodeType]: ['children'], [listNodeType]: ['style', 'children'], [paragraphNodeType]: ['children'], [rootNodeType]: ['children'], [spanNodeType]: ['value', 'marks'], [thematicBreakNodeType]: [], }; export const allowedMarks = [ 'strong', 'code', 'emphasis', 'underline', 'strikethrough', 'highlight', ]; //# sourceMappingURL=definitions.js.map