mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	fix(ribbon): not visible when coming from view source on same note
This commit is contained in:
		| @@ -36,7 +36,7 @@ async function getLinkIcon(noteId: string, viewMode: ViewMode | undefined) { | ||||
| } | ||||
|  | ||||
| // TODO: Remove `string` once all the view modes have been mapped. | ||||
| type ViewMode = "default" | "source" | "attachments" | "contextual-help" | string; | ||||
| export type ViewMode = "default" | "source" | "attachments" | "contextual-help" | string; | ||||
|  | ||||
| export interface ViewScope { | ||||
|     /** | ||||
|   | ||||
| @@ -19,6 +19,7 @@ import Mark from "mark.js"; | ||||
| import { DragData } from "../note_tree"; | ||||
| import Component from "../../components/component"; | ||||
| import toast, { ToastOptions } from "../../services/toast"; | ||||
| import { ViewMode } from "../../services/link"; | ||||
|  | ||||
| export function useTriliumEvent<T extends EventNames>(eventName: T, handler: (data: EventData<T>) => void) { | ||||
|     const parentComponent = useContext(ParentComponent); | ||||
| @@ -196,6 +197,7 @@ export function useNoteContext() { | ||||
|     const [ noteContext, setNoteContext ] = useState<NoteContext>(); | ||||
|     const [ notePath, setNotePath ] = useState<string | null | undefined>(); | ||||
|     const [ note, setNote ] = useState<FNote | null | undefined>(); | ||||
|     const [ , setViewMode ] = useState<ViewMode>(); | ||||
|     const [ refreshCounter, setRefreshCounter ] = useState(0); | ||||
|  | ||||
|     useEffect(() => { | ||||
| @@ -205,6 +207,7 @@ export function useNoteContext() { | ||||
|     useTriliumEvents([ "setNoteContext", "activeContextChanged", "noteSwitchedAndActivated", "noteSwitched" ], ({ noteContext }) => { | ||||
|         setNoteContext(noteContext); | ||||
|         setNotePath(noteContext.notePath); | ||||
|         setViewMode(noteContext.viewScope?.viewMode); | ||||
|     }); | ||||
|     useTriliumEvent("frocaReloaded", () => { | ||||
|         setNote(noteContext?.note); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user