Skip to content

Commit 8a042cf

Browse files
Merge branch 'main' into makecode-tweaks
2 parents 7fa5557 + 7e46977 commit 8a042cf

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@blockly/keyboard-experiment",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "A plugin for keyboard navigation.",
55
"scripts": {
66
"audit:fix": "blockly-scripts auditFix",

src/navigation.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,13 @@ export class Navigation {
548548
}
549549

550550
/**
551-
* Moves the cursor to the top connection point on on the first top block.
552-
* If the workspace is empty, moves the cursor to the default location on
553-
* the workspace.
554-
*
551+
* Sets the cursor location when focusing the workspace.
552+
* Tries the following, in order, stopping after the first success:
553+
* - Resume editing by putting the cursor at the marker location, if any.
554+
* - Resume editing by returning the cursor to its previous location, if any.
555+
* - Move the cursor to the top connection point on on the first top block.
556+
* - Move the cursor to the default location on the workspace.
557+
*
555558
* @param workspace The main Blockly workspace.
556559
* @param keepPosition Whether to retain the cursor's previous position.
557560
*/
@@ -564,6 +567,13 @@ export class Navigation {
564567
if (!cursor) {
565568
return;
566569
}
570+
571+
if (this.markedNode) {
572+
cursor.setCurNode(this.markedNode);
573+
this.removeMark(workspace);
574+
return;
575+
}
576+
567577
if (cursor.getCurNode() && keepPosition) {
568578
// Retain the cursor's previous position since it's set.
569579
return;

0 commit comments

Comments
 (0)