@manuscripts/body-editor 3.9.15 → 3.9.18

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,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MATHJAX_VERSION = exports.VERSION = void 0;
4
- exports.VERSION = '3.9.15';
4
+ exports.VERSION = '3.9.18';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -32,6 +32,8 @@ class AwardView extends block_view_1.default {
32
32
  constructor() {
33
33
  super(...arguments);
34
34
  this.newAward = false;
35
+ this.ignoreMutation = () => true;
36
+ this.stopEvent = () => true;
35
37
  this.createAwardFragment = (className, title, content) => {
36
38
  const awardFragment = document.createElement('div');
37
39
  awardFragment.classList.add(className);
@@ -49,16 +51,10 @@ class AwardView extends block_view_1.default {
49
51
  }
50
52
  return awardFragment;
51
53
  };
52
- this.handleClick = () => {
53
- if ((0, track_changes_utils_1.isDeleted)(this.node) || !this.props.getCapabilities().editArticle) {
54
- return;
55
- }
56
- this.showContextMenu();
57
- };
58
- this.showContextMenu = () => {
59
- this.props.popper.destroy();
60
- if (!this.contentDOM) {
61
- return;
54
+ this.awardContextMenu = () => {
55
+ const can = this.props.getCapabilities();
56
+ if (!can.editArticle || (0, track_changes_utils_1.isDeleted)(this.node)) {
57
+ return undefined;
62
58
  }
63
59
  const componentProps = {
64
60
  actions: [
@@ -80,7 +76,12 @@ class AwardView extends block_view_1.default {
80
76
  },
81
77
  ],
82
78
  };
83
- this.props.popper.show(this.contentDOM, (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']), 'right-start', false);
79
+ this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
80
+ return this.contextMenu;
81
+ };
82
+ this.actionGutterButtons = () => {
83
+ const contextMenu = this.awardContextMenu();
84
+ return contextMenu ? [contextMenu] : [];
84
85
  };
85
86
  this.showAwardModal = (award) => {
86
87
  this.dialog?.remove();
@@ -135,9 +136,6 @@ class AwardView extends block_view_1.default {
135
136
  fragment.appendChild(this.createAwardFragment('award-source', '', source));
136
137
  fragment.appendChild(this.createAwardFragment('award-code', 'Grant Number(s): ', code ? code.split(';').join(', ') : notAvailable));
137
138
  fragment.appendChild(this.createAwardFragment('award-recipient', 'Recipient: ', recipient ? recipient : notAvailable));
138
- if (this.props.getCapabilities().editArticle) {
139
- this.dom.addEventListener('mouseup', this.handleClick);
140
- }
141
139
  this.contentDOM.appendChild(fragment);
142
140
  this.updateClasses();
143
141
  }
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.9.15';
1
+ export const VERSION = '3.9.18';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -26,6 +26,8 @@ export class AwardView extends BlockView {
26
26
  constructor() {
27
27
  super(...arguments);
28
28
  this.newAward = false;
29
+ this.ignoreMutation = () => true;
30
+ this.stopEvent = () => true;
29
31
  this.createAwardFragment = (className, title, content) => {
30
32
  const awardFragment = document.createElement('div');
31
33
  awardFragment.classList.add(className);
@@ -43,16 +45,10 @@ export class AwardView extends BlockView {
43
45
  }
44
46
  return awardFragment;
45
47
  };
46
- this.handleClick = () => {
47
- if (isDeleted(this.node) || !this.props.getCapabilities().editArticle) {
48
- return;
49
- }
50
- this.showContextMenu();
51
- };
52
- this.showContextMenu = () => {
53
- this.props.popper.destroy();
54
- if (!this.contentDOM) {
55
- return;
48
+ this.awardContextMenu = () => {
49
+ const can = this.props.getCapabilities();
50
+ if (!can.editArticle || isDeleted(this.node)) {
51
+ return undefined;
56
52
  }
57
53
  const componentProps = {
58
54
  actions: [
@@ -74,7 +70,12 @@ export class AwardView extends BlockView {
74
70
  },
75
71
  ],
76
72
  };
77
- this.props.popper.show(this.contentDOM, ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']), 'right-start', false);
73
+ this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
74
+ return this.contextMenu;
75
+ };
76
+ this.actionGutterButtons = () => {
77
+ const contextMenu = this.awardContextMenu();
78
+ return contextMenu ? [contextMenu] : [];
78
79
  };
79
80
  this.showAwardModal = (award) => {
80
81
  this.dialog?.remove();
@@ -129,9 +130,6 @@ export class AwardView extends BlockView {
129
130
  fragment.appendChild(this.createAwardFragment('award-source', '', source));
130
131
  fragment.appendChild(this.createAwardFragment('award-code', 'Grant Number(s): ', code ? code.split(';').join(', ') : notAvailable));
131
132
  fragment.appendChild(this.createAwardFragment('award-recipient', 'Recipient: ', recipient ? recipient : notAvailable));
132
- if (this.props.getCapabilities().editArticle) {
133
- this.dom.addEventListener('mouseup', this.handleClick);
134
- }
135
133
  this.contentDOM.appendChild(fragment);
136
134
  this.updateClasses();
137
135
  }
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.9.15";
1
+ export declare const VERSION = "3.9.18";
2
2
  export declare const MATHJAX_VERSION = "3.2.2";
@@ -20,12 +20,15 @@ export type AwardAttrs = TrackableAttributes<AwardNode>;
20
20
  export declare class AwardView extends BlockView<Trackable<AwardNode>> {
21
21
  protected popperContainer: HTMLDivElement;
22
22
  private dialog;
23
+ contextMenu: HTMLElement;
23
24
  newAward: boolean;
25
+ ignoreMutation: () => boolean;
26
+ stopEvent: () => boolean;
24
27
  updateContents(): void;
25
28
  selectNode(): void;
26
29
  private createAwardFragment;
27
- handleClick: () => void;
28
- showContextMenu: () => void;
30
+ awardContextMenu: () => HTMLElement | undefined;
31
+ actionGutterButtons: () => HTMLElement[];
29
32
  showAwardModal: (award: AwardNode) => void;
30
33
  showDeleteAwardDialog: () => void;
31
34
  handleSaveAward: (award: AwardAttrs) => void;
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": "3.9.15",
4
+ "version": "3.9.18",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -39,7 +39,7 @@
39
39
  "@iarna/word-count": "1.1.2",
40
40
  "@manuscripts/json-schema": "2.2.12",
41
41
  "@manuscripts/style-guide": "3.4.7",
42
- "@manuscripts/track-changes-plugin": "2.2.10",
42
+ "@manuscripts/track-changes-plugin": "2.2.11",
43
43
  "@manuscripts/transform": "4.3.22",
44
44
  "@popperjs/core": "2.11.8",
45
45
  "citeproc": "2.4.63",