From 3b234c7f87acab765e9b4a9bc6d9638ed229b087 Mon Sep 17 00:00:00 2001 From: laurensvalk Date: Wed, 20 Sep 2023 15:15:17 +0200 Subject: [PATCH] fix: Call onFinishEditing_ for fields on mobile. (#7483) On the desktop, widgetDispose_ will call onFinishEditing_ on close. This was missing in the mobile counterpart, so any cleanups in onFinishEditing_ would not be called. Also update the message string comment while we are touching this code. --- core/field_input.ts | 1 + msg/messages.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/field_input.ts b/core/field_input.ts index 8281afe34..22c6765b4 100644 --- a/core/field_input.ts +++ b/core/field_input.ts @@ -342,6 +342,7 @@ export abstract class FieldInput extends Field< if (text !== null) { this.setValue(this.getValueFromEditorText_(text)); } + this.onFinishEditing_(this.value_); }, ); } diff --git a/msg/messages.js b/msg/messages.js index b1d762f0f..e29ed57f1 100644 --- a/msg/messages.js +++ b/msg/messages.js @@ -132,7 +132,7 @@ Blockly.Msg.REDO = 'Redo'; // Variable renaming. /** @type {string} */ -/// prompt - This message is only seen in the Opera browser. With most browsers, users can edit numeric values in blocks by just clicking and typing. Opera does not allows this, so we have to open a new window and prompt users with this message to chanage a value. +/// prompt - This message is seen on mobile devices and the Opera browser. With most browsers, users can edit numeric values in blocks by just clicking and typing. Opera does not allow this and mobile browsers may have issues with in-line textareas. So we prompt users with this message (usually a popup) to change a value. Blockly.Msg.CHANGE_VALUE_TITLE = 'Change value:'; /** @type {string} */ /// dropdown choice - When the user clicks on a variable block, this is one of the dropdown menu choices. It is used to rename the current variable. See [https://github.com/google/blockly/wiki/Variables#dropdown-menu https://github.com/google/blockly/wiki/Variables#dropdown-menu].