mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +02:00
chore(collections/board): bring back scrolling inside columns
This commit is contained in:
parent
0844f60343
commit
1e1a458add
@ -9,6 +9,7 @@ import Icon from "../../react/Icon";
|
|||||||
import { t } from "../../../services/i18n";
|
import { t } from "../../../services/i18n";
|
||||||
import BoardApi from "./api";
|
import BoardApi from "./api";
|
||||||
import Card from "./card";
|
import Card from "./card";
|
||||||
|
import { JSX } from "preact/jsx-runtime";
|
||||||
|
|
||||||
interface DragContext {
|
interface DragContext {
|
||||||
column: string;
|
column: string;
|
||||||
@ -42,6 +43,17 @@ export default function Column({
|
|||||||
openColumnContextMenu(api, e, column);
|
openColumnContextMenu(api, e, column);
|
||||||
}, [ api, column ]);
|
}, [ api, column ]);
|
||||||
|
|
||||||
|
/** Allow using mouse wheel to scroll inside card, while also maintaining column horizontal scrolling. */
|
||||||
|
const handleScroll = useCallback((event: JSX.TargetedWheelEvent<HTMLDivElement>) => {
|
||||||
|
const el = event.currentTarget;
|
||||||
|
if (!el) return;
|
||||||
|
|
||||||
|
const needsScroll = el.scrollHeight > el.clientHeight;
|
||||||
|
if (needsScroll) {
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
editorRef.current?.focus();
|
editorRef.current?.focus();
|
||||||
}, [ isEditing ]);
|
}, [ isEditing ]);
|
||||||
@ -52,6 +64,7 @@ export default function Column({
|
|||||||
onDragOver={handleDragOver}
|
onDragOver={handleDragOver}
|
||||||
onDragLeave={handleDragLeave}
|
onDragLeave={handleDragLeave}
|
||||||
onDrop={handleDrop}
|
onDrop={handleDrop}
|
||||||
|
onWheel={handleScroll}
|
||||||
>
|
>
|
||||||
<h3
|
<h3
|
||||||
className={`${isEditing ? "editing" : ""}`}
|
className={`${isEditing ? "editing" : ""}`}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user