Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: use `dataurl` attr for inserting an image

Abdullah Atta4318a65a9928
diff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsx
index 16c8f7c92..f9b64f42b 100644
--- a/apps/web/src/components/editor/tiptap.tsx
+++ b/apps/web/src/components/editor/tiptap.tsx
@@ -390,15 +390,18 @@ function toIEditor(editor: Editor): IEditor {
},
attachFile: (file: Attachment) => {
if (file.dataurl) {
- editor.current?.commands.insertImage({ ...file, src: file.dataurl });
+ editor.current?.commands.insertImage({
+ ...file,
+ dataurl: file.dataurl
+ });
} else editor.current?.commands.insertAttachment(file);
},
loadWebClip: (hash, src) =>
editor.current?.commands.updateWebClip({ hash }, { src }),
- loadImage: (hash, src) =>
+ loadImage: (hash, dataurl) =>
editor.current?.commands.updateImage(
{ hash },
- { hash, dataurl: src, preventUpdate: true }
+ { hash, dataurl, preventUpdate: true }
),
sendAttachmentProgress: (hash, type, progress) =>
editor.current?.commands.setAttachmentProgress({
diff --git a/packages/editor/src/extensions/image/image.ts b/packages/editor/src/extensions/image/image.ts
index 424e1e313..4829d700f 100644
--- a/packages/editor/src/extensions/image/image.ts
+++ b/packages/editor/src/extensions/image/image.ts
@@ -79,7 +79,7 @@ declare module "@tiptap/core" {
/**
* Add an image
*/
- insertImage: (options: ImageAttributes) => ReturnType;
+ insertImage: (options: Partial<ImageAttributes>) => ReturnType;
updateImage: (
query: { src?: string; hash?: string },
options: Partial<ImageAttributes> & { preventUpdate?: boolean }