MJS Diagram Documentation: Editor Settings

Editor Settings

Diagram settings defines the property defaults for the diagram elements and EditorSettings extendsDiagramSettings to cover options for those settings in the Editor.

Default options

We can change the options for stroke colors for all stencil types by settingeditor.settings.defaultStrokeColorSet property like this:

editor.settings.defaultStrokeColorSet = new ColorSet( "magenta", "yellow", "green" );

Now property editors for all shapes will contain only these three colors for stroke color options.

Contextual options

Like with the diagram settings, we can also specify custom setting options for specific stencil and connector types. Here's how we define a different color set for ellipse stencils:

editor.settings.setContextColorSet( "EllipseStencil", "stroke", new ColorSet("red", "blue", "black") );

Demo

Here are all these settings in action (or access the demo on Codesandbox).

See also

The complete list of configurable editor settings is available in the EditorSettings reference