Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: support upload more file type

Steven22971c3a93e4
diff --git a/web/src/components/ResourcesDialog.tsx b/web/src/components/ResourcesDialog.tsx
index 4c4ea71a5..799659e4e 100644
--- a/web/src/components/ResourcesDialog.tsx
+++ b/web/src/components/ResourcesDialog.tsx
@@ -58,7 +58,7 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
document.body.appendChild(inputEl);
inputEl.type = "file";
inputEl.multiple = true;
- inputEl.accept = "image/*";
+ inputEl.accept = "*";
inputEl.onchange = async () => {
if (!inputEl.files || inputEl.files.length === 0) {
return;
@@ -90,7 +90,12 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
};
const handlPreviewBtnClick = (resource: Resource) => {
- showPreviewImageDialog(`${window.location.origin}/o/r/${resource.id}/${resource.filename}`);
+ const resourceUrl = `${window.location.origin}/o/r/${resource.id}/${resource.filename}`;
+ if (resource.type.startsWith("image")) {
+ showPreviewImageDialog(resourceUrl);
+ } else {
+ window.open(resourceUrl);
+ }
};
const handleCopyResourceLinkBtnClick = (resource: Resource) => {