21 - the table's row is the node's model, never the node
This commit was merged in pull request #119.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { AttributeVocabulary } from './attribute-vocabulary.ts'
|
||||
|
||||
export type BlockNode = {
|
||||
export type BlockNodeModel = {
|
||||
attributes: AttributeVocabulary
|
||||
contentModel: 'block' | 'code' | 'inline' | 'none'
|
||||
}
|
||||
@@ -80,11 +80,11 @@ export const blockNodes = {
|
||||
tableRow: { attributes: localIdAttributes, contentModel: 'block' },
|
||||
taskItem: { attributes: localIdAttributes, contentModel: 'inline' },
|
||||
taskList: { attributes: localIdAttributes, contentModel: 'block' },
|
||||
} satisfies Readonly<Record<string, BlockNode>>
|
||||
} satisfies Readonly<Record<string, BlockNodeModel>>
|
||||
|
||||
export type BlockType = keyof typeof blockNodes
|
||||
|
||||
export function blockNodeNamed(type: string): BlockNode | undefined {
|
||||
export function blockNodeModel(type: string): BlockNodeModel | undefined {
|
||||
return isBlockType(type) ? blockNodes[type] : undefined
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { AttributeVocabulary } from './attribute-vocabulary.ts'
|
||||
|
||||
export type InlineNode = {
|
||||
export type InlineNodeModel = {
|
||||
attributes: AttributeVocabulary
|
||||
textAttribute?: string
|
||||
}
|
||||
|
||||
export const inlineNodes: Readonly<Record<string, InlineNode>> = {
|
||||
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' } },
|
||||
@@ -27,6 +27,6 @@ export const inlineNodes: Readonly<Record<string, InlineNode>> = {
|
||||
status: { attributes: { color: 'string', localId: 'string', style: 'string', text: 'string' }, textAttribute: 'text' },
|
||||
}
|
||||
|
||||
export function inlineNodeNamed(type: string): InlineNode | undefined {
|
||||
export function inlineNodeModel(type: string): InlineNodeModel | undefined {
|
||||
return Object.hasOwn(inlineNodes, type) ? inlineNodes[type] : undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user