Skip to content

Commit a6267b5

Browse files
Update documentation for triggering a layout (#106)
Relates to eclipse-glsp/glsp#1561
1 parent c65321e commit a6267b5

1 file changed

Lines changed: 35 additions & 7 deletions

File tree

content/documentation/protocol/content.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,25 @@ interface ComputedBoundsAction extends ResponseAction {
10561056

10571057
</details>
10581058

1059-
#### 2.6.3. LayoutOperation
1059+
#### 2.6.3. TriggerLayoutAction
1060+
1061+
Triggers a request for layout on the client. The handler of this request can collect client-side model information, such as viewport data, before sending a `LayoutOperation` to the server.
1062+
1063+
<details open><summary Code></summary>
1064+
1065+
```typescript
1066+
interface TriggerLayoutAction extends Action {
1067+
kind: 'triggerLayout';
1068+
/**
1069+
* Custom arguments that may be interpreted by the client.
1070+
*/
1071+
args?: Args;
1072+
}
1073+
```
1074+
1075+
</details>
1076+
1077+
#### 2.6.4. LayoutOperation
10601078

10611079
Request a layout of the diagram or selected elements from the server.
10621080

@@ -1073,6 +1091,16 @@ interface LayoutOperation extends Operation {
10731091
* The identifiers of the elements that should be layouted, will default to the root element if not defined.
10741092
*/
10751093
elementIds?: string[];
1094+
1095+
/**
1096+
* The current bounds of the canvas at time of layout.
1097+
*/
1098+
canvasBounds?: Bounds;
1099+
1100+
/**
1101+
* The current viewport information at time of layout.
1102+
*/
1103+
viewport?: Viewport;
10761104
}
10771105
```
10781106

@@ -2426,9 +2454,9 @@ interface RedoAction {
24262454

24272455
A context is a dedicated space in the client that is identified via a unique id. Context actions are a specific set of actions that are available in that context id. At the moment we support three such contexts:
24282456

2429-
- The Context Menu with the context id `context-menu`
2430-
- The Command Palette with the context id `command-palette`
2431-
- The Tool Palette with the context id `tool-palette`
2457+
- The Context Menu with the context id `context-menu`
2458+
- The Command Palette with the context id `command-palette`
2459+
- The Tool Palette with the context id `tool-palette`
24322460

24332461
#### 2.19.1. RequestContextActions
24342462

@@ -2523,9 +2551,9 @@ interface Tool {
25232551

25242552
By default, the tool palette in GLSP includes the following tools in the palette:
25252553

2526-
- Default Tool (Selection Tool)
2527-
- Mouse Delete Tool
2528-
- Validation Tool
2554+
- Default Tool (Selection Tool)
2555+
- Mouse Delete Tool
2556+
- Validation Tool
25292557

25302558
The supported actions of the tool palette come from the server. If server actions are to be used, the client needs to send a `RequestContextActions` action with context id `tool-palette` and handle the returned actions from the `SetContextActions` response accordingly, e.g., rendering them in the tool palette. A user may click on any of the entries in the tool palette to trigger the corresponding action.
25312559

0 commit comments

Comments
 (0)