Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9283c4e
Improve the robustness of workspace SVG tests.
BenHenning Dec 6, 2024
3a52aad
chore(deps): bump @blockly/theme-modern from 6.0.7 to 6.0.10 (#8728)
dependabot[bot] Jan 13, 2025
f9ef785
fix: Listen for keyboard shortcuts when the widget or dropdown divs h…
gonfunko Jan 14, 2025
6404107
fix: Fix display of multiline RTL strings in bubbles on Webkit. (#8733)
gonfunko Jan 14, 2025
2a36de1
fix: Listen for keyboard shortcuts when the widget or dropdown divs h…
gonfunko Jan 14, 2025
44e783c
fix: treat media files as binary while packaging them (#8706)
jfedor2 Jan 6, 2025
f166b67
fix: Fix bug that preventing scrolling menu items into view. (#8726)
gonfunko Jan 10, 2025
d95039d
release: Update version number to 11.2.1
gonfunko Jan 15, 2025
a86ba15
fix: Fix the browser tests. (#8735)
gonfunko Jan 16, 2025
6daa162
fix: Fix the browser tests. (#8735)
gonfunko Jan 16, 2025
7a23c88
fix: Actually fix the browser tests. (#8736)
gonfunko Jan 16, 2025
50f390b
fix: Actually fix the browser tests. (#8736)
gonfunko Jan 16, 2025
087aea2
Merge pull request #8734 from google/rc/v11.2.1
gonfunko Jan 16, 2025
16c8600
Merge pull request #8737 from google/master
gonfunko Jan 16, 2025
94794af
Merge branch 'develop' into improve-workspace-svg-test-robustness
BenHenning Jan 16, 2025
f866126
Merge pull request #8689 from BenHenning/improve-workspace-svg-test-r…
BenHenning Jan 16, 2025
a190539
fix: Fix dropdown text color in Zelos (#8741)
clementcontet Jan 20, 2025
3e4665e
chore(deps): bump globals from 15.12.0 to 15.14.0 (#8742)
dependabot[bot] Jan 20, 2025
34da1da
fix: Fix flaky connection checker test. (#8754)
gonfunko Jan 31, 2025
101ad82
chore(deps): bump @microsoft/api-documenter from 7.25.14 to 7.26.7 (#…
dependabot[bot] Feb 3, 2025
8fcc730
fix: Improve menu mouse/keyboard selection interaction. (#8749)
gonfunko Feb 4, 2025
db57976
chore(deps): bump typescript-eslint from 8.16.0 to 8.23.0 (#8761)
dependabot[bot] Feb 10, 2025
58406af
fix: Fix menu scrolling. (#8765)
gonfunko Feb 12, 2025
15d6ea2
Fix: #8194 by using a stepped animation for the wiggle (#8743)
RoboErikG Feb 12, 2025
29950fd
fix: Allow dragging blocks from the far lower right corner. (#8766)
gonfunko Feb 12, 2025
7e44e81
fix: Fix bug that prevented editing workspace comments on Firefox. (#…
gonfunko Feb 20, 2025
d016801
fix: Fix bug in IF block generators. (#8780)
michaela-mm Feb 24, 2025
dcd2d0e
fix: Fix a bug where selection outlines could be cut off when connect…
gonfunko Feb 27, 2025
fd55810
chore(deps): bump google-github-actions/deploy-appengine (#8755)
dependabot[bot] Mar 10, 2025
d3f0c6d
chore(deps): bump @hyperjump/json-schema from 1.9.8 to 1.11.0 (#8760)
dependabot[bot] Mar 10, 2025
810dd72
chore(deps): bump eslint-plugin-prettier from 5.2.1 to 5.2.3 (#8777)
dependabot[bot] Mar 10, 2025
87efad0
chore(deps): bump glob from 10.4.1 to 11.0.1 (#8730)
dependabot[bot] Mar 10, 2025
b8f71b8
Merge branch 'rc/v12.0.0' into develop-v12-merge
gonfunko Mar 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/appengine_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
path: _deploy/

- name: Deploy to App Engine
uses: google-github-actions/deploy-appengine@v2.1.4
uses: google-github-actions/deploy-appengine@v2.1.5
# For parameters see:
# https://github.com/google-github-actions/deploy-appengine#inputs
with:
Expand Down
32 changes: 20 additions & 12 deletions core/block_animations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,30 +176,38 @@ export function disconnectUiEffect(block: BlockSvg) {
}
// Start the animation.
wobblingBlock = block;
disconnectUiStep(block, magnitude, new Date());
disconnectUiStep(block, magnitude, new Date(), 0);
}

/**
* Animate a brief wiggle of a disconnected block.
*
* @param block Block to animate.
* @param magnitude Maximum degrees skew (reversed for RTL).
* @param start Date of animation's start.
* @param start Date of animation's start for deciding when to stop.
* @param step Which step of the animation we're on.
*/
function disconnectUiStep(block: BlockSvg, magnitude: number, start: Date) {
function disconnectUiStep(
block: BlockSvg,
magnitude: number,
start: Date,
step: number,
) {
const DURATION = 200; // Milliseconds.
const WIGGLES = 3; // Half oscillations.

const ms = new Date().getTime() - start.getTime();
const percent = ms / DURATION;
const WIGGLES = [0.66, 1, 0.66, 0, -0.66, -1, -0.66, 0]; // Single cycle

let skew = '';
if (percent <= 1) {
const val = Math.round(
Math.sin(percent * Math.PI * WIGGLES) * (1 - percent) * magnitude,
);
if (start.getTime() + DURATION > new Date().getTime()) {
const val = Math.round(WIGGLES[step % WIGGLES.length] * magnitude);
skew = `skewX(${val})`;
disconnectPid = setTimeout(disconnectUiStep, 10, block, magnitude, start);
disconnectPid = setTimeout(
disconnectUiStep,
15,
block,
magnitude,
start,
step + 1,
);
}

block
Expand Down
47 changes: 28 additions & 19 deletions core/bubbles/text_bubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {Bubble} from './bubble.js';
* A bubble that displays non-editable text. Used by the warning icon.
*/
export class TextBubble extends Bubble {
private paragraph: SVGTextElement;
private paragraph: SVGGElement;

constructor(
private text: string,
Expand Down Expand Up @@ -49,43 +49,52 @@ export class TextBubble extends Bubble {
*/
private stringToSvg(text: string, container: SVGGElement) {
const paragraph = this.createParagraph(container);
const spans = this.createSpans(paragraph, text);
const fragments = this.createTextFragments(paragraph, text);
if (this.workspace.RTL)
this.rightAlignSpans(paragraph.getBBox().width, spans);
this.rightAlignTextFragments(paragraph.getBBox().width, fragments);
return paragraph;
}

/** Creates the paragraph container for this bubble's view's spans. */
private createParagraph(container: SVGGElement): SVGTextElement {
/** Creates the paragraph container for this bubble's view's text fragments. */
private createParagraph(container: SVGGElement): SVGGElement {
return dom.createSvgElement(
Svg.TEXT,
Svg.G,
{
'class': 'blocklyText blocklyBubbleText blocklyNoPointerEvents',
'y': Bubble.BORDER_WIDTH,
'transform': `translate(0,${Bubble.BORDER_WIDTH})`,
'style': `direction: ${this.workspace.RTL ? 'rtl' : 'ltr'}`,
},
container,
);
}

/** Creates the spans visualizing the text of this bubble. */
private createSpans(parent: SVGTextElement, text: string): SVGTSpanElement[] {
/** Creates the text fragments visualizing the text of this bubble. */
private createTextFragments(
parent: SVGGElement,
text: string,
): SVGTextElement[] {
let lineNum = 1;
return text.split('\n').map((line) => {
const tspan = dom.createSvgElement(
Svg.TSPAN,
{'dy': '1em', 'x': Bubble.BORDER_WIDTH},
const fragment = dom.createSvgElement(
Svg.TEXT,
{'y': `${lineNum}em`, 'x': Bubble.BORDER_WIDTH},
parent,
);
const textNode = document.createTextNode(line);
tspan.appendChild(textNode);
return tspan;
fragment.appendChild(textNode);
lineNum += 1;
return fragment;
});
}

/** Right aligns the given spans. */
private rightAlignSpans(maxWidth: number, spans: SVGTSpanElement[]) {
for (const span of spans) {
span.setAttribute('text-anchor', 'end');
span.setAttribute('x', `${maxWidth + Bubble.BORDER_WIDTH}`);
/** Right aligns the given text fragments. */
private rightAlignTextFragments(
maxWidth: number,
fragments: SVGTextElement[],
) {
for (const text of fragments) {
text.setAttribute('text-anchor', 'start');
text.setAttribute('x', `${maxWidth + Bubble.BORDER_WIDTH}`);
}
}

Expand Down
10 changes: 8 additions & 2 deletions core/comments/rendered_workspace_comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,14 @@ export class RenderedWorkspaceComment
private startGesture(e: PointerEvent) {
const gesture = this.workspace.getGesture(e);
if (gesture) {
gesture.handleCommentStart(e, this);
this.workspace.getLayerManager()?.append(this, layers.BLOCK);
if (browserEvents.isTargetInput(e)) {
// If the text area was the focus, don't allow this event to bubble up
// and steal focus away from the editor/comment.
e.stopPropagation();
} else {
gesture.handleCommentStart(e, this);
this.workspace.getLayerManager()?.append(this, layers.BLOCK);
}
common.setSelected(this);
}
}
Expand Down
1 change: 1 addition & 0 deletions core/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ input[type=number] {

.blocklyScrollbarBackground {
opacity: 0;
pointer-events: none;
}

.blocklyScrollbarHandle {
Expand Down
6 changes: 6 additions & 0 deletions core/field_dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ 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';

/**
Expand Down Expand Up @@ -302,6 +303,11 @@ export class FieldDropdown extends Field<string> {

if (this.selectedMenuItem) {
this.menu_!.setHighlighted(this.selectedMenuItem);
style.scrollIntoContainerView(
this.selectedMenuItem.getElement()!,
dropDownDiv.getContentDiv(),
true,
);
}

this.applyColour();
Expand Down
10 changes: 10 additions & 0 deletions core/inject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading