From 53fd19ae2ea1f71cb1046e02948cf0b59b3cd6ef Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 15 Apr 2025 08:18:20 -0400 Subject: [PATCH] fix: Full-width image control should act as toggle closes #8954 --- shared/editor/nodes/Image.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shared/editor/nodes/Image.tsx b/shared/editor/nodes/Image.tsx index 16839779f8..c122fa5ee9 100644 --- a/shared/editor/nodes/Image.tsx +++ b/shared/editor/nodes/Image.tsx @@ -408,10 +408,14 @@ export default class Image extends SimpleImage { if (!(state.selection instanceof NodeSelection)) { return false; } + let layoutClass: string | null = "full-width"; + if (state.selection.node.attrs.layoutClass === layoutClass) { + layoutClass = null; + } const attrs = { ...state.selection.node.attrs, title: null, - layoutClass: "full-width", + layoutClass, }; const { selection } = state; dispatch?.(state.tr.setNodeMarkup(selection.from, undefined, attrs));