Skip to content

Commit

Permalink
Fixed copied time blocks - see #1404
Browse files Browse the repository at this point in the history
  • Loading branch information
klein0r committed Dec 7, 2023
1 parent 074acb7 commit fb58a3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions src/public/google-blockly/own/blocks_time.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit fb58a3d

Please sign in to comment.