diff --git a/packages/plugins/field-bitmap/package.json b/packages/plugins/field-bitmap/package.json index 5bdd8e40696..eaf85a9c271 100644 --- a/packages/plugins/field-bitmap/package.json +++ b/packages/plugins/field-bitmap/package.json @@ -1,7 +1,6 @@ { "name": "@blockly/field-bitmap", "version": "13.1.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/packages/plugins/field-bitmap/src/field-bitmap.ts b/packages/plugins/field-bitmap/src/field-bitmap.ts index 5c061e9590a..a3973797766 100644 --- a/packages/plugins/field-bitmap/src/field-bitmap.ts +++ b/packages/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( @@ -843,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) ) { @@ -938,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), diff --git a/packages/plugins/field-colour-hsv-sliders/package.json b/packages/plugins/field-colour-hsv-sliders/package.json index d710e04c5b2..de70302b5d0 100644 --- a/packages/plugins/field-colour-hsv-sliders/package.json +++ b/packages/plugins/field-colour-hsv-sliders/package.json @@ -1,7 +1,6 @@ { "name": "@blockly/field-colour-hsv-sliders", "version": "13.1.0", - "private": true, "description": "A Blockly colour field using HSV sliders.", "scripts": { "audit:fix": "blockly-scripts auditFix",