mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
chore(react/collections/table): bring back wheel scroll
This commit is contained in:
parent
05973672e4
commit
d367cf9972
@ -13,6 +13,7 @@ import branchService from "../../../services/branches";
|
||||
import { openColumnContextMenu, openNoteContextMenu } from "./context_menu";
|
||||
import { ContextMenuEvent } from "../../../menus/context_menu";
|
||||
import { createContext } from "preact";
|
||||
import { onWheelHorizontalScroll } from "../../widget_utils";
|
||||
|
||||
export interface BoardViewData {
|
||||
columns?: BoardColumnData[];
|
||||
@ -79,7 +80,6 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC
|
||||
|
||||
saveConfig(newViewConfig);
|
||||
setColumns(newColumns);
|
||||
console.log("New columns are ", newColumns);
|
||||
setDraggedColumn(null);
|
||||
setColumnDropPosition(null);
|
||||
}, [columns, viewConfig, saveConfig]);
|
||||
@ -136,7 +136,10 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC
|
||||
}, [draggedColumn, columnDropPosition, handleColumnDrop]);
|
||||
|
||||
return (
|
||||
<div className="board-view">
|
||||
<div
|
||||
className="board-view"
|
||||
onWheel={onWheelHorizontalScroll}
|
||||
>
|
||||
<BoardViewContext.Provider value={boardViewContext}>
|
||||
<div
|
||||
className="board-view-container"
|
||||
|
@ -24,7 +24,6 @@ export default class BoardView extends ViewMode<BoardData> {
|
||||
super(args, "board");
|
||||
|
||||
this.$root = $(TPL);
|
||||
setupHorizontalScrollViaWheel(this.$root);
|
||||
this.$container = this.$root.find(".board-view-container");
|
||||
this.spacedUpdate = new SpacedUpdate(() => this.onSave(), 5_000);
|
||||
this.persistentData = {
|
||||
|
@ -7,12 +7,15 @@ import utils from "../services/utils.js";
|
||||
*/
|
||||
export function setupHorizontalScrollViaWheel($container: JQuery<HTMLElement>) {
|
||||
$container.on("wheel", (event) => {
|
||||
const wheelEvent = event.originalEvent as WheelEvent;
|
||||
if (utils.isCtrlKey(event) || event.altKey || event.shiftKey) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
event.currentTarget.scrollLeft += wheelEvent.deltaY + wheelEvent.deltaX;
|
||||
onWheelHorizontalScroll(event.originalEvent as WheelEvent);
|
||||
});
|
||||
}
|
||||
|
||||
export function onWheelHorizontalScroll(event: WheelEvent) {
|
||||
if (!event.currentTarget || utils.isCtrlKey(event) || event.altKey || event.shiftKey) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
(event.currentTarget as HTMLElement).scrollLeft += event.deltaY + event.deltaX;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user