diff --git a/apps/client/src/widgets/react/FormFileUpload.tsx b/apps/client/src/widgets/react/FormFileUpload.tsx
index e97e73184b..42d9c908eb 100644
--- a/apps/client/src/widgets/react/FormFileUpload.tsx
+++ b/apps/client/src/widgets/react/FormFileUpload.tsx
@@ -3,8 +3,9 @@ import { useEffect, useRef } from "preact/hooks";
import ActionButton, { ActionButtonProps } from "./ActionButton";
import Button, { ButtonProps } from "./Button";
+import { FormListItem, FormListItemOpts } from "./FormList";
-interface FormFileUploadProps {
+export interface FormFileUploadProps {
name?: string;
onChange: (files: FileList | null) => void;
multiple?: boolean;
@@ -75,3 +76,25 @@ export function FormFileUploadActionButton({ onChange, ...buttonProps }: Omit
);
}
+
+/**
+ * Similar to {@link FormFileUploadButton}, but uses an {@link FormListItem} instead of a normal {@link Button}.
+ * @param param the change listener for the file upload and the properties for the button.
+ */
+export function FormFileUploadFormListItem({ onChange, children, ...buttonProps }: Omit & Pick) {
+ const inputRef = useRef(null);
+
+ return (
+ <>
+ inputRef.current?.click()}
+ >{children}
+
+ >
+ );
+}
diff --git a/apps/client/src/widgets/react/FormList.tsx b/apps/client/src/widgets/react/FormList.tsx
index 6e4b81f33a..fdfdfb3167 100644
--- a/apps/client/src/widgets/react/FormList.tsx
+++ b/apps/client/src/widgets/react/FormList.tsx
@@ -78,7 +78,7 @@ export interface FormListBadge {
text: string;
}
-interface FormListItemOpts {
+export interface FormListItemOpts {
children: ComponentChildren;
icon?: string;
value?: string;
diff --git a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx
index 3a64e8c9c5..8ce9592406 100644
--- a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx
+++ b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx
@@ -13,6 +13,7 @@ import { isMobile, openInAppHelpFromUrl } from "../../services/utils";
import { ViewTypeOptions } from "../collections/interface";
import { buildSaveSqlToNoteHandler } from "../FloatingButtonsDefinitions";
import ActionButton, { ActionButtonProps } from "../react/ActionButton";
+import { FormFileUploadActionButton, FormFileUploadFormListItem, FormFileUploadProps } from "../react/FormFileUpload";
import { FormListItem } from "../react/FormList";
import { useNoteLabel, useNoteLabelBoolean, useNoteProperty, useTriliumEvent, useTriliumEvents, useTriliumOption } from "../react/hooks";
import { ParentComponent } from "../react/react_utils";
@@ -265,13 +266,15 @@ const cachedIsMobile = isMobile();
function NoteAction({ text, ...props }: Pick & {
onClick?: ((e: MouseEvent) => void) | undefined;
}) {
- if (cachedIsMobile) {
- return {text};
- }
- return ;
-
+ return (cachedIsMobile
+ ? {text}
+ :
+ );
}
-function NoteActionWithFileUpload() {
- return "Not implemented.";
+function NoteActionWithFileUpload({ text, ...props }: Pick & Pick) {
+ return (cachedIsMobile
+ ? {text}
+ :
+ );
}