diff --git a/app/routes/_editor+/core/components/BlockSelector.tsx b/app/routes/_editor+/core/components/BlockSelector.tsx
index 341d507d5..ff8de0aae 100644
--- a/app/routes/_editor+/core/components/BlockSelector.tsx
+++ b/app/routes/_editor+/core/components/BlockSelector.tsx
@@ -71,7 +71,8 @@ export function BlockSelector({
type: BlockType.Image,
refId: null,
url: null,
- caption: null,
+ caption: false,
+ containerWidth: 728,
children: [{ text: "" }],
});
},
diff --git a/app/routes/_editor+/core/components/EditorView.tsx b/app/routes/_editor+/core/components/EditorView.tsx
index 6e4ff7318..09b2c52c7 100644
--- a/app/routes/_editor+/core/components/EditorView.tsx
+++ b/app/routes/_editor+/core/components/EditorView.tsx
@@ -1,9 +1,8 @@
import { useCallback, useMemo } from "react";
-import clsx from "clsx";
import { createEditor } from "slate";
import type { RenderElementProps } from "slate-react";
-import { Slate, Editable, withReact } from "slate-react";
+import { Slate, Editable, withReact, ReactEditor } from "slate-react";
// eslint-disable-next-line import/no-cycle
import { EditorBlocks } from "./EditorBlocks";
@@ -14,25 +13,25 @@ export function EditorView({ data }: { data: any }) {
const editor = useMemo(() => withReact(createEditor()), []);
const renderElement = useCallback((props: RenderElementProps) => {
- const isVariableWidth = props.element.type === BlockType.Image;
+ const path = ReactEditor.findPath(editor, props.element);
+ const isTopLevel = path.length === 1;
+ const isVariableWidth =
+ props.element.type === BlockType.Image && props.element.containerWidth;
- return (
-
-
+
+ ) : (
+
);
}, []);
return (
diff --git a/app/routes/_editor+/core/dnd.tsx b/app/routes/_editor+/core/dnd.tsx
index 5be331fd6..f73f860a7 100644
--- a/app/routes/_editor+/core/dnd.tsx
+++ b/app/routes/_editor+/core/dnd.tsx
@@ -334,15 +334,13 @@ function HoverElement({
const isParentTwoColumn =
element.type == BlockType.TwoColumn && !isTwoColumn;
- const isVariableWidth = element.type === BlockType.Image;
+ const isVariableWidth =
+ element.type === BlockType.Image && element.containerWidth;
return (