Files
adf-codec/src/adf/inline-nodes.ts
T
lilleman 67c3345fd2
CI / gate (push) Successful in 29s
CI / publish (push) Successful in 5s
21 - the table's row is the node's model, never the node
2026-09-21 21:45:11 +02:00

33 lines
1.2 KiB
TypeScript

import type { AttributeVocabulary } from './attribute-vocabulary.ts'
export type InlineNodeModel = {
attributes: AttributeVocabulary
textAttribute?: string
}
export const inlineNodes: Readonly<Record<string, InlineNodeModel>> = {
date: { attributes: { localId: 'string', timestamp: 'string' } },
emoji: { attributes: { id: 'string', localId: 'string', shortName: 'string', text: 'string' }, textAttribute: 'text' },
hardBreak: { attributes: { localId: 'string', text: 'string' } },
inlineCard: { attributes: { data: 'json', localId: 'string', url: 'string' } },
mediaInline: {
attributes: {
alt: 'string',
collection: 'string',
data: 'json',
height: 'number',
id: 'string',
localId: 'string',
occurrenceKey: 'string',
type: 'string',
width: 'number',
},
},
mention: { attributes: { accessLevel: 'string', id: 'string', localId: 'string', text: 'string', userType: 'string' }, textAttribute: 'text' },
status: { attributes: { color: 'string', localId: 'string', style: 'string', text: 'string' }, textAttribute: 'text' },
}
export function inlineNodeModel(type: string): InlineNodeModel | undefined {
return Object.hasOwn(inlineNodes, type) ? inlineNodes[type] : undefined
}