From 345aa57b7e619ee53ec9a8b5592d11b0a20f4033 Mon Sep 17 00:00:00 2001 From: Delucse <46593742+Delucse@users.noreply.github.com> Date: Wed, 28 Oct 2020 12:21:13 +0100 Subject: [PATCH 1/2] consideration of higher-level parent node --- src/helpers/compareXml.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/helpers/compareXml.js b/src/helpers/compareXml.js index 40b6fae..74ab515 100644 --- a/src/helpers/compareXml.js +++ b/src/helpers/compareXml.js @@ -57,6 +57,16 @@ const compareParentBlock = (originalBlock, userBlock, index) => { } } } + if(userBlock.attributes['disabled']){ + // user-block is not connected + return {text: `Der Block mit dem Typen '${userBlock.attributes['type'].value}' hat keine Verbindung zu einem anderen Block.`, type: 'error'}; + } + else if(originalBlock.parentNode.parentNode && originalBlock.parentNode.parentNode.attributes && originalBlock.parentNode.parentNode.attributes['type']){ + var type = compareBlockType(originalBlock.parentNode.parentNode, userBlock.parentNode.parentNode, index); + if(type){ + return {text: `Der Block an Position ${index+1} ist falsch eingeordnet. Tipp: Block an Position ${index+1} einem vorherigen Block unterordnen.`, type: 'error'}; + } + } }; const compareXml = (originalXml, userXml) => { From 104d432278b08da80fc4e7174fa32509f46d6693 Mon Sep 17 00:00:00 2001 From: Delucse <46593742+Delucse@users.noreply.github.com> Date: Wed, 28 Oct 2020 13:57:38 +0100 Subject: [PATCH 2/2] block labeling in german --- src/components/Blockly/BlocklyWindow.js | 3 ++- src/components/Blockly/msg/de.js | 7 ++++++- src/components/Blockly/msg/en.js | 10 ++++++++-- src/components/Blockly/toolbox/Toolbox.js | 12 ++++++------ 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/components/Blockly/BlocklyWindow.js b/src/components/Blockly/BlocklyWindow.js index 15ec6d1..d68e272 100644 --- a/src/components/Blockly/BlocklyWindow.js +++ b/src/components/Blockly/BlocklyWindow.js @@ -2,7 +2,8 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { onChangeWorkspace, clearStats } from '../../actions/workspaceActions'; -import * as De from './msg/de'; +// import * as De from 'blockly/msg/de'; +import {De} from './msg/de'; import BlocklyComponent from './BlocklyComponent'; import BlocklySvg from './BlocklySvg'; import * as Blockly from 'blockly/core'; diff --git a/src/components/Blockly/msg/de.js b/src/components/Blockly/msg/de.js index cf6db85..202084e 100644 --- a/src/components/Blockly/msg/de.js +++ b/src/components/Blockly/msg/de.js @@ -1,5 +1,9 @@ +// import * as Blockly from 'blockly/core'; -import * as Blockly from 'blockly/core'; +// https://developers.google.com/blockly/guides/configure/web/translations + +const Blockly = {}; +Blockly.Msg = {}; Blockly.Msg.ADD_COMMENT = "Kommentar hinzufügen"; Blockly.Msg.AUTH = "Bitte autorisiere diese App zum Aktivieren der Speicherung deiner Arbeit und zum Teilen."; @@ -770,3 +774,4 @@ Blockly.Msg.senseBox_telegram_send = "Sende Nachricht" Blockly.Msg.senseBox_scd30 = "CO2 Sensor (Sensirion SCD30)"; +export const De = Blockly.Msg; diff --git a/src/components/Blockly/msg/en.js b/src/components/Blockly/msg/en.js index e32e321..856ef7c 100644 --- a/src/components/Blockly/msg/en.js +++ b/src/components/Blockly/msg/en.js @@ -1,5 +1,9 @@ +// import * as Blockly from 'blockly/core'; -import * as Blockly from 'blockly/core'; +// https://developers.google.com/blockly/guides/configure/web/translations + +const Blockly = {}; +Blockly.Msg = {}; Blockly.Msg.ADD_COMMENT = "Add Comment"; Blockly.Msg.AUTH = "Please authorize this app to enable your work to be saved and to allow it to be shared by you."; @@ -750,4 +754,6 @@ Blockly.Msg.sensebox_sd_filename = "data"; Blockly.Msg.sensebox_soil_smt50 = "Soil Moisture and Temperature (SMT50)"; Blockly.Msg.sensebox_web_readHTML_filename = "File:"; -Blockly.Msg.senseBox_scd30 = "CO2 Sensor (Sensirion SCD30)"; \ No newline at end of file +Blockly.Msg.senseBox_scd30 = "CO2 Sensor (Sensirion SCD30)"; + +export const En = Blockly.Msg; diff --git a/src/components/Blockly/toolbox/Toolbox.js b/src/components/Blockly/toolbox/Toolbox.js index 3cfae6e..ec5711e 100644 --- a/src/components/Blockly/toolbox/Toolbox.js +++ b/src/components/Blockly/toolbox/Toolbox.js @@ -183,7 +183,7 @@ class Toolbox extends React.Component { - + @@ -202,7 +202,7 @@ class Toolbox extends React.Component { - + @@ -211,7 +211,7 @@ class Toolbox extends React.Component { - + @@ -250,7 +250,7 @@ class Toolbox extends React.Component { - + @@ -270,7 +270,7 @@ class Toolbox extends React.Component { - + @@ -325,7 +325,7 @@ class Toolbox extends React.Component { ; - +