Skip to content

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

editor: double click to preview image

Abdullah Atta53d5073690a8
diff --git a/packages/editor/src/extensions/image/component.tsx b/packages/editor/src/extensions/image/component.tsx
index 521446a45..5457828ce 100644
--- a/packages/editor/src/extensions/image/component.tsx
+++ b/packages/editor/src/extensions/image/component.tsx
@@ -256,6 +256,9 @@ export function ImageComponent(
: "2px solid transparent",
borderRadius: "default"
}}
+ onDoubleClick={() =>
+ editor.current?.commands.previewAttachment(node.attrs)
+ }
onLoad={(e) => {
const { clientHeight, clientWidth } = e.currentTarget;
if (!height && !width && !aspectRatio) {
diff --git a/packages/editor/src/extensions/image/image.ts b/packages/editor/src/extensions/image/image.ts
index 24e2ffa4e..cfb55afda 100644
--- a/packages/editor/src/extensions/image/image.ts
+++ b/packages/editor/src/extensions/image/image.ts
@@ -59,7 +59,7 @@ export interface ImageOptions {
* data.
*/
export type ImageAttributes = Partial<ImageSizeOptions> &
- Partial<Attachment> & {
+ Attachment & {
src: string;
dataurl?: string;
alt?: string;
diff --git a/packages/editor/src/toolbar/popups/image-upload.tsx b/packages/editor/src/toolbar/popups/image-upload.tsx
index 9b7800b3c..c7f42ce03 100644
--- a/packages/editor/src/toolbar/popups/image-upload.tsx
+++ b/packages/editor/src/toolbar/popups/image-upload.tsx
@@ -26,7 +26,7 @@ import { downloadImage, toDataURL } from "../../utils/downloader";
import { useToolbarStore } from "../stores/toolbar-store";
export type ImageUploadPopupProps = {
- onInsert: (image: ImageAttributes) => void;
+ onInsert: (image: Partial<ImageAttributes>) => void;
onClose: () => void;
};
export function ImageUploadPopup(props: ImageUploadPopupProps) {