Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1x 1x 1x 8x 8x 8x 7x 7x 7x 7x 7x 7x | import type {PeritextMlElement, PeritextMlNode} from '../block/types'; import {CommonSliceType} from '../slice'; import {SliceStacking} from '../slice/constants'; export const h = ( tag: string, props: Record<string, unknown> | null, ...children: PeritextMlNode[] ): PeritextMlElement => { const attrs: PeritextMlElement[1] = {}; if (props) attrs.data = props; if ((tag as any) === h) return ['', null, ...children]; const num = CommonSliceType[tag as any]; if (typeof num === 'number') { const inline = num < 0; attrs.inline = inline; attrs.stacking = inline ? (props ? SliceStacking.Many : SliceStacking.One) : SliceStacking.Marker; return [num, attrs, ...children]; } else E{ const inline = !props; attrs.inline = inline; attrs.stacking = inline ? (props ? SliceStacking.Many : SliceStacking.One) : SliceStacking.Marker; return [tag, attrs, ...children]; } }; |