Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

fix: convert image size to string (#5717)

Aaryan Khandelwal04686d172133
diff --git a/packages/editor/src/core/extensions/custom-image/components/image-block.tsx b/packages/editor/src/core/extensions/custom-image/components/image-block.tsx
index 565c37c540..34e936c723 100644
--- a/packages/editor/src/core/extensions/custom-image/components/image-block.tsx
+++ b/packages/editor/src/core/extensions/custom-image/components/image-block.tsx
@@ -11,7 +11,10 @@ export const CustomImageBlock: React.FC<CustomImageNodeViewProps> = (props) => {
const { node, updateAttributes, selected, getPos, editor } = props;
const { src, width, height } = node.attrs;
- const [size, setSize] = useState({ width: width || "35%", height: height || "auto" });
+ const [size, setSize] = useState({
+ width: width?.toString() || "35%",
+ height: height?.toString() || "auto",
+ });
const [isLoading, setIsLoading] = useState(true);
const [initialResizeComplete, setInitialResizeComplete] = useState(false);
const isShimmerVisible = isLoading || !initialResizeComplete;
@@ -56,7 +59,10 @@ export const CustomImageBlock: React.FC<CustomImageNodeViewProps> = (props) => {
}, [width, height, updateAttributes]);
useLayoutEffect(() => {
- setSize({ width, height });
+ setSize({
+ width: width?.toString(),
+ height: height?.toString(),
+ });
}, [width, height]);
const handleResizeStart = useCallback(
diff --git a/packages/editor/src/core/extensions/custom-image/components/image-node.tsx b/packages/editor/src/core/extensions/custom-image/components/image-node.tsx
index 4786d8f997..94d58f712b 100644
--- a/packages/editor/src/core/extensions/custom-image/components/image-node.tsx
+++ b/packages/editor/src/core/extensions/custom-image/components/image-node.tsx
@@ -15,8 +15,8 @@ export type CustomImageNodeViewProps = {
node: ProsemirrorNode & {
attrs: {
src: string;
- width: string;
- height: string;
+ width: number | string;
+ height: number | string;
};
};
updateAttributes: (attrs: Record<string, any>) => void;