-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement script component (editor)
Related to #1102
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
packages/form-js-editor/src/render/components/editor-form-fields/EditorJSFunctionField.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters