mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
fix: Fix bug that prevented dismissing the widgetdiv in a mutator workspace. (#8600)
* fix: Fix bug that prevented dismissing the widgetdiv in a mutator workspace. * fix: Check if the correct workspace is null. * fix: Remove errant this.
This commit is contained in:
@@ -166,10 +166,22 @@ export function hideIfOwner(oldOwner: unknown) {
|
||||
* Destroy the widget and hide the div if it is being used by an object in the
|
||||
* specified workspace, or if it is used by an unknown workspace.
|
||||
*
|
||||
* @param oldOwnerWorkspace The workspace that was using this container.
|
||||
* @param workspace The workspace that was using this container.
|
||||
*/
|
||||
export function hideIfOwnerIsInWorkspace(oldOwnerWorkspace: WorkspaceSvg) {
|
||||
if (ownerWorkspace === null || ownerWorkspace === oldOwnerWorkspace) {
|
||||
export function hideIfOwnerIsInWorkspace(workspace: WorkspaceSvg) {
|
||||
let ownerIsInWorkspace = ownerWorkspace === null;
|
||||
// Check if the given workspace is a parent workspace of the one containing
|
||||
// our owner.
|
||||
let currentWorkspace: WorkspaceSvg | null = workspace;
|
||||
while (!ownerIsInWorkspace && currentWorkspace) {
|
||||
if (currentWorkspace === workspace) {
|
||||
ownerIsInWorkspace = true;
|
||||
break;
|
||||
}
|
||||
currentWorkspace = workspace.options.parentWorkspace;
|
||||
}
|
||||
|
||||
if (ownerIsInWorkspace) {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user