mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
@@ -29,7 +29,6 @@ import {Coordinate} from './utils/coordinate.js';
|
||||
import * as dom from './utils/dom.js';
|
||||
import * as parsing from './utils/parsing.js';
|
||||
import * as utilsString from './utils/string.js';
|
||||
import * as style from './utils/style.js';
|
||||
import {Svg} from './utils/svg.js';
|
||||
|
||||
/**
|
||||
@@ -304,11 +303,6 @@ export class FieldDropdown extends Field<string> {
|
||||
|
||||
if (this.selectedMenuItem) {
|
||||
this.menu_!.setHighlighted(this.selectedMenuItem);
|
||||
style.scrollIntoContainerView(
|
||||
this.selectedMenuItem.getElement()!,
|
||||
dropDownDiv.getContentDiv(),
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
this.applyColour();
|
||||
|
||||
@@ -77,6 +77,16 @@ export function inject(
|
||||
});
|
||||
|
||||
browserEvents.conditionalBind(subContainer, 'keydown', null, onKeyDown);
|
||||
browserEvents.conditionalBind(
|
||||
dropDownDiv.getContentDiv(),
|
||||
'keydown',
|
||||
null,
|
||||
onKeyDown,
|
||||
);
|
||||
const widgetContainer = WidgetDiv.getDiv();
|
||||
if (widgetContainer) {
|
||||
browserEvents.conditionalBind(widgetContainer, 'keydown', null, onKeyDown);
|
||||
}
|
||||
|
||||
return workspace;
|
||||
}
|
||||
|
||||
12
core/menu.ts
12
core/menu.ts
@@ -260,10 +260,14 @@ export class Menu {
|
||||
this.highlightedItem = item;
|
||||
// Bring the highlighted item into view. This has no effect if the menu is
|
||||
// not scrollable.
|
||||
const el = this.getElement() as Element;
|
||||
style.scrollIntoContainerView(item.getElement() as Element, el);
|
||||
|
||||
aria.setState(el, aria.State.ACTIVEDESCENDANT, item.getId());
|
||||
const el = this.getElement();
|
||||
if (el) {
|
||||
aria.setState(el, aria.State.ACTIVEDESCENDANT, item.getId());
|
||||
}
|
||||
item.getElement()?.scrollIntoView({
|
||||
block: 'nearest',
|
||||
inline: 'start',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
// Former goog.module ID: Blockly.utils.style
|
||||
|
||||
import {Coordinate} from './coordinate.js';
|
||||
import * as deprecation from './deprecation.js';
|
||||
import {Rect} from './rect.js';
|
||||
import {Size} from './size.js';
|
||||
|
||||
@@ -58,6 +59,7 @@ function getSizeInternal(element: Element): Size {
|
||||
* @returns Object with width/height properties.
|
||||
*/
|
||||
function getSizeWithDisplay(element: Element): Size {
|
||||
deprecation.warn(`Blockly.utils.style.getSizeWithDisplay()`, 'v11.2', 'v13');
|
||||
const offsetWidth = (element as HTMLElement).offsetWidth;
|
||||
const offsetHeight = (element as HTMLElement).offsetHeight;
|
||||
return new Size(offsetWidth, offsetHeight);
|
||||
@@ -130,6 +132,7 @@ export function getViewportPageOffset(): Coordinate {
|
||||
* @returns The computed border widths.
|
||||
*/
|
||||
export function getBorderBox(element: Element): Rect {
|
||||
deprecation.warn(`Blockly.utils.style.getBorderBox()`, 'v11.2', 'v13');
|
||||
const left = parseFloat(getComputedStyle(element, 'borderLeftWidth'));
|
||||
const right = parseFloat(getComputedStyle(element, 'borderRightWidth'));
|
||||
const top = parseFloat(getComputedStyle(element, 'borderTopWidth'));
|
||||
@@ -156,6 +159,12 @@ export function scrollIntoContainerView(
|
||||
container: Element,
|
||||
opt_center?: boolean,
|
||||
) {
|
||||
deprecation.warn(
|
||||
`Blockly.utils.style.scrollIntoContainerView()`,
|
||||
'v11.2',
|
||||
'v13',
|
||||
'the native Element.scrollIntoView()',
|
||||
);
|
||||
const offset = getContainerOffsetToScrollInto(element, container, opt_center);
|
||||
container.scrollLeft = offset.x;
|
||||
container.scrollTop = offset.y;
|
||||
@@ -180,6 +189,11 @@ export function getContainerOffsetToScrollInto(
|
||||
container: Element,
|
||||
opt_center?: boolean,
|
||||
): Coordinate {
|
||||
deprecation.warn(
|
||||
`Blockly.utils.style.getContainerOffsetToScrollInto()`,
|
||||
'v11.2',
|
||||
'v13',
|
||||
);
|
||||
// Absolute position of the element's border's top left corner.
|
||||
const elementPos = getPageOffset(element);
|
||||
// Absolute position of the container's border's top left corner.
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "blockly",
|
||||
"version": "11.2.0",
|
||||
"version": "11.2.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "blockly",
|
||||
"version": "11.2.0",
|
||||
"version": "11.2.1",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "blockly",
|
||||
"version": "11.2.0",
|
||||
"version": "11.2.1",
|
||||
"description": "Blockly is a library for building visual programming editors.",
|
||||
"keywords": [
|
||||
"blockly"
|
||||
|
||||
@@ -159,7 +159,7 @@ module.exports = require('./${bundle}');
|
||||
* This task copies all the media/* files into the release directory.
|
||||
*/
|
||||
function packageMedia() {
|
||||
return gulp.src('media/*')
|
||||
return gulp.src('media/*', {encoding: false})
|
||||
.pipe(gulp.dest(`${RELEASE_DIR}/media`));
|
||||
};
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ suite('Disabling', function () {
|
||||
110,
|
||||
);
|
||||
await connect(this.browser, child, 'OUTPUT', parent, 'IF0');
|
||||
|
||||
await this.browser.pause(PAUSE_TIME);
|
||||
await contextMenuSelect(this.browser, parent, 'Disable Block');
|
||||
|
||||
chai.assert.isTrue(await getIsDisabled(this.browser, child.id));
|
||||
|
||||
@@ -123,10 +123,14 @@ suite('Delete blocks', function (done) {
|
||||
)
|
||||
.waitForExist({timeout: 2000, reverse: true});
|
||||
|
||||
// Load the start blocks
|
||||
await this.browser.execute((blocks) => {
|
||||
Blockly.serialization.workspaces.load(blocks, Blockly.getMainWorkspace());
|
||||
}, startBlocks);
|
||||
// Load the start blocks. This hangs indefinitely if `startBlocks` is
|
||||
// passed without being stringified.
|
||||
this.browser.execute((blocks) => {
|
||||
Blockly.serialization.workspaces.load(
|
||||
JSON.parse(blocks),
|
||||
Blockly.getMainWorkspace(),
|
||||
);
|
||||
}, JSON.stringify(startBlocks));
|
||||
// Wait for there to be a block on the main workspace before continuing
|
||||
(await getBlockElementById(this.browser, firstBlockId)).waitForExist({
|
||||
timeout: 2000,
|
||||
|
||||
@@ -26,6 +26,9 @@ suite('Testing Connecting Blocks', function (done) {
|
||||
// Setup Selenium for all of the tests
|
||||
suiteSetup(async function () {
|
||||
this.browser = await testSetup(testFileLocations.CODE_DEMO);
|
||||
// Prevent WebDriver from suppressing alerts
|
||||
// https://github.com/webdriverio/webdriverio/issues/13610#issuecomment-2357768103
|
||||
this.browser.on('dialog', (dialog) => {});
|
||||
});
|
||||
|
||||
test('Testing Procedure', async function () {
|
||||
|
||||
@@ -38,6 +38,7 @@ export async function driverSetup() {
|
||||
const options = {
|
||||
capabilities: {
|
||||
'browserName': 'chrome',
|
||||
'unhandledPromptBehavior': 'ignore',
|
||||
'goog:chromeOptions': {
|
||||
args: ['--allow-file-access-from-files'],
|
||||
},
|
||||
@@ -254,9 +255,9 @@ export async function getCategory(browser, categoryName) {
|
||||
export async function getNthBlockOfCategory(browser, categoryName, n) {
|
||||
const category = await getCategory(browser, categoryName);
|
||||
await category.click();
|
||||
const block = await browser.$(
|
||||
`.blocklyFlyout .blocklyBlockCanvas > g:nth-child(${3 + n * 2})`,
|
||||
);
|
||||
const block = (
|
||||
await browser.$$(`.blocklyFlyout .blocklyBlockCanvas > .blocklyDraggable`)
|
||||
)[n];
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import * as chai from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import {testFileLocations, testSetup} from './test_setup.mjs';
|
||||
|
||||
suite('Workspace comments', function () {
|
||||
@@ -20,8 +19,6 @@ suite('Workspace comments', function () {
|
||||
});
|
||||
|
||||
teardown(async function () {
|
||||
sinon.restore();
|
||||
|
||||
await this.browser.execute(() => {
|
||||
Blockly.getMainWorkspace().clear();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user