Skip to content

Commit f59f6a7

Browse files
mejo-backportbot[bot]
authored andcommitted
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 6d2db93 commit f59f6a7

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

playwright/e2e/versions.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ 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.getByRole('heading', { name: 'V1' }).boundingBox()
68+
const currentBox = await oldVersion.getByRole('heading', { name: 'V3' }).boundingBox()
69+
expect(Math.abs(oldBox!.y - currentBox!.y)).toBeLessThan(5)
6570
})
6671
})
6772

src/components/ViewerComponent.vue

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

0 commit comments

Comments
 (0)