A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
editor: fix loading copied image on ios
ammarahm-edb4220d349fb0
diff --git a/packages/editor/src/extensions/image/image.ts b/packages/editor/src/extensions/image/image.tsindex 4981d151c..767141e57 100644--- a/packages/editor/src/extensions/image/image.ts+++ b/packages/editor/src/extensions/image/image.ts@@ -169,7 +169,7 @@ export const ImageNode = Node.create<ImageOptions>({},updateImage:(query, options) =>- ({ state, tr, dispatch }) => {+ ({ state, tr }) => {const keyedQuery = query.hash? { key: "hash", value: query.hash }: query.src@@ -191,7 +191,6 @@ export const ImageNode = Node.create<ImageOptions>({}tr.setMeta("preventUpdate", options.preventUpdate || false);tr.setMeta("addToHistory", false);- if (dispatch) dispatch(tr);return true;}};diff --git a/packages/editor/src/utils/downloader.ts b/packages/editor/src/utils/downloader.tsindex fef0a97e8..7891e1d36 100644--- a/packages/editor/src/utils/downloader.ts+++ b/packages/editor/src/utils/downloader.ts@@ -20,14 +20,49 @@ export type DownloadOptions = {corsHost: string;};+const UTITypes: Record<string, string> = {+ "com.microsoft.bmp": "image/bmp",+ "com.canon.crw-raw-image": "image/x-canon-crw",+ "com.adobe.raw-image": "image/x-adobe-dng",+ "com.dxo.raw-image": "image/x-dxo-dxo",+ "com.j2.efx-fax": "image/efax",+ "com.epson.raw-image": "image/x-epson-erf",+ "com.kodak.flashpix-image": "image/fpx",+ "com.compuserve.gif": "image/gif",+ "com.microsoft.ico": "image/vnd.microsoft.icon",+ "public.jpeg": "image/jpeg",+ "public.jpeg-2000": "image/jp2",+ "com.nikon.nrw-raw-image": "image/x-nikon-nrw",+ "com.apple.pict": "image/pict",+ "public.png": "image/png",+ "com.adobe.photoshop-image": "image/vnd.adobe.photoshop",+ "com.leica.pwl-raw-image": "image/x-leica-pwl",+ "com.apple.quicktime-image": "image/x-quicktime",+ "com.sgi.sgi-image": "image/sgi",+ "com.sony.sr2-raw-image": "image/x-sony-sr2",+ "public.svg-image": "image/svg+xml",+ "com.truevision.tga-image": "image/targa",+ "public.tiff": "image/tiff",+ "public.xbitmap-image": "image/x-xbitmap",+ "public.avci": "image/avci",+ "public.avcs": "image/avcs",+ "public.heic": "image/heic",+ "public.heif": "image/heif",+ "public.heics": "image/heic-sequence",+ "public.heifs": "image/heif-sequence"+};+export async function downloadImage(url: string, options?: DownloadOptions) {- if (options?.corsHost) url = `${options.corsHost}/${url}`;+ if (options?.corsHost && !url.startsWith("blob:"))+ url = `${options.corsHost}/${url}`;const response = await fetch(url);if (!response.ok) throw new Error(`invalid status code ${response.status}`);- const contentType = response.headers.get("Content-Type");+ let contentType = response.headers.get("Content-Type");const contentLength = response.headers.get("Content-Length");+ if (contentType && UTITypes[contentType]) contentType = UTITypes[contentType];+if (!contentType ||!contentLength ||