mirror of
https://github.com/usememos/memos.git
synced 2025-12-18 14:50:13 +08:00
chore: support upload more file type
This commit is contained in:
parent
5fa9aa3c22
commit
22971c3a93
1 changed files with 7 additions and 2 deletions
|
|
@ -58,7 +58,7 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
|
||||||
document.body.appendChild(inputEl);
|
document.body.appendChild(inputEl);
|
||||||
inputEl.type = "file";
|
inputEl.type = "file";
|
||||||
inputEl.multiple = true;
|
inputEl.multiple = true;
|
||||||
inputEl.accept = "image/*";
|
inputEl.accept = "*";
|
||||||
inputEl.onchange = async () => {
|
inputEl.onchange = async () => {
|
||||||
if (!inputEl.files || inputEl.files.length === 0) {
|
if (!inputEl.files || inputEl.files.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -90,7 +90,12 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlPreviewBtnClick = (resource: Resource) => {
|
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) => {
|
const handleCopyResourceLinkBtnClick = (resource: Resource) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue