Skip to content

Commit ce5e4be

Browse files
committed
fix(viewer): align content of old version in viewer version comparison
The source viewer in the "compare side by side" view in Viewer app doesn't have a menubar, so it needs a margin-top to align both versions vertically. Signed-off-by: Jonas <jonas@freesources.org>
1 parent 199dd68 commit ce5e4be

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

playwright/e2e/versions.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ test.describe('Versions with distant timestamps', () => {
6262
const current = page.locator('.ProseMirror[contenteditable="true"]')
6363
await expect(oldVersion.getByRole('heading', { name: 'V1' })).toBeVisible()
6464
await expect(current.getByRole('heading', { name: 'V3' })).toBeVisible()
65+
66+
// Test that version contents are vertically aligned
67+
const oldBox = await oldVersion
68+
.getByRole('heading', { name: 'V1' })
69+
.boundingBox()
70+
const currentBox = await oldVersion
71+
.getByRole('heading', { name: 'V3' })
72+
.boundingBox()
73+
expect(Math.abs(oldBox!.y - currentBox!.y)).toBeLessThan(5)
6574
})
6675
})
6776

src/components/ViewerComponent.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ body .toastify.dialogs {
146146
margin-top: calc(45px + var(--default-clickable-area));
147147
}
148148
149+
.viewer--split .source-viewer .editor__content-wrapper {
150+
// Account for missing menubar for old version in version comparison
151+
margin-top: calc(
152+
var(--default-clickable-area) + 2 * var(--default-grid-baseline)
153+
);
154+
}
155+
149156
.viewer[data-handler='text'] .modal-wrapper .modal-container {
150157
bottom: 0;
151158
}

0 commit comments

Comments
 (0)