@jbrowse/app-core 3.6.4 → 3.7.0

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.
@@ -19,4 +19,5 @@ export declare function HistoryManagementMixin(): import("mobx-state-tree").IMod
19
19
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
20
20
  }, {
21
21
  afterCreate(): void;
22
+ beforeDestroy(): void;
22
23
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
@@ -12,30 +12,36 @@ function HistoryManagementMixin() {
12
12
  .model({
13
13
  history: mobx_state_tree_1.types.optional(TimeTraveller_1.default, { targetPath: '../session' }),
14
14
  })
15
- .actions(self => ({
16
- afterCreate() {
17
- document.addEventListener('keydown', e => {
18
- var _a, _b;
19
- if (self.history.canRedo &&
20
- (((e.ctrlKey || e.metaKey) && e.shiftKey && e.code === 'KeyZ') ||
21
- (e.ctrlKey && !e.shiftKey && e.code === 'KeyY')) &&
22
- ((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.tagName.toUpperCase()) !== 'INPUT') {
23
- self.history.redo();
24
- }
25
- if (self.history.canUndo &&
26
- (e.ctrlKey || e.metaKey) &&
27
- !e.shiftKey &&
28
- e.code === 'KeyZ' &&
29
- ((_b = document.activeElement) === null || _b === void 0 ? void 0 : _b.tagName.toUpperCase()) !== 'INPUT') {
30
- self.history.undo();
31
- }
32
- });
33
- (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
34
- const { session } = self;
35
- if (session) {
36
- self.history.initialize();
37
- }
38
- }));
39
- },
40
- }));
15
+ .actions(self => {
16
+ const keydownListener = (e) => {
17
+ var _a, _b;
18
+ if (self.history.canRedo &&
19
+ (((e.ctrlKey || e.metaKey) && e.shiftKey && e.code === 'KeyZ') ||
20
+ (e.ctrlKey && !e.shiftKey && e.code === 'KeyY')) &&
21
+ ((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.tagName.toUpperCase()) !== 'INPUT') {
22
+ self.history.redo();
23
+ }
24
+ if (self.history.canUndo &&
25
+ (e.ctrlKey || e.metaKey) &&
26
+ !e.shiftKey &&
27
+ e.code === 'KeyZ' &&
28
+ ((_b = document.activeElement) === null || _b === void 0 ? void 0 : _b.tagName.toUpperCase()) !== 'INPUT') {
29
+ self.history.undo();
30
+ }
31
+ };
32
+ return {
33
+ afterCreate() {
34
+ document.addEventListener('keydown', keydownListener);
35
+ (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
36
+ const { session } = self;
37
+ if (session) {
38
+ self.history.initialize();
39
+ }
40
+ }));
41
+ },
42
+ beforeDestroy() {
43
+ document.removeEventListener('keydown', keydownListener);
44
+ },
45
+ };
46
+ });
41
47
  }
@@ -19,4 +19,5 @@ export declare function HistoryManagementMixin(): import("mobx-state-tree").IMod
19
19
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
20
20
  }, {
21
21
  afterCreate(): void;
22
+ beforeDestroy(): void;
22
23
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
@@ -6,30 +6,36 @@ export function HistoryManagementMixin() {
6
6
  .model({
7
7
  history: types.optional(TimeTraveller, { targetPath: '../session' }),
8
8
  })
9
- .actions(self => ({
10
- afterCreate() {
11
- document.addEventListener('keydown', e => {
12
- var _a, _b;
13
- if (self.history.canRedo &&
14
- (((e.ctrlKey || e.metaKey) && e.shiftKey && e.code === 'KeyZ') ||
15
- (e.ctrlKey && !e.shiftKey && e.code === 'KeyY')) &&
16
- ((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.tagName.toUpperCase()) !== 'INPUT') {
17
- self.history.redo();
18
- }
19
- if (self.history.canUndo &&
20
- (e.ctrlKey || e.metaKey) &&
21
- !e.shiftKey &&
22
- e.code === 'KeyZ' &&
23
- ((_b = document.activeElement) === null || _b === void 0 ? void 0 : _b.tagName.toUpperCase()) !== 'INPUT') {
24
- self.history.undo();
25
- }
26
- });
27
- addDisposer(self, autorun(() => {
28
- const { session } = self;
29
- if (session) {
30
- self.history.initialize();
31
- }
32
- }));
33
- },
34
- }));
9
+ .actions(self => {
10
+ const keydownListener = (e) => {
11
+ var _a, _b;
12
+ if (self.history.canRedo &&
13
+ (((e.ctrlKey || e.metaKey) && e.shiftKey && e.code === 'KeyZ') ||
14
+ (e.ctrlKey && !e.shiftKey && e.code === 'KeyY')) &&
15
+ ((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.tagName.toUpperCase()) !== 'INPUT') {
16
+ self.history.redo();
17
+ }
18
+ if (self.history.canUndo &&
19
+ (e.ctrlKey || e.metaKey) &&
20
+ !e.shiftKey &&
21
+ e.code === 'KeyZ' &&
22
+ ((_b = document.activeElement) === null || _b === void 0 ? void 0 : _b.tagName.toUpperCase()) !== 'INPUT') {
23
+ self.history.undo();
24
+ }
25
+ };
26
+ return {
27
+ afterCreate() {
28
+ document.addEventListener('keydown', keydownListener);
29
+ addDisposer(self, autorun(() => {
30
+ const { session } = self;
31
+ if (session) {
32
+ self.history.initialize();
33
+ }
34
+ }));
35
+ },
36
+ beforeDestroy() {
37
+ document.removeEventListener('keydown', keydownListener);
38
+ },
39
+ };
40
+ });
35
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/app-core",
3
- "version": "3.6.4",
3
+ "version": "3.7.0",
4
4
  "description": "JBrowse 2 code shared between the 'full featured' apps e.g. jbrowse-web and jbrowse-desktop",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@babel/runtime": "^7.16.3",
45
- "@jbrowse/product-core": "^3.6.4",
45
+ "@jbrowse/product-core": "^3.7.0",
46
46
  "@mui/icons-material": "^7.0.0",
47
47
  "@mui/material": "^7.0.0",
48
48
  "copy-to-clipboard": "^3.3.1",
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "3db8e50ce2bd9c081efbf6c2e7ae5f342380a25a"
62
+ "gitHead": "85bdd0d58286b7adbfd408146b15847676317635"
63
63
  }