From 0ed6c82acca280816069613a059e3830147f132b Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Thu, 27 Feb 2025 10:55:34 -0800 Subject: [PATCH] fix: Disallow and ignore x and y attributes for blocks in toolbox definitions. (#8785) * fix: Disallow and ignore x and y attributes for blocks in toolbox definitions. * chore: Clarify comment in BlockFlyoutInflater. --- core/block_flyout_inflater.ts | 9 +++++++++ core/utils/toolbox.ts | 2 -- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/block_flyout_inflater.ts b/core/block_flyout_inflater.ts index 6011b150e..b180dbc0c 100644 --- a/core/block_flyout_inflater.ts +++ b/core/block_flyout_inflater.ts @@ -101,6 +101,15 @@ export class BlockFlyoutInflater implements IFlyoutInflater { ) { blockDefinition['disabledReasons'] = [MANUALLY_DISABLED]; } + // These fields used to be allowed and may still be present, but are + // ignored here since everything in the flyout should always be laid out + // linearly. + if ('x' in blockDefinition) { + delete blockDefinition['x']; + } + if ('y' in blockDefinition) { + delete blockDefinition['y']; + } block = blocks.appendInternal(blockDefinition as blocks.State, workspace); } diff --git a/core/utils/toolbox.ts b/core/utils/toolbox.ts index 296bb6dcc..f81ebdc72 100644 --- a/core/utils/toolbox.ts +++ b/core/utils/toolbox.ts @@ -24,8 +24,6 @@ export interface BlockInfo { disabledReasons?: string[]; enabled?: boolean; id?: string; - x?: number; - y?: number; collapsed?: boolean; inline?: boolean; data?: string;