Skip to content

Commit 67fd4c2

Browse files
chore: fix review feedback
1 parent 44bc613 commit 67fd4c2

File tree

5 files changed

+5
-9
lines changed

5 files changed

+5
-9
lines changed

src/actions/enter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ export class EnterAction {
128128
*/
129129
private insertFromFlyout(workspace: WorkspaceSvg) {
130130
workspace.setResizesEnabled(false);
131+
// Create a new event group or append to the existing group.
131132
const existingGroup = Events.getGroup();
132133
if (!existingGroup) {
133134
Events.setGroup(true);

src/actions/move.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export class MoveActions {
199199
const curNode = workspace?.getCursor()?.getCurNode();
200200
let block = curNode?.getSourceBlock();
201201
if (!block) return undefined;
202-
while (block && block.isShadow()) {
202+
while (block?.isShadow()) {
203203
block = block.getParent();
204204
if (!block) {
205205
throw new Error(

src/actions/mover.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export class Mover {
206206
info.startLocation,
207207
);
208208

209-
if (target) {
209+
if (dragStrategy.isNewBlock && target) {
210210
const newNode = ASTNode.createConnectionNode(target);
211211
if (newNode) workspace.getCursor()?.setCurNode(newNode);
212212
}

src/keyboard_drag_strategy.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
import {
8-
common,
98
ASTNode,
109
BlockSvg,
1110
ConnectionType,
@@ -52,8 +51,6 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
5251

5352
override startDrag(e?: PointerEvent) {
5453
if (!this.cursor) throw new Error('precondition failure');
55-
// Select and focus block.
56-
common.setSelected(this.block);
5754
this.cursor.setCurNode(ASTNode.createBlockNode(this.block));
5855
super.startDrag(e);
5956
// Set position of the dragging block, so that it doesn't pop
@@ -166,8 +163,6 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
166163
draggingBlock: BlockSvg,
167164
localConns: RenderedConnection[],
168165
): ConnectionCandidate | null {
169-
// TODO: Handle the case where the cursor is null, or never return null
170-
// from workspace.getCursor()
171166
if (!this.cursor) throw new Error('precondition failure');
172167

173168
// Helper function for traversal.

src/navigation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,7 @@ export class Navigation {
770770
*
771771
* @param stationaryNode The first node to connect.
772772
* @param movingBlock The block we're moving.
773-
* @returns True if the key was handled; false if something went
774-
* wrong.
773+
* @returns True if the connection was successful, false otherwise.
775774
*/
776775
tryToConnectBlock(
777776
stationaryNode: Blockly.ASTNode,
@@ -784,6 +783,7 @@ export class Navigation {
784783
if (!destConnection) return false;
785784
return this.insertBlock(movingBlock, destConnection);
786785
}
786+
787787
/**
788788
* Disconnects the block from its parent and moves it to the position of the
789789
* workspace node.

0 commit comments

Comments
 (0)