mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-25 20:44:49 -04:00
Fix smooth scroll and other bugs (#1861)
This PR fixes: - The wrong clean up of window post message communicators - The smooth scroll bug in chrome (Fixes Anchor navigation in render view not working #1770) - Scroll by using touch devices in renderer - Lazy loading of the editor (code mirror doesn't need to be lazy loaded any more)
This commit is contained in:
parent
0f3f7a82b5
commit
8b4e9191e5
15 changed files with 260 additions and 213 deletions
|
@ -4,16 +4,16 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { RefObject } from 'react'
|
||||
import type React from 'react'
|
||||
import { useCallback } from 'react'
|
||||
import type { LineMarkerPosition } from '../../../markdown-renderer/markdown-extension/linemarker/types'
|
||||
import type { ScrollState } from '../../../editor-page/synced-scroll/scroll-props'
|
||||
|
||||
export const useOnUserScroll = (
|
||||
lineMarks: LineMarkerPosition[] | undefined,
|
||||
scrollContainer: RefObject<HTMLElement>,
|
||||
scrollContainer: React.RefObject<HTMLElement>,
|
||||
onScroll: ((newScrollState: ScrollState) => void) | undefined
|
||||
): (() => void) => {
|
||||
): React.UIEventHandler<HTMLElement> => {
|
||||
return useCallback(() => {
|
||||
if (!scrollContainer.current || !lineMarks || lineMarks.length === 0 || !onScroll) {
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue