@@ -24,10 +24,15 @@ import './PlaygroundRoot.css';
2424export function PlaygroundRoot ( props ) {
2525
2626 const {
27+ actions : actionsConfig = { } ,
2728 editor : editorConfig = { } ,
2829 emit
2930 } = props ;
3031
32+ const {
33+ display : displayActions = true
34+ } = actionsConfig ;
35+
3136 const {
3237 inlinePropertiesPanel = true
3338 } = editorConfig ;
@@ -39,10 +44,12 @@ export function PlaygroundRoot(props) {
3944 const resultContainerRef = useRef ( ) ;
4045 const propertiesPanelContainerRef = useRef ( ) ;
4146
47+ const paletteRef = useRef ( ) ;
4248 const formEditorRef = useRef ( ) ;
4349 const formRef = useRef ( ) ;
4450 const dataEditorRef = useRef ( ) ;
4551 const resultViewRef = useRef ( ) ;
52+ const propertiesPanelRef = useRef ( ) ;
4653
4754 const [ showEmbed , setShowEmbed ] = useState ( false ) ;
4855
@@ -57,6 +64,12 @@ export function PlaygroundRoot(props) {
5764 // pipe to playground API
5865 useEffect ( ( ) => {
5966 props . onInit ( {
67+ attachDataContainer : ( node ) => dataEditorRef . current . attachTo ( node ) ,
68+ attachEditorContainer : ( node ) => formEditorRef . current . attachTo ( node ) ,
69+ attachFormContainer : ( node ) => formRef . current . attachTo ( node ) ,
70+ attachPaletteContainer : ( node ) => paletteRef . current . attachTo ( node ) ,
71+ attachPropertiesPanelContainer : ( node ) => propertiesPanelRef . current . attachTo ( node ) ,
72+ attachResultContainer : ( node ) => resultViewRef . current . attachTo ( node ) ,
6073 get : ( name , strict ) => formEditorRef . current . get ( name , strict ) ,
6174 setSchema : setInitialSchema
6275 } ) ;
@@ -89,6 +102,9 @@ export function PlaygroundRoot(props) {
89102 }
90103 } ) ;
91104
105+ paletteRef . current = formEditor . get ( 'palette' ) ;
106+ propertiesPanelRef . current = formEditor . get ( 'propertiesPanel' ) ;
107+
92108 formEditor . on ( 'changed' , ( ) => {
93109 setSchema ( formEditor . getSchema ( ) ) ;
94110 } ) ;
@@ -178,19 +194,26 @@ export function PlaygroundRoot(props) {
178194 < div class = "fjs-pgl-main" >
179195
180196 < Section name = "Form Definition" >
181- < Section . HeaderItem >
182- < button
183- class = "fjs-pgl-button"
184- title = "Download form definition"
185- onClick = { handleDownload }
186- > Download</ button >
187- </ Section . HeaderItem >
188- < Section . HeaderItem >
189- < button
190- class = "fjs-pgl-button"
191- onClick = { showEmbedModal }
192- > Embed</ button >
193- </ Section . HeaderItem >
197+
198+ {
199+ displayActions && < Section . HeaderItem >
200+ < button
201+ class = "fjs-pgl-button"
202+ title = "Download form definition"
203+ onClick = { handleDownload }
204+ > Download</ button >
205+ </ Section . HeaderItem >
206+ }
207+
208+ {
209+ displayActions && < Section . HeaderItem >
210+ < button
211+ class = "fjs-pgl-button"
212+ onClick = { showEmbedModal }
213+ > Embed</ button >
214+ </ Section . HeaderItem >
215+ }
216+
194217 < div ref = { editorContainerRef } class = "fjs-pgl-form-container" > </ div >
195218 </ Section >
196219 < Section name = "Form Preview" >
0 commit comments