From 384dd7601be08a3faacda83875ee45ac93c7f99d Mon Sep 17 00:00:00 2001 From: Niklas Kiefer Date: Thu, 14 Sep 2023 14:14:27 +0200 Subject: [PATCH] feat(playground): provide general `additionalModules` option This goes into both editor and viewer --- packages/form-js-playground/src/Playground.js | 1 + .../src/components/PlaygroundRoot.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/form-js-playground/src/Playground.js b/packages/form-js-playground/src/Playground.js index 7e8eefd55..97190b88c 100644 --- a/packages/form-js-playground/src/Playground.js +++ b/packages/form-js-playground/src/Playground.js @@ -12,6 +12,7 @@ import { PlaygroundRoot } from './components/PlaygroundRoot'; * * @typedef { { * actions?: { display: Boolean } + * additionalModules?: Array * container?: Element * data: any * editor?: { inlinePropertiesPanel: Boolean } diff --git a/packages/form-js-playground/src/components/PlaygroundRoot.js b/packages/form-js-playground/src/components/PlaygroundRoot.js index aaf0e23d7..3e3e19537 100644 --- a/packages/form-js-playground/src/components/PlaygroundRoot.js +++ b/packages/form-js-playground/src/components/PlaygroundRoot.js @@ -25,6 +25,7 @@ import './PlaygroundRoot.css'; export function PlaygroundRoot(props) { const { + additionalModules = [], // goes into both editor + viewer actions: actionsConfig = {}, emit, exporter: exporterConfig = {}, @@ -101,7 +102,10 @@ export function PlaygroundRoot(props) { }); const form = formRef.current = new Form({ - additionalModules: viewerAdditionalModules, + additionalModules: [ + ...additionalModules, + ...viewerAdditionalModules + ], properties: { ...viewerProperties, 'ariaLabel': 'Form Preview' @@ -124,7 +128,10 @@ export function PlaygroundRoot(props) { ...editorProperties, 'ariaLabel': 'Form Definition' }, - additionalModules: editorAdditionalModules + additionalModules: [ + ...additionalModules, + ...editorAdditionalModules + ] }); paletteRef.current = formEditor.get('palette');