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.
This commit is contained in:
Aaron Dodson
2025-02-27 10:55:34 -08:00
committed by GitHub
parent 22dbd75bd4
commit 0ed6c82acc
2 changed files with 9 additions and 2 deletions

View File

@@ -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);
}

View File

@@ -24,8 +24,6 @@ export interface BlockInfo {
disabledReasons?: string[];
enabled?: boolean;
id?: string;
x?: number;
y?: number;
collapsed?: boolean;
inline?: boolean;
data?: string;