From 4d3580bf3aa1e83b2e602fe5283bde4d191eca36 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 7 Aug 2025 23:34:53 -0600 Subject: [PATCH] Update transforms.ts --- apps/web/src/components/ui/report/elements/transforms.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/ui/report/elements/transforms.ts b/apps/web/src/components/ui/report/elements/transforms.ts index 9735c6cf0..c751d66fb 100644 --- a/apps/web/src/components/ui/report/elements/transforms.ts +++ b/apps/web/src/components/ui/report/elements/transforms.ts @@ -74,7 +74,11 @@ export const insertBlock = (editor: PlateEditor, type: string) => { select: true }); } - if (getBlockType(block[0]) !== type) { + // Only remove the previous block when replacing an empty paragraph. + // This prevents non-paragraph blocks (e.g., metric elements) from being + // inadvertently removed when inserting a new block after them. + const previousType = getBlockType(block[0]); + if (previousType === KEYS.p && previousType !== type) { // Check if SuggestionPlugin is available before using it const suggestionApi = editor.getApi(SuggestionPlugin); if (suggestionApi?.suggestion?.withoutSuggestions) {