Skip to content

Commit 6eef374

Browse files
committed
readme.
1 parent b227fad commit 6eef374

File tree

1 file changed

+41
-6
lines changed

1 file changed

+41
-6
lines changed

README.md

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ const configuration = {
138138
editors: {
139139
isHidden: false, // optional, default: false
140140

141-
globalEditorProvider: (definition) => {
142-
const container = document.createElement('div');
141+
globalEditorProvider: (definition, globalContext) => {
142+
const editor = document.createElement('div');
143143
// ...
144-
return container;
144+
return editor;
145145
},
146-
stepEditorProvider: (step) => {
147-
const container = document.createElement('div');
146+
stepEditorProvider: (step, stepContext) => {
147+
const editor = document.createElement('div');
148148
// ...
149-
return container;
149+
return editor;
150150
}
151151
}
152152
};
@@ -157,6 +157,41 @@ designer.onDefinitionChanged.subscribe((newDefinition) => {
157157
});
158158
```
159159

160+
### 📝 Editors
161+
162+
The designer doesn't provide editors for steps. Why? Because this part usually is strongly dependent on a project type. So you must create editors by your own and set them in the start configuration.
163+
164+
The designer supports two types of editors.
165+
166+
* Global editor - it appears when no step is selected. This editor should configure a global settings of your definition. You should set your configuration to the `definition.properties` object.
167+
* Step editor - it appears when some step is selected. This editor can change the step's name (`step.name`) and step's property values (`step.properties`). Also, it can change children, but you must be careful and don't mix responsibilities.
168+
169+
You need to notify the designer when your editor changes the definition. To do it you need to call one of the editor context methods.
170+
171+
```js
172+
const editorsConfiguration = {
173+
globalEditorProvider: (definition, globalContext) => {
174+
// ...
175+
definition.properties['a'] = newA;
176+
definition.notifyPropertiesChanged();
177+
// ...
178+
},
179+
180+
stepEditorProvider: (step, stepContext) => {
181+
// ...
182+
step.name = newName;
183+
stepContext.notifyNameChanged();
184+
185+
step.properties['x'] = newX;
186+
stepContext.notifyPropertiesChanged();
187+
188+
step.branches['newBranch'] = [];
189+
stepContext.notifyChildrenChanged();
190+
// ...
191+
}
192+
}
193+
```
194+
160195
## 🚧 Supported Components
161196

162197
### Task

0 commit comments

Comments
 (0)