From cbfe73e0bf725cc9b2760d4763c6da32e894d0bf Mon Sep 17 00:00:00 2001 From: cialloo Date: Sun, 26 Oct 2025 09:23:14 +0800 Subject: [PATCH] refactor: clean up ImageNode code structure and improve readability --- src/blog/nodes/ImageNode.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/blog/nodes/ImageNode.tsx b/src/blog/nodes/ImageNode.tsx index 57bd80c..572ebf7 100644 --- a/src/blog/nodes/ImageNode.tsx +++ b/src/blog/nodes/ImageNode.tsx @@ -49,8 +49,7 @@ export type SerializedImageNode = Spread< maxWidth: number; width?: number; fileKey?: string; - uploadProgress?: number; - uploadError?: string; + // uploadProgress and uploadError are runtime-only, not serialized }, SerializedLexicalNode >; @@ -84,7 +83,7 @@ export class ImageNode extends DecoratorNode { } static importJSON(serializedNode: SerializedImageNode): ImageNode { - const { altText, height, width, maxWidth, fileKey, uploadProgress, uploadError } = serializedNode; + const { altText, height, width, maxWidth, fileKey } = serializedNode; // Generate src from fileKey if available, otherwise use empty string const src = fileKey ? '' : ''; // src will be generated from fileKey when rendering @@ -96,8 +95,7 @@ export class ImageNode extends DecoratorNode { src, width, fileKey, - uploadProgress, - uploadError, + // uploadProgress and uploadError are not imported - they're runtime-only }); } @@ -158,8 +156,7 @@ export class ImageNode extends DecoratorNode { version: 1, width: this.__width === 'inherit' ? 0 : this.__width, fileKey: this.__fileKey, - uploadProgress: this.__uploadProgress, - uploadError: this.__uploadError, + // Don't export uploadProgress or uploadError - they're runtime-only UI state }; }