From 938d1fa5f23b265c2c062739d3dfa56e19701742 Mon Sep 17 00:00:00 2001 From: Maribeth Moffatt Date: Tue, 26 May 2026 17:18:46 -0400 Subject: [PATCH] fix: typo in `unregisterWorkspace` (#9936) * fix: Fix typo in unregisterWorkspace function name * fix: Add deprecation warning for unregisterWorkpace function * fix: Add renaming entry for unregisterWorkspace in version 13.0.0 * fix(typo): "." -> "," in renamings.json5 Co-authored-by: Maribeth Moffatt * fix(workspace): Correct typo in `unregisterWorkspace` method call * chore: change v12 to v13 * chore: update import --------- Co-authored-by: Woosuk Nam --- packages/blockly/core/common.ts | 20 ++++++++++++++++++- packages/blockly/core/workspace.ts | 2 +- .../blockly/scripts/migration/renamings.json5 | 11 ++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/packages/blockly/core/common.ts b/packages/blockly/core/common.ts index 87fb19f71..302d47ccd 100644 --- a/packages/blockly/core/common.ts +++ b/packages/blockly/core/common.ts @@ -15,6 +15,7 @@ import * as eventUtils from './events/utils.js'; import {getFocusManager} from './focus_manager.js'; import {ISelectable, isSelectable} from './interfaces/i_selectable.js'; import {ShortcutRegistry} from './shortcut_registry.js'; +import * as deprecation from './utils/deprecation.js'; import type {Workspace} from './workspace.js'; import type {WorkspaceSvg} from './workspace_svg.js'; @@ -58,10 +59,27 @@ export function registerWorkspace(workspace: Workspace) { * * @param workspace */ -export function unregisterWorkpace(workspace: Workspace) { +export function unregisterWorkspace(workspace: Workspace) { delete WorkspaceDB_[workspace.id]; } +/** + * Unregister a workspace from the workspace db. + * + * @deprecated v13: use Blockly.common.unregisterWorkspace + * @param workspace + */ +export function unregisterWorkpace(workspace: Workspace) { + deprecation.warn( + 'Blockly.common.unregisterWorkpace', + 'v13', + 'v14', + 'Blockly.common.unregisterWorkspace', + ); + + unregisterWorkspace(workspace); +} + /** * The main workspace most recently used. * Set by Blockly.WorkspaceSvg.prototype.markFocused diff --git a/packages/blockly/core/workspace.ts b/packages/blockly/core/workspace.ts index 48a05fc37..7b5e897f4 100644 --- a/packages/blockly/core/workspace.ts +++ b/packages/blockly/core/workspace.ts @@ -167,7 +167,7 @@ export class Workspace { this.listeners.length = 0; this.clear(); // Remove from workspace database. - common.unregisterWorkpace(this); + common.unregisterWorkspace(this); } /** diff --git a/packages/blockly/scripts/migration/renamings.json5 b/packages/blockly/scripts/migration/renamings.json5 index 9c51b2d4a..5e11e1c94 100644 --- a/packages/blockly/scripts/migration/renamings.json5 +++ b/packages/blockly/scripts/migration/renamings.json5 @@ -1595,5 +1595,16 @@ }, ], + '13.0.0': [ + { + oldName: 'Blockly.common', + exports: { + unregisterWorkpace: { + newExport: 'unregisterWorkspace', + }, + }, + }, + ], + 'develop': [], }