mirror of
https://github.com/zadam/trilium.git
synced 2025-10-31 18:36:30 +01:00
Revert "chore(react): prototype for note context"
This reverts commit 660db3b3ab.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useContext, useEffect, useRef, useState } from "preact/hooks";
|
||||
import { useEffect, useRef, useState } from "preact/hooks";
|
||||
import { t } from "../services/i18n";
|
||||
import FormTextBox from "./react/FormTextBox";
|
||||
import { useNoteContext, useNoteProperty, useSpacedUpdate, useTriliumEvent } from "./react/hooks";
|
||||
@@ -8,13 +8,9 @@ import "./note_title.css";
|
||||
import { isLaunchBarConfig } from "../services/utils";
|
||||
import appContext from "../components/app_context";
|
||||
import branches from "../services/branches";
|
||||
import { NoteContext, ParentComponent } from "./react/react_utils";
|
||||
|
||||
export default function NoteTitleWidget() {
|
||||
const parentComponent = useContext(ParentComponent);
|
||||
const noteContext = useContext(NoteContext);
|
||||
const { noteId, note, componentId, viewScope } = noteContext ?? {};
|
||||
|
||||
const { note, noteId, componentId, viewScope, noteContext, parentComponent } = useNoteContext();
|
||||
const title = useNoteProperty(note, "title", componentId);
|
||||
const isProtected = useNoteProperty(note, "isProtected");
|
||||
const newTitle = useRef("");
|
||||
@@ -35,7 +31,7 @@ export default function NoteTitleWidget() {
|
||||
// Manage the title for read-only notes
|
||||
useEffect(() => {
|
||||
if (isReadOnly) {
|
||||
noteContext?.getNavigationTitle?.().then(setNavigationTitle);
|
||||
noteContext?.getNavigationTitle().then(setNavigationTitle);
|
||||
}
|
||||
}, [isReadOnly]);
|
||||
|
||||
@@ -82,7 +78,7 @@ export default function NoteTitleWidget() {
|
||||
// Focus on the note content when pressing enter.
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
parentComponent?.triggerCommand("focusOnDetail", { ntxId: noteContext?.ntxId });
|
||||
parentComponent.triggerCommand("focusOnDetail", { ntxId: noteContext?.ntxId });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user