@manuscripts/body-editor 1.8.4 → 1.8.5-LEAN-3535-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.
@@ -25,6 +25,8 @@ class PopperManager {
25
25
  if (this.activePopper) {
26
26
  return this.destroy();
27
27
  }
28
+ this.clickEventHandler = this.clickEventHandler.bind(this);
29
+ document.body.addEventListener('click', this.clickEventHandler);
28
30
  window.requestAnimationFrame(() => {
29
31
  const container = document.createElement('div');
30
32
  container.className = 'popper';
@@ -54,7 +56,14 @@ class PopperManager {
54
56
  });
55
57
  });
56
58
  }
59
+ clickEventHandler(event) {
60
+ const editorElement = document.querySelector('.manuscript-editor');
61
+ if (!(editorElement === null || editorElement === void 0 ? void 0 : editorElement.contains(event.target))) {
62
+ this.destroy();
63
+ }
64
+ }
57
65
  destroy() {
66
+ document.body.removeEventListener('click', this.clickEventHandler);
58
67
  if (this.activePopper) {
59
68
  this.removeContainerClass(this.activePopper.reference);
60
69
  this.activePopper.destroy();
@@ -19,6 +19,8 @@ export class PopperManager {
19
19
  if (this.activePopper) {
20
20
  return this.destroy();
21
21
  }
22
+ this.clickEventHandler = this.clickEventHandler.bind(this);
23
+ document.body.addEventListener('click', this.clickEventHandler);
22
24
  window.requestAnimationFrame(() => {
23
25
  const container = document.createElement('div');
24
26
  container.className = 'popper';
@@ -48,7 +50,14 @@ export class PopperManager {
48
50
  });
49
51
  });
50
52
  }
53
+ clickEventHandler(event) {
54
+ const editorElement = document.querySelector('.manuscript-editor');
55
+ if (!(editorElement === null || editorElement === void 0 ? void 0 : editorElement.contains(event.target))) {
56
+ this.destroy();
57
+ }
58
+ }
51
59
  destroy() {
60
+ document.body.removeEventListener('click', this.clickEventHandler);
52
61
  if (this.activePopper) {
53
62
  this.removeContainerClass(this.activePopper.reference);
54
63
  this.activePopper.destroy();
@@ -17,6 +17,7 @@ import Popper from 'popper.js';
17
17
  export declare class PopperManager {
18
18
  protected activePopper?: Popper;
19
19
  show(target: Element, contents: HTMLElement, placement?: Popper.Placement, showArrow?: boolean, modifiers?: Popper.Modifiers): void;
20
+ clickEventHandler(event: Event): void;
20
21
  destroy(): void;
21
22
  update(): void;
22
23
  private focusInput;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/body-editor",
3
3
  "description": "Prosemirror components for editing and viewing manuscripts",
4
- "version": "1.8.4",
4
+ "version": "1.8.5-LEAN-3535-0",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -32,7 +32,7 @@
32
32
  "@manuscripts/json-schema": "^2.2.7",
33
33
  "@manuscripts/library": "^1.3.6",
34
34
  "@manuscripts/style-guide": "^1.11.2",
35
- "@manuscripts/track-changes-plugin": "1.7.9",
35
+ "@manuscripts/track-changes-plugin": "1.7.10",
36
36
  "@manuscripts/transform": "^2.2.1",
37
37
  "astrocite-eutils": "^0.16.4",
38
38
  "axios": "^1.6.7",
@@ -112,4 +112,4 @@
112
112
  "@types/react": "^17.0.2",
113
113
  "prosemirror-tables": "^1.3.5"
114
114
  }
115
- }
115
+ }