Merge pull request #13477 from overleaf/ae-bottom-padding

[cm6] Improve bottom padding calculations

GitOrigin-RevId: 91fff97ebf6675cddffdd89118fd06f003321143
This commit is contained in:
Alf Eaton
2023-07-17 10:36:00 +00:00
committed by Copybot
parent 374e525cde
commit a4d1ac2f13
4 changed files with 28 additions and 27 deletions
@@ -334,20 +334,17 @@ export const createChangeManager = (
}
case 'sizes': {
const { overflowTop, height } = payload
const padding = view.documentPadding
const contentHeight =
view.contentDOM.clientHeight - padding.top - padding.bottom
const paddingNeeded = height - contentHeight
if (
overflowTop !== editorVerticalTopPadding(view) ||
paddingNeeded !== padding.bottom
) {
// the content height and top overflow of the review panel
const { height, overflowTop } = payload
// the difference between the review panel height and the editor content height
const heightDiff = height + overflowTop - view.contentDOM.clientHeight
// the height of the block added at the top of the editor to match the review panel
const topPadding = editorVerticalTopPadding(view)
if (overflowTop !== topPadding || heightDiff !== 0) {
view.dispatch(
setVerticalOverflow({
top: overflowTop,
bottom: paddingNeeded,
bottom: heightDiff + view.documentPadding.bottom,
})
)
}