mirror of
https://github.com/zadam/trilium.git
synced 2025-12-29 10:44:25 +01:00
fix(note_type_switcher): don't read blob
This commit is contained in:
parent
faea35b363
commit
bd24cf68b6
@ -11,7 +11,7 @@ import { NOTE_TYPES, NoteTypeMapping } from "../../services/note_types";
|
||||
import server from "../../services/server";
|
||||
import { Badge, BadgeWithDropdown } from "../react/Badge";
|
||||
import { FormDropdownDivider, FormListItem } from "../react/FormList";
|
||||
import { useNoteBlob, useNoteContext, useNoteProperty, useTriliumEvent } from "../react/hooks";
|
||||
import { useNoteContext, useNoteProperty, useNoteSavedData, useTriliumEvent } from "../react/hooks";
|
||||
import { onWheelHorizontalScroll } from "../widget_utils";
|
||||
|
||||
const SWITCHER_PINNED_NOTE_TYPES = new Set<NoteType>([ "text", "code", "book", "canvas" ]);
|
||||
@ -21,7 +21,7 @@ const supportedNoteTypes = new Set<NoteType>([
|
||||
|
||||
export default function NoteTypeSwitcher() {
|
||||
const { note } = useNoteContext();
|
||||
const blob = useNoteBlob(note);
|
||||
const blob = useNoteSavedData(note?.noteId);
|
||||
const currentNoteType = useNoteProperty(note, "type");
|
||||
const { pinnedNoteTypes, restNoteTypes } = useMemo(() => {
|
||||
const pinnedNoteTypes: NoteTypeMapping[] = [];
|
||||
@ -44,7 +44,7 @@ export default function NoteTypeSwitcher() {
|
||||
className="note-type-switcher"
|
||||
onWheel={onWheelHorizontalScroll}
|
||||
>
|
||||
{note && blob?.contentLength === 0 && (
|
||||
{note && blob?.length === 0 && (
|
||||
<>
|
||||
<div className="intro">{t("note_title.note_type_switcher_label", { type: currentNoteTypeData?.title.toLocaleLowerCase() })}</div>
|
||||
{pinnedNoteTypes.map(noteType => noteType.type !== currentNoteType && (
|
||||
|
||||
@ -27,7 +27,6 @@ import ws from "../../services/ws";
|
||||
import BasicWidget, { ReactWrappedWidget } from "../basic_widget";
|
||||
import NoteContextAwareWidget from "../note_context_aware_widget";
|
||||
import { DragData } from "../note_tree";
|
||||
import CKEditor from "./CKEditor";
|
||||
import { noteSavedDataStore } from "./NoteStore";
|
||||
import { NoteContextContext, ParentComponent, refToJQuerySelector } from "./react_utils";
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user