Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

diagram-js-code-editor

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diagram-js-code-editor

A code-editor for diagram-js

latest
Source
npmnpm
Version
1.1.85
Version published
Maintainers
2
Created
Source

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

Keywords

diagram-js

FAQs

Package last updated on 01 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts