Skip to content

Commit 59e9695

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/npm_and_yarn-96c788614a
2 parents 144f7cf + 9dac4bd commit 59e9695

20 files changed

+482
-290
lines changed

.github/workflows/pages.yml

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
name: Deploy static content to Pages
33

44
on:
5-
# Runs on pushes targeting the default branch
5+
# Runs on pushes targeting the default and experimentation branches.
66
push:
7-
branches: ['main']
7+
branches:
8+
- main
9+
- add-screen-reader-support-experimental
810

9-
# Allows you to run this workflow manually from the Actions tab
11+
# Allows the workflow to be manually run from the Actions tab.
1012
workflow_dispatch:
1113

12-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages.
1315
permissions:
1416
contents: read
1517
pages: write
@@ -26,45 +28,77 @@ jobs:
2628
build:
2729
runs-on: ubuntu-latest
2830
steps:
29-
- name: Checkout blockly
31+
- name: Checkout tip-of-tree core Blockly
3032
uses: actions/checkout@v4
3133
with:
3234
path: blockly
3335
repository: google/blockly
3436
ref: develop
3537

36-
- name: Checkout blockly-keyboard-experimentation
38+
- name: Checkout add-screen-reader-support-experimental core Blockly
39+
uses: actions/checkout@v4
40+
with:
41+
path: blockly-add-screen-reader-support-experimental
42+
repository: google/blockly
43+
ref: add-screen-reader-support-experimental
44+
45+
- name: Checkout tip-of-tree blockly-keyboard-experimentation
3746
uses: actions/checkout@v4
3847
with:
3948
path: blockly-keyboard-experimentation
4049

50+
- name: Checkout add-screen-reader-support-experimental blockly-keyboard-experimentation
51+
uses: actions/checkout@v4
52+
with:
53+
path: blockly-keyboard-experimentation-add-screen-reader-support-experimental
54+
ref: add-screen-reader-support-experimental
55+
4156
- name: Setup Node
4257
uses: actions/setup-node@v4
4358
with:
4459
node-version: 20.x
4560

46-
- name: Build blockly
61+
- name: Build tip-of-tree core Blockly
4762
run: |
4863
cd blockly
4964
npm ci
5065
npm run package
5166
cd dist
5267
npm link
53-
cd ../..
5468
55-
- name: Build blockly-keyboard-experimentation
69+
- name: Build tip-of-tree blockly-keyboard-experimentation
5670
run: |
5771
cd blockly-keyboard-experimentation
5872
npm ci
5973
npm link blockly
6074
npm run ghpages
61-
cd ..
75+
mkdir ../ghpages
76+
cp -r build/* ../ghpages/
77+
78+
- name: Build add-screen-reader-support-experimental core Blockly
79+
run: |
80+
cd blockly/dist
81+
npm unlink -g
82+
cd ../../blockly-add-screen-reader-support-experimental
83+
npm ci
84+
npm run package
85+
cd dist
86+
npm link
87+
88+
- name: Build add-screen-reader-support-experimental blockly-keyboard-experimentation
89+
run: |
90+
cd blockly-keyboard-experimentation-add-screen-reader-support-experimental
91+
npm ci
92+
npm link blockly
93+
npm run ghpages
94+
mkdir ../ghpages/screenreader
95+
cp -r build/* ../ghpages/screenreader/
6296
6397
- name: Upload artifact
6498
uses: actions/upload-pages-artifact@v3
6599
with:
66-
# Upload build folder
67-
path: './blockly-keyboard-experimentation/build'
100+
# Upload configured GH pages site files.
101+
path: './ghpages'
68102

69103
deploy:
70104
environment:

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ const workspace = Blockly.inject('blocklyDiv', {
8181
const keyboardNav = new KeyboardNavigation(workspace);
8282
```
8383

84+
## Add shortcuts to page
85+
86+
In order to see the keyboard help popup when the user presses /, you need to add an empty div element to the hosting page that has the Blockly div element with the id "shortcuts". The plugin will take care of layout and formatting.
87+
88+
```html
89+
...
90+
<div id="shortcuts"></div>
91+
...
92+
<div id="blockly"></div>
93+
...
94+
```
95+
8496
### Usage with cross-tab-copy-paste plugin
8597

8698
This plugin adds context menu items for copying & pasting. It also adds feedback to copying & pasting as toasts that are shown to the user upon successful copy or cut. It is compatible with the `@blockly/plugin-cross-tab-copy-paste` by following these steps:

eslint.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,17 @@ module.exports = [
259259
'@typescript-eslint/no-require-imports': 'error',
260260
},
261261
},
262+
{
263+
files: ['test/webdriverio/test/*.ts'],
264+
languageOptions: {
265+
parserOptions: {
266+
project: true,
267+
tsconfigRootDir: __dirname,
268+
},
269+
},
270+
rules: {
271+
'@typescript-eslint/no-floating-promises': 'error',
272+
'@typescript-eslint/no-misused-promises': 'error',
273+
},
274+
},
262275
];

package-lock.json

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

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
"predeploy": "blockly-scripts predeploy",
1515
"prepublishOnly": "npm login --registry https://wombat-dressing-room.appspot.com",
1616
"start": "blockly-scripts start",
17-
"test": "npm run wdio:clean && npm run wdio:build && npm run wdio:run",
17+
"test": "npm run test:mocha && npm run test:wdio",
18+
"test:mocha": "blockly-scripts test",
19+
"test:wdio": "npm run wdio:clean && npm run wdio:run",
1820
"wdio:build": "npm run wdio:build:app && npm run wdio:build:tests",
1921
"wdio:build:app": "cd test/webdriverio && webpack",
2022
"wdio:build:tests": "tsc -p ./test/webdriverio/test/tsconfig.json",
@@ -65,6 +67,7 @@
6567
"eslint-plugin-jsdoc": "^46.8.2",
6668
"globals": "^15.4.0",
6769
"html-webpack-plugin": "^5.6.0",
70+
"jsdom-global": "^3.0.2",
6871
"mocha": "^11.1.0",
6972
"p5": "^1.10.0",
7073
"prettier": "^3.3.1",

src/actions/clipboard.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ export class Clipboard {
6060

6161
/**
6262
* Uninstall this action as both a keyboard shortcut and a context menu item.
63-
* N. B. This does *not* currently reinstall the original keyboard shortcuts.
64-
* You should manually reinstall the previously registered shortcuts (either
65-
* from core or from another plugin you may be using).
63+
* Reinstall the original cut/copy/paste shortcuts.
6664
*/
6765
uninstall() {
6866
ContextMenuRegistry.registry.unregister('blockCutFromContextMenu');
@@ -72,6 +70,18 @@ export class Clipboard {
7270
ShortcutRegistry.registry.unregister(Constants.SHORTCUT_NAMES.CUT);
7371
ShortcutRegistry.registry.unregister(Constants.SHORTCUT_NAMES.COPY);
7472
ShortcutRegistry.registry.unregister(Constants.SHORTCUT_NAMES.PASTE);
73+
74+
if (this.oldCutShortcut) {
75+
ShortcutRegistry.registry.register(this.oldCutShortcut);
76+
}
77+
78+
if (this.oldCopyShortcut) {
79+
ShortcutRegistry.registry.register(this.oldCopyShortcut);
80+
}
81+
82+
if (this.oldPasteShortcut) {
83+
ShortcutRegistry.registry.register(this.oldPasteShortcut);
84+
}
7585
}
7686

7787
/**

src/actions/edit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import {ContextMenuRegistry, Msg, keyboardNavigationController} from 'blockly';
8-
import {Navigation} from 'src/navigation';
8+
import {Navigation} from '../navigation';
99
import {getMenuItem} from '../shortcut_formatting';
1010
import * as Constants from '../constants';
1111

src/actions/enter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export class EnterAction {
105105
}
106106
},
107107
keyCodes: [KeyCodes.ENTER, KeyCodes.SPACE],
108+
allowCollision: true,
108109
});
109110
}
110111

@@ -116,6 +117,7 @@ export class EnterAction {
116117
*/
117118
private shouldHandleEnterForWS(workspace: WorkspaceSvg): boolean {
118119
if (!this.navigation.canCurrentlyNavigate(workspace)) return false;
120+
if (workspace.isDragging()) return false;
119121

120122
const curNode = workspace.getCursor().getCurNode();
121123
if (!curNode) return false;

0 commit comments

Comments
 (0)