Skip to content

Commit

Permalink
fix: fixup keyboard nav to remove blockly version check (#1991)
Browse files Browse the repository at this point in the history
* fix: fixup keyboard nav to remove check

* chore: update beta version
  • Loading branch information
BeksOmega committed Sep 28, 2023
1 parent 9d00c1d commit 4150380
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
16 changes: 8 additions & 8 deletions plugins/keyboard-navigation/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions plugins/keyboard-navigation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
"devDependencies": {
"@blockly/dev-scripts": "^2.0.1",
"@blockly/dev-tools": "^7.1.0",
"blockly": "^10.2.0-beta.0",
"blockly": "^10.2.0-beta.3",
"chai": "^4.2.0",
"jsdom": "^16.4.0",
"jsdom-global": "^3.0.2",
"mocha": "^7.1.0",
"sinon": "^9.0.1"
},
"peerDependencies": {
"blockly": "^10.2.0-beta.0"
"blockly": "^10.2.0-beta.3"
},
"publishConfig": {
"access": "public",
Expand Down
23 changes: 8 additions & 15 deletions plugins/keyboard-navigation/src/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -872,21 +872,14 @@ export class Navigation {
if (!destConnection.isSuperior()) {
const rootBlock = movingBlock.getRootBlock();

// DO NOT DO CHECKS BASED ON BLOCKLY VERSION.
// We have to do this because are calling an internal method, which we
// should not be doing.
if (/** @type {string} */ (Blockly.VERSION) === '10.2.0') {
const originalOffsetToTarget = {
x: destConnection.x - movingConnection.x,
y: destConnection.y - movingConnection.y,
};
const originalOffsetInBlock =
movingConnection.getOffsetInBlock().clone();
rootBlock.positionNearConnection(
movingConnection, originalOffsetToTarget, originalOffsetInBlock);
} else {
rootBlock.positionNearConnection(movingConnection, destConnection);
}
const originalOffsetToTarget = {
x: destConnection.x - movingConnection.x,
y: destConnection.y - movingConnection.y,
};
const originalOffsetInBlock =
movingConnection.getOffsetInBlock().clone();
rootBlock.positionNearConnection(
movingConnection, originalOffsetToTarget, originalOffsetInBlock);
}
destConnection.connect(movingConnection);
return true;
Expand Down

0 comments on commit 4150380

Please sign in to comment.