Skip to content

Commit

Permalink
feat(playground): provide general additionalModules option
Browse files Browse the repository at this point in the history
This goes into both editor and viewer
  • Loading branch information
Niklas Kiefer committed Oct 5, 2023
1 parent 4a84b92 commit 384dd76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/form-js-playground/src/Playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { PlaygroundRoot } from './components/PlaygroundRoot';
*
* @typedef { {
* actions?: { display: Boolean }
* additionalModules?: Array<any>
* container?: Element
* data: any
* editor?: { inlinePropertiesPanel: Boolean }
Expand Down
11 changes: 9 additions & 2 deletions packages/form-js-playground/src/components/PlaygroundRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import './PlaygroundRoot.css';
export function PlaygroundRoot(props) {

const {
additionalModules = [], // goes into both editor + viewer
actions: actionsConfig = {},
emit,
exporter: exporterConfig = {},
Expand Down Expand Up @@ -101,7 +102,10 @@ export function PlaygroundRoot(props) {
});

const form = formRef.current = new Form({
additionalModules: viewerAdditionalModules,
additionalModules: [
...additionalModules,
...viewerAdditionalModules
],
properties: {
...viewerProperties,
'ariaLabel': 'Form Preview'
Expand All @@ -124,7 +128,10 @@ export function PlaygroundRoot(props) {
...editorProperties,
'ariaLabel': 'Form Definition'
},
additionalModules: editorAdditionalModules
additionalModules: [
...additionalModules,
...editorAdditionalModules
]
});

paletteRef.current = formEditor.get('palette');
Expand Down

0 comments on commit 384dd76

Please sign in to comment.