@eclipse-glsp/vscode-integration-webview 0.10.0-next.f8202b8.39 → 1.1.0-RC02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/diagram.css +45 -4
- package/css/tool-palette.css +24 -14
- package/lib/copy-paste-handler-provider.d.ts +23 -0
- package/lib/copy-paste-handler-provider.d.ts.map +1 -0
- package/lib/copy-paste-handler-provider.js +20 -0
- package/lib/copy-paste-handler-provider.js.map +1 -0
- package/lib/diagram-identifer.d.ts +1 -1
- package/lib/diagram-identifer.d.ts.map +1 -1
- package/lib/diagram-identifer.js +19 -4
- package/lib/diagram-identifer.js.map +1 -1
- package/lib/extension-action-handler.d.ts +5 -3
- package/lib/extension-action-handler.d.ts.map +1 -1
- package/lib/extension-action-handler.js +3 -3
- package/lib/extension-action-handler.js.map +1 -1
- package/lib/glsp-starter.d.ts.map +1 -1
- package/lib/glsp-starter.js +10 -4
- package/lib/glsp-starter.js.map +1 -1
- package/lib/glsp-vscode-diagram-widget.d.ts.map +1 -1
- package/lib/glsp-vscode-diagram-widget.js +9 -7
- package/lib/glsp-vscode-diagram-widget.js.map +1 -1
- package/lib/glsp-vscode-diagramserver.d.ts +5 -4
- package/lib/glsp-vscode-diagramserver.d.ts.map +1 -1
- package/lib/glsp-vscode-diagramserver.js +22 -19
- package/lib/glsp-vscode-diagramserver.js.map +1 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/package.json +8 -9
- package/src/copy-paste-handler-provider.ts +24 -0
- package/src/diagram-identifer.ts +5 -6
- package/src/extension-action-handler.ts +9 -5
- package/src/glsp-starter.ts +17 -7
- package/src/glsp-vscode-diagram-widget.ts +11 -9
- package/src/glsp-vscode-diagramserver.ts +29 -26
package/css/diagram.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -52,10 +52,51 @@ body {
|
|
|
52
52
|
stroke: var(--vscode-editor-foreground);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.sprotty-edge.arrow {
|
|
55
|
+
.sprotty-edge .arrow {
|
|
56
56
|
fill: var(--vscode-editor-foreground);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
.sprotty-node.selected
|
|
60
|
-
|
|
59
|
+
.sprotty-node.selected,
|
|
60
|
+
.sprotty-edge.selected {
|
|
61
|
+
stroke: var(--vscode-focusBorder);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.sprotty-edge.selected .arrow {
|
|
65
|
+
fill: var(--vscode-focusBorder);
|
|
66
|
+
stroke: var(--vscode-focusBorder);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.inactive .sprotty-node.selected {
|
|
70
|
+
stroke: var(--vscode-editor-inactiveSelectionBackground);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.sprotty-resize-handle.selected,
|
|
74
|
+
.sprotty-resize-handle.active,
|
|
75
|
+
.sprotty-edge > .sprotty-routing-handle.selected,
|
|
76
|
+
.sprotty-edge > .sprotty-routing-handle.mouseover {
|
|
77
|
+
fill: var(--vscode-focusBorder);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.inactive .sprotty-resize-handle,
|
|
81
|
+
.inactive .sprotty-routing-handle {
|
|
82
|
+
fill: var(--vscode-tab-unfocusedInactiveForeground);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.sprotty-node.mouseover:not(.selected),
|
|
86
|
+
.sprotty-edge.mouseover:not(.selected) {
|
|
87
|
+
stroke: var(--vscode-editor-foreground);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.sprotty-edge.mouseover:not(.selected) .arrow {
|
|
91
|
+
fill: var(--vscode-editor-foreground);
|
|
92
|
+
stroke: var(--vscode-editor-foreground);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.sprotty-popup {
|
|
96
|
+
padding: 0px;
|
|
97
|
+
border-radius: 2px;
|
|
98
|
+
box-shadow: 0px 1px 6px var(--vscode-widget-shadow);
|
|
99
|
+
background-color: var(--vscode-editorHoverWidget-background);
|
|
100
|
+
color: var(--vscode-editorHoverWidget-foreground);
|
|
101
|
+
border: 1px solid var(--vscode-editorHoverWidget-border);
|
|
61
102
|
}
|
package/css/tool-palette.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -18,8 +18,16 @@
|
|
|
18
18
|
box-shadow: 0px 1px 6px var(--vscode-widget-shadow);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
.tool-palette :focus-visible {
|
|
22
|
+
outline: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tool-group {
|
|
26
|
+
background: var(--vscode-settings-dropdownBackground);
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
.tool-palette .palette-header {
|
|
22
|
-
background: var(--vscode-
|
|
30
|
+
background: var(--vscode-settings-dropdownBackground);
|
|
23
31
|
color: var(--vscode-titleBar-activeForeground);
|
|
24
32
|
border: 0;
|
|
25
33
|
font-weight: normal;
|
|
@@ -31,20 +39,23 @@
|
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
.tool-palette .palette-header .header-icon {
|
|
34
|
-
font-size: var(--vscode-ui-font-size1);
|
|
35
42
|
float: left;
|
|
36
43
|
padding: 0.2em;
|
|
44
|
+
font-size: 11px;
|
|
45
|
+
text-transform: uppercase;
|
|
46
|
+
font-weight: 400;
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
.tool-palette .palette-header .header-tools {
|
|
40
|
-
font-size: var(--vscode-ui-font-size3);
|
|
41
50
|
float: right;
|
|
51
|
+
font-size: 11px;
|
|
42
52
|
}
|
|
43
53
|
|
|
44
54
|
.tool-palette .palette-header .header-tools i {
|
|
45
55
|
border: none;
|
|
46
56
|
width: 1em;
|
|
47
57
|
text-align: center;
|
|
58
|
+
border-radius: 5px;
|
|
48
59
|
}
|
|
49
60
|
|
|
50
61
|
.tool-palette .palette-header .header-tools i:hover:not(.clicked) {
|
|
@@ -58,35 +69,34 @@
|
|
|
58
69
|
.tool-palette .palette-body {
|
|
59
70
|
border: 0;
|
|
60
71
|
box-shadow: none;
|
|
72
|
+
background: var(--vscode-list-focusBackground);
|
|
73
|
+
color: var(--vscode-titleBar-activeForeground);
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
.tool-palette .palette-body .group-header {
|
|
64
77
|
font-size: var(--vscode-ui-font-size1);
|
|
65
|
-
|
|
66
|
-
|
|
78
|
+
text-transform: uppercase;
|
|
79
|
+
font-weight: bold;
|
|
80
|
+
background: var(--vscode-editorHoverWidget-statusBarBackground);
|
|
67
81
|
color: var(--vscode-titleBar-activeForeground);
|
|
68
82
|
border: 0;
|
|
69
83
|
}
|
|
70
84
|
|
|
71
|
-
.tool-
|
|
72
|
-
background: var(--vscode-
|
|
85
|
+
.tool-button {
|
|
86
|
+
background: var(--vscode-settings-dropdownBackground);
|
|
73
87
|
color: var(--vscode-titleBar-activeForeground);
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
.tool-palette .palette-body .tool-button:hover:not(.clicked) {
|
|
77
|
-
background: var(--vscode-
|
|
91
|
+
background: var(--vscode-menubar-selectionBackground);
|
|
78
92
|
}
|
|
79
93
|
|
|
80
94
|
.tool-palette .tool-button.clicked {
|
|
81
|
-
background: var(--vscode-
|
|
82
|
-
color: var(--vscode-menu-selectionForeground);
|
|
95
|
+
background: var(--vscode-inputOption-activeBackground);
|
|
83
96
|
}
|
|
84
97
|
|
|
85
98
|
.search-input {
|
|
86
99
|
background: var(--vscode-input-background);
|
|
87
100
|
color: var(--vscode-input-foreground);
|
|
88
101
|
border: var(--vscode-border-width) solid var(--vscode-input-border);
|
|
89
|
-
font-family: var(--vscode-ui-font-family);
|
|
90
|
-
font-size: var(--vscode-ui-font-size1);
|
|
91
|
-
line-height: var(--vscode-content-line-height);
|
|
92
102
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2022 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { ICopyPasteHandler } from '@eclipse-glsp/client/lib/features/copy-paste/copy-paste-handler';
|
|
17
|
+
export declare const CopyPasteHandlerProvider: unique symbol;
|
|
18
|
+
/**
|
|
19
|
+
* Service identifier and type definition to bind the {@link ICopyPasteHandler} to an provider.
|
|
20
|
+
* This enables asynchronous injections and can be used to bypass circular dependency issues.
|
|
21
|
+
*/
|
|
22
|
+
export declare type CopyPasteHandlerProvider = () => Promise<ICopyPasteHandler>;
|
|
23
|
+
//# sourceMappingURL=copy-paste-handler-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-paste-handler-provider.d.ts","sourceRoot":"","sources":["../src/copy-paste-handler-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iEAAiE,CAAC;AAEpG,eAAO,MAAM,wBAAwB,eAAqC,CAAC;AAC3E;;;GAGG;AACH,oBAAY,wBAAwB,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2022 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.CopyPasteHandlerProvider = void 0;
|
|
19
|
+
exports.CopyPasteHandlerProvider = Symbol('CopyPasteHandlerProvider');
|
|
20
|
+
//# sourceMappingURL=copy-paste-handler-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-paste-handler-provider.js","sourceRoot":"","sources":["../src/copy-paste-handler-provider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAIrE,QAAA,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2021-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagram-identifer.d.ts","sourceRoot":"","sources":["../src/diagram-identifer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,
|
|
1
|
+
{"version":3,"file":"diagram-identifer.d.ts","sourceRoot":"","sources":["../src/diagram-identifer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAiB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEvE,eAAO,MAAM,qBAAqB,eAAkC,CAAC;AAErE,MAAM,WAAW,qBAAqB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACvC;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,qBAAqB,CAQhF"}
|
package/lib/diagram-identifer.js
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isDiagramIdentifier = exports.GLSPDiagramIdentifier = void 0;
|
|
4
|
-
|
|
4
|
+
/********************************************************************************
|
|
5
|
+
* Copyright (c) 2021-2022 EclipseSource and others.
|
|
6
|
+
*
|
|
7
|
+
* This program and the accompanying materials are made available under the
|
|
8
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
9
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
10
|
+
*
|
|
11
|
+
* This Source Code may also be made available under the following Secondary
|
|
12
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
13
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
14
|
+
* with the GNU Classpath Exception which is available at
|
|
15
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
16
|
+
*
|
|
17
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
18
|
+
********************************************************************************/
|
|
19
|
+
const client_1 = require("@eclipse-glsp/client");
|
|
5
20
|
exports.GLSPDiagramIdentifier = Symbol('GLSPDiagramIdentifier');
|
|
6
21
|
function isDiagramIdentifier(object) {
|
|
7
22
|
return (object !== undefined &&
|
|
8
23
|
typeof object === 'object' &&
|
|
9
|
-
(0,
|
|
10
|
-
(0,
|
|
11
|
-
(0,
|
|
24
|
+
(0, client_1.hasStringProp)(object, 'clientId') &&
|
|
25
|
+
(0, client_1.hasStringProp)(object, 'diagramType') &&
|
|
26
|
+
(0, client_1.hasStringProp)(object, 'uri'));
|
|
12
27
|
}
|
|
13
28
|
exports.isDiagramIdentifier = isDiagramIdentifier;
|
|
14
29
|
//# sourceMappingURL=diagram-identifer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagram-identifer.js","sourceRoot":"","sources":["../src/diagram-identifer.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"diagram-identifer.js","sourceRoot":"","sources":["../src/diagram-identifer.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAAuE;AAE1D,QAAA,qBAAqB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AASrE,SAAgB,mBAAmB,CAAC,MAAW;IAC3C,OAAO,CACH,MAAM,KAAK,SAAS;QACpB,OAAO,MAAM,KAAK,QAAQ;QAC1B,IAAA,sBAAa,EAAC,MAAM,EAAE,UAAU,CAAC;QACjC,IAAA,sBAAa,EAAC,MAAM,EAAE,aAAa,CAAC;QACpC,IAAA,sBAAa,EAAC,MAAM,EAAE,KAAK,CAAC,CAC/B,CAAC;AACN,CAAC;AARD,kDAQC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2021-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Action, ActionHandlerRegistry, IActionHandler, IActionHandlerInitializer, ICommand } from '
|
|
16
|
+
import { Action, ActionHandlerRegistry, IActionHandler, IActionHandlerInitializer, ICommand } from '@eclipse-glsp/client';
|
|
17
17
|
import { SprottyDiagramIdentifier } from 'sprotty-vscode-webview';
|
|
18
|
+
import { VsCodeApi } from 'sprotty-vscode-webview/lib/services';
|
|
18
19
|
/**
|
|
19
20
|
* Delegates actions that should be handled inside of the glsp vscode extension instead
|
|
20
21
|
* of the webview. This enables the implementation of action handlers that require access
|
|
@@ -23,7 +24,8 @@ import { SprottyDiagramIdentifier } from 'sprotty-vscode-webview';
|
|
|
23
24
|
export declare class GLSPVscodeExtensionActionHandler implements IActionHandler, IActionHandlerInitializer {
|
|
24
25
|
protected readonly actionKinds: string[];
|
|
25
26
|
protected readonly diagramIdentifier: SprottyDiagramIdentifier;
|
|
26
|
-
|
|
27
|
+
protected vscodeApi: VsCodeApi;
|
|
28
|
+
constructor(actionKinds: string[], diagramIdentifier: SprottyDiagramIdentifier, vscodeApi: VsCodeApi);
|
|
27
29
|
initialize(registry: ActionHandlerRegistry): void;
|
|
28
30
|
handle(action: Action): void | Action | ICommand;
|
|
29
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-action-handler.d.ts","sourceRoot":"","sources":["../src/extension-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,cAAc,EAAE,yBAAyB,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"extension-action-handler.d.ts","sourceRoot":"","sources":["../src/extension-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,cAAc,EAAE,yBAAyB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1H,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE;;;;GAIG;AACH,qBAAa,gCAAiC,YAAW,cAAc,EAAE,yBAAyB;IAE1F,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE;IACxC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,wBAAwB;IAC9D,SAAS,CAAC,SAAS,EAAE,SAAS;gBAFX,WAAW,EAAE,MAAM,EAAE,EACrB,iBAAiB,EAAE,wBAAwB,EACpD,SAAS,EAAE,SAAS;IAGlC,UAAU,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI;IAIjD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ;CAUnD"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GLSPVscodeExtensionActionHandler = void 0;
|
|
4
|
-
const vscode_api_1 = require("sprotty-vscode-webview/lib/vscode-api");
|
|
5
4
|
/**
|
|
6
5
|
* Delegates actions that should be handled inside of the glsp vscode extension instead
|
|
7
6
|
* of the webview. This enables the implementation of action handlers that require access
|
|
8
7
|
* to the vscode API and/or node backend.
|
|
9
8
|
*/
|
|
10
9
|
class GLSPVscodeExtensionActionHandler {
|
|
11
|
-
constructor(actionKinds, diagramIdentifier) {
|
|
10
|
+
constructor(actionKinds, diagramIdentifier, vscodeApi) {
|
|
12
11
|
this.actionKinds = actionKinds;
|
|
13
12
|
this.diagramIdentifier = diagramIdentifier;
|
|
13
|
+
this.vscodeApi = vscodeApi;
|
|
14
14
|
}
|
|
15
15
|
initialize(registry) {
|
|
16
16
|
this.actionKinds.forEach(kind => registry.register(kind, this));
|
|
@@ -22,7 +22,7 @@ class GLSPVscodeExtensionActionHandler {
|
|
|
22
22
|
action,
|
|
23
23
|
__localDispatch: true
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
this.vscodeApi.postMessage(message);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-action-handler.js","sourceRoot":"","sources":["../src/extension-action-handler.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"extension-action-handler.js","sourceRoot":"","sources":["../src/extension-action-handler.ts"],"names":[],"mappings":";;;AAmBA;;;;GAIG;AACH,MAAa,gCAAgC;IACzC,YACuB,WAAqB,EACrB,iBAA2C,EACpD,SAAoB;QAFX,gBAAW,GAAX,WAAW,CAAU;QACrB,sBAAiB,GAAjB,iBAAiB,CAA0B;QACpD,cAAS,GAAT,SAAS,CAAW;IAC/B,CAAC;IAEJ,UAAU,CAAC,QAA+B;QACtC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACxC,MAAM,OAAO,GAAG;gBACZ,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAC,QAAQ;gBACzC,MAAM;gBACN,eAAe,EAAE,IAAI;aACxB,CAAC;YACF,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;SACvC;IACL,CAAC;CACJ;AArBD,4EAqBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-starter.d.ts","sourceRoot":"","sources":["../src/glsp-starter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"glsp-starter.d.ts","sourceRoot":"","sources":["../src/glsp-starter.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACH,wBAAwB,EACxB,cAAc,EAIjB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,qBAAqB,EAAuB,MAAM,qBAAqB,CAAC;AAKjF,8BAAsB,WAAY,SAAQ,cAAc;cACjC,uBAAuB,IAAI,IAAI;cA2B/B,iBAAiB,CAAC,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,qBAAqB,GAAG,IAAI;IAuB1G,SAAS,CAAC,+BAA+B,CAAC,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,wBAAwB,GAAG,IAAI;IAMlH;;OAEG;IACH,SAAS,KAAK,oBAAoB,IAAI,MAAM,EAAE,CAQ7C;CACJ"}
|
package/lib/glsp-starter.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GLSPStarter = void 0;
|
|
4
4
|
/********************************************************************************
|
|
5
|
-
* Copyright (c) 2020-
|
|
5
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
6
6
|
*
|
|
7
7
|
* This program and the accompanying materials are made available under the
|
|
8
8
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -18,6 +18,8 @@ exports.GLSPStarter = void 0;
|
|
|
18
18
|
********************************************************************************/
|
|
19
19
|
const client_1 = require("@eclipse-glsp/client");
|
|
20
20
|
const sprotty_vscode_webview_1 = require("sprotty-vscode-webview");
|
|
21
|
+
const services_1 = require("sprotty-vscode-webview/lib/services");
|
|
22
|
+
const copy_paste_handler_provider_1 = require("./copy-paste-handler-provider");
|
|
21
23
|
const diagram_identifer_1 = require("./diagram-identifer");
|
|
22
24
|
const extension_action_handler_1 = require("./extension-action-handler");
|
|
23
25
|
const glsp_vscode_diagram_widget_1 = require("./glsp-vscode-diagram-widget");
|
|
@@ -51,21 +53,25 @@ class GLSPStarter extends sprotty_vscode_webview_1.SprottyStarter {
|
|
|
51
53
|
window.addEventListener('message', eventListener);
|
|
52
54
|
}
|
|
53
55
|
addVscodeBindings(container, diagramIdentifier) {
|
|
56
|
+
container.bind(services_1.VsCodeApi).toConstantValue(this.vscodeApi);
|
|
54
57
|
container.bind(glsp_vscode_diagram_widget_1.GLSPVscodeDiagramWidget).toSelf().inSingletonScope();
|
|
55
58
|
container.bind(sprotty_vscode_webview_1.VscodeDiagramWidget).toService(glsp_vscode_diagram_widget_1.GLSPVscodeDiagramWidget);
|
|
56
59
|
container
|
|
57
60
|
.bind(sprotty_vscode_webview_1.VscodeDiagramWidgetFactory)
|
|
58
61
|
.toFactory(context => () => context.container.get(glsp_vscode_diagram_widget_1.GLSPVscodeDiagramWidget));
|
|
59
62
|
container.bind(diagram_identifer_1.GLSPDiagramIdentifier).toConstantValue(diagramIdentifier);
|
|
60
|
-
container
|
|
63
|
+
container
|
|
64
|
+
.bind(copy_paste_handler_provider_1.CopyPasteHandlerProvider)
|
|
65
|
+
.toProvider(ctx => () => new Promise(resolve => resolve(ctx.container.get(client_1.TYPES.ICopyPasteHandler))));
|
|
66
|
+
container.bind(sprotty_vscode_webview_1.SprottyDiagramIdentifier).toService(diagram_identifer_1.GLSPDiagramIdentifier);
|
|
61
67
|
container.bind(glsp_vscode_diagramserver_1.GLSPVscodeDiagramServer).toSelf().inSingletonScope();
|
|
62
68
|
container.bind(sprotty_vscode_webview_1.VscodeDiagramServer).toService(glsp_vscode_diagramserver_1.GLSPVscodeDiagramServer);
|
|
63
69
|
container.bind(client_1.TYPES.ModelSource).toService(glsp_vscode_diagramserver_1.GLSPVscodeDiagramServer);
|
|
64
|
-
container.bind(client_1.
|
|
70
|
+
container.bind(client_1.DiagramServerProxy).toService(glsp_vscode_diagramserver_1.GLSPVscodeDiagramServer);
|
|
65
71
|
this.configureExtensionActionHandler(container, diagramIdentifier);
|
|
66
72
|
}
|
|
67
73
|
configureExtensionActionHandler(container, diagramIdentifier) {
|
|
68
|
-
const extensionActionHandler = new extension_action_handler_1.GLSPVscodeExtensionActionHandler(this.extensionActionKinds, diagramIdentifier);
|
|
74
|
+
const extensionActionHandler = new extension_action_handler_1.GLSPVscodeExtensionActionHandler(this.extensionActionKinds, diagramIdentifier, this.vscodeApi);
|
|
69
75
|
container.bind(extension_action_handler_1.GLSPVscodeExtensionActionHandler).toConstantValue(extensionActionHandler);
|
|
70
76
|
container.bind(client_1.TYPES.IActionHandlerInitializer).toService(extension_action_handler_1.GLSPVscodeExtensionActionHandler);
|
|
71
77
|
}
|
package/lib/glsp-starter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-starter.js","sourceRoot":"","sources":["../src/glsp-starter.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"glsp-starter.js","sourceRoot":"","sources":["../src/glsp-starter.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAU8B;AAE9B,mEAMgC;AAChC,kEAAgE;AAChE,+EAAyE;AACzE,2DAAiF;AACjF,yEAA8E;AAC9E,6EAAuE;AACvE,2EAAsE;AAEtE,MAAsB,WAAY,SAAQ,uCAAc;IACjC,uBAAuB;QACtC,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QACjD,MAAM,aAAa,GAAG,CAAC,OAAY,EAAQ,EAAE;YACzC,IAAI,IAAA,uCAAmB,EAAC,OA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,sBAAsB,GAAG,IAAI,2DAAgC,CAAC,IAAI,CAAC,oBAAoB,EAAE,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAClI,SAAS,CAAC,IAAI,CAAC,2DAAgC,CAAC,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC;QACzF,SAAS,CAAC,IAAI,CAAC,cAAK,CAAC,yBAAyB,CAAC,CAAC,SAAS,CAAC,2DAAgC,CAAC,CAAC;IAChG,CAAC;IAED;;OAEG;IACH,IAAc,oBAAoB;QAC9B,OAAO;YACH,uCAA8B,CAAC,IAAI;YACnC,mCAA0B,CAAC,IAAI;YAC/B,+BAAsB,CAAC,IAAI;YAC3B,qBAAY,CAAC,IAAI;YACjB,wBAAe,CAAC,IAAI;SACvB,CAAC;IACN,CAAC;CACJ;AArED,kCAqEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-vscode-diagram-widget.d.ts","sourceRoot":"","sources":["../src/glsp-vscode-diagram-widget.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,8BACsB,uBAAwB,SAAQ,mBAAmB;
|
|
1
|
+
{"version":3,"file":"glsp-vscode-diagram-widget.d.ts","sourceRoot":"","sources":["../src/glsp-vscode-diagram-widget.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,8BACsB,uBAAwB,SAAQ,mBAAmB;cAClD,iBAAiB,IAAI,IAAI;CAgB/C;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C"}
|
|
@@ -8,7 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.decodeURI = exports.GLSPVscodeDiagramWidget = void 0;
|
|
10
10
|
/********************************************************************************
|
|
11
|
-
* Copyright (c) 2020-
|
|
11
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
12
12
|
*
|
|
13
13
|
* This program and the accompanying materials are made available under the
|
|
14
14
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -27,15 +27,17 @@ const inversify_1 = require("inversify");
|
|
|
27
27
|
const sprotty_vscode_webview_1 = require("sprotty-vscode-webview");
|
|
28
28
|
let GLSPVscodeDiagramWidget = class GLSPVscodeDiagramWidget extends sprotty_vscode_webview_1.VscodeDiagramWidget {
|
|
29
29
|
initializeSprotty() {
|
|
30
|
-
if (this.modelSource instanceof client_1.
|
|
30
|
+
if (this.modelSource instanceof client_1.DiagramServerProxy) {
|
|
31
31
|
this.modelSource.clientId = this.diagramIdentifier.clientId;
|
|
32
32
|
}
|
|
33
|
-
this.actionDispatcher.dispatch(
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
this.actionDispatcher.dispatch(client_1.RequestModelAction.create({
|
|
34
|
+
options: {
|
|
35
|
+
sourceUri: decodeURI(this.diagramIdentifier.uri),
|
|
36
|
+
diagramType: this.diagramIdentifier.diagramType
|
|
37
|
+
}
|
|
36
38
|
}));
|
|
37
|
-
this.actionDispatcher.dispatch(
|
|
38
|
-
this.actionDispatcher.dispatch(
|
|
39
|
+
this.actionDispatcher.dispatch(client_1.RequestTypeHintsAction.create());
|
|
40
|
+
this.actionDispatcher.dispatch(client_1.EnableToolPaletteAction.create());
|
|
39
41
|
}
|
|
40
42
|
};
|
|
41
43
|
GLSPVscodeDiagramWidget = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-vscode-diagram-widget.js","sourceRoot":"","sources":["../src/glsp-vscode-diagram-widget.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"glsp-vscode-diagram-widget.js","sourceRoot":"","sources":["../src/glsp-vscode-diagram-widget.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAA+H;AAC/H,yCAAuC;AACvC,mEAA6D;AAGtD,IAAe,uBAAuB,GAAtC,MAAe,uBAAwB,SAAQ,4CAAmB;IAClD,iBAAiB;QAChC,IAAI,IAAI,CAAC,WAAW,YAAY,2BAAkB,EAAE;YAChD,IAAI,CAAC,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC;SAC/D;QACD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAC1B,2BAAkB,CAAC,MAAM,CAAC;YACtB,OAAO,EAAE;gBACL,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC;gBAChD,WAAW,EAAE,IAAI,CAAC,iBAAiB,CAAC,WAAW;aAClD;SACJ,CAAC,CACL,CAAC;QAEF,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,+BAAsB,CAAC,MAAM,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,gCAAuB,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;CACJ,CAAA;AAjBqB,uBAAuB;IAD5C,IAAA,sBAAU,GAAE;GACS,uBAAuB,CAiB5C;AAjBqB,0DAAuB;AAmB7C,SAAgB,SAAS,CAAC,GAAW;IACjC,OAAO,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AACvD,CAAC;AAFD,8BAEC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,14 +13,15 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Action, ActionHandlerRegistry, ActionMessage, ComputedBoundsAction, DeleteElementOperation,
|
|
16
|
+
import { Action, ActionHandlerRegistry, ActionMessage, ComputedBoundsAction, DeleteElementOperation, SetEditModeAction } from '@eclipse-glsp/client';
|
|
17
17
|
import { SelectionService } from '@eclipse-glsp/client/lib/features/select/selection-service';
|
|
18
|
-
import { VscodeDiagramServer } from 'sprotty-vscode-webview';
|
|
18
|
+
import { VscodeDiagramServer } from 'sprotty-vscode-webview/lib/vscode-diagram-server';
|
|
19
|
+
import { CopyPasteHandlerProvider } from './copy-paste-handler-provider';
|
|
19
20
|
export declare const receivedFromServerProperty = "__receivedFromServer";
|
|
20
21
|
export declare const localDispatchProperty = "__localDispatch";
|
|
21
22
|
export declare class GLSPVscodeDiagramServer extends VscodeDiagramServer {
|
|
22
23
|
protected selectionService: SelectionService;
|
|
23
|
-
protected
|
|
24
|
+
protected copyPasteHandlerProvider: CopyPasteHandlerProvider;
|
|
24
25
|
initialize(registry: ActionHandlerRegistry): void;
|
|
25
26
|
handleLocally(action: Action): boolean;
|
|
26
27
|
protected messageReceived(data: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-vscode-diagramserver.d.ts","sourceRoot":"","sources":["../src/glsp-vscode-diagramserver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,MAAM,EACN,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EAEtB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"glsp-vscode-diagramserver.d.ts","sourceRoot":"","sources":["../src/glsp-vscode-diagramserver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,MAAM,EACN,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EAEtB,iBAAiB,EAEpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAC;AAE9F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,eAAO,MAAM,0BAA0B,yBAAyB,CAAC;AACjE,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,qBAAa,uBAAwB,SAAQ,mBAAmB;IAE5D,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAG7C,SAAS,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;IAEpD,UAAU,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI;IAyBjD,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;cAU5B,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAenD,SAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;cAOvC,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO;IAI9E,SAAS,CAAC,4BAA4B,CAAC,SAAS,EAAE,sBAAsB,GAAG,OAAO;IAOlF,SAAS,CAAC,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO;CAGxE"}
|
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.GLSPVscodeDiagramServer = exports.localDispatchProperty = exports.receivedFromServerProperty = void 0;
|
|
13
13
|
/********************************************************************************
|
|
14
|
-
* Copyright (c) 2020-
|
|
14
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
15
15
|
*
|
|
16
16
|
* This program and the accompanying materials are made available under the
|
|
17
17
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -28,40 +28,43 @@ exports.GLSPVscodeDiagramServer = exports.localDispatchProperty = exports.receiv
|
|
|
28
28
|
const client_1 = require("@eclipse-glsp/client");
|
|
29
29
|
const selection_service_1 = require("@eclipse-glsp/client/lib/features/select/selection-service");
|
|
30
30
|
const inversify_1 = require("inversify");
|
|
31
|
-
const
|
|
31
|
+
const vscode_diagram_server_1 = require("sprotty-vscode-webview/lib/vscode-diagram-server");
|
|
32
|
+
const copy_paste_handler_provider_1 = require("./copy-paste-handler-provider");
|
|
32
33
|
exports.receivedFromServerProperty = '__receivedFromServer';
|
|
33
34
|
exports.localDispatchProperty = '__localDispatch';
|
|
34
|
-
class GLSPVscodeDiagramServer extends
|
|
35
|
+
class GLSPVscodeDiagramServer extends vscode_diagram_server_1.VscodeDiagramServer {
|
|
35
36
|
initialize(registry) {
|
|
36
37
|
(0, client_1.registerDefaultGLSPServerActions)(registry, this);
|
|
37
38
|
this.clientId = this.viewerOptions.baseDiv;
|
|
38
39
|
window.addEventListener('message', message => {
|
|
39
|
-
if ('data' in message &&
|
|
40
|
+
if ('data' in message && client_1.ActionMessage.is(message.data)) {
|
|
40
41
|
this.messageReceived(message.data);
|
|
41
42
|
}
|
|
42
43
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
this.copyPasteHandlerProvider().then(copyPasteHandler => {
|
|
45
|
+
document.addEventListener('copy', (e) => {
|
|
46
|
+
copyPasteHandler.handleCopy(e);
|
|
47
|
+
});
|
|
48
|
+
document.addEventListener('cut', (e) => {
|
|
49
|
+
copyPasteHandler.handleCut(e);
|
|
50
|
+
});
|
|
51
|
+
document.addEventListener('paste', (e) => {
|
|
52
|
+
copyPasteHandler.handlePaste(e);
|
|
53
|
+
});
|
|
51
54
|
});
|
|
52
55
|
}
|
|
53
56
|
handleLocally(action) {
|
|
54
|
-
if (
|
|
57
|
+
if (client_1.SetEditModeAction.is(action)) {
|
|
55
58
|
return this.handleSetEditModeAction(action);
|
|
56
59
|
}
|
|
57
|
-
if (
|
|
60
|
+
if (client_1.DeleteElementOperation.is(action)) {
|
|
58
61
|
return this.handleDeleteElementOperation(action);
|
|
59
62
|
}
|
|
60
63
|
return super.handleLocally(action);
|
|
61
64
|
}
|
|
62
65
|
messageReceived(data) {
|
|
63
66
|
const object = typeof data === 'string' ? JSON.parse(data) : data;
|
|
64
|
-
if (
|
|
67
|
+
if (client_1.ActionMessage.is(object) && object.action) {
|
|
65
68
|
if (!object.clientId || object.clientId === this.clientId) {
|
|
66
69
|
this.checkMessageOrigin(object);
|
|
67
70
|
this.logger.log(this, 'receiving', object);
|
|
@@ -94,12 +97,12 @@ class GLSPVscodeDiagramServer extends sprotty_vscode_webview_1.VscodeDiagramServ
|
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
__decorate([
|
|
97
|
-
(0, inversify_1.inject)(client_1.
|
|
100
|
+
(0, inversify_1.inject)(client_1.TYPES.SelectionService),
|
|
98
101
|
__metadata("design:type", selection_service_1.SelectionService)
|
|
99
102
|
], GLSPVscodeDiagramServer.prototype, "selectionService", void 0);
|
|
100
103
|
__decorate([
|
|
101
|
-
(0, inversify_1.inject)(
|
|
102
|
-
__metadata("design:type",
|
|
103
|
-
], GLSPVscodeDiagramServer.prototype, "
|
|
104
|
+
(0, inversify_1.inject)(copy_paste_handler_provider_1.CopyPasteHandlerProvider),
|
|
105
|
+
__metadata("design:type", Function)
|
|
106
|
+
], GLSPVscodeDiagramServer.prototype, "copyPasteHandlerProvider", void 0);
|
|
104
107
|
exports.GLSPVscodeDiagramServer = GLSPVscodeDiagramServer;
|
|
105
108
|
//# sourceMappingURL=glsp-vscode-diagramserver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-vscode-diagramserver.js","sourceRoot":"","sources":["../src/glsp-vscode-diagramserver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"glsp-vscode-diagramserver.js","sourceRoot":"","sources":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AO,CAAC,MAAc,CAAC,kCAA0B,CAAC,GAAG,IAAI,CAAC;SAC9D;IACL,CAAC;IAEkB,oBAAoB,CAAC,MAA4B;QAChE,OAAO,IAAI,CAAC;IAChB,CAAC;IAES,4BAA4B,CAAC,SAAiC;QACpE,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACnC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,CAAC,CAAC;SAC/E;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAES,uBAAuB,CAAC,MAAyB;QACvD,OAAQ,MAAc,CAAC,kCAA0B,CAAC,KAAK,IAAI,CAAC;IAChE,CAAC;CACJ;AA7EG;IAAC,IAAA,kBAAM,EAAC,cAAK,CAAC,gBAAgB,CAAC;8BACH,oCAAgB;iEAAC;AAE7C;IAAC,IAAA,kBAAM,EAAC,sDAAwB,CAAC;;yEAC4B;AALjE,0DA8EC"}
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAA+B;AAC/B,8DAA4C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/vscode-integration-webview",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0-RC02",
|
|
4
4
|
"description": "Integration of a GLSP diagram in a VS Code extensions (WebView part)",
|
|
5
5
|
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
|
|
6
6
|
"keywords": [
|
|
@@ -32,25 +32,24 @@
|
|
|
32
32
|
"css"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@eclipse-glsp/client": "
|
|
36
|
-
"sprotty-vscode-webview": "0.1
|
|
35
|
+
"@eclipse-glsp/client": "1.1.0-RC02",
|
|
36
|
+
"sprotty-vscode-webview": "~0.3.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"reflect-metadata": "^0.1.13"
|
|
40
|
-
"rimraf": "latest",
|
|
41
|
-
"typescript": "^4.4.3"
|
|
39
|
+
"reflect-metadata": "^0.1.13"
|
|
42
40
|
},
|
|
43
41
|
"scripts": {
|
|
44
42
|
"prepare": "yarn clean && yarn build && yarn lint",
|
|
45
|
-
"clean": "rimraf lib",
|
|
43
|
+
"clean": "rimraf lib tsconfig.tsbuildinfo",
|
|
46
44
|
"build": "tsc",
|
|
47
45
|
"watch": "tsc -w",
|
|
48
|
-
"lint": "eslint
|
|
46
|
+
"lint": "eslint --ext .ts,.tsx ./src",
|
|
47
|
+
"lint:fix": "eslint --fix --ext .ts,.tsx ./src"
|
|
49
48
|
},
|
|
50
49
|
"publishConfig": {
|
|
51
50
|
"access": "public"
|
|
52
51
|
},
|
|
53
52
|
"main": "lib/index",
|
|
54
53
|
"types": "lib/index",
|
|
55
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "efbb6f2a7b74d65712f4cacff796ecb1e8b65c6c"
|
|
56
55
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2022 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
import { ICopyPasteHandler } from '@eclipse-glsp/client/lib/features/copy-paste/copy-paste-handler';
|
|
18
|
+
|
|
19
|
+
export const CopyPasteHandlerProvider = Symbol('CopyPasteHandlerProvider');
|
|
20
|
+
/**
|
|
21
|
+
* Service identifier and type definition to bind the {@link ICopyPasteHandler} to an provider.
|
|
22
|
+
* This enables asynchronous injections and can be used to bypass circular dependency issues.
|
|
23
|
+
*/
|
|
24
|
+
export type CopyPasteHandlerProvider = () => Promise<ICopyPasteHandler>;
|
package/src/diagram-identifer.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2021-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { InitializeResult } from '@eclipse-glsp/client';
|
|
17
|
-
import { isString } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { hasStringProp, InitializeResult } from '@eclipse-glsp/client';
|
|
18
17
|
|
|
19
18
|
export const GLSPDiagramIdentifier = Symbol('GLSPDiagramIdentifier');
|
|
20
19
|
|
|
@@ -29,8 +28,8 @@ export function isDiagramIdentifier(object: any): object is GLSPDiagramIdentifie
|
|
|
29
28
|
return (
|
|
30
29
|
object !== undefined &&
|
|
31
30
|
typeof object === 'object' &&
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
hasStringProp(object, 'clientId') &&
|
|
32
|
+
hasStringProp(object, 'diagramType') &&
|
|
33
|
+
hasStringProp(object, 'uri')
|
|
35
34
|
);
|
|
36
35
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2021-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Action, ActionHandlerRegistry, IActionHandler, IActionHandlerInitializer, ICommand } from '
|
|
16
|
+
import { Action, ActionHandlerRegistry, IActionHandler, IActionHandlerInitializer, ICommand } from '@eclipse-glsp/client';
|
|
17
17
|
import { SprottyDiagramIdentifier } from 'sprotty-vscode-webview';
|
|
18
|
-
import {
|
|
18
|
+
import { VsCodeApi } from 'sprotty-vscode-webview/lib/services';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Delegates actions that should be handled inside of the glsp vscode extension instead
|
|
@@ -23,7 +23,11 @@ import { vscodeApi } from 'sprotty-vscode-webview/lib/vscode-api';
|
|
|
23
23
|
* to the vscode API and/or node backend.
|
|
24
24
|
*/
|
|
25
25
|
export class GLSPVscodeExtensionActionHandler implements IActionHandler, IActionHandlerInitializer {
|
|
26
|
-
constructor(
|
|
26
|
+
constructor(
|
|
27
|
+
protected readonly actionKinds: string[],
|
|
28
|
+
protected readonly diagramIdentifier: SprottyDiagramIdentifier,
|
|
29
|
+
protected vscodeApi: VsCodeApi
|
|
30
|
+
) {}
|
|
27
31
|
|
|
28
32
|
initialize(registry: ActionHandlerRegistry): void {
|
|
29
33
|
this.actionKinds.forEach(kind => registry.register(kind, this));
|
|
@@ -36,7 +40,7 @@ export class GLSPVscodeExtensionActionHandler implements IActionHandler, IAction
|
|
|
36
40
|
action,
|
|
37
41
|
__localDispatch: true
|
|
38
42
|
};
|
|
39
|
-
vscodeApi.postMessage(message);
|
|
43
|
+
this.vscodeApi.postMessage(message);
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
}
|
package/src/glsp-starter.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import {
|
|
17
17
|
configureServerActions,
|
|
18
|
-
|
|
18
|
+
DiagramServerProxy,
|
|
19
19
|
ExportSvgAction,
|
|
20
|
+
ICopyPasteHandler,
|
|
20
21
|
NavigateToExternalTargetAction,
|
|
21
22
|
RequestClipboardDataAction,
|
|
22
23
|
SelectAction,
|
|
@@ -31,13 +32,15 @@ import {
|
|
|
31
32
|
VscodeDiagramWidget,
|
|
32
33
|
VscodeDiagramWidgetFactory
|
|
33
34
|
} from 'sprotty-vscode-webview';
|
|
35
|
+
import { VsCodeApi } from 'sprotty-vscode-webview/lib/services';
|
|
36
|
+
import { CopyPasteHandlerProvider } from './copy-paste-handler-provider';
|
|
34
37
|
import { GLSPDiagramIdentifier, isDiagramIdentifier } from './diagram-identifer';
|
|
35
38
|
import { GLSPVscodeExtensionActionHandler } from './extension-action-handler';
|
|
36
39
|
import { GLSPVscodeDiagramWidget } from './glsp-vscode-diagram-widget';
|
|
37
40
|
import { GLSPVscodeDiagramServer } from './glsp-vscode-diagramserver';
|
|
38
41
|
|
|
39
42
|
export abstract class GLSPStarter extends SprottyStarter {
|
|
40
|
-
protected acceptDiagramIdentifier(): void {
|
|
43
|
+
protected override acceptDiagramIdentifier(): void {
|
|
41
44
|
console.log('Waiting for diagram identifier...');
|
|
42
45
|
const eventListener = (message: any): void => {
|
|
43
46
|
if (isDiagramIdentifier(message.data)) {
|
|
@@ -64,24 +67,31 @@ export abstract class GLSPStarter extends SprottyStarter {
|
|
|
64
67
|
window.addEventListener('message', eventListener);
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
protected addVscodeBindings(container: Container, diagramIdentifier: GLSPDiagramIdentifier): void {
|
|
70
|
+
protected override addVscodeBindings(container: Container, diagramIdentifier: GLSPDiagramIdentifier): void {
|
|
71
|
+
container.bind(VsCodeApi).toConstantValue(this.vscodeApi);
|
|
68
72
|
container.bind(GLSPVscodeDiagramWidget).toSelf().inSingletonScope();
|
|
69
73
|
container.bind(VscodeDiagramWidget).toService(GLSPVscodeDiagramWidget);
|
|
70
74
|
container
|
|
71
75
|
.bind(VscodeDiagramWidgetFactory)
|
|
72
76
|
.toFactory(context => () => context.container.get<GLSPVscodeDiagramWidget>(GLSPVscodeDiagramWidget));
|
|
73
77
|
container.bind(GLSPDiagramIdentifier).toConstantValue(diagramIdentifier);
|
|
74
|
-
container
|
|
78
|
+
container
|
|
79
|
+
.bind(CopyPasteHandlerProvider)
|
|
80
|
+
.toProvider(
|
|
81
|
+
ctx => () =>
|
|
82
|
+
new Promise<ICopyPasteHandler>(resolve => resolve(ctx.container.get<ICopyPasteHandler>(TYPES.ICopyPasteHandler)))
|
|
83
|
+
);
|
|
84
|
+
container.bind(SprottyDiagramIdentifier).toService(GLSPDiagramIdentifier);
|
|
75
85
|
container.bind(GLSPVscodeDiagramServer).toSelf().inSingletonScope();
|
|
76
86
|
container.bind(VscodeDiagramServer).toService(GLSPVscodeDiagramServer);
|
|
77
87
|
container.bind(TYPES.ModelSource).toService(GLSPVscodeDiagramServer);
|
|
78
|
-
container.bind(
|
|
88
|
+
container.bind(DiagramServerProxy).toService(GLSPVscodeDiagramServer);
|
|
79
89
|
|
|
80
90
|
this.configureExtensionActionHandler(container, diagramIdentifier);
|
|
81
91
|
}
|
|
82
92
|
|
|
83
93
|
protected configureExtensionActionHandler(container: Container, diagramIdentifier: SprottyDiagramIdentifier): void {
|
|
84
|
-
const extensionActionHandler = new GLSPVscodeExtensionActionHandler(this.extensionActionKinds, diagramIdentifier);
|
|
94
|
+
const extensionActionHandler = new GLSPVscodeExtensionActionHandler(this.extensionActionKinds, diagramIdentifier, this.vscodeApi);
|
|
85
95
|
container.bind(GLSPVscodeExtensionActionHandler).toConstantValue(extensionActionHandler);
|
|
86
96
|
container.bind(TYPES.IActionHandlerInitializer).toService(GLSPVscodeExtensionActionHandler);
|
|
87
97
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,25 +13,27 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
16
|
+
import { DiagramServerProxy, EnableToolPaletteAction, RequestModelAction, RequestTypeHintsAction } from '@eclipse-glsp/client';
|
|
17
17
|
import { injectable } from 'inversify';
|
|
18
18
|
import { VscodeDiagramWidget } from 'sprotty-vscode-webview';
|
|
19
19
|
|
|
20
20
|
@injectable()
|
|
21
21
|
export abstract class GLSPVscodeDiagramWidget extends VscodeDiagramWidget {
|
|
22
|
-
protected initializeSprotty(): void {
|
|
23
|
-
if (this.modelSource instanceof
|
|
22
|
+
protected override initializeSprotty(): void {
|
|
23
|
+
if (this.modelSource instanceof DiagramServerProxy) {
|
|
24
24
|
this.modelSource.clientId = this.diagramIdentifier.clientId;
|
|
25
25
|
}
|
|
26
26
|
this.actionDispatcher.dispatch(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
RequestModelAction.create({
|
|
28
|
+
options: {
|
|
29
|
+
sourceUri: decodeURI(this.diagramIdentifier.uri),
|
|
30
|
+
diagramType: this.diagramIdentifier.diagramType
|
|
31
|
+
}
|
|
30
32
|
})
|
|
31
33
|
);
|
|
32
34
|
|
|
33
|
-
this.actionDispatcher.dispatch(
|
|
34
|
-
this.actionDispatcher.dispatch(
|
|
35
|
+
this.actionDispatcher.dispatch(RequestTypeHintsAction.create());
|
|
36
|
+
this.actionDispatcher.dispatch(EnableToolPaletteAction.create());
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -19,59 +19,62 @@ import {
|
|
|
19
19
|
ActionMessage,
|
|
20
20
|
ComputedBoundsAction,
|
|
21
21
|
DeleteElementOperation,
|
|
22
|
-
GLSP_TYPES,
|
|
23
|
-
ICopyPasteHandler,
|
|
24
|
-
isDeleteElementOperation,
|
|
25
|
-
isSetEditModeAction,
|
|
26
22
|
registerDefaultGLSPServerActions,
|
|
27
|
-
SetEditModeAction
|
|
23
|
+
SetEditModeAction,
|
|
24
|
+
TYPES
|
|
28
25
|
} from '@eclipse-glsp/client';
|
|
29
26
|
import { SelectionService } from '@eclipse-glsp/client/lib/features/select/selection-service';
|
|
30
27
|
import { inject } from 'inversify';
|
|
31
|
-
import {
|
|
32
|
-
|
|
28
|
+
import { VscodeDiagramServer } from 'sprotty-vscode-webview/lib/vscode-diagram-server';
|
|
29
|
+
import { CopyPasteHandlerProvider } from './copy-paste-handler-provider';
|
|
33
30
|
export const receivedFromServerProperty = '__receivedFromServer';
|
|
34
31
|
export const localDispatchProperty = '__localDispatch';
|
|
35
32
|
|
|
36
33
|
export class GLSPVscodeDiagramServer extends VscodeDiagramServer {
|
|
37
|
-
@inject(
|
|
38
|
-
|
|
34
|
+
@inject(TYPES.SelectionService)
|
|
35
|
+
protected selectionService: SelectionService;
|
|
36
|
+
|
|
37
|
+
@inject(CopyPasteHandlerProvider)
|
|
38
|
+
protected copyPasteHandlerProvider: CopyPasteHandlerProvider;
|
|
39
39
|
|
|
40
|
-
initialize(registry: ActionHandlerRegistry): void {
|
|
40
|
+
override initialize(registry: ActionHandlerRegistry): void {
|
|
41
41
|
registerDefaultGLSPServerActions(registry, this);
|
|
42
42
|
this.clientId = this.viewerOptions.baseDiv;
|
|
43
|
+
|
|
43
44
|
window.addEventListener('message', message => {
|
|
44
|
-
if ('data' in message &&
|
|
45
|
+
if ('data' in message && ActionMessage.is(message.data)) {
|
|
45
46
|
this.messageReceived(message.data);
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
this.copyPasteHandlerProvider().then(copyPasteHandler => {
|
|
51
|
+
document.addEventListener('copy', (e: ClipboardEvent) => {
|
|
52
|
+
copyPasteHandler.handleCopy(e);
|
|
53
|
+
});
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
document.addEventListener('cut', (e: ClipboardEvent) => {
|
|
56
|
+
copyPasteHandler.handleCut(e);
|
|
57
|
+
});
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
document.addEventListener('paste', (e: ClipboardEvent) => {
|
|
60
|
+
copyPasteHandler.handlePaste(e);
|
|
61
|
+
});
|
|
59
62
|
});
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
handleLocally(action: Action): boolean {
|
|
63
|
-
if (
|
|
65
|
+
override handleLocally(action: Action): boolean {
|
|
66
|
+
if (SetEditModeAction.is(action)) {
|
|
64
67
|
return this.handleSetEditModeAction(action);
|
|
65
68
|
}
|
|
66
|
-
if (
|
|
69
|
+
if (DeleteElementOperation.is(action)) {
|
|
67
70
|
return this.handleDeleteElementOperation(action);
|
|
68
71
|
}
|
|
69
72
|
return super.handleLocally(action);
|
|
70
73
|
}
|
|
71
74
|
|
|
72
|
-
protected messageReceived(data: any): void {
|
|
75
|
+
protected override messageReceived(data: any): void {
|
|
73
76
|
const object = typeof data === 'string' ? JSON.parse(data) : data;
|
|
74
|
-
if (
|
|
77
|
+
if (ActionMessage.is(object) && object.action) {
|
|
75
78
|
if (!object.clientId || object.clientId === this.clientId) {
|
|
76
79
|
this.checkMessageOrigin(object);
|
|
77
80
|
this.logger.log(this, 'receiving', object);
|
|
@@ -91,7 +94,7 @@ export class GLSPVscodeDiagramServer extends VscodeDiagramServer {
|
|
|
91
94
|
}
|
|
92
95
|
}
|
|
93
96
|
|
|
94
|
-
protected handleComputedBounds(action: ComputedBoundsAction): boolean {
|
|
97
|
+
protected override handleComputedBounds(action: ComputedBoundsAction): boolean {
|
|
95
98
|
return true;
|
|
96
99
|
}
|
|
97
100
|
|