No longer serialize binary blobs as data URLs
This commit is contained in:
@@ -180,7 +180,7 @@ export function attachmentExtension(editor: Editor) {
|
||||
if (!finalFileName) {
|
||||
return;
|
||||
}
|
||||
await editor.space.writeAttachment(finalFileName, "arraybuffer", data!);
|
||||
await editor.space.writeAttachment(finalFileName, new Uint8Array(data));
|
||||
let attachmentMarkdown = `[${finalFileName}](${
|
||||
encodeURIComponent(finalFileName)
|
||||
})`;
|
||||
|
||||
+3
-11
@@ -33,24 +33,16 @@ class TableViewWidget extends WidgetType {
|
||||
});
|
||||
});
|
||||
|
||||
renderMarkdownToHtml(this.t, {
|
||||
dom.innerHTML = renderMarkdownToHtml(this.t, {
|
||||
// Annotate every element with its position so we can use it to put
|
||||
// the cursor there when the user clicks on the table.
|
||||
annotationPositions: true,
|
||||
inlineAttachments: async (url): Promise<string> => {
|
||||
inlineAttachments: (url) => {
|
||||
if (!url.includes("://")) {
|
||||
try {
|
||||
const d = await this.editor.space.readAttachment(url, "dataurl");
|
||||
return d.data as string;
|
||||
} catch (e: any) {
|
||||
console.error(e);
|
||||
return url;
|
||||
}
|
||||
return `/.fs/${url}`;
|
||||
}
|
||||
return url;
|
||||
},
|
||||
}).then((html) => {
|
||||
dom.innerHTML = html;
|
||||
});
|
||||
return dom;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user