[cm6] Add offset to review panel entry positions when needed (#13912)

* Add offset to review panel entry positions when needed
* Fix useResizeObserver usage

GitOrigin-RevId: e220ce94e13c3a2347fc72654de747356eb1e658
This commit is contained in:
Alf Eaton
2023-07-19 08:04:40 +00:00
committed by Copybot
parent 4d3c4c6ae9
commit 9f719c572d
3 changed files with 11 additions and 5 deletions
@@ -10,6 +10,12 @@ import { EditorView, ViewUpdate } from '@codemirror/view'
import { CurrentDoc } from '../../../../../../types/current-doc'
import { fullHeightCoordsAtPos } from '../../utils/layer'
import { debounce } from 'lodash'
import getMeta from '../../../../utils/meta'
// If a toolbar row sits alongside the review panel, the review panel entries need to be shifted down by 32px.
// Once the review panel is always inside the editor, this offset can be removed.
const offsetTop =
getMeta('ol-showSourceToolbar') && !getMeta('ol-isReviewPanelReact') ? 32 : 0
// With less than this number of entries, don't bother culling to avoid
// little UI jumps when scrolling.
@@ -79,7 +85,7 @@ export const createChangeManager = (
visibilityChanged = true
}
entry.screenPos = { y, height, editorPaddingTop }
entry.screenPos = { y: y + offsetTop, height, editorPaddingTop }
}
if (allVisible) {