Upload robustness
parent
e3a9bc532f
commit
cd27739336
|
@ -56,7 +56,10 @@ export function downloadFile(filename: string, dataUrl: string): Promise<void> {
|
||||||
return syscall("editor.downloadFile", filename, dataUrl);
|
return syscall("editor.downloadFile", filename, dataUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function uploadFile(accept?: string, capture?: string): Promise<UploadFile> {
|
export function uploadFile(
|
||||||
|
accept?: string,
|
||||||
|
capture?: string,
|
||||||
|
): Promise<UploadFile> {
|
||||||
return syscall("editor.uploadFile", accept, capture);
|
return syscall("editor.uploadFile", accept, capture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +80,7 @@ export function filterBox(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showPanel(
|
export function showPanel(
|
||||||
id: "lhs" | "rhs" | "bhs" | "modal" | "ps",
|
id: "lhs" | "rhs" | "bhs" | "modal" | "ps" | "preface",
|
||||||
mode: number,
|
mode: number,
|
||||||
html: string,
|
html: string,
|
||||||
script = "",
|
script = "",
|
||||||
|
@ -86,7 +89,7 @@ export function showPanel(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hidePanel(
|
export function hidePanel(
|
||||||
id: "lhs" | "rhs" | "bhs" | "modal" | "ps",
|
id: "lhs" | "rhs" | "bhs" | "modal" | "ps" | "preface",
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
return syscall("editor.hidePanel", id);
|
return syscall("editor.hidePanel", id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ async function saveFile(file: UploadFile) {
|
||||||
file.content,
|
file.content,
|
||||||
);
|
);
|
||||||
let attachmentMarkdown = `[${finalFileName}](${encodeURI(finalFileName)})`;
|
let attachmentMarkdown = `[${finalFileName}](${encodeURI(finalFileName)})`;
|
||||||
if (file.contentType.startsWith("image/")) {
|
if (file.contentType?.startsWith("image/")) {
|
||||||
attachmentMarkdown = `})`;
|
attachmentMarkdown = `})`;
|
||||||
}
|
}
|
||||||
editor.insertAtCursor(attachmentMarkdown);
|
editor.insertAtCursor(attachmentMarkdown);
|
||||||
|
|
Loading…
Reference in New Issue