Skip to content

Commit

Permalink
feat: implement script component (editor)
Browse files Browse the repository at this point in the history
Related to #1102
  • Loading branch information
Skaiir committed Apr 8, 2024
1 parent 2d797d6 commit 1065dbe
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { JSFunctionField, iconsByType } from '@bpmn-io/form-js-viewer';
import { editorFormFieldClasses } from '../Util';

const type = 'script';

export function EditorJSFunctionField(props) {
const { field } = props;
const { jsFunction = '' } = field;

const Icon = iconsByType(type);

let placeholderContent = 'JS function is empty';

if (jsFunction.trim()) {
placeholderContent = 'JS function';
}

return (
<div class={ editorFormFieldClasses(type) }>
<div class="fjs-form-field-placeholder">
<Icon viewBox="0 0 54 54" />{placeholderContent}
</div>
</div>
);
}

EditorJSFunctionField.config = {
...JSFunctionField.config,
escapeGridRender: false
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { EditorText } from './EditorText';
import { EditorHtml } from './EditorHtml';
import { EditorTable } from './EditorTable';
import { EditorExpressionField } from './EditorExpressionField';
import { EditorJSFunctionField } from './EditorJSFunctionField';

export const editorFormFields = [
EditorIFrame,
EditorText,
EditorHtml,
EditorTable,
EditorExpressionField
EditorExpressionField,
EditorJSFunctionField
];

0 comments on commit 1065dbe

Please sign in to comment.