mirror of
https://github.com/zadam/trilium.git
synced 2025-12-23 16:49:58 +01:00
feat(layout): keyboard shortcut for file properties
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { NoteType } from "@triliumnext/commons";
|
import { NoteType } from "@triliumnext/commons";
|
||||||
import { useContext, useEffect, useState } from "preact/hooks";
|
import { useContext, useEffect, useRef, useState } from "preact/hooks";
|
||||||
|
|
||||||
import Component from "../../components/component";
|
import Component from "../../components/component";
|
||||||
import NoteContext from "../../components/note_context";
|
import NoteContext from "../../components/note_context";
|
||||||
@@ -38,6 +38,7 @@ interface NoteActionsCustomInnerProps extends NoteActionsCustomProps {
|
|||||||
*/
|
*/
|
||||||
export default function NoteActionsCustom(props: NoteActionsCustomProps) {
|
export default function NoteActionsCustom(props: NoteActionsCustomProps) {
|
||||||
const { note } = props;
|
const { note } = props;
|
||||||
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
const noteType = useNoteProperty(note, "type");
|
const noteType = useNoteProperty(note, "type");
|
||||||
const noteMime = useNoteProperty(note, "mime");
|
const noteMime = useNoteProperty(note, "mime");
|
||||||
const [ viewType ] = useNoteLabel(note, "viewType");
|
const [ viewType ] = useNoteLabel(note, "viewType");
|
||||||
@@ -53,8 +54,15 @@ export default function NoteActionsCustom(props: NoteActionsCustomProps) {
|
|||||||
isReadOnly
|
isReadOnly
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useTriliumEvent("toggleRibbonTabFileProperties", () => {
|
||||||
|
(containerRef.current?.firstElementChild as HTMLElement)?.focus();
|
||||||
|
});
|
||||||
|
|
||||||
return (innerProps &&
|
return (innerProps &&
|
||||||
<div className="note-actions-custom">
|
<div
|
||||||
|
ref={containerRef}
|
||||||
|
className="note-actions-custom"
|
||||||
|
>
|
||||||
<AddChildButton {...innerProps} />
|
<AddChildButton {...innerProps} />
|
||||||
<RunActiveNoteButton {...innerProps } />
|
<RunActiveNoteButton {...innerProps } />
|
||||||
<OpenTriliumApiDocsButton {...innerProps} />
|
<OpenTriliumApiDocsButton {...innerProps} />
|
||||||
|
|||||||
Reference in New Issue
Block a user