mirror of
https://github.com/google/blockly.git
synced 2026-01-30 20:20:09 +01:00
fix: focus after drag and deleting comments (#9074)
* fix: focus after drag and deleting comments * chore: fix import
This commit is contained in:
@@ -856,7 +856,7 @@ export class BlockSvg
|
||||
if (parent) {
|
||||
focusManager.focusNode(parent);
|
||||
} else {
|
||||
focusManager.focusTree(this.workspace);
|
||||
setTimeout(() => focusManager.focusTree(this.workspace), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import {IContextMenu} from '../interfaces/i_contextmenu.js';
|
||||
import {ICopyable} from '../interfaces/i_copyable.js';
|
||||
import {IDeletable} from '../interfaces/i_deletable.js';
|
||||
import {IDraggable} from '../interfaces/i_draggable.js';
|
||||
import {IFocusableNode} from '../interfaces/i_focusable_node.js';
|
||||
import type {IFocusableTree} from '../interfaces/i_focusable_tree.js';
|
||||
import {IRenderedElement} from '../interfaces/i_rendered_element.js';
|
||||
import {ISelectable} from '../interfaces/i_selectable.js';
|
||||
@@ -42,7 +43,8 @@ export class RenderedWorkspaceComment
|
||||
ISelectable,
|
||||
IDeletable,
|
||||
ICopyable<WorkspaceCommentCopyData>,
|
||||
IContextMenu
|
||||
IContextMenu,
|
||||
IFocusableNode
|
||||
{
|
||||
/** The class encompassing the svg elements making up the workspace comment. */
|
||||
private view: CommentView;
|
||||
@@ -207,7 +209,12 @@ export class RenderedWorkspaceComment
|
||||
/** Disposes of the view. */
|
||||
override dispose() {
|
||||
this.disposing = true;
|
||||
const focusManager = getFocusManager();
|
||||
if (focusManager.getFocusedNode() === this) {
|
||||
setTimeout(() => focusManager.focusTree(this.workspace), 0);
|
||||
}
|
||||
if (!this.view.isDeadOrDying()) this.view.dispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user