mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
15db0ce4e3
Add hook for synchronizing review panel height with editor content height GitOrigin-RevId: ef0a96ef4e77e7858b28f6f65254a4b0c1e778ea
15 lines
515 B
TypeScript
15 lines
515 B
TypeScript
import { EditorView } from '@codemirror/view'
|
|
|
|
/**
|
|
* An extension that triggers a custom DOM event whenever the editor geometry
|
|
* changes. This is used to synchronize the editor content and review panel
|
|
* height in "Current file" mode.
|
|
*/
|
|
export const geometryChangeEvent = (reactReviewPanel: boolean) =>
|
|
reactReviewPanel
|
|
? EditorView.updateListener.of(update => {
|
|
if (update.geometryChanged) {
|
|
window.dispatchEvent(new CustomEvent('editor:geometry-change'))
|
|
}
|
|
})
|
|
: []
|