Skip to content

Commit b8bf9fe

Browse files
Override clean_up_workspace shortcut to use flow function (#36)
1 parent c16436a commit b8bf9fe

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

webapp/src/blocks.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import SimState = pxt.editor.SimState;
3535
import { DuplicateOnDragConnectionChecker } from "../../pxtblocks/plugins/duplicateOnDrag";
3636
import { PathObject } from "../../pxtblocks/plugins/renderer/pathObject";
3737
import { Measurements } from "./constants";
38+
import { flow } from "../../pxtblocks";
3839

3940
interface CopyDataEntry {
4041
version: 1;
@@ -561,6 +562,17 @@ export class Editor extends toolboxeditor.ToolboxEditor {
561562
this.editor.getSvgGroup().addEventListener("blur", () => {
562563
delete focusRingDiv.dataset.focused;
563564
})
565+
566+
const cleanUpWorkspace = Blockly.ShortcutRegistry.registry.getRegistry()["clean_up_workspace"];
567+
Blockly.ShortcutRegistry.registry.unregister(cleanUpWorkspace.name);
568+
Blockly.ShortcutRegistry.registry.register({
569+
...cleanUpWorkspace,
570+
keyCodes: [Blockly.ShortcutRegistry.registry.createSerializedKey(cleanUpWorkspace.keyCodes[0] as number, null)],
571+
callback: (workspace) => {
572+
flow(workspace, { useViewWidth: true });
573+
return true
574+
}
575+
});
564576
}
565577
}
566578

0 commit comments

Comments
 (0)