@eclipse-glsp/client 2.3.0-next.384 → 2.3.0-next.385

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.
@@ -1 +1 @@
1
- {"version":3,"file":"copy-paste-modules.d.ts","sourceRoot":"","sources":["../../../src/features/copy-paste/copy-paste-modules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAiB,aAAa,EAAS,MAAM,uBAAuB,CAAC;AAI5E,eAAO,MAAM,eAAe,eAM3B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,eAQrC,CAAC"}
1
+ {"version":3,"file":"copy-paste-modules.d.ts","sourceRoot":"","sources":["../../../src/features/copy-paste/copy-paste-modules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAiB,aAAa,EAAS,MAAM,uBAAuB,CAAC;AAI5E,eAAO,MAAM,eAAe,eAM3B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,eASrC,CAAC"}
@@ -30,6 +30,7 @@ exports.copyPasteModule = new sprotty_1.FeatureModule((bind, _unbind, isBound) =
30
30
  */
31
31
  exports.standaloneCopyPasteModule = new sprotty_1.FeatureModule((bind, _unbind, isBound) => {
32
32
  (0, sprotty_1.bindAsService)(bind, sprotty_1.TYPES.IDiagramStartup, copy_paste_standalone_1.CopyPasteStartup);
33
+ bind(sprotty_1.TYPES.IGModelRootListener).toService(copy_paste_standalone_1.CopyPasteStartup);
33
34
  }, {
34
35
  featureId: Symbol('standaloneCopyPaste'),
35
36
  requires: exports.copyPasteModule
@@ -1 +1 @@
1
- {"version":3,"file":"copy-paste-modules.js","sourceRoot":"","sources":["../../../src/features/copy-paste/copy-paste-modules.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAA4E;AAC5E,6DAAqF;AACrF,mEAA2D;AAE9C,QAAA,eAAe,GAAG,IAAI,uBAAa,CAC5C,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IACvB,IAAI,CAAC,eAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,2CAAsB,CAAC,CAAC;IACzD,IAAI,CAAC,eAAK,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC,0CAAqB,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACpF,CAAC,EACD,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CACrC,CAAC;AAEF;;;;GAIG;AACU,QAAA,yBAAyB,GAAG,IAAI,uBAAa,CACtD,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IACvB,IAAA,uBAAa,EAAC,IAAI,EAAE,eAAK,CAAC,eAAe,EAAE,wCAAgB,CAAC,CAAC;AACjE,CAAC,EACD;IACI,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC;IACxC,QAAQ,EAAE,uBAAe;CAC5B,CACJ,CAAC"}
1
+ {"version":3,"file":"copy-paste-modules.js","sourceRoot":"","sources":["../../../src/features/copy-paste/copy-paste-modules.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAA4E;AAC5E,6DAAqF;AACrF,mEAA2D;AAE9C,QAAA,eAAe,GAAG,IAAI,uBAAa,CAC5C,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IACvB,IAAI,CAAC,eAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,2CAAsB,CAAC,CAAC;IACzD,IAAI,CAAC,eAAK,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC,0CAAqB,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACpF,CAAC,EACD,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CACrC,CAAC;AAEF;;;;GAIG;AACU,QAAA,yBAAyB,GAAG,IAAI,uBAAa,CACtD,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IACvB,IAAA,uBAAa,EAAC,IAAI,EAAE,eAAK,CAAC,eAAe,EAAE,wCAAgB,CAAC,CAAC;IAC7D,IAAI,CAAC,eAAK,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC,wCAAgB,CAAC,CAAC;AAChE,CAAC,EACD;IACI,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC;IACxC,QAAQ,EAAE,uBAAe;CAC5B,CACJ,CAAC"}
@@ -13,15 +13,19 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { Disposable, DisposableCollection } from '@eclipse-glsp/sprotty';
16
+ import { DOMHelper, Disposable, DisposableCollection, GModelRoot } from '@eclipse-glsp/sprotty';
17
+ import { IGModelRootListener } from '../../base/editor-context-service';
17
18
  import { IDiagramStartup } from '../../base/model/diagram-loader';
18
19
  import { ICopyPasteHandler } from './copy-paste-handler';
19
20
  /**
20
21
  * Startup service to hook up the copy&paste event handler
21
22
  */
22
- export declare class CopyPasteStartup implements IDiagramStartup, Disposable {
23
+ export declare class CopyPasteStartup implements IDiagramStartup, Disposable, IGModelRootListener {
23
24
  protected copyPasteHandler?: ICopyPasteHandler;
25
+ protected domHelper: DOMHelper;
24
26
  protected toDispose: DisposableCollection;
27
+ protected graphElementId?: string;
28
+ modelRootChanged(root: Readonly<GModelRoot>): void;
25
29
  postModelInitialization(): void;
26
30
  dispose(): void;
27
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"copy-paste-standalone.d.ts","sourceRoot":"","sources":["../../../src/features/copy-paste/copy-paste-standalone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAS,MAAM,uBAAuB,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD;;GAEG;AACH,qBACa,gBAAiB,YAAW,eAAe,EAAE,UAAU;IAGhE,SAAS,CAAC,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IAE/C,SAAS,CAAC,SAAS,uBAA8B;IAEjD,uBAAuB,IAAI,IAAI;IA2B/B,OAAO,IAAI,IAAI;CAGlB"}
1
+ {"version":3,"file":"copy-paste-standalone.d.ts","sourceRoot":"","sources":["../../../src/features/copy-paste/copy-paste-standalone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAc,UAAU,EAAS,MAAM,uBAAuB,CAAC;AAEnH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD;;GAEG;AACH,qBACa,gBAAiB,YAAW,eAAe,EAAE,UAAU,EAAE,mBAAmB;IAGrF,SAAS,CAAC,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IAG/C,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC;IAE/B,SAAS,CAAC,SAAS,uBAA8B;IACjD,SAAS,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAElC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI;IAMlD,uBAAuB,IAAI,IAAI;IAiC/B,OAAO,IAAI,IAAI;CAGlB"}
@@ -34,21 +34,32 @@ let CopyPasteStartup = class CopyPasteStartup {
34
34
  constructor() {
35
35
  this.toDispose = new sprotty_1.DisposableCollection();
36
36
  }
37
+ modelRootChanged(root) {
38
+ if (root.id !== sprotty_1.EMPTY_ROOT.id) {
39
+ this.graphElementId = this.domHelper.createUniqueDOMElementId(root);
40
+ }
41
+ }
37
42
  postModelInitialization() {
38
43
  if (!this.copyPasteHandler) {
39
44
  return;
40
45
  }
41
46
  const copyListener = (e) => {
42
- var _a;
43
- (_a = this.copyPasteHandler) === null || _a === void 0 ? void 0 : _a.handleCopy(e);
47
+ var _a, _b;
48
+ if (this.graphElementId && ((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.id) === this.graphElementId) {
49
+ (_b = this.copyPasteHandler) === null || _b === void 0 ? void 0 : _b.handleCopy(e);
50
+ }
44
51
  };
45
52
  const cutListener = (e) => {
46
- var _a;
47
- (_a = this.copyPasteHandler) === null || _a === void 0 ? void 0 : _a.handleCut(e);
53
+ var _a, _b;
54
+ if (this.graphElementId && ((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.id) === this.graphElementId) {
55
+ (_b = this.copyPasteHandler) === null || _b === void 0 ? void 0 : _b.handleCut(e);
56
+ }
48
57
  };
49
58
  const pasteListener = (e) => {
50
- var _a;
51
- (_a = this.copyPasteHandler) === null || _a === void 0 ? void 0 : _a.handlePaste(e);
59
+ var _a, _b;
60
+ if (this.graphElementId && ((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.id) === this.graphElementId) {
61
+ (_b = this.copyPasteHandler) === null || _b === void 0 ? void 0 : _b.handlePaste(e);
62
+ }
52
63
  };
53
64
  window.addEventListener('copy', copyListener);
54
65
  window.addEventListener('cut', cutListener);
@@ -69,6 +80,10 @@ __decorate([
69
80
  (0, inversify_1.optional)(),
70
81
  __metadata("design:type", Object)
71
82
  ], CopyPasteStartup.prototype, "copyPasteHandler", void 0);
83
+ __decorate([
84
+ (0, inversify_1.inject)(sprotty_1.TYPES.DOMHelper),
85
+ __metadata("design:type", sprotty_1.DOMHelper)
86
+ ], CopyPasteStartup.prototype, "domHelper", void 0);
72
87
  __decorate([
73
88
  (0, inversify_1.preDestroy)(),
74
89
  __metadata("design:type", Function),
@@ -1 +1 @@
1
- {"version":3,"file":"copy-paste-standalone.js","sourceRoot":"","sources":["../../../src/features/copy-paste/copy-paste-standalone.ts"],"names":[],"mappings":";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CAGZ;2BApDQ,gBAAgB;IAD5B,IAAA,sBAAU,GAAE;GACA,gBAAgB,CAqD5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-glsp/client",
3
- "version": "2.3.0-next.384+a172687",
3
+ "version": "2.3.0-next.385+8ff53c2",
4
4
  "description": "A sprotty-based client for GLSP",
5
5
  "keywords": [
6
6
  "eclipse",
@@ -46,7 +46,7 @@
46
46
  "watch": "tsc -w"
47
47
  },
48
48
  "dependencies": {
49
- "@eclipse-glsp/sprotty": "2.3.0-next.384+a172687",
49
+ "@eclipse-glsp/sprotty": "2.3.0-next.385+8ff53c2",
50
50
  "autocompleter": "^9.1.2",
51
51
  "file-saver": "^2.0.5",
52
52
  "lodash": "4.17.21",
@@ -63,5 +63,5 @@
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "a172687427d52b5aeacc84e1f3f786d36118d31c"
66
+ "gitHead": "8ff53c2ff35b7dadd6d2d0e2633145d292e8d72d"
67
67
  }
@@ -33,6 +33,7 @@ export const copyPasteModule = new FeatureModule(
33
33
  export const standaloneCopyPasteModule = new FeatureModule(
34
34
  (bind, _unbind, isBound) => {
35
35
  bindAsService(bind, TYPES.IDiagramStartup, CopyPasteStartup);
36
+ bind(TYPES.IGModelRootListener).toService(CopyPasteStartup);
36
37
  },
37
38
  {
38
39
  featureId: Symbol('standaloneCopyPaste'),
@@ -14,33 +14,50 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
- import { Disposable, DisposableCollection, TYPES } from '@eclipse-glsp/sprotty';
17
+ import { DOMHelper, Disposable, DisposableCollection, EMPTY_ROOT, GModelRoot, TYPES } from '@eclipse-glsp/sprotty';
18
18
  import { inject, injectable, optional, preDestroy } from 'inversify';
19
+ import { IGModelRootListener } from '../../base/editor-context-service';
19
20
  import { IDiagramStartup } from '../../base/model/diagram-loader';
20
21
  import { ICopyPasteHandler } from './copy-paste-handler';
21
22
  /**
22
23
  * Startup service to hook up the copy&paste event handler
23
24
  */
24
25
  @injectable()
25
- export class CopyPasteStartup implements IDiagramStartup, Disposable {
26
+ export class CopyPasteStartup implements IDiagramStartup, Disposable, IGModelRootListener {
26
27
  @inject(TYPES.ICopyPasteHandler)
27
28
  @optional()
28
29
  protected copyPasteHandler?: ICopyPasteHandler;
29
30
 
31
+ @inject(TYPES.DOMHelper)
32
+ protected domHelper: DOMHelper;
33
+
30
34
  protected toDispose = new DisposableCollection();
35
+ protected graphElementId?: string;
36
+
37
+ modelRootChanged(root: Readonly<GModelRoot>): void {
38
+ if (root.id !== EMPTY_ROOT.id) {
39
+ this.graphElementId = this.domHelper.createUniqueDOMElementId(root);
40
+ }
41
+ }
31
42
 
32
43
  postModelInitialization(): void {
33
44
  if (!this.copyPasteHandler) {
34
45
  return;
35
46
  }
36
47
  const copyListener = (e: ClipboardEvent): void => {
37
- this.copyPasteHandler?.handleCopy(e);
48
+ if (this.graphElementId && document.activeElement?.id === this.graphElementId) {
49
+ this.copyPasteHandler?.handleCopy(e);
50
+ }
38
51
  };
39
52
  const cutListener = (e: ClipboardEvent): void => {
40
- this.copyPasteHandler?.handleCut(e);
53
+ if (this.graphElementId && document.activeElement?.id === this.graphElementId) {
54
+ this.copyPasteHandler?.handleCut(e);
55
+ }
41
56
  };
42
57
  const pasteListener = (e: ClipboardEvent): void => {
43
- this.copyPasteHandler?.handlePaste(e);
58
+ if (this.graphElementId && document.activeElement?.id === this.graphElementId) {
59
+ this.copyPasteHandler?.handlePaste(e);
60
+ }
44
61
  };
45
62
  window.addEventListener('copy', copyListener);
46
63
  window.addEventListener('cut', cutListener);