@manuscripts/body-editor 2.7.28 → 2.7.30-LEAN-4096.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.
Files changed (60) hide show
  1. package/dist/cjs/components/affiliations/AffiliationItem.js +2 -2
  2. package/dist/cjs/components/affiliations/AffiliationsModal.js +3 -3
  3. package/dist/cjs/components/authors/AuthorsModal.js +3 -3
  4. package/dist/cjs/components/views/FigureDropdown.js +8 -47
  5. package/dist/cjs/configs/editor-plugins.js +2 -0
  6. package/dist/cjs/index.js +1 -0
  7. package/dist/cjs/lib/context-menu.js +71 -4
  8. package/dist/cjs/plugins/inspector-tabs.js +84 -0
  9. package/dist/cjs/versions.js +1 -1
  10. package/dist/cjs/views/ReactSubView.js +4 -4
  11. package/dist/cjs/views/affiliations.js +1 -1
  12. package/dist/cjs/views/award.js +3 -3
  13. package/dist/cjs/views/bibliography_element.js +2 -2
  14. package/dist/cjs/views/citation_editable.js +3 -3
  15. package/dist/cjs/views/contributors.js +2 -2
  16. package/dist/cjs/views/cross_reference_editable.js +1 -1
  17. package/dist/cjs/views/embed.js +1 -1
  18. package/dist/cjs/views/figure_editable.js +91 -7
  19. package/dist/cjs/views/figure_element.js +0 -79
  20. package/dist/cjs/views/inline_footnote.js +2 -2
  21. package/dist/cjs/views/keyword.js +1 -1
  22. package/dist/cjs/views/keyword_group.js +1 -1
  23. package/dist/cjs/views/link_editable.js +1 -1
  24. package/dist/cjs/views/table_cell.js +1 -1
  25. package/dist/es/components/affiliations/AffiliationItem.js +2 -2
  26. package/dist/es/components/affiliations/AffiliationsModal.js +3 -3
  27. package/dist/es/components/authors/AuthorsModal.js +3 -3
  28. package/dist/es/components/views/FigureDropdown.js +8 -46
  29. package/dist/es/configs/editor-plugins.js +2 -0
  30. package/dist/es/index.js +1 -0
  31. package/dist/es/lib/context-menu.js +72 -5
  32. package/dist/es/plugins/inspector-tabs.js +81 -0
  33. package/dist/es/versions.js +1 -1
  34. package/dist/es/views/ReactSubView.js +4 -4
  35. package/dist/es/views/affiliations.js +1 -1
  36. package/dist/es/views/award.js +3 -3
  37. package/dist/es/views/bibliography_element.js +2 -2
  38. package/dist/es/views/citation_editable.js +3 -3
  39. package/dist/es/views/contributors.js +2 -2
  40. package/dist/es/views/cross_reference_editable.js +1 -1
  41. package/dist/es/views/embed.js +1 -1
  42. package/dist/es/views/figure_editable.js +91 -7
  43. package/dist/es/views/figure_element.js +0 -79
  44. package/dist/es/views/inline_footnote.js +2 -2
  45. package/dist/es/views/keyword.js +1 -1
  46. package/dist/es/views/keyword_group.js +1 -1
  47. package/dist/es/views/link_editable.js +1 -1
  48. package/dist/es/views/table_cell.js +1 -1
  49. package/dist/types/components/views/FigureDropdown.d.ts +0 -1
  50. package/dist/types/index.d.ts +1 -0
  51. package/dist/types/lib/context-menu.d.ts +3 -0
  52. package/dist/types/plugins/inspector-tabs.d.ts +35 -0
  53. package/dist/types/versions.d.ts +1 -1
  54. package/dist/types/views/ReactSubView.d.ts +1 -1
  55. package/dist/types/views/figure_editable.d.ts +9 -0
  56. package/dist/types/views/figure_element.d.ts +0 -3
  57. package/package.json +3 -3
  58. package/styles/AdvancedEditor.css +15 -5
  59. package/styles/Editor.css +10 -1
  60. package/styles/popper.css +33 -11
@@ -92,10 +92,10 @@ const AffiliationItem = ({ affiliation, isSelected, onClick, onDelete, showSucce
92
92
  block: 'nearest',
93
93
  });
94
94
  }
95
- return (react_1.default.createElement(AffiliationContainer, { onClick: onClick, className: isSelected ? 'active' : '', ref: ref },
95
+ return (react_1.default.createElement(AffiliationContainer, { "data-cy": "affiliation-item", onClick: onClick, className: isSelected ? 'active' : '', ref: ref },
96
96
  react_1.default.createElement(style_guide_1.AffiliationIcon, { opacity: showSuccessIcon ? 0.05 : 1, style: { minWidth: 24, minHeight: 24 } }),
97
97
  react_1.default.createElement(AffiliationBox, null,
98
- react_1.default.createElement(AffiliationName, null, affiliation.institution),
98
+ react_1.default.createElement(AffiliationName, { "data-cy": "affiliation-name" }, affiliation.institution),
99
99
  react_1.default.createElement(AffiliationDetails, null,
100
100
  affiliation.city && (react_1.default.createElement(react_1.default.Fragment, null,
101
101
  affiliation.city,
@@ -384,7 +384,7 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, onS
384
384
  }
385
385
  };
386
386
  return (react_1.default.createElement(style_guide_1.StyledModal, { isOpen: isOpen, onRequestClose: () => handleClose(), shouldCloseOnOverlayClick: true },
387
- react_1.default.createElement(style_guide_1.ModalContainer, null,
387
+ react_1.default.createElement(style_guide_1.ModalContainer, { "data-cy": "affiliations-modal" },
388
388
  react_1.default.createElement(style_guide_1.ModalHeader, null,
389
389
  react_1.default.createElement(style_guide_1.CloseButton, { onClick: () => handleClose(), "data-cy": "modal-close-button" })),
390
390
  react_1.default.createElement(StyledModalBody, null,
@@ -407,10 +407,10 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, onS
407
407
  react_1.default.createElement(AffiliateButton, { onClick: () => setShowAuthorDrawer(true), "data-cy": "affiliate-authors-button" },
408
408
  react_1.default.createElement(style_guide_1.AddUserIcon, { width: 16, height: 16 }),
409
409
  "Affiliate Authors")),
410
- react_1.default.createElement(style_guide_1.SelectedItemsBox, { items: selectedAuthors, onRemove: (id) => {
410
+ react_1.default.createElement(style_guide_1.SelectedItemsBox, { "data-cy": "affiliation-authors", items: selectedAuthors, onRemove: (id) => {
411
411
  setSelectedIds((prev) => prev.filter((authorId) => authorId !== id));
412
412
  }, placeholder: "No authors assigned" })),
413
- showAuthorDrawer && (react_1.default.createElement(style_guide_1.Drawer, { items: authorItems, selectedIds: selectedIds, title: "Authors", onSelect: handleAuthorSelect, onBack: () => setShowAuthorDrawer(false), width: "100%" })))) : (react_1.default.createElement(FormPlaceholder_1.FormPlaceholder, { type: "affiliation", title: 'Affiliation Details', message: "Select an affiliation from the list to display it's details here.", placeholderIcon: react_1.default.createElement(style_guide_1.AffiliationPlaceholderIcon, null) })))),
413
+ showAuthorDrawer && (react_1.default.createElement(style_guide_1.Drawer, { items: authorItems, selectedIds: selectedIds, title: "Authors", onSelect: handleAuthorSelect, onBack: () => setShowAuthorDrawer(false), width: "100%" })))) : (react_1.default.createElement(FormPlaceholder_1.FormPlaceholder, { type: "affiliation", title: "Affiliation Details", message: "Select an affiliation from the list to display it's details here.", placeholderIcon: react_1.default.createElement(style_guide_1.AffiliationPlaceholderIcon, null) })))),
414
414
  react_1.default.createElement(FormFooter_1.default, { onCancel: handleClose }))));
415
415
  };
416
416
  exports.AffiliationsModal = AffiliationsModal;
@@ -461,7 +461,7 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
461
461
  setSelectedAffiliations(affiliationItems.filter((item) => newAffiliations.includes(item.id)));
462
462
  };
463
463
  return (react_1.default.createElement(style_guide_1.StyledModal, { isOpen: isOpen, onRequestClose: () => handleClose(), shouldCloseOnOverlayClick: true },
464
- react_1.default.createElement(style_guide_1.ModalContainer, null,
464
+ react_1.default.createElement(style_guide_1.ModalContainer, { "data-cy": "authors-modal" },
465
465
  react_1.default.createElement(style_guide_1.ModalHeader, null,
466
466
  react_1.default.createElement(style_guide_1.CloseButton, { onClick: () => handleClose(), "data-cy": "modal-close-button" })),
467
467
  react_1.default.createElement(StyledModalBody, null,
@@ -488,8 +488,8 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
488
488
  react_1.default.createElement(AffiliateButton, { onClick: () => setShowAffiliationDrawer(true), "data-cy": "affiliate-authors-button" },
489
489
  react_1.default.createElement(style_guide_1.AddInstitutionIcon, { width: 16, height: 16 }),
490
490
  "Assign Institutions")),
491
- react_1.default.createElement(style_guide_1.SelectedItemsBox, { items: selectedAffiliations, onRemove: handleRemoveAffiliation, placeholder: "No institutions assigned" })),
492
- showAffiliationDrawer && (react_1.default.createElement(style_guide_1.Drawer, { items: affiliationItems, selectedIds: selectedAffiliationIds, title: "Authors", onSelect: handleAffiliationSelect, onBack: () => setShowAffiliationDrawer(false), width: "100%" })))) : (react_1.default.createElement(FormPlaceholder_1.FormPlaceholder, { type: "author", title: 'Author Details', message: 'Select an author from the list to display their details here.', placeholderIcon: react_1.default.createElement(style_guide_1.AuthorPlaceholderIcon, null) })))),
491
+ react_1.default.createElement(style_guide_1.SelectedItemsBox, { "data-cy": "author-affiliations", items: selectedAffiliations, onRemove: handleRemoveAffiliation, placeholder: "No institutions assigned" })),
492
+ showAffiliationDrawer && (react_1.default.createElement(style_guide_1.Drawer, { items: affiliationItems, selectedIds: selectedAffiliationIds, title: "Authors", onSelect: handleAffiliationSelect, onBack: () => setShowAffiliationDrawer(false), width: "100%" })))) : (react_1.default.createElement(FormPlaceholder_1.FormPlaceholder, { type: "author", title: "Author Details", message: "Select an author from the list to display their details here.", placeholderIcon: react_1.default.createElement(style_guide_1.AuthorPlaceholderIcon, null) })))),
493
493
  react_1.default.createElement(FormFooter_1.default, { onCancel: handleClose }))));
494
494
  };
495
495
  exports.AuthorsModal = AuthorsModal;
@@ -3,31 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FigureOptions = exports.FigureElementOptions = void 0;
6
+ exports.FigureOptions = void 0;
7
7
  const style_guide_1 = require("@manuscripts/style-guide");
8
8
  const react_1 = __importDefault(require("react"));
9
9
  const styled_components_1 = __importDefault(require("styled-components"));
10
- const FigureElementOptions = ({ can, files, onAdd, onUpload, hasUploadedImage, }) => {
11
- const { isOpen, toggleOpen, wrapperRef } = (0, style_guide_1.useDropdown)();
12
- const supplements = files.supplements
13
- .map((s) => s.file)
14
- .filter((f) => (0, style_guide_1.isImageFile)(f.name));
15
- const others = files.others.filter((f) => (0, style_guide_1.isImageFile)(f.name));
16
- return (react_1.default.createElement(FilesDropdownWrapper, { onClick: toggleOpen, ref: wrapperRef },
17
- react_1.default.createElement(FilesButton, { disabled: hasUploadedImage },
18
- react_1.default.createElement(style_guide_1.AttachIcon, null)),
19
- isOpen && (react_1.default.createElement(style_guide_1.DropdownList, { direction: 'left', width: 208, height: 187, onClick: toggleOpen, top: 7 },
20
- react_1.default.createElement(NestedDropdown, { disabled: !can.replaceFile || supplements.length < 1, parentToggleOpen: toggleOpen, buttonText: 'Supplements', list: react_1.default.createElement(react_1.default.Fragment, null, supplements.map((file) => (react_1.default.createElement(ListItemButton, { key: file.id, onClick: () => onAdd(file) },
21
- (0, style_guide_1.getFileIcon)(file.name),
22
- react_1.default.createElement(ListItemText, null, file.name))))) }),
23
- react_1.default.createElement(NestedDropdown, { disabled: !can.replaceFile || others.length < 1, parentToggleOpen: toggleOpen, buttonText: 'Other files', list: react_1.default.createElement(react_1.default.Fragment, null, others.map((file) => (react_1.default.createElement(ListItemButton, { key: file.id, onClick: () => onAdd(file) },
24
- (0, style_guide_1.getFileIcon)(file.name),
25
- react_1.default.createElement(ListItemText, null, file.name))))) }),
26
- react_1.default.createElement(UploadButton, { onClick: onUpload, disabled: !can.uploadFile },
27
- react_1.default.createElement(style_guide_1.AddIcon, null),
28
- " New file...")))));
29
- };
30
- exports.FigureElementOptions = FigureElementOptions;
31
10
  const FigureOptions = ({ can, files, onDownload, onUpload, onDetach, onReplace, }) => {
32
11
  const { isOpen, toggleOpen, wrapperRef } = (0, style_guide_1.useDropdown)();
33
12
  const otherFiles = files.others.filter((f) => (0, style_guide_1.isImageFile)(f.name));
@@ -35,18 +14,19 @@ const FigureOptions = ({ can, files, onDownload, onUpload, onDetach, onReplace,
35
14
  const showUpload = onUpload && can.uploadFile;
36
15
  const showDetach = onDetach && can.detachFile;
37
16
  const showReplace = onReplace && can.replaceFile;
17
+ const replaceBtnText = onDownload ? 'Replace' : 'Choose file';
38
18
  return (react_1.default.createElement(DropdownWrapper, { ref: wrapperRef },
39
19
  react_1.default.createElement(OptionsButton, { className: 'options-button', onClick: toggleOpen },
40
20
  react_1.default.createElement(style_guide_1.DotsIcon, null)),
41
21
  isOpen && (react_1.default.createElement(OptionsDropdownList, { direction: 'right', width: 128, top: 5 },
42
- react_1.default.createElement(ListItemButton, { onClick: onDownload, disabled: !showDownload }, "Download"),
43
- react_1.default.createElement(NestedDropdown, { disabled: !showReplace, parentToggleOpen: toggleOpen, buttonText: 'Replace', moveLeft: true, list: react_1.default.createElement(react_1.default.Fragment, null,
22
+ react_1.default.createElement(NestedDropdown, { disabled: !showReplace, parentToggleOpen: toggleOpen, buttonText: replaceBtnText, moveLeft: true, list: react_1.default.createElement(react_1.default.Fragment, null,
44
23
  otherFiles.map((file, index) => (react_1.default.createElement(ListItemButton, { key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file) },
45
24
  (0, style_guide_1.getFileIcon)(file.name),
46
25
  react_1.default.createElement(ListItemText, null, file.name)))),
47
26
  react_1.default.createElement(UploadButton, { onClick: onUpload, disabled: !showUpload },
48
27
  react_1.default.createElement(style_guide_1.UploadIcon, null),
49
28
  " Upload new...")) }),
29
+ react_1.default.createElement(ListItemButton, { onClick: onDownload, disabled: !showDownload }, "Download"),
50
30
  react_1.default.createElement(ListItemButton, { onClick: onDetach, disabled: !showDetach }, "Detach")))));
51
31
  };
52
32
  exports.FigureOptions = FigureOptions;
@@ -54,8 +34,7 @@ const NestedDropdown = ({ parentToggleOpen, buttonText, disabled, list, moveLeft
54
34
  const { isOpen, toggleOpen, wrapperRef } = (0, style_guide_1.useDropdown)();
55
35
  return (react_1.default.createElement(DropdownWrapper, { ref: wrapperRef },
56
36
  react_1.default.createElement(NestedListButton, { onClick: toggleOpen, disabled: disabled },
57
- buttonText,
58
- " ",
37
+ react_1.default.createElement("div", null, buttonText),
59
38
  react_1.default.createElement(style_guide_1.TriangleCollapsedIcon, null)),
60
39
  isOpen && (react_1.default.createElement(NestedListDropdownList, { direction: 'right', moveLeft: moveLeft, width: 192, onClick: (e) => {
61
40
  toggleOpen();
@@ -75,9 +54,6 @@ const OptionsButton = (0, styled_components_1.default)(style_guide_1.IconButton)
75
54
  margin: ${(props) => props.theme.grid.unit}px;
76
55
  visibility: hidden;
77
56
  background: white;
78
- position: absolute;
79
- top: -4px;
80
- right: 4%;
81
57
 
82
58
  &:hover {
83
59
  background: #f2fbfc !important;
@@ -119,30 +95,15 @@ const ListItemText = styled_components_1.default.div `
119
95
  text-overflow: ellipsis;
120
96
  text-align: start;
121
97
  `;
122
- const FilesButton = (0, styled_components_1.default)(style_guide_1.RoundIconButton) `
123
- path {
124
- stroke: #6e6e6e;
125
- }
126
-
127
- &:active,
128
- &:focus {
129
- path {
130
- stroke: #1a9bc7;
131
- }
132
- }
133
- `;
134
- const FilesDropdownWrapper = styled_components_1.default.div `
135
- position: absolute;
136
- top: 8px;
137
- left: 70px;
138
- z-index: 1;
139
- `;
140
98
  const NestedListButton = (0, styled_components_1.default)(ListItemButton) `
141
99
  width: 100%;
142
100
  &:active,
143
101
  &:focus {
144
102
  background: #f2fbfc;
145
103
  }
104
+ svg {
105
+ margin-right: 0;
106
+ }
146
107
  `;
147
108
  const NestedListDropdownList = (0, styled_components_1.default)(style_guide_1.DropdownList) `
148
109
  top: 0;
@@ -34,6 +34,7 @@ const doi_1 = __importDefault(require("../plugins/doi"));
34
34
  const editor_props_1 = __importDefault(require("../plugins/editor-props"));
35
35
  const elements_1 = __importDefault(require("../plugins/elements"));
36
36
  const footnotes_1 = __importDefault(require("../plugins/footnotes"));
37
+ const inspector_tabs_1 = __importDefault(require("../plugins/inspector-tabs"));
37
38
  const objects_1 = __importDefault(require("../plugins/objects"));
38
39
  const paragraphs_1 = __importDefault(require("../plugins/paragraphs"));
39
40
  const persist_1 = __importDefault(require("../plugins/persist"));
@@ -75,6 +76,7 @@ exports.default = (props) => {
75
76
  (0, doi_1.default)(),
76
77
  (0, section_category_1.default)(props),
77
78
  (0, cross_references_1.default)(),
79
+ (0, inspector_tabs_1.default)(),
78
80
  ];
79
81
  if (props.collabProvider) {
80
82
  allPlugins.push((0, prosemirror_collab_1.collab)({ version: props.collabProvider.currentVersion }));
package/dist/cjs/index.js CHANGED
@@ -68,3 +68,4 @@ Object.defineProperty(exports, "metadata", { enumerable: true, get: function ()
68
68
  var authors_1 = require("./lib/authors");
69
69
  Object.defineProperty(exports, "authorLabel", { enumerable: true, get: function () { return authors_1.authorLabel; } });
70
70
  Object.defineProperty(exports, "affiliationLabel", { enumerable: true, get: function () { return authors_1.affiliationLabel; } });
71
+ __exportStar(require("./plugins/inspector-tabs"), exports);
@@ -16,11 +16,16 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.ContextMenu = exports.contextMenuBtnClass = exports.sectionLevel = void 0;
19
+ const style_guide_1 = require("@manuscripts/style-guide");
19
20
  const transform_1 = require("@manuscripts/transform");
20
21
  const prosemirror_utils_1 = require("prosemirror-utils");
22
+ const react_1 = require("react");
23
+ const server_1 = require("react-dom/server");
21
24
  const commands_1 = require("../commands");
25
+ const figure_editable_1 = require("../views/figure_editable");
22
26
  const popper_1 = require("./popper");
23
27
  const utils_1 = require("./utils");
28
+ const view_1 = require("./view");
24
29
  const popper = new popper_1.PopperManager();
25
30
  const readonlyTypes = [
26
31
  transform_1.schema.nodes.keywords,
@@ -42,6 +47,7 @@ const hasAny = (set, ...items) => {
42
47
  return items.some((i) => set.has(i));
43
48
  };
44
49
  exports.contextMenuBtnClass = 'btn-context-menu';
50
+ const contextSubmenuBtnClass = 'context-submenu-trigger';
45
51
  class ContextMenu {
46
52
  constructor(node, view, getPos, actions = {}) {
47
53
  this.showAddMenu = (target, after) => {
@@ -150,6 +156,36 @@ class ContextMenu {
150
156
  const $pos = this.resolvePos();
151
157
  const isBox = isBoxElementSectionTitle($pos, this.node);
152
158
  const type = isBox ? transform_1.schema.nodes.box_element : this.node.type;
159
+ if (type === transform_1.schema.nodes.figure_element ||
160
+ type === transform_1.schema.nodes.image_element) {
161
+ const figure = (0, utils_1.getMatchingChild)(this.node, (node) => node.type === transform_1.schema.nodes.figure);
162
+ if (figure) {
163
+ const attrType = figure.attrs.type;
164
+ const submenuOptions = [
165
+ {
166
+ title: 'Left',
167
+ action: () => (0, view_1.updateNodeAttrs)(this.view, transform_1.schema.nodes.figure, Object.assign(Object.assign({}, figure.attrs), { type: figure_editable_1.figurePositions.left })),
168
+ Icon: style_guide_1.ImageLeftIcon,
169
+ selected: attrType === figure_editable_1.figurePositions.left,
170
+ },
171
+ {
172
+ title: 'Default',
173
+ action: () => (0, view_1.updateNodeAttrs)(this.view, transform_1.schema.nodes.figure, Object.assign(Object.assign({}, figure.attrs), { type: figure_editable_1.figurePositions.default })),
174
+ Icon: style_guide_1.ImageDefaultIcon,
175
+ selected: !attrType,
176
+ },
177
+ {
178
+ title: 'Right',
179
+ action: () => (0, view_1.updateNodeAttrs)(this.view, transform_1.schema.nodes.figure, Object.assign(Object.assign({}, figure.attrs), { type: figure_editable_1.figurePositions.right })),
180
+ Icon: style_guide_1.ImageRightIcon,
181
+ selected: attrType === figure_editable_1.figurePositions.right,
182
+ },
183
+ ];
184
+ const submenuLabel = 'Position';
185
+ const submenu = this.createSubmenu(submenuLabel, submenuOptions);
186
+ menu.appendChild(submenu);
187
+ }
188
+ }
153
189
  if (type === transform_1.schema.nodes.list) {
154
190
  menu.appendChild(this.createMenuSection((section) => {
155
191
  const attrs = this.node.attrs;
@@ -214,22 +250,48 @@ class ContextMenu {
214
250
  popper.show(target, menu, 'right', true);
215
251
  this.addPopperEventListeners();
216
252
  };
217
- this.createMenuItem = (contents, handler) => {
253
+ this.createSubmenuTrigger = (contents) => {
254
+ const item = document.createElement('div');
255
+ item.className = 'menu-item';
256
+ const textNode = document.createTextNode(contents);
257
+ item.innerHTML = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(style_guide_1.TriangleCollapsedIcon));
258
+ item.prepend(textNode);
259
+ item.classList.add(contextSubmenuBtnClass);
260
+ item.addEventListener('mousedown', this.toggleSubmenu);
261
+ return item;
262
+ };
263
+ this.createMenuItem = (contents, handler, Icon = null, selected = false) => {
218
264
  const item = document.createElement('div');
219
265
  item.className = 'menu-item';
220
- item.textContent = contents;
266
+ selected && item.classList.add('selected');
267
+ if (Icon) {
268
+ item.innerHTML = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(Icon));
269
+ }
270
+ const textNode = document.createTextNode(contents);
271
+ item.appendChild(textNode);
221
272
  item.addEventListener('mousedown', (event) => {
222
273
  event.preventDefault();
223
274
  handler(event);
224
275
  });
225
276
  return item;
226
277
  };
227
- this.createMenuSection = (createMenuItems) => {
278
+ this.createMenuSection = (createMenuItems, isSubmenu = false) => {
228
279
  const section = document.createElement('div');
229
280
  section.className = 'menu-section';
281
+ isSubmenu && section.classList.add('menu');
230
282
  createMenuItems(section);
231
283
  return section;
232
284
  };
285
+ this.createSubmenu = (submenuLabel, items) => {
286
+ const submenu = document.createElement('div');
287
+ submenu.classList.add('menu-section', 'context-submenu');
288
+ submenu.append(this.createSubmenuTrigger(submenuLabel), this.createMenuSection((section) => {
289
+ items.forEach(({ title, action, Icon, selected }) => {
290
+ section.appendChild(this.createMenuItem(title, action, Icon, selected));
291
+ });
292
+ }, true));
293
+ return submenu;
294
+ };
233
295
  this.insertableTypes = (after, insertPos, endPos) => {
234
296
  const { nodes } = transform_1.schema;
235
297
  const insertable = new Set();
@@ -291,7 +353,8 @@ class ContextMenu {
291
353
  this.addPopperEventListeners = () => {
292
354
  const mouseListener = (event) => {
293
355
  const target = event.target;
294
- if (target.classList.contains(exports.contextMenuBtnClass)) {
356
+ if (target.classList.contains(exports.contextMenuBtnClass) ||
357
+ target.classList.contains(contextSubmenuBtnClass)) {
295
358
  return;
296
359
  }
297
360
  window.requestAnimationFrame(() => {
@@ -323,6 +386,10 @@ class ContextMenu {
323
386
  }
324
387
  return this.node;
325
388
  };
389
+ this.toggleSubmenu = (ev) => {
390
+ const submenu = ev.target.nextElementSibling;
391
+ submenu === null || submenu === void 0 ? void 0 : submenu.classList.toggle('show');
392
+ };
326
393
  this.node = node;
327
394
  this.view = view;
328
395
  this.getPos = getPos;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2025 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.InspectorSecondaryTabsFiles = exports.InspectorPrimaryTabs = exports.inspectorTabsKey = void 0;
19
+ const prosemirror_state_1 = require("prosemirror-state");
20
+ exports.inspectorTabsKey = new prosemirror_state_1.PluginKey('inspector_tabs');
21
+ var InspectorPrimaryTabs;
22
+ (function (InspectorPrimaryTabs) {
23
+ InspectorPrimaryTabs[InspectorPrimaryTabs["Comments"] = 0] = "Comments";
24
+ InspectorPrimaryTabs[InspectorPrimaryTabs["History"] = 1] = "History";
25
+ InspectorPrimaryTabs[InspectorPrimaryTabs["Files"] = 2] = "Files";
26
+ })(InspectorPrimaryTabs = exports.InspectorPrimaryTabs || (exports.InspectorPrimaryTabs = {}));
27
+ var InspectorSecondaryTabsFiles;
28
+ (function (InspectorSecondaryTabsFiles) {
29
+ InspectorSecondaryTabsFiles[InspectorSecondaryTabsFiles["SupplementsFiles"] = 1] = "SupplementsFiles";
30
+ InspectorSecondaryTabsFiles[InspectorSecondaryTabsFiles["OtherFiles"] = 2] = "OtherFiles";
31
+ })(InspectorSecondaryTabsFiles = exports.InspectorSecondaryTabsFiles || (exports.InspectorSecondaryTabsFiles = {}));
32
+ exports.default = () => {
33
+ return new prosemirror_state_1.Plugin({
34
+ key: exports.inspectorTabsKey,
35
+ state: {
36
+ init: () => ({
37
+ inspectorOpenTabs: {
38
+ primaryTab: null,
39
+ secondaryTab: null,
40
+ },
41
+ }),
42
+ apply: (tr, value) => {
43
+ const meta = tr.getMeta(exports.inspectorTabsKey);
44
+ if (meta && meta.inspectorOpenTabs !== undefined) {
45
+ return Object.assign(Object.assign({}, value), { inspectorOpenTabs: meta.inspectorOpenTabs });
46
+ }
47
+ return value;
48
+ },
49
+ },
50
+ props: {
51
+ handleClick: (view, pos, event) => {
52
+ const target = event.target;
53
+ const inspectorOpenTabs = {
54
+ primaryTab: null,
55
+ secondaryTab: null,
56
+ };
57
+ switch (target.dataset.action) {
58
+ case 'open-other-files':
59
+ event.stopPropagation();
60
+ inspectorOpenTabs.primaryTab = InspectorPrimaryTabs.Files;
61
+ inspectorOpenTabs.secondaryTab =
62
+ InspectorSecondaryTabsFiles.OtherFiles;
63
+ break;
64
+ case 'open-supplement-files':
65
+ event.stopPropagation();
66
+ inspectorOpenTabs.primaryTab = InspectorPrimaryTabs.Files;
67
+ inspectorOpenTabs.secondaryTab =
68
+ InspectorSecondaryTabsFiles.SupplementsFiles;
69
+ break;
70
+ default:
71
+ break;
72
+ }
73
+ if (inspectorOpenTabs.primaryTab != null ||
74
+ inspectorOpenTabs.secondaryTab != null) {
75
+ const tr = view.state.tr.setMeta(exports.inspectorTabsKey, {
76
+ inspectorOpenTabs,
77
+ });
78
+ view.dispatch(tr);
79
+ }
80
+ return false;
81
+ },
82
+ },
83
+ });
84
+ };
@@ -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 = '2.7.28';
4
+ exports.VERSION = '2.7.30-LEAN-4096.0';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -21,12 +21,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
21
  const react_1 = __importDefault(require("react"));
22
22
  const client_1 = require("react-dom/client");
23
23
  const styled_components_1 = require("styled-components");
24
- function createSubView(props, Component, componentProps, node, getPos, view, classNames = '') {
24
+ function createSubView(props, Component, componentProps, node, getPos, view, classNames = []) {
25
25
  const container = document.createElement('div');
26
26
  container.classList.add('tools-panel');
27
- if (classNames) {
28
- container.classList.add(classNames);
29
- container.setAttribute('data-cy', classNames);
27
+ if (classNames.length) {
28
+ container.classList.add(...classNames);
29
+ container.setAttribute('data-cy', classNames[0]);
30
30
  }
31
31
  container.setAttribute('contenteditable', 'false');
32
32
  const Wrapped = () => {
@@ -104,7 +104,7 @@ class AffiliationsView extends block_view_1.default {
104
104
  action: () => this.handleEdit(),
105
105
  icon: 'Edit',
106
106
  });
107
- this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
107
+ this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
108
108
  return this.contextMenu;
109
109
  }
110
110
  return undefined;
@@ -80,7 +80,7 @@ class AwardView extends block_view_1.default {
80
80
  },
81
81
  ],
82
82
  };
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);
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);
84
84
  };
85
85
  this.showAwardModal = (award) => {
86
86
  var _a, _b;
@@ -91,7 +91,7 @@ class AwardView extends block_view_1.default {
91
91
  onSaveAward: this.handleSaveAward,
92
92
  onCancelAward: this.handleCancelAward,
93
93
  };
94
- this.popperContainer = (0, ReactSubView_1.default)(this.props, AwardModal_1.AwardModal, componentProps, this.node, this.getPos, this.view, 'award-editor');
94
+ this.popperContainer = (0, ReactSubView_1.default)(this.props, AwardModal_1.AwardModal, componentProps, this.node, this.getPos, this.view, ['award-editor']);
95
95
  this.props.popper.show(this.dom, this.popperContainer, 'auto', false);
96
96
  };
97
97
  this.showDeleteAwardDialog = () => {
@@ -100,7 +100,7 @@ class AwardView extends block_view_1.default {
100
100
  const componentProps = {
101
101
  handleDelete: this.handleDeleteAward,
102
102
  };
103
- this.popperContainer = (0, ReactSubView_1.default)(this.props, DeleteAwardDiaolog_1.DeleteAwardDialog, componentProps, this.node, this.getPos, this.view, 'award-editor');
103
+ this.popperContainer = (0, ReactSubView_1.default)(this.props, DeleteAwardDiaolog_1.DeleteAwardDialog, componentProps, this.node, this.getPos, this.view, ['award-editor']);
104
104
  this.props.popper.show(this.dom, this.popperContainer, 'auto', false);
105
105
  };
106
106
  this.handleSaveAward = (award) => {
@@ -125,7 +125,7 @@ class BibliographyElementBlockView extends block_view_1.default {
125
125
  onSave: this.handleSave,
126
126
  onDelete: this.handleDelete,
127
127
  };
128
- this.editor = (0, ReactSubView_1.default)(this.props, ReferencesEditor_1.ReferencesEditor, componentProps, this.node, this.getPos, this.view, 'references-editor');
128
+ this.editor = (0, ReactSubView_1.default)(this.props, ReferencesEditor_1.ReferencesEditor, componentProps, this.node, this.getPos, this.view, ['references-editor']);
129
129
  this.props.popper.show(this.dom, this.editor, 'right');
130
130
  }
131
131
  handleEdit(citationID) {
@@ -151,7 +151,7 @@ class BibliographyElementBlockView extends block_view_1.default {
151
151
  action: () => (0, comments_1.handleComment)(item, this.view),
152
152
  icon: 'AddComment',
153
153
  });
154
- this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
154
+ this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
155
155
  this.props.popper.show(element, this.contextMenu, 'right-start');
156
156
  }
157
157
  updateContents() {
@@ -93,7 +93,7 @@ class CitationEditableView extends citation_1.CitationView {
93
93
  const componentProps = {
94
94
  actions,
95
95
  };
96
- this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
96
+ this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
97
97
  this.props.popper.show(this.dom, this.contextMenu, 'right-start', false);
98
98
  };
99
99
  this.showPopper = () => {
@@ -121,14 +121,14 @@ class CitationEditableView extends citation_1.CitationView {
121
121
  onCancel: this.handleCancel,
122
122
  canEdit: can.editCitationsAndRefs,
123
123
  };
124
- this.editor = (0, ReactSubView_1.default)(this.props, CitationEditor_1.CitationEditor, componentProps, this.node, this.getPos, this.view, 'citation-editor');
124
+ this.editor = (0, ReactSubView_1.default)(this.props, CitationEditor_1.CitationEditor, componentProps, this.node, this.getPos, this.view, ['citation-editor']);
125
125
  }
126
126
  else {
127
127
  const componentProps = {
128
128
  rids,
129
129
  items,
130
130
  };
131
- this.editor = (0, ReactSubView_1.default)(this.props, CitationViewer_1.CitationViewer, componentProps, this.node, this.getPos, this.view, 'citation-editor');
131
+ this.editor = (0, ReactSubView_1.default)(this.props, CitationViewer_1.CitationViewer, componentProps, this.node, this.getPos, this.view, ['citation-editor']);
132
132
  }
133
133
  this.props.popper.show(this.dom, this.editor, 'auto');
134
134
  };
@@ -138,7 +138,7 @@ class ContributorsView extends block_view_1.default {
138
138
  action: () => this.handleEdit(''),
139
139
  icon: 'Edit',
140
140
  });
141
- this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
141
+ this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
142
142
  return this.contextMenu;
143
143
  }
144
144
  return undefined;
@@ -202,7 +202,7 @@ class ContributorsView extends block_view_1.default {
202
202
  },
203
203
  ],
204
204
  };
205
- this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
205
+ this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
206
206
  this.props.popper.show(element, this.contextMenu, 'right-start');
207
207
  };
208
208
  this.handleEdit = (id, addNew) => {
@@ -52,7 +52,7 @@ class CrossReferenceEditableView extends cross_reference_1.CrossReferenceView {
52
52
  currentTargetId: rids[0],
53
53
  currentCustomLabel: this.node.attrs.label,
54
54
  };
55
- this.popperContainer = (0, ReactSubView_1.default)(this.props, CrossReferenceItems_1.CrossReferenceItems, componentProps, this.node, this.getPos, this.view, 'cross-reference-editor');
55
+ this.popperContainer = (0, ReactSubView_1.default)(this.props, CrossReferenceItems_1.CrossReferenceItems, componentProps, this.node, this.getPos, this.view, ['cross-reference-editor']);
56
56
  this.props.popper.show(this.dom, this.popperContainer, 'auto');
57
57
  };
58
58
  this.destroy = () => {
@@ -74,7 +74,7 @@ class EmbedMediaView extends block_view_1.default {
74
74
  },
75
75
  ],
76
76
  };
77
- preview.appendChild((0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, 'embed-context-menu'));
77
+ preview.appendChild((0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, ['embed-context-menu']));
78
78
  };
79
79
  }
80
80
  updateContents() {