From d368249f7a6ea348d879d52e8428be65e0617418 Mon Sep 17 00:00:00 2001 From: Mike Harvey <43474485+mikeharv@users.noreply.github.com> Date: Tue, 28 Jul 2026 15:06:40 -0400 Subject: [PATCH 1/2] fix(field-bitmap): revert separate keys for revert and commit --- plugins/field-bitmap/package.json | 1 - plugins/field-bitmap/src/field-bitmap.ts | 22 ------------------- plugins/field-colour-hsv-sliders/package.json | 1 - 3 files changed, 24 deletions(-) diff --git a/plugins/field-bitmap/package.json b/plugins/field-bitmap/package.json index 49a02c2d1..f4c37cd28 100644 --- a/plugins/field-bitmap/package.json +++ b/plugins/field-bitmap/package.json @@ -1,7 +1,6 @@ { "name": "@blockly/field-bitmap", "version": "13.2.0", - "private": true, "description": "A field that lets users input a pixel grid with their mouse.", "scripts": { "audit:fix": "blockly-scripts auditFix", diff --git a/plugins/field-bitmap/src/field-bitmap.ts b/plugins/field-bitmap/src/field-bitmap.ts index 5c061e959..edb9ef452 100644 --- a/plugins/field-bitmap/src/field-bitmap.ts +++ b/plugins/field-bitmap/src/field-bitmap.ts @@ -338,7 +338,6 @@ export class FieldBitmap extends Blockly.Field { this.bindEvent(dropdownEditor, 'pointerleave', this.onPointerEnd); this.bindEvent(dropdownEditor, 'pointerdown', this.onPointerStart); this.bindEvent(dropdownEditor, 'pointercancel', this.onPointerEnd); - this.bindEvent(dropdownEditor, 'keydown', this.onEditorKeyDown); // Stop the browser from handling touch events and cancelling the event. this.bindEvent(dropdownEditor, 'touchmove', (e: Event) => { e.preventDefault(); @@ -424,26 +423,6 @@ export class FieldBitmap extends Blockly.Field { return grid; } - /** - * Handles editor-level keyboard shortcuts. - * Ctrl/Cmd+Enter commits and closes; Escape reverts and closes. - * - * @param e The keydown event. - */ - private onEditorKeyDown(e: KeyboardEvent) { - const isEscape = e.key === 'Escape'; - const isCommit = e.key === 'Enter' && (e.ctrlKey || e.metaKey); - if (!isEscape && !isCommit) return; - - if (isEscape && this.initialValue !== null) { - this.setValue(this.initialValue, false); - } - Blockly.DropDownDiv.hideIfOwner(this); - Blockly.getFocusManager().focusNode(this); - e.preventDefault(); - e.stopPropagation(); - } - /** * Handles keyboard navigation and activation inside the pixel grid. * @@ -737,7 +716,6 @@ export class FieldBitmap extends Blockly.Field { this.focusedPixelIndex = -1; this.pointerIsDown = false; this.valToPaintWith = undefined; - // Set this.initialValue back to null. this.initialValue = null; Blockly.DropDownDiv.getContentDiv().classList.remove( diff --git a/plugins/field-colour-hsv-sliders/package.json b/plugins/field-colour-hsv-sliders/package.json index 32e86ddd4..9d89b83db 100644 --- a/plugins/field-colour-hsv-sliders/package.json +++ b/plugins/field-colour-hsv-sliders/package.json @@ -1,7 +1,6 @@ { "name": "@blockly/field-colour-hsv-sliders", "version": "13.2.0", - "private": true, "description": "A Blockly colour field using HSV sliders.", "scripts": { "audit:fix": "blockly-scripts auditFix", From 72e13e0f8b539a3e0cc2fc192b076038f4e4c57f Mon Sep 17 00:00:00 2001 From: Mike Harvey <43474485+mikeharv@users.noreply.github.com> Date: Tue, 28 Jul 2026 15:10:55 -0400 Subject: [PATCH 2/2] chore: revert private method signature changes --- plugins/field-bitmap/src/field-bitmap.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/field-bitmap/src/field-bitmap.ts b/plugins/field-bitmap/src/field-bitmap.ts index edb9ef452..a39737977 100644 --- a/plugins/field-bitmap/src/field-bitmap.ts +++ b/plugins/field-bitmap/src/field-bitmap.ts @@ -821,10 +821,11 @@ export class FieldBitmap extends Blockly.Field { * Resets pointer state (e.g. After either a pointerup event or if the * gesture is canceled). * - * @param e The pointer event that ended the gesture. + * @param e The pointer event that ended the gesture, when available. */ - private onPointerEnd(e: PointerEvent) { + private onPointerEnd(e?: PointerEvent) { if ( + e && e.currentTarget instanceof HTMLElement && e.currentTarget.hasPointerCapture?.(e.pointerId) ) { @@ -916,10 +917,10 @@ export class FieldBitmap extends Blockly.Field { * @param eventName Name of the event to bind. * @param callback Function to be called on specified event. */ - private bindEvent( + private bindEvent( element: HTMLElement, eventName: string, - callback: (e: E) => void, + callback: (e: PointerEvent) => void, ) { this.boundEvents.push( Blockly.browserEvents.bind(element, eventName, this, callback),