update initialXml
This commit is contained in:
		
							parent
							
								
									e7723487c9
								
							
						
					
					
						commit
						f997bb661f
					
				| @ -1,7 +1,7 @@ | |||||||
| import React, { Component } from 'react'; | import React, { Component } from 'react'; | ||||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||||
| import { connect } from 'react-redux'; | import { connect } from 'react-redux'; | ||||||
| import { onChangeWorkspace } from '../../actions/workspaceActions'; | import { onChangeWorkspace, clearStats } from '../../actions/workspaceActions'; | ||||||
| import * as De from './msg/de'; | import * as De from './msg/de'; | ||||||
| import BlocklyComponent from './'; | import BlocklyComponent from './'; | ||||||
| import * as Blockly from 'blockly/core'; | import * as Blockly from 'blockly/core'; | ||||||
| @ -22,6 +22,7 @@ class BlocklyWindow extends Component { | |||||||
|   componentDidMount() { |   componentDidMount() { | ||||||
|     const workspace = Blockly.getMainWorkspace(); |     const workspace = Blockly.getMainWorkspace(); | ||||||
|     this.props.onChangeWorkspace({}); |     this.props.onChangeWorkspace({}); | ||||||
|  |     this.props.clearStats(); | ||||||
|     workspace.addChangeListener((event) => { |     workspace.addChangeListener((event) => { | ||||||
|       this.props.onChangeWorkspace(event); |       this.props.onChangeWorkspace(event); | ||||||
|       Blockly.Events.disableOrphans(event); |       Blockly.Events.disableOrphans(event); | ||||||
| @ -29,15 +30,15 @@ class BlocklyWindow extends Component { | |||||||
|     Blockly.svgResize(workspace); |     Blockly.svgResize(workspace); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // componentDidUpdate(props) {
 |   componentDidUpdate(props) { | ||||||
|   //   const workspace = Blockly.getMainWorkspace();
 |     const workspace = Blockly.getMainWorkspace(); | ||||||
|   //   if(props.initialXml !== this.props.initialXml){
 |     if(props.initialXml !== this.props.initialXml){ | ||||||
|   //     // guarantees that the current xml-code (this.props.initialXml) is rendered
 |       // guarantees that the current xml-code (this.props.initialXml) is rendered
 | ||||||
|   //     workspace.clear();
 |       workspace.clear(); | ||||||
|   //     Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(this.props.initialXml), workspace);
 |       Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(this.props.initialXml), workspace); | ||||||
|   //   }
 |     } | ||||||
|   //   Blockly.svgResize(workspace);
 |     Blockly.svgResize(workspace); | ||||||
|   // }
 |   } | ||||||
| 
 | 
 | ||||||
|   render() { |   render() { | ||||||
|     return ( |     return ( | ||||||
| @ -77,8 +78,9 @@ class BlocklyWindow extends Component { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| BlocklyWindow.propTypes = { | BlocklyWindow.propTypes = { | ||||||
|   onChangeWorkspace: PropTypes.func.isRequired |   onChangeWorkspace: PropTypes.func.isRequired, | ||||||
|  |   clearStats: PropTypes.func.isRequired | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| export default connect(null, { onChangeWorkspace })(BlocklyWindow); | export default connect(null, { onChangeWorkspace, clearStats })(BlocklyWindow); | ||||||
|  | |||||||
| @ -48,7 +48,7 @@ class Tutorial extends Component { | |||||||
|         <div style={{display: 'flex'}}> |         <div style={{display: 'flex'}}> | ||||||
|           <StepperVertical steps={steps}/> |           <StepperVertical steps={steps}/> | ||||||
|                                   {/* calc(Card-padding: 10px + Button-height: 35px + Button-marginTop: 15px)*/} |                                   {/* calc(Card-padding: 10px + Button-height: 35px + Button-marginTop: 15px)*/} | ||||||
|           <Card style={{padding: '10px 10px 60px 10px', display: 'block', position: 'relative', height: 'max-content'}}> |           <Card style={{padding: '10px 10px 60px 10px', display: 'block', position: 'relative', height: 'max-content', width: '100%'}}> | ||||||
|             {step ? |             {step ? | ||||||
|               step.type === 'instruction' ? |               step.type === 'instruction' ? | ||||||
|                 <Instruction step={step}/> |                 <Instruction step={step}/> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user