@manuscripts/body-editor 2.7.32 → 2.7.33

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.
Files changed (56) hide show
  1. package/dist/cjs/components/views/FigureDropdown.js +12 -45
  2. package/dist/cjs/configs/editor-plugins.js +2 -0
  3. package/dist/cjs/index.js +1 -0
  4. package/dist/cjs/lib/context-menu.js +71 -4
  5. package/dist/cjs/lib/view.js +3 -1
  6. package/dist/cjs/plugins/inspector-tabs.js +84 -0
  7. package/dist/cjs/versions.js +1 -1
  8. package/dist/cjs/views/ReactSubView.js +4 -4
  9. package/dist/cjs/views/affiliations.js +1 -1
  10. package/dist/cjs/views/award.js +3 -3
  11. package/dist/cjs/views/bibliography_element.js +2 -2
  12. package/dist/cjs/views/citation_editable.js +3 -3
  13. package/dist/cjs/views/contributors.js +2 -2
  14. package/dist/cjs/views/cross_reference_editable.js +1 -1
  15. package/dist/cjs/views/embed.js +1 -1
  16. package/dist/cjs/views/figure_editable.js +99 -9
  17. package/dist/cjs/views/figure_element.js +0 -79
  18. package/dist/cjs/views/inline_footnote.js +2 -2
  19. package/dist/cjs/views/keyword.js +1 -1
  20. package/dist/cjs/views/keyword_group.js +1 -1
  21. package/dist/cjs/views/link_editable.js +1 -1
  22. package/dist/cjs/views/table_cell.js +1 -1
  23. package/dist/es/components/views/FigureDropdown.js +12 -44
  24. package/dist/es/configs/editor-plugins.js +2 -0
  25. package/dist/es/index.js +1 -0
  26. package/dist/es/lib/context-menu.js +72 -5
  27. package/dist/es/lib/view.js +3 -1
  28. package/dist/es/plugins/inspector-tabs.js +81 -0
  29. package/dist/es/versions.js +1 -1
  30. package/dist/es/views/ReactSubView.js +4 -4
  31. package/dist/es/views/affiliations.js +1 -1
  32. package/dist/es/views/award.js +3 -3
  33. package/dist/es/views/bibliography_element.js +2 -2
  34. package/dist/es/views/citation_editable.js +3 -3
  35. package/dist/es/views/contributors.js +2 -2
  36. package/dist/es/views/cross_reference_editable.js +1 -1
  37. package/dist/es/views/embed.js +1 -1
  38. package/dist/es/views/figure_editable.js +99 -9
  39. package/dist/es/views/figure_element.js +0 -79
  40. package/dist/es/views/inline_footnote.js +2 -2
  41. package/dist/es/views/keyword.js +1 -1
  42. package/dist/es/views/keyword_group.js +1 -1
  43. package/dist/es/views/link_editable.js +1 -1
  44. package/dist/es/views/table_cell.js +1 -1
  45. package/dist/types/components/views/FigureDropdown.d.ts +0 -1
  46. package/dist/types/index.d.ts +1 -0
  47. package/dist/types/lib/context-menu.d.ts +3 -0
  48. package/dist/types/plugins/inspector-tabs.d.ts +35 -0
  49. package/dist/types/versions.d.ts +1 -1
  50. package/dist/types/views/ReactSubView.d.ts +1 -1
  51. package/dist/types/views/figure_editable.d.ts +9 -0
  52. package/dist/types/views/figure_element.d.ts +0 -3
  53. package/package.json +2 -2
  54. package/styles/AdvancedEditor.css +17 -5
  55. package/styles/Editor.css +10 -1
  56. package/styles/popper.css +33 -11
@@ -0,0 +1,81 @@
1
+ /*!
2
+ * © 2025 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Plugin, PluginKey } from 'prosemirror-state';
17
+ export const inspectorTabsKey = new PluginKey('inspector_tabs');
18
+ export var InspectorPrimaryTabs;
19
+ (function (InspectorPrimaryTabs) {
20
+ InspectorPrimaryTabs[InspectorPrimaryTabs["Comments"] = 0] = "Comments";
21
+ InspectorPrimaryTabs[InspectorPrimaryTabs["History"] = 1] = "History";
22
+ InspectorPrimaryTabs[InspectorPrimaryTabs["Files"] = 2] = "Files";
23
+ })(InspectorPrimaryTabs || (InspectorPrimaryTabs = {}));
24
+ export var InspectorSecondaryTabsFiles;
25
+ (function (InspectorSecondaryTabsFiles) {
26
+ InspectorSecondaryTabsFiles[InspectorSecondaryTabsFiles["SupplementsFiles"] = 1] = "SupplementsFiles";
27
+ InspectorSecondaryTabsFiles[InspectorSecondaryTabsFiles["OtherFiles"] = 2] = "OtherFiles";
28
+ })(InspectorSecondaryTabsFiles || (InspectorSecondaryTabsFiles = {}));
29
+ export default () => {
30
+ return new Plugin({
31
+ key: inspectorTabsKey,
32
+ state: {
33
+ init: () => ({
34
+ inspectorOpenTabs: {
35
+ primaryTab: null,
36
+ secondaryTab: null,
37
+ },
38
+ }),
39
+ apply: (tr, value) => {
40
+ const meta = tr.getMeta(inspectorTabsKey);
41
+ if (meta && meta.inspectorOpenTabs !== undefined) {
42
+ return Object.assign(Object.assign({}, value), { inspectorOpenTabs: meta.inspectorOpenTabs });
43
+ }
44
+ return value;
45
+ },
46
+ },
47
+ props: {
48
+ handleClick: (view, pos, event) => {
49
+ const target = event.target;
50
+ const inspectorOpenTabs = {
51
+ primaryTab: null,
52
+ secondaryTab: null,
53
+ };
54
+ switch (target.dataset.action) {
55
+ case 'open-other-files':
56
+ event.stopPropagation();
57
+ inspectorOpenTabs.primaryTab = InspectorPrimaryTabs.Files;
58
+ inspectorOpenTabs.secondaryTab =
59
+ InspectorSecondaryTabsFiles.OtherFiles;
60
+ break;
61
+ case 'open-supplement-files':
62
+ event.stopPropagation();
63
+ inspectorOpenTabs.primaryTab = InspectorPrimaryTabs.Files;
64
+ inspectorOpenTabs.secondaryTab =
65
+ InspectorSecondaryTabsFiles.SupplementsFiles;
66
+ break;
67
+ default:
68
+ break;
69
+ }
70
+ if (inspectorOpenTabs.primaryTab != null ||
71
+ inspectorOpenTabs.secondaryTab != null) {
72
+ const tr = view.state.tr.setMeta(inspectorTabsKey, {
73
+ inspectorOpenTabs,
74
+ });
75
+ view.dispatch(tr);
76
+ }
77
+ return false;
78
+ },
79
+ },
80
+ });
81
+ };
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.7.32';
1
+ export const VERSION = '2.7.33';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -16,12 +16,12 @@
16
16
  import React from 'react';
17
17
  import { createRoot } from 'react-dom/client';
18
18
  import { ThemeProvider } from 'styled-components';
19
- function createSubView(props, Component, componentProps, node, getPos, view, classNames = '') {
19
+ function createSubView(props, Component, componentProps, node, getPos, view, classNames = []) {
20
20
  const container = document.createElement('div');
21
21
  container.classList.add('tools-panel');
22
- if (classNames) {
23
- container.classList.add(classNames);
24
- container.setAttribute('data-cy', classNames);
22
+ if (classNames.length) {
23
+ container.classList.add(...classNames);
24
+ container.setAttribute('data-cy', classNames[0]);
25
25
  }
26
26
  container.setAttribute('contenteditable', 'false');
27
27
  const Wrapped = () => {
@@ -98,7 +98,7 @@ export class AffiliationsView extends BlockView {
98
98
  action: () => this.handleEdit(),
99
99
  icon: 'Edit',
100
100
  });
101
- this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
101
+ this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
102
102
  return this.contextMenu;
103
103
  }
104
104
  return undefined;
@@ -74,7 +74,7 @@ export class AwardView extends BlockView {
74
74
  },
75
75
  ],
76
76
  };
77
- this.props.popper.show(this.contentDOM, ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu'), 'right-start', false);
77
+ this.props.popper.show(this.contentDOM, ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']), 'right-start', false);
78
78
  };
79
79
  this.showAwardModal = (award) => {
80
80
  var _a, _b;
@@ -85,7 +85,7 @@ export class AwardView extends BlockView {
85
85
  onSaveAward: this.handleSaveAward,
86
86
  onCancelAward: this.handleCancelAward,
87
87
  };
88
- this.popperContainer = ReactSubView(this.props, AwardModal, componentProps, this.node, this.getPos, this.view, 'award-editor');
88
+ this.popperContainer = ReactSubView(this.props, AwardModal, componentProps, this.node, this.getPos, this.view, ['award-editor']);
89
89
  this.props.popper.show(this.dom, this.popperContainer, 'auto', false);
90
90
  };
91
91
  this.showDeleteAwardDialog = () => {
@@ -94,7 +94,7 @@ export class AwardView extends BlockView {
94
94
  const componentProps = {
95
95
  handleDelete: this.handleDeleteAward,
96
96
  };
97
- this.popperContainer = ReactSubView(this.props, DeleteAwardDialog, componentProps, this.node, this.getPos, this.view, 'award-editor');
97
+ this.popperContainer = ReactSubView(this.props, DeleteAwardDialog, componentProps, this.node, this.getPos, this.view, ['award-editor']);
98
98
  this.props.popper.show(this.dom, this.popperContainer, 'auto', false);
99
99
  };
100
100
  this.handleSaveAward = (award) => {
@@ -119,7 +119,7 @@ export class BibliographyElementBlockView extends BlockView {
119
119
  onSave: this.handleSave,
120
120
  onDelete: this.handleDelete,
121
121
  };
122
- this.editor = ReactSubView(this.props, ReferencesEditor, componentProps, this.node, this.getPos, this.view, 'references-editor');
122
+ this.editor = ReactSubView(this.props, ReferencesEditor, componentProps, this.node, this.getPos, this.view, ['references-editor']);
123
123
  this.props.popper.show(this.dom, this.editor, 'right');
124
124
  }
125
125
  handleEdit(citationID) {
@@ -145,7 +145,7 @@ export class BibliographyElementBlockView extends BlockView {
145
145
  action: () => handleComment(item, this.view),
146
146
  icon: 'AddComment',
147
147
  });
148
- this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
148
+ this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
149
149
  this.props.popper.show(element, this.contextMenu, 'right-start');
150
150
  }
151
151
  updateContents() {
@@ -87,7 +87,7 @@ export class CitationEditableView extends CitationView {
87
87
  const componentProps = {
88
88
  actions,
89
89
  };
90
- this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
90
+ this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
91
91
  this.props.popper.show(this.dom, this.contextMenu, 'right-start', false);
92
92
  };
93
93
  this.showPopper = () => {
@@ -115,14 +115,14 @@ export class CitationEditableView extends CitationView {
115
115
  onCancel: this.handleCancel,
116
116
  canEdit: can.editCitationsAndRefs,
117
117
  };
118
- this.editor = ReactSubView(this.props, CitationEditor, componentProps, this.node, this.getPos, this.view, 'citation-editor');
118
+ this.editor = ReactSubView(this.props, CitationEditor, componentProps, this.node, this.getPos, this.view, ['citation-editor']);
119
119
  }
120
120
  else {
121
121
  const componentProps = {
122
122
  rids,
123
123
  items,
124
124
  };
125
- this.editor = ReactSubView(this.props, CitationViewer, componentProps, this.node, this.getPos, this.view, 'citation-editor');
125
+ this.editor = ReactSubView(this.props, CitationViewer, componentProps, this.node, this.getPos, this.view, ['citation-editor']);
126
126
  }
127
127
  this.props.popper.show(this.dom, this.editor, 'auto');
128
128
  };
@@ -132,7 +132,7 @@ export class ContributorsView extends BlockView {
132
132
  action: () => this.handleEdit(''),
133
133
  icon: 'Edit',
134
134
  });
135
- this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
135
+ this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
136
136
  return this.contextMenu;
137
137
  }
138
138
  return undefined;
@@ -196,7 +196,7 @@ export class ContributorsView extends BlockView {
196
196
  },
197
197
  ],
198
198
  };
199
- this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
199
+ this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
200
200
  this.props.popper.show(element, this.contextMenu, 'right-start');
201
201
  };
202
202
  this.handleEdit = (id, addNew) => {
@@ -46,7 +46,7 @@ export class CrossReferenceEditableView extends CrossReferenceView {
46
46
  currentTargetId: rids[0],
47
47
  currentCustomLabel: this.node.attrs.label,
48
48
  };
49
- this.popperContainer = ReactSubView(this.props, CrossReferenceItems, componentProps, this.node, this.getPos, this.view, 'cross-reference-editor');
49
+ this.popperContainer = ReactSubView(this.props, CrossReferenceItems, componentProps, this.node, this.getPos, this.view, ['cross-reference-editor']);
50
50
  this.props.popper.show(this.dom, this.popperContainer, 'auto');
51
51
  };
52
52
  this.destroy = () => {
@@ -68,7 +68,7 @@ export class EmbedMediaView extends BlockView {
68
68
  },
69
69
  ],
70
70
  };
71
- preview.appendChild(ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'embed-context-menu'));
71
+ preview.appendChild(ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['embed-context-menu']));
72
72
  };
73
73
  }
74
74
  updateContents() {
@@ -22,15 +22,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  step((generator = generator.apply(thisArg, _arguments || [])).next());
23
23
  });
24
24
  };
25
- import { FileCorruptedIcon } from '@manuscripts/style-guide';
25
+ import { ContextMenu, FileCorruptedIcon, ImageDefaultIcon, ImageLeftIcon, ImageRightIcon, } from '@manuscripts/style-guide';
26
+ import { schema } from '@manuscripts/transform';
27
+ import { NodeSelection } from 'prosemirror-state';
26
28
  import { createElement } from 'react';
27
29
  import { renderToStaticMarkup } from 'react-dom/server';
28
30
  import { FigureOptions, } from '../components/views/FigureDropdown';
29
31
  import { groupFiles } from '../lib/files';
32
+ import { updateNodeAttrs } from '../lib/view';
30
33
  import { createEditableNodeView } from './creators';
31
34
  import { FigureView } from './figure';
32
35
  import { figureUploader } from './figure_uploader';
33
36
  import ReactSubView from './ReactSubView';
37
+ export var figurePositions;
38
+ (function (figurePositions) {
39
+ figurePositions["left"] = "half-left";
40
+ figurePositions["right"] = "half-right";
41
+ figurePositions["default"] = "";
42
+ })(figurePositions || (figurePositions = {}));
34
43
  export class FigureEditableView extends FigureView {
35
44
  constructor() {
36
45
  super(...arguments);
@@ -39,8 +48,10 @@ export class FigureEditableView extends FigureView {
39
48
  this.updateContents();
40
49
  };
41
50
  this.setSrc = (src) => {
42
- const { selection, tr } = this.view.state;
43
- tr.setNodeMarkup(this.getPos(), undefined, Object.assign(Object.assign({}, this.node.attrs), { src: src })).setSelection(selection.map(tr.doc, tr.mapping));
51
+ const { tr } = this.view.state;
52
+ const pos = this.getPos();
53
+ tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), { src: src }));
54
+ tr.setSelection(NodeSelection.create(tr.doc, pos));
44
55
  this.view.dispatch(tr);
45
56
  };
46
57
  this.createUnsupportedFormat = (name) => {
@@ -78,11 +89,78 @@ export class FigureEditableView extends FigureView {
78
89
  element.classList.add('figure', 'placeholder');
79
90
  const instructions = document.createElement('div');
80
91
  instructions.classList.add('instructions');
81
- instructions.textContent = 'Click to select an image file';
82
- instructions.style.pointerEvents = 'none';
92
+ instructions.innerHTML = `
93
+ <p>Drag or click here to upload image <br>
94
+ or drag items here from the file inspector tabs <br>
95
+ <a data-action='open-other-files'>'Other files'</a> |
96
+ <a data-action='open-supplement-files'>'Supplements'</a></p>
97
+ `;
83
98
  element.appendChild(instructions);
84
99
  return element;
85
100
  };
101
+ this.createPositionMenuWrapper = () => {
102
+ const can = this.props.getCapabilities();
103
+ this.positionMenuWrapper = document.createElement('div');
104
+ this.positionMenuWrapper.classList.add('position-menu');
105
+ const positionMenuButton = document.createElement('div');
106
+ positionMenuButton.classList.add('position-menu-button');
107
+ let icon;
108
+ switch (this.figurePosition) {
109
+ case figurePositions.left:
110
+ icon = ImageLeftIcon;
111
+ break;
112
+ case figurePositions.right:
113
+ icon = ImageRightIcon;
114
+ break;
115
+ default:
116
+ icon = ImageDefaultIcon;
117
+ break;
118
+ }
119
+ if (icon) {
120
+ positionMenuButton.innerHTML = renderToStaticMarkup(createElement(icon));
121
+ }
122
+ if (can.editArticle) {
123
+ positionMenuButton.addEventListener('click', this.showPositionMenu);
124
+ }
125
+ this.positionMenuWrapper.appendChild(positionMenuButton);
126
+ return this.positionMenuWrapper;
127
+ };
128
+ this.showPositionMenu = () => {
129
+ this.props.popper.destroy();
130
+ const figure = this.node;
131
+ const componentProps = {
132
+ actions: [
133
+ {
134
+ label: 'Left',
135
+ action: () => {
136
+ this.props.popper.destroy();
137
+ updateNodeAttrs(this.view, schema.nodes.figure, Object.assign(Object.assign({}, figure.attrs), { type: figurePositions.left }));
138
+ },
139
+ icon: 'ImageLeft',
140
+ selected: this.figurePosition === figurePositions.left,
141
+ },
142
+ {
143
+ label: 'Default',
144
+ action: () => {
145
+ this.props.popper.destroy();
146
+ updateNodeAttrs(this.view, schema.nodes.figure, Object.assign(Object.assign({}, figure.attrs), { type: figurePositions.default }));
147
+ },
148
+ icon: 'ImageDefault',
149
+ selected: !this.figurePosition,
150
+ },
151
+ {
152
+ label: 'Right',
153
+ action: () => {
154
+ this.props.popper.destroy();
155
+ updateNodeAttrs(this.view, schema.nodes.figure, Object.assign(Object.assign({}, figure.attrs), { type: figurePositions.right }));
156
+ },
157
+ icon: 'ImageRight',
158
+ selected: this.figurePosition === figurePositions.right,
159
+ },
160
+ ],
161
+ };
162
+ this.props.popper.show(this.positionMenuWrapper, ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu', 'position-menu']), 'left', false);
163
+ };
86
164
  }
87
165
  updateContents() {
88
166
  var _a;
@@ -91,6 +169,7 @@ export class FigureEditableView extends FigureView {
91
169
  const src = attrs.src;
92
170
  const files = this.props.getFiles();
93
171
  const file = src && files.filter((f) => f.id === src)[0];
172
+ this.figurePosition = attrs.type;
94
173
  this.container.innerHTML = '';
95
174
  const can = this.props.getCapabilities();
96
175
  const link = file && this.props.fileManagement.previewLink(file);
@@ -109,20 +188,30 @@ export class FigureEditableView extends FigureView {
109
188
  this.props.fileManagement.download(file);
110
189
  };
111
190
  }
112
- handleReplace = (file) => {
113
- this.setSrc(file.id);
114
- };
115
191
  handleDetach = () => {
116
192
  this.setSrc('');
117
193
  };
118
194
  }
195
+ if (can.replaceFile) {
196
+ handleReplace = (file) => {
197
+ this.setSrc(file.id);
198
+ };
199
+ }
119
200
  if (can.uploadFile) {
120
201
  const upload = (file) => __awaiter(this, void 0, void 0, function* () {
121
202
  const result = yield this.props.fileManagement.upload(file);
122
203
  this.setSrc(result.id);
123
204
  });
124
205
  handleUpload = figureUploader(upload);
125
- img.addEventListener('click', handleUpload);
206
+ const handlePlaceholderClick = (event) => {
207
+ const target = event.target;
208
+ if (target.dataset && target.dataset.action) {
209
+ return;
210
+ }
211
+ const triggerUpload = figureUploader(upload);
212
+ triggerUpload();
213
+ };
214
+ img.addEventListener('click', handlePlaceholderClick);
126
215
  img.addEventListener('mouseenter', () => {
127
216
  img.classList.toggle('over', true);
128
217
  });
@@ -170,6 +259,7 @@ export class FigureEditableView extends FigureView {
170
259
  this.reactTools = ReactSubView(this.props, FigureOptions, componentProps, this.node, this.getPos, this.view);
171
260
  this.dom.insertBefore(this.reactTools, this.dom.firstChild);
172
261
  }
262
+ this.container.appendChild(this.createPositionMenuWrapper());
173
263
  }
174
264
  }
175
265
  export default createEditableNodeView(FigureEditableView);
@@ -13,23 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
- return new (P || (P = Promise))(function (resolve, reject) {
19
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
- step((generator = generator.apply(thisArg, _arguments || [])).next());
23
- });
24
- };
25
- import { schema } from '@manuscripts/transform';
26
- import { FigureElementOptions, } from '../components/views/FigureDropdown';
27
- import { groupFiles } from '../lib/files';
28
- import { getMatchingChild } from '../lib/utils';
29
16
  import BlockView from './block_view';
30
17
  import { createNodeView } from './creators';
31
- import { figureUploader } from './figure_uploader';
32
- import ReactSubView from './ReactSubView';
33
18
  export class FigureElementView extends BlockView {
34
19
  constructor() {
35
20
  super(...arguments);
@@ -44,69 +29,5 @@ export class FigureElementView extends BlockView {
44
29
  this.container.appendChild(this.contentDOM);
45
30
  };
46
31
  }
47
- updateContents() {
48
- var _a;
49
- super.updateContents();
50
- if (!this.contentDOM) {
51
- throw new Error('No contentDOM');
52
- }
53
- const can = this.props.getCapabilities();
54
- let handleUpload = () => {
55
- };
56
- const hasUploadedImage = !!getMatchingChild(this.node, (node) => node.type === schema.nodes.figure && node.attrs.src);
57
- const handleAdd = (file) => __awaiter(this, void 0, void 0, function* () {
58
- const { state: { tr, schema, selection }, dispatch, } = this.view;
59
- const src = file.id;
60
- const figure = getMatchingChild(this.node, (node) => node.type === schema.nodes.figure);
61
- if (figure === null || figure === void 0 ? void 0 : figure.attrs.src) {
62
- const figure = schema.nodes.figure.createAndFill({
63
- src,
64
- }, []);
65
- let position = 0;
66
- this.node.forEach((node, pos) => {
67
- if (node.type === schema.nodes.figure) {
68
- position = pos + node.nodeSize;
69
- }
70
- });
71
- dispatch(tr.insert(this.getPos() + position + 1, figure));
72
- }
73
- else if (figure) {
74
- tr.setNodeMarkup(this.getPos() + 1, undefined, Object.assign(Object.assign({}, figure.attrs), { src })).setSelection(selection.map(tr.doc, tr.mapping));
75
- dispatch(tr);
76
- }
77
- this.deleteSupplementNode(file);
78
- });
79
- if (can.uploadFile) {
80
- const upload = (file) => __awaiter(this, void 0, void 0, function* () {
81
- const result = yield this.props.fileManagement.upload(file);
82
- yield handleAdd(result);
83
- });
84
- handleUpload = figureUploader(upload);
85
- }
86
- if (this.props.dispatch && this.props.theme) {
87
- const files = this.props.getFiles();
88
- const doc = this.view.state.doc;
89
- const componentProps = {
90
- can: can,
91
- files: groupFiles(doc, files),
92
- onUpload: handleUpload,
93
- onAdd: handleAdd,
94
- hasUploadedImage: hasUploadedImage,
95
- };
96
- (_a = this.reactTools) === null || _a === void 0 ? void 0 : _a.remove();
97
- this.reactTools = ReactSubView(this.props, FigureElementOptions, componentProps, this.node, this.getPos, this.view);
98
- this.dom.insertBefore(this.reactTools, this.dom.firstChild);
99
- }
100
- }
101
- deleteSupplementNode(file) {
102
- const tr = this.view.state.tr;
103
- this.view.state.doc.descendants((node, pos) => {
104
- if (node.type === schema.nodes.supplement &&
105
- node.attrs.href === file.id) {
106
- tr.delete(pos, pos + node.nodeSize);
107
- }
108
- });
109
- this.view.dispatch(tr);
110
- }
111
32
  }
112
33
  export default createNodeView(FigureElementView);
@@ -52,7 +52,7 @@ export class InlineFootnoteView extends BaseNodeView {
52
52
  },
53
53
  ],
54
54
  };
55
- this.props.popper.show(this.dom, ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu'), 'right-start', false);
55
+ this.props.popper.show(this.dom, ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']), 'right-start', false);
56
56
  };
57
57
  this.handleClick = () => {
58
58
  if (isDeleted(this.node)) {
@@ -97,7 +97,7 @@ export class InlineFootnoteView extends BaseNodeView {
97
97
  onAdd: this.handleAdd,
98
98
  onInsert: this.handleInsert,
99
99
  };
100
- this.popperContainer = ReactSubView(this.props, FootnotesSelector, props, this.node, this.getPos, this.view, 'footnote-editor');
100
+ this.popperContainer = ReactSubView(this.props, FootnotesSelector, props, this.node, this.getPos, this.view, ['footnote-editor']);
101
101
  this.props.popper.show(this.dom, this.popperContainer, 'auto', false);
102
102
  };
103
103
  this.initialise = () => {
@@ -52,7 +52,7 @@ export class KeywordView extends BaseNodeView {
52
52
  keyword: keyword.textContent,
53
53
  handleDelete: handleDelete,
54
54
  };
55
- this.dialog = ReactSubView(this.props, DeleteKeywordDialog, componentProps, this.node, this.getPos, this.view, 'keywords-delete');
55
+ this.dialog = ReactSubView(this.props, DeleteKeywordDialog, componentProps, this.node, this.getPos, this.view, ['keywords-delete']);
56
56
  if (this.dialog) {
57
57
  this.dom.appendChild(this.dialog);
58
58
  }
@@ -31,7 +31,7 @@ export class KeywordGroupView extends BlockView {
31
31
  this.contentDOM.setAttribute('contenteditable', 'false');
32
32
  this.element.appendChild(this.contentDOM);
33
33
  if (this.props.getCapabilities().editArticle) {
34
- this.addingTools = ReactSubView(this.props, AddKeywordInline, { getUpdatedNode: () => this.node }, this.node, this.getPos, this.view, 'keywords-editor');
34
+ this.addingTools = ReactSubView(this.props, AddKeywordInline, { getUpdatedNode: () => this.node }, this.node, this.getPos, this.view, ['keywords-editor']);
35
35
  }
36
36
  if (this.addingTools) {
37
37
  this.element.appendChild(this.addingTools);
@@ -65,7 +65,7 @@ export class LinkEditableView extends LinkView {
65
65
  onRemove: this.handleRemove,
66
66
  onSave: this.handleSave,
67
67
  };
68
- this.popperContainer = ReactSubView(this.props, LinkForm, componentProps, this.node, this.getPos, this.view, 'link-editor');
68
+ this.popperContainer = ReactSubView(this.props, LinkForm, componentProps, this.node, this.getPos, this.view, ['link-editor']);
69
69
  this.props.popper.show(this.dom, this.popperContainer, 'bottom');
70
70
  };
71
71
  this.handleClick = (e) => {
@@ -73,7 +73,7 @@ export class TableCellView extends BlockView {
73
73
  contextMenuButton.classList.toggle('open-context-menu');
74
74
  },
75
75
  onCancelColumnDialog: () => this.addOutClickListener(contextMenuButton),
76
- }, this.view.state.selection.$from.node(), this.getPos, this.view, 'table-cell-context-menu');
76
+ }, this.view.state.selection.$from.node(), this.getPos, this.view, ['table-cell-context-menu']);
77
77
  contextMenuButton.classList.toggle('open-context-menu');
78
78
  this.props.popper.show(contextMenuButton, contextMenu, 'right', false);
79
79
  this.addOutClickListener(contextMenuButton);
@@ -16,5 +16,4 @@ export interface FigureElementOptionsProps extends FigureDropdownProps {
16
16
  onUpload: () => void;
17
17
  hasUploadedImage: boolean;
18
18
  }
19
- export declare const FigureElementOptions: React.FC<FigureElementOptionsProps>;
20
19
  export declare const FigureOptions: React.FC<FigureOptionsProps>;
@@ -40,3 +40,4 @@ export { footnotesKey as footnotesPluginKey } from './plugins/footnotes';
40
40
  export { bibliographyKey as bibliographyPluginKey } from './plugins/bibliography';
41
41
  export { metadata, BibliographyItemAttrs } from './lib/references';
42
42
  export { authorLabel, affiliationLabel, AffiliationAttrs, ContributorAttrs, } from './lib/authors';
43
+ export * from './plugins/inspector-tabs';
@@ -23,8 +23,10 @@ export declare class ContextMenu {
23
23
  constructor(node: ManuscriptNode, view: ManuscriptEditorView, getPos: () => number);
24
24
  showAddMenu: (target: Element, after: boolean) => void;
25
25
  showEditMenu: (target: Element) => void;
26
+ private createSubmenuTrigger;
26
27
  private createMenuItem;
27
28
  private createMenuSection;
29
+ private createSubmenu;
28
30
  private insertableTypes;
29
31
  private changeNodeType;
30
32
  private deleteNode;
@@ -32,4 +34,5 @@ export declare class ContextMenu {
32
34
  private addPopperEventListeners;
33
35
  private trimTitle;
34
36
  private getCommentTarget;
37
+ private toggleSubmenu;
35
38
  }
@@ -0,0 +1,35 @@
1
+ /*!
2
+ * © 2025 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Plugin, PluginKey } from 'prosemirror-state';
17
+ export declare const inspectorTabsKey: PluginKey<any>;
18
+ export interface InspectorOpenTabs {
19
+ primaryTab: InspectorPrimaryTabs | null;
20
+ secondaryTab: InspectorSecondaryTabsFiles | null;
21
+ }
22
+ interface PluginState {
23
+ inspectorOpenTabs: InspectorOpenTabs;
24
+ }
25
+ export declare enum InspectorPrimaryTabs {
26
+ Comments = 0,
27
+ History = 1,
28
+ Files = 2
29
+ }
30
+ export declare enum InspectorSecondaryTabsFiles {
31
+ SupplementsFiles = 1,
32
+ OtherFiles = 2
33
+ }
34
+ declare const _default: () => Plugin<PluginState>;
35
+ export default _default;
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.7.32";
1
+ export declare const VERSION = "2.7.33";
2
2
  export declare const MATHJAX_VERSION = "3.2.2";
@@ -29,5 +29,5 @@ export interface ReactViewComponentProps<NodeT extends ManuscriptNode> {
29
29
  };
30
30
  dispatch: Dispatch;
31
31
  }
32
- declare function createSubView<T extends Trackable<ManuscriptNode>>(props: EditorProps, Component: React.FC<any>, componentProps: object, node: T, getPos: () => number, view: ManuscriptEditorView, classNames?: string): HTMLDivElement;
32
+ declare function createSubView<T extends Trackable<ManuscriptNode>>(props: EditorProps, Component: React.FC<any>, componentProps: object, node: T, getPos: () => number, view: ManuscriptEditorView, classNames?: string[]): HTMLDivElement;
33
33
  export default createSubView;