feat: add S3 configuration and utility functions for blog image handling
All checks were successful
CI - Build and Push / Build and Push Docker Image (push) Successful in 17s

This commit is contained in:
2025-10-26 07:56:19 +08:00
parent 031c2b25e2
commit 7f58c9c847
10 changed files with 98 additions and 30 deletions

View File

@@ -47,7 +47,6 @@ export type SerializedImageNode = Spread<
altText: string;
height?: number;
maxWidth: number;
src: string;
width?: number;
fileKey?: string;
uploadProgress?: number;
@@ -85,7 +84,11 @@ export class ImageNode extends DecoratorNode<JSX.Element> {
}
static importJSON(serializedNode: SerializedImageNode): ImageNode {
const { altText, height, width, maxWidth, src, fileKey, uploadProgress, uploadError } = serializedNode;
const { altText, height, width, maxWidth, fileKey, uploadProgress, uploadError } = serializedNode;
// Generate src from fileKey if available, otherwise use empty string
const src = fileKey ? '' : ''; // src will be generated from fileKey when rendering
return $createImageNode({
altText,
height,
@@ -150,7 +153,7 @@ export class ImageNode extends DecoratorNode<JSX.Element> {
altText: this.getAltText(),
height: this.__height === 'inherit' ? 0 : this.__height,
maxWidth: this.__maxWidth,
src: this.getSrc(),
// Don't export src - it's mutable and will be generated from fileKey
type: 'image',
version: 1,
width: this.__width === 'inherit' ? 0 : this.__width,