fix(docx): keep heavy leader for ptab stops (#318)

Co-authored-by: Aniruddha Adak <aniruddhaadak80@users.noreply.github.com>
This commit is contained in:
ANIRUDDHA ADAK
2026-09-13 16:40:59 +08:00
committed by GitHub
co-authored by Aniruddha Adak
parent b3374c19f2
commit ae6c94df44
2 changed files with 15 additions and 0 deletions
+1
View File
@@ -322,6 +322,7 @@ export function ptabDisplayStops(pNode: XNode): import('./types').TabStop[] {
leader === 'dot' ||
leader === 'hyphen' ||
leader === 'underscore' ||
leader === 'heavy' ||
leader === 'middleDot'
) {
stop.leader = leader
+14
View File
@@ -111,4 +111,18 @@ describe('w:ptab absolute position tabs', () => {
})
expect(xml).not.toContain('<w:tabs>')
})
it('ptab heavy leader survives like w:tab', async () => {
const doc = await parseDocx(
await buildDocx({
bodyXml:
'<w:p><w:r><w:t>A</w:t></w:r>' +
'<w:r><w:ptab w:relativeTo="margin" w:alignment="right" w:leader="heavy"/></w:r>' +
'<w:r><w:t xml:space="preserve"> </w:t></w:r></w:p>',
}),
)
expect(doc.blocks[0].format?.tabStops).toEqual([
{ pos: 100, val: 'right', leader: 'heavy', rel: 'margin' },
])
})
})