3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-18 22:25:44 +01:00

Hold the editor's join rule in plain/editor-normal.ts as the reader's over editor-normal forms

This commit is contained in:
2026-10-03 16:19:55 +02:00
parent 72f919ae04
commit c3ac8edb76
5 changed files with 48 additions and 48 deletions
+5
View File
@@ -75,3 +75,8 @@ test('normalizes blocks and mark attributes nesting far past the levels a recurs
const merged = toEditorNormal({ content: [{ content: [{ marks, text: 'a', type: 'text' }, { marks, text: 'b', type: 'text' }], type: 'paragraph' }], type: 'doc', version: 1 })
assert.deepEqual(merged.content?.[0]?.content?.map((text) => text.text), ['ab'])
})
test('joins a text node holding content to its neighbour, as editor-normal forms hold no content to part them', () => {
const paragraph: AdfNode = { content: [{ content: [{ text: 'lost', type: 'text' }], text: 'a', type: 'text' }, { text: 'b', type: 'text' }], type: 'paragraph' }
assert.deepEqual(toEditorNormal({ content: [paragraph], type: 'doc', version: 1 }).content, [{ content: [{ content: [{ text: 'lost', type: 'text' }], text: 'ab', type: 'text' }], type: 'paragraph' }])
})