fix: a frame keeps its place whatever kind of frame it is
Text boxes and shapes had no offsets at all, and for images the wrap side overrode the x: a file that names the side its text flows on lost the coordinate, our own export included. Side and place are read separately now, and one helper turns both into the float's margins for every frame kind.
This commit is contained in:
1 parent
f8c818c203
commit
5968b6a04b
7 files changed
+99
-54
No files matched your search
@@ -62,7 +62,7 @@ describe('DOCX export → import round trip', () => {
|
||||
para('box text'),
|
||||
para([text('bold in box', [{ type: 'bold' }])]),
|
||||
] },
|
||||
{ type: 'textBox', attrs: { width: 192, height: 96, wrap: 'right', shapeKind: 'ellipse', fillColor: '#FFEE00', strokeColor: '#FF0000', strokeWidthPt: 2.25, rotation: 30 }, content: [para('ellipse text')] },
|
||||
{ type: 'textBox', attrs: { width: 192, height: 96, wrap: 'right', wrapOffset: 6, wrapOffsetY: 1.5, shapeKind: 'ellipse', fillColor: '#FFEE00', strokeColor: '#FF0000', strokeWidthPt: 2.25, rotation: 30 }, content: [para('ellipse text')] },
|
||||
{ type: 'columns', attrs: { count: 2, gapCm: 0.8 }, content: [para('newspaper one'), para('newspaper two')] },
|
||||
{ type: 'table', content: [
|
||||
{ type: 'tableRow', content: [headerCell('Name', { colwidth: [6] }), headerCell('Qty', { colwidth: [3] })] },
|
||||
@@ -317,6 +317,8 @@ describe('DOCX export → import round trip', () => {
|
||||
expect(hasMark(walk(plain, 'text')[1], 'bold')).toBe(true);
|
||||
expect(ellipse.attrs.shapeKind).toBe('ellipse');
|
||||
expect(ellipse.attrs.wrap).toBe('right');
|
||||
expect(ellipse.attrs.wrapOffset).toBeCloseTo(6, 1);
|
||||
expect(ellipse.attrs.wrapOffsetY).toBeCloseTo(1.5, 1);
|
||||
expect(ellipse.attrs.rotation).toBe(30);
|
||||
expect(ellipse.attrs.fillColor).toBe('#FFEE00');
|
||||
expect(ellipse.attrs.strokeColor).toBe('#FF0000');
|
||||
|
||||
@@ -87,7 +87,7 @@ const fixture: N = {
|
||||
P(null, T('wrapped left '), IMGN(90, 60, 'Float', 0, 'left', 2.5), T(' text flows beside it')),
|
||||
P(null, T('top/bottom '), IMGN(70, 50, 'Banner', 0, 'topBottom')),
|
||||
TBX({ width: 288, height: 96 }, P(null, T('box para one')), P(null, T('box '), T('bold', { type: 'bold' }))),
|
||||
TBX({ width: 192, height: 80, wrap: 'right', shapeKind: 'ellipse', fillColor: '#FFEE00', strokeColor: '#FF0000', strokeWidthPt: 2.25, rotation: 30 }, P(null, T('in ellipse'))),
|
||||
TBX({ width: 192, height: 80, wrap: 'right', wrapOffset: 6, wrapOffsetY: 1.5, shapeKind: 'ellipse', fillColor: '#FFEE00', strokeColor: '#FF0000', strokeWidthPt: 2.25, rotation: 30 }, P(null, T('in ellipse'))),
|
||||
COLS({ count: 2, gapCm: 0.5 }, P(null, T('newspaper column text one')), P(null, T('newspaper column text two'))),
|
||||
{ type: 'bulletList', content: [
|
||||
LI(P(null, T('bullet one'))),
|
||||
|
||||
Reference in new issue
Block a user