@@ -21,10 +21,15 @@ import './PlaygroundRoot.css';
2121export function PlaygroundRoot ( props ) {
2222
2323 const {
24+ actions : actionsConfig = { } ,
2425 editor : editorConfig = { } ,
2526 emit
2627 } = props ;
2728
29+ const {
30+ display : displayActions = true
31+ } = actionsConfig ;
32+
2833 const {
2934 inlinePropertiesPanel = true
3035 } = editorConfig ;
@@ -36,10 +41,12 @@ export function PlaygroundRoot(props) {
3641 const resultContainerRef = useRef ( ) ;
3742 const propertiesPanelContainerRef = useRef ( ) ;
3843
44+ const paletteRef = useRef ( ) ;
3945 const formEditorRef = useRef ( ) ;
4046 const formRef = useRef ( ) ;
4147 const dataEditorRef = useRef ( ) ;
4248 const resultViewRef = useRef ( ) ;
49+ const propertiesPanelRef = useRef ( ) ;
4350
4451 const [ showEmbed , setShowEmbed ] = useState ( false ) ;
4552
@@ -54,6 +61,12 @@ export function PlaygroundRoot(props) {
5461 // pipe to playground API
5562 useEffect ( ( ) => {
5663 props . onInit ( {
64+ attachDataContainer : ( node ) => dataEditorRef . current . attachTo ( node ) ,
65+ attachEditorContainer : ( node ) => formEditorRef . current . attachTo ( node ) ,
66+ attachFormContainer : ( node ) => formRef . current . attachTo ( node ) ,
67+ attachPaletteContainer : ( node ) => paletteRef . current . attachTo ( node ) ,
68+ attachPropertiesPanelContainer : ( node ) => propertiesPanelRef . current . attachTo ( node ) ,
69+ attachResultContainer : ( node ) => resultViewRef . current . attachTo ( node ) ,
5770 get : ( name , strict ) => formEditorRef . current . get ( name , strict ) ,
5871 setSchema : setInitialSchema
5972 } ) ;
@@ -86,6 +99,9 @@ export function PlaygroundRoot(props) {
8699 }
87100 } ) ;
88101
102+ paletteRef . current = formEditor . get ( 'palette' ) ;
103+ propertiesPanelRef . current = formEditor . get ( 'propertiesPanel' ) ;
104+
89105 formEditor . on ( 'changed' , ( ) => {
90106 setSchema ( formEditor . getSchema ( ) ) ;
91107 } ) ;
@@ -175,19 +191,26 @@ export function PlaygroundRoot(props) {
175191 < div class = "fjs-pgl-main" >
176192
177193 < Section name = "Form Definition" >
178- < Section . HeaderItem >
179- < button
180- class = "fjs-pgl-button"
181- title = "Download form definition"
182- onClick = { handleDownload }
183- > Download</ button >
184- </ Section . HeaderItem >
185- < Section . HeaderItem >
186- < button
187- class = "fjs-pgl-button"
188- onClick = { showEmbedModal }
189- > Embed</ button >
190- </ Section . HeaderItem >
194+
195+ {
196+ displayActions && < Section . HeaderItem >
197+ < button
198+ class = "fjs-pgl-button"
199+ title = "Download form definition"
200+ onClick = { handleDownload }
201+ > Download</ button >
202+ </ Section . HeaderItem >
203+ }
204+
205+ {
206+ displayActions && < Section . HeaderItem >
207+ < button
208+ class = "fjs-pgl-button"
209+ onClick = { showEmbedModal }
210+ > Embed</ button >
211+ </ Section . HeaderItem >
212+ }
213+
191214 < div ref = { editorContainerRef } class = "fjs-pgl-form-container" > </ div >
192215 </ Section >
193216 < Section name = "Form Preview" >
0 commit comments