Skip to content

Commit

Permalink
chore: add example settings in BpmnEditor (to be removed)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarekdanielak committed Mar 5, 2025
1 parent 1751e2c commit 468db04
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion client/src/app/tabs/cloud-bpmn/BpmnEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export class BpmnEditor extends CachedComponent {
this.ref = React.createRef();
this.propertiesPanelRef = React.createRef();

this.settings = props.settings;

this.handleEngineProfileChangeDebounced = debounce(this.handleEngineProfileChange);

this.engineProfile = new EngineProfileHelper({
Expand Down Expand Up @@ -123,8 +125,41 @@ export class BpmnEditor extends CachedComponent {

this.handlePropertiesPanelLayoutChange = this.handlePropertiesPanelLayoutChange.bind(this);
this.handleLayoutChange = this.handleLayoutChange.bind(this);

// TODO(@jarekdanielak): This is just for testing purposes. Remove before going live.
const defaultSettings = {
id: 'bpmnEditor',
title: 'BPMN Editor',
properties: {
'bpmnEditor.forceLinting': {
type: 'boolean',
default: false,
label: 'Force Linting',
description: 'Force linting even when the Problem panel is closed.'
}
}
};

// When using Settings, a module has the following responsibilities:

// Register BPMN editor settings
this.settings.register(defaultSettings);

// (try to register them again just to get the console error)
this.settings.register(defaultSettings);

// Set the initial value (it can be set in the settings.json file)
this.forceLinting = this.settings.get('bpmnEditor.forceLinting');

// Subscribe to the forceLinting setting change
this.settings.subscribe('bpmnEditor.forceLinting', this.onSettingsChanged);
}

// TODO(@jarekdanielak): This is just for testing purposes. Remove before going live.
onSettingsChanged = (value) => {
this.forceLinting = value;
};

async componentDidMount() {
this._isMounted = true;

Expand Down Expand Up @@ -195,7 +230,8 @@ export class BpmnEditor extends CachedComponent {

const { panel = {} } = layout;

if (panel.open && panel.tab === 'linting') {
// TODO(@jarekdanielak): This is just for testing purposes. Remove before going live.
if ((panel.open && panel.tab === 'linting') || this.forceLinting) {
this.getModeler().get('linting').activate();
} else if (!panel.open || panel.tab !== 'linting') {
this.getModeler().get('linting').deactivate();
Expand Down

0 comments on commit 468db04

Please sign in to comment.