fix: attachment bugs in safari(#1908)

* use widely available arrayBuffer
* fix stream fails in safari
* fix hasFocus bug
* fix safari upload bug
* feat: add HTTP range request support for file serving
This commit is contained in:
Philip Okugbe
2026-02-05 07:47:03 -08:00
committed by GitHub
parent 5c3942c159
commit 4878850b25
8 changed files with 140 additions and 49 deletions
@@ -170,6 +170,8 @@ const CommandGroups: SlashMenuGroupedItemsType = {
input.type = "file";
input.accept = "image/*";
input.multiple = true;
input.style.display = "none";
document.body.appendChild(input);
input.onchange = async () => {
if (input.files?.length) {
for (const file of input.files) {
@@ -179,8 +181,7 @@ const CommandGroups: SlashMenuGroupedItemsType = {
}
}
// Reset the input value to allow uploading the same file again if needed
input.value = "";
input.remove();
};
input.click();
},
@@ -202,6 +203,8 @@ const CommandGroups: SlashMenuGroupedItemsType = {
input.type = "file";
input.accept = "video/*";
input.multiple = true;
input.style.display = "none";
document.body.appendChild(input);
input.onchange = async () => {
if (input.files?.length) {
for (const file of input.files) {
@@ -211,8 +214,7 @@ const CommandGroups: SlashMenuGroupedItemsType = {
}
}
// Reset the input value to allow uploading the same file again if needed
input.value = "";
input.remove();
};
input.click();
},
@@ -234,6 +236,8 @@ const CommandGroups: SlashMenuGroupedItemsType = {
input.type = "file";
input.accept = "";
input.multiple = true;
input.style.display = "none";
document.body.appendChild(input);
input.onchange = async () => {
if (input.files?.length) {
for (const file of input.files) {
@@ -243,8 +247,7 @@ const CommandGroups: SlashMenuGroupedItemsType = {
}
}
// Reset the input value to allow uploading the same file again if needed
input.value = "";
input.remove();
};
input.click();
},
@@ -157,7 +157,9 @@ export function TitleEditor({
useEffect(() => {
setTimeout(() => {
titleEditor?.commands.focus("end");
// guard against Cannot access view['hasFocus'] error
if (!titleEditor?.isInitialized) return;
titleEditor?.commands?.focus("end");
}, 500);
}, [titleEditor]);