From fb58a3d03041f92fa37fa248db0ed711fc03949e Mon Sep 17 00:00:00 2001 From: Matthias Kleine Date: Thu, 7 Dec 2023 14:10:59 +0100 Subject: [PATCH] Fixed copied time blocks - see #1404 --- README.md | 1 + src/public/google-blockly/own/blocks_time.js | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d154151a0..d4921a24c 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ Since v5.5.0 of the JavaScript adapter the following locations (relative to the * (klein0r) Updated blockly logo * (klein0r) Always set variables like isDaylightSaving * (klein0r) Added astro times as states +* (klein0r) Fixed copied time blocks ### 7.2.0 (2023-12-04) NodeJS 16.x is required diff --git a/src/public/google-blockly/own/blocks_time.js b/src/public/google-blockly/own/blocks_time.js index 30a005dc6..39f54e065 100644 --- a/src/public/google-blockly/own/blocks_time.js +++ b/src/public/google-blockly/own/blocks_time.js @@ -114,19 +114,20 @@ Blockly.Blocks['time_compare_ex'] = { this.appendDummyInput('AND') .appendField(Blockly.Translate('time_compare_and')); - const input = this.appendValueInput('END_TIME'); + this.appendValueInput('END_TIME'); if (!window.scripts.loading) { const wp = this.workspace; - setTimeout(function () { - if (!input.connection.isConnected()) { + setTimeout(() => { + const existingInput = this.getInput('END_TIME'); + if (!existingInput.connection.isConnected()) { const shadow = wp.newBlock('text'); shadow.setShadow(true); shadow.setFieldValue('18:00', 'TEXT'); - shadow.outputConnection.connect(input.connection); - // input.connection.connect(shadow.outputConnection); + shadow.outputConnection.connect(existingInput.connection); + // existingInput.connection.connect(shadow.outputConnection); shadow.initSvg(); shadow.render();