Skip to content

Commit

Permalink
Add initial block
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipChalupa committed Dec 16, 2024
1 parent 1978ace commit decbd56
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Components/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { FunctionComponent, useMemo } from 'react'
import { BlocklyWorkspace } from 'react-blockly'
import styles from './Playground.module.css'

const initialXml =
'<xml xmlns="http://www.w3.org/1999/xhtml"><block type="start" x="70" y="30"></block></xml>'

const blocks = [
{
type: 'start',
Expand Down Expand Up @@ -75,9 +78,20 @@ export const Playground: FunctionComponent<{
return (
<>
<BlocklyWorkspace
initialXml={initialXml}
className={styles.workspace}
workspaceConfiguration={configuration}
toolboxConfiguration={toolbox}
onWorkspaceChange={(workspace) => {
const blocks = workspace.getAllBlocks()
blocks.forEach((block) => {
if (block.type === 'start') {
block.setMovable(false)
block.setEditable(false)
block.setDeletable(false)
}
})
}}
/>
<div className={styles.run}>
<Button
Expand Down

0 comments on commit decbd56

Please sign in to comment.