mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-19 19:13:17 +03:00
feat: fix-track-pad-scroll
This commit is contained in:
parent
7c15f704e0
commit
011aac0bfc
@ -102,6 +102,12 @@ export const RenderRoot: FC<PropsWithChildren<RenderRootProps>> = ({
|
|||||||
editor.getHooks().onRootNodeMouseLeave(event);
|
editor.getHooks().onRootNodeMouseLeave(event);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onContextmenu = (
|
||||||
|
event: React.MouseEvent<HTMLDivElement, MouseEvent>
|
||||||
|
) => {
|
||||||
|
selectionRef.current?.onContextmenu(event);
|
||||||
|
};
|
||||||
|
|
||||||
const onKeyDown: React.KeyboardEventHandler<HTMLDivElement> = event => {
|
const onKeyDown: React.KeyboardEventHandler<HTMLDivElement> = event => {
|
||||||
// IMP move into keyboard managers?
|
// IMP move into keyboard managers?
|
||||||
editor.getHooks().onRootNodeKeyDown(event);
|
editor.getHooks().onRootNodeKeyDown(event);
|
||||||
@ -165,6 +171,7 @@ export const RenderRoot: FC<PropsWithChildren<RenderRootProps>> = ({
|
|||||||
onMouseUp={onMouseUp}
|
onMouseUp={onMouseUp}
|
||||||
onMouseLeave={onMouseLeave}
|
onMouseLeave={onMouseLeave}
|
||||||
onMouseOut={onMouseOut}
|
onMouseOut={onMouseOut}
|
||||||
|
onContextMenu={onContextmenu}
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
onKeyDownCapture={onKeyDownCapture}
|
onKeyDownCapture={onKeyDownCapture}
|
||||||
onKeyUp={onKeyUp}
|
onKeyUp={onKeyUp}
|
||||||
|
@ -29,6 +29,9 @@ export type SelectionRef = {
|
|||||||
onMouseDown: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
onMouseDown: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
||||||
onMouseMove: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
onMouseMove: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
||||||
onMouseUp: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
onMouseUp: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
||||||
|
onContextmenu: (
|
||||||
|
event: React.MouseEvent<HTMLDivElement, MouseEvent>
|
||||||
|
) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFixedPoint = (
|
const getFixedPoint = (
|
||||||
@ -207,10 +210,17 @@ export const SelectionRect = forwardRef<SelectionRef, SelectionProps>(
|
|||||||
scrollManager.stopAutoScroll();
|
scrollManager.stopAutoScroll();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onContextmenu = () => {
|
||||||
|
if (mouseType.current === 'down') {
|
||||||
|
onMouseUp();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
onMouseDown,
|
onMouseDown,
|
||||||
onMouseMove,
|
onMouseMove,
|
||||||
onMouseUp,
|
onMouseUp,
|
||||||
|
onContextmenu,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user