Go to file
Dan Funk 186c64e9b8
Merge pull request #1 from sartography/script-editor-style
Script editor style
2021-11-05 08:53:19 -04:00
assets Fixes CRConnect #414 and #415 2021-11-04 11:02:02 -04:00
lib Fixes dependency issues 2021-11-04 10:58:31 -04:00
resources Updated linter and deps for version 1.1.5 2021-07-22 11:19:47 -04:00
.eslintignore Updated linter and deps for version 1.1.5 2021-07-22 11:19:47 -04:00
.eslintrc Updated linter and deps for version 1.1.5 2021-07-22 11:19:47 -04:00
.gitignore Updated linter and deps for version 1.1.5 2021-07-22 11:19:47 -04:00
.npmignore Updated linter and deps for version 1.1.5 2021-07-22 11:19:47 -04:00
.travis.yml Updated linter and deps for version 1.1.5 2021-07-22 11:19:47 -04:00
CHANGELOG.md Updated linter and deps for version 1.1.5 2021-07-22 11:19:47 -04:00
LICENSE Updated linter and deps for version 1.1.5 2021-07-22 11:19:47 -04:00
README.md Updated linter and deps for version 1.1.5 2021-07-22 11:19:47 -04:00
package-lock.json Fixes dependency issues 2021-11-04 10:58:31 -04:00
package.json Fixes dependency issues 2021-11-04 10:58:31 -04:00
rollup.config.js Fixes dependency issues 2021-11-04 10:58:31 -04:00

README.md

diagram-js Code Editor

Build Status

A code editor for diagram-js.

Code Editor

Features

  • Modify script tasks with python formatting
  • Tests scripts in place with feedback
  • View externally provided data and functions

Usage

Extend your diagram-js application with the coding module. We'll use bpmn-js as an example:

import BpmnModeler from 'bpmn-js/lib/Modeler';
import propertiesPanelModule from 'bpmn-js-properties-panel';
import propertiesProviderModule from 'bpmn-js-properties-panel/lib/provider/camunda';

import codingModule from 'diagram-js-code-editor';


var bpmnModeler = new BpmnModeler({
  additionalModules: [
    propertiesProviderModule,
    propertiesPanelModule,
    codingModule
  ]
});

bpmnModeler.get('eventBus').on('editor.validate.request', (request) => {
  if (isGoodCode(request.code)){

  } else {

  }
bpmnModeler.get('eventBus').fire('editor.validate.response', {passing: true, msg: "msg"});
});

bpmnModeler.get('eventBus').on('editor.scripts.request', () => {
  let scripts = [{name: "", description: ""}]
bpmnModeler.get('eventBus').fire('editor.scripts.response', {scripts: scripts});
});

bpmnModeler.get('eventBus').on('editor.objects.request', () => {
  let data = [{userId: "int", description: "string"}]
bpmnModeler.get('eventBus').fire('editor.scripts.response', {objects: data});
});

For proper styling integrate the embedded style sheet:

<link rel="stylesheet" href="diagram-js-code-editor/assets/diagram-js-code-editor.css" />

Please see this example for a more detailed instruction.

License

MIT