feat(layout/inline-title): horizontal scroll via wheel

This commit is contained in:
Elian Doran
2025-12-13 12:27:45 +02:00
parent e06abe6e5b
commit 5145ce2d23

View File

@@ -8,15 +8,16 @@ import { Trans } from "react-i18next";
import FNote from "../../entities/fnote"; import FNote from "../../entities/fnote";
import { ViewScope } from "../../services/link"; import { ViewScope } from "../../services/link";
import { NOTE_TYPES } from "../../services/note_types";
import server from "../../services/server";
import { formatDateTime } from "../../utils/formatters"; import { formatDateTime } from "../../utils/formatters";
import NoteIcon from "../note_icon"; import NoteIcon from "../note_icon";
import NoteTitleWidget from "../note_title"; import NoteTitleWidget from "../note_title";
import { Badge } from "../react/Badge";
import { useNoteContext, useNoteProperty, useStaticTooltip } from "../react/hooks"; import { useNoteContext, useNoteProperty, useStaticTooltip } from "../react/hooks";
import { joinElements } from "../react/react_utils"; import { joinElements } from "../react/react_utils";
import { useNoteMetadata } from "../ribbon/NoteInfoTab"; import { useNoteMetadata } from "../ribbon/NoteInfoTab";
import { NOTE_TYPES } from "../../services/note_types"; import { onWheelHorizontalScroll } from "../widget_utils";
import { Badge } from "../react/Badge";
import server from "../../services/server";
const supportedNoteTypes = new Set<NoteType>([ const supportedNoteTypes = new Set<NoteType>([
"text", "code" "text", "code"
@@ -135,7 +136,10 @@ function NoteTypeSwitcher() {
const noteTypes = useMemo(() => NOTE_TYPES.filter((nt) => !nt.reserved && !nt.static), []); const noteTypes = useMemo(() => NOTE_TYPES.filter((nt) => !nt.reserved && !nt.static), []);
return (note && return (note &&
<div className="note-type-switcher"> <div
className="note-type-switcher"
onWheel={onWheelHorizontalScroll}
>
{noteTypes.map(noteType => noteType.type !== currentNoteType && ( {noteTypes.map(noteType => noteType.type !== currentNoteType && (
<Badge <Badge
key={noteType.type} key={noteType.type}