@manuscripts/body-editor 3.9.19 → 3.9.22

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.
@@ -365,14 +365,15 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, aff
365
365
  react_1.default.createElement(style_guide_1.AddIcon, { width: 18, height: 18 }),
366
366
  react_1.default.createElement(ActionTitle, null, "New Affiliation")),
367
367
  react_1.default.createElement(AffiliationList_1.AffiliationList, { affiliation: selection, affiliations: affiliations, onSelect: handleSelect, onDelete: handleShowDeleteDialog, lastSavedAffiliationId: savedAffiliationId }))),
368
- react_1.default.createElement(style_guide_1.ScrollableModalContent, { "data-cy": "affiliations-modal-content" }, selection ? (react_1.default.createElement(AffiliationForms, null,
369
- react_1.default.createElement(ModalFormActions_1.ModalFormActions, { type: 'affiliation', form: 'affiliation-form', onDelete: handleDeleteAffiliation, showingDeleteDialog: showingDeleteDialog, showDeleteDialog: handleShowDeleteDialog, newEntity: newAffiliation, isDisableSave: isDisableSave }),
370
- react_1.default.createElement(AffiliationForm_1.AffiliationForm, { values: (0, normalize_1.checkID)(selection, 'affiliation'), onSave: () => handleSaveAffiliation(valuesRef.current), onChange: handleAffiliationChange, actionsRef: actionsRef }),
371
- react_1.default.createElement(ConfirmationDialog_1.ConfirmationDialog, { isOpen: showRequiredFieldConfirmationDialog, onPrimary: () => setShowRequiredFieldConfirmationDialog(false), onSecondary: handleConfirmationCancel, type: ConfirmationDialog_1.DialogType.REQUIRED, entityType: "affiliation" }),
372
- react_1.default.createElement(ConfirmationDialog_1.ConfirmationDialog, { isOpen: showConfirmationDialog, onPrimary: handleConfirmationSave, onSecondary: handleConfirmationCancel, type: ConfirmationDialog_1.DialogType.SAVE, entityType: "affiliation" }),
373
- react_1.default.createElement(GenericDrawerGroup_1.DrawerGroup, { Drawer: GenericDrawer_1.GenericDrawer, removeItem: (id) => {
374
- setSelectedAuthorIds((prev) => prev.filter((authorId) => authorId !== id));
375
- }, selectedItems: selectedAuthors, onSelect: selectAuthor, items: makeAuthorItems(authors), showDrawer: showAuthorDrawer, setShowDrawer: setShowAuthorDrawer, title: "Authors", cy: "affiliations", labelField: "label", buttonText: "Affiliate Authors", Icon: react_1.default.createElement(style_guide_1.AddUserIcon, { width: 16, height: 16 }) }))) : (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) })))),
368
+ react_1.default.createElement(DrawerRelativeParent, null,
369
+ react_1.default.createElement(style_guide_1.ScrollableModalContent, { "data-cy": "affiliations-modal-content" }, selection ? (react_1.default.createElement(AffiliationForms, null,
370
+ react_1.default.createElement(ModalFormActions_1.ModalFormActions, { type: 'affiliation', form: 'affiliation-form', onDelete: handleDeleteAffiliation, showingDeleteDialog: showingDeleteDialog, showDeleteDialog: handleShowDeleteDialog, newEntity: newAffiliation, isDisableSave: isDisableSave }),
371
+ react_1.default.createElement(AffiliationForm_1.AffiliationForm, { values: (0, normalize_1.checkID)(selection, 'affiliation'), onSave: () => handleSaveAffiliation(valuesRef.current), onChange: handleAffiliationChange, actionsRef: actionsRef }),
372
+ react_1.default.createElement(ConfirmationDialog_1.ConfirmationDialog, { isOpen: showRequiredFieldConfirmationDialog, onPrimary: () => setShowRequiredFieldConfirmationDialog(false), onSecondary: handleConfirmationCancel, type: ConfirmationDialog_1.DialogType.REQUIRED, entityType: "affiliation" }),
373
+ react_1.default.createElement(ConfirmationDialog_1.ConfirmationDialog, { isOpen: showConfirmationDialog, onPrimary: handleConfirmationSave, onSecondary: handleConfirmationCancel, type: ConfirmationDialog_1.DialogType.SAVE, entityType: "affiliation" }),
374
+ react_1.default.createElement(GenericDrawerGroup_1.DrawerGroup, { Drawer: GenericDrawer_1.GenericDrawer, removeItem: (id) => {
375
+ setSelectedAuthorIds((prev) => prev.filter((authorId) => authorId !== id));
376
+ }, selectedItems: selectedAuthors, onSelect: selectAuthor, items: makeAuthorItems(authors), showDrawer: showAuthorDrawer, setShowDrawer: setShowAuthorDrawer, title: "Authors", cy: "affiliations", labelField: "label", buttonText: "Affiliate Authors", Icon: react_1.default.createElement(style_guide_1.AddUserIcon, { width: 16, height: 16 }) }))) : (react_1.default.createElement(FormPlaceholder_1.FormPlaceholder, { type: "affiliation", title: "Affiliation Details", message: "Select an affiliation from the list to display its details here.", placeholderIcon: react_1.default.createElement(style_guide_1.AffiliationPlaceholderIcon, null) }))))),
376
377
  react_1.default.createElement(FormFooter_1.default, { onCancel: handleClose }))));
377
378
  };
378
379
  exports.AffiliationsModal = AffiliationsModal;
@@ -416,9 +417,11 @@ const ActionTitle = styled_components_1.default.div `
416
417
  const AffiliationForms = styled_components_1.default.div `
417
418
  padding-left: ${(props) => props.theme.grid.unit * 3}px;
418
419
  padding-right: ${(props) => props.theme.grid.unit * 3}px;
419
- position: relative;
420
420
  margin-top: 20px;
421
421
  `;
422
+ const DrawerRelativeParent = styled_components_1.default.div `
423
+ position: relative;
424
+ `;
422
425
  const StyledModalBody = (0, styled_components_1.default)(style_guide_1.ModalBody) `
423
426
  position: relative;
424
427
  height: calc(90vh - 40px);
@@ -5,7 +5,6 @@ const transform_1 = require("@manuscripts/transform");
5
5
  const prosemirror_state_1 = require("prosemirror-state");
6
6
  const prosemirror_utils_1 = require("prosemirror-utils");
7
7
  const prosemirror_view_1 = require("prosemirror-view");
8
- const navigation_utils_1 = require("../lib/navigation-utils");
9
8
  const comments_1 = require("../lib/comments");
10
9
  exports.commentsKey = new prosemirror_state_1.PluginKey('comments');
11
10
  const COMMENT_SELECTION = 'comment-selection';
@@ -50,10 +49,17 @@ exports.default = () => {
50
49
  },
51
50
  handleDOMEvents: {
52
51
  keydown: (view, e) => {
53
- return (0, navigation_utils_1.handleEnterKey)(() => {
54
- const target = document.activeElement;
55
- handleCommentMarkerInteraction(view, target);
56
- })(e);
52
+ if (e.key !== 'Enter') {
53
+ return false;
54
+ }
55
+ const target = document.activeElement;
56
+ const marker = target?.closest('[data-key]');
57
+ if (!marker) {
58
+ return false;
59
+ }
60
+ e.preventDefault();
61
+ handleCommentMarkerInteraction(view, target);
62
+ return true;
57
63
  },
58
64
  },
59
65
  },
@@ -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.19';
4
+ exports.VERSION = '3.9.22';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -326,14 +326,15 @@ export const AffiliationsModal = ({ authors: $authors, affiliations: $affiliatio
326
326
  React.createElement(AddIcon, { width: 18, height: 18 }),
327
327
  React.createElement(ActionTitle, null, "New Affiliation")),
328
328
  React.createElement(AffiliationList, { affiliation: selection, affiliations: affiliations, onSelect: handleSelect, onDelete: handleShowDeleteDialog, lastSavedAffiliationId: savedAffiliationId }))),
329
- React.createElement(ScrollableModalContent, { "data-cy": "affiliations-modal-content" }, selection ? (React.createElement(AffiliationForms, null,
330
- React.createElement(ModalFormActions, { type: 'affiliation', form: 'affiliation-form', onDelete: handleDeleteAffiliation, showingDeleteDialog: showingDeleteDialog, showDeleteDialog: handleShowDeleteDialog, newEntity: newAffiliation, isDisableSave: isDisableSave }),
331
- React.createElement(AffiliationForm, { values: checkID(selection, 'affiliation'), onSave: () => handleSaveAffiliation(valuesRef.current), onChange: handleAffiliationChange, actionsRef: actionsRef }),
332
- React.createElement(ConfirmationDialog, { isOpen: showRequiredFieldConfirmationDialog, onPrimary: () => setShowRequiredFieldConfirmationDialog(false), onSecondary: handleConfirmationCancel, type: DialogType.REQUIRED, entityType: "affiliation" }),
333
- React.createElement(ConfirmationDialog, { isOpen: showConfirmationDialog, onPrimary: handleConfirmationSave, onSecondary: handleConfirmationCancel, type: DialogType.SAVE, entityType: "affiliation" }),
334
- React.createElement(DrawerGroup, { Drawer: GenericDrawer, removeItem: (id) => {
335
- setSelectedAuthorIds((prev) => prev.filter((authorId) => authorId !== id));
336
- }, selectedItems: selectedAuthors, onSelect: selectAuthor, items: makeAuthorItems(authors), showDrawer: showAuthorDrawer, setShowDrawer: setShowAuthorDrawer, title: "Authors", cy: "affiliations", labelField: "label", buttonText: "Affiliate Authors", Icon: React.createElement(AddUserIcon, { width: 16, height: 16 }) }))) : (React.createElement(FormPlaceholder, { type: "affiliation", title: "Affiliation Details", message: "Select an affiliation from the list to display it's details here.", placeholderIcon: React.createElement(AffiliationPlaceholderIcon, null) })))),
329
+ React.createElement(DrawerRelativeParent, null,
330
+ React.createElement(ScrollableModalContent, { "data-cy": "affiliations-modal-content" }, selection ? (React.createElement(AffiliationForms, null,
331
+ React.createElement(ModalFormActions, { type: 'affiliation', form: 'affiliation-form', onDelete: handleDeleteAffiliation, showingDeleteDialog: showingDeleteDialog, showDeleteDialog: handleShowDeleteDialog, newEntity: newAffiliation, isDisableSave: isDisableSave }),
332
+ React.createElement(AffiliationForm, { values: checkID(selection, 'affiliation'), onSave: () => handleSaveAffiliation(valuesRef.current), onChange: handleAffiliationChange, actionsRef: actionsRef }),
333
+ React.createElement(ConfirmationDialog, { isOpen: showRequiredFieldConfirmationDialog, onPrimary: () => setShowRequiredFieldConfirmationDialog(false), onSecondary: handleConfirmationCancel, type: DialogType.REQUIRED, entityType: "affiliation" }),
334
+ React.createElement(ConfirmationDialog, { isOpen: showConfirmationDialog, onPrimary: handleConfirmationSave, onSecondary: handleConfirmationCancel, type: DialogType.SAVE, entityType: "affiliation" }),
335
+ React.createElement(DrawerGroup, { Drawer: GenericDrawer, removeItem: (id) => {
336
+ setSelectedAuthorIds((prev) => prev.filter((authorId) => authorId !== id));
337
+ }, selectedItems: selectedAuthors, onSelect: selectAuthor, items: makeAuthorItems(authors), showDrawer: showAuthorDrawer, setShowDrawer: setShowAuthorDrawer, title: "Authors", cy: "affiliations", labelField: "label", buttonText: "Affiliate Authors", Icon: React.createElement(AddUserIcon, { width: 16, height: 16 }) }))) : (React.createElement(FormPlaceholder, { type: "affiliation", title: "Affiliation Details", message: "Select an affiliation from the list to display its details here.", placeholderIcon: React.createElement(AffiliationPlaceholderIcon, null) }))))),
337
338
  React.createElement(FormFooter, { onCancel: handleClose }))));
338
339
  };
339
340
  function createEmptyAffiliation(priority) {
@@ -376,9 +377,11 @@ const ActionTitle = styled.div `
376
377
  const AffiliationForms = styled.div `
377
378
  padding-left: ${(props) => props.theme.grid.unit * 3}px;
378
379
  padding-right: ${(props) => props.theme.grid.unit * 3}px;
379
- position: relative;
380
380
  margin-top: 20px;
381
381
  `;
382
+ const DrawerRelativeParent = styled.div `
383
+ position: relative;
384
+ `;
382
385
  const StyledModalBody = styled(ModalBody) `
383
386
  position: relative;
384
387
  height: calc(90vh - 40px);
@@ -2,7 +2,6 @@ import { schema, } from '@manuscripts/transform';
2
2
  import { Plugin, PluginKey } from 'prosemirror-state';
3
3
  import { findChildrenByType } from 'prosemirror-utils';
4
4
  import { Decoration, DecorationSet } from 'prosemirror-view';
5
- import { handleEnterKey } from '../lib/navigation-utils';
6
5
  import { createCommentMarker, getCommentKey, isReply, } from '../lib/comments';
7
6
  export const commentsKey = new PluginKey('comments');
8
7
  const COMMENT_SELECTION = 'comment-selection';
@@ -47,10 +46,17 @@ export default () => {
47
46
  },
48
47
  handleDOMEvents: {
49
48
  keydown: (view, e) => {
50
- return handleEnterKey(() => {
51
- const target = document.activeElement;
52
- handleCommentMarkerInteraction(view, target);
53
- })(e);
49
+ if (e.key !== 'Enter') {
50
+ return false;
51
+ }
52
+ const target = document.activeElement;
53
+ const marker = target?.closest('[data-key]');
54
+ if (!marker) {
55
+ return false;
56
+ }
57
+ e.preventDefault();
58
+ handleCommentMarkerInteraction(view, target);
59
+ return true;
54
60
  },
55
61
  },
56
62
  },
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.9.19';
1
+ export const VERSION = '3.9.22';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.9.19";
1
+ export declare const VERSION = "3.9.22";
2
2
  export declare const MATHJAX_VERSION = "3.2.2";
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.19",
4
+ "version": "3.9.22",
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.12",
42
+ "@manuscripts/track-changes-plugin": "2.2.13",
43
43
  "@manuscripts/transform": "4.3.22",
44
44
  "@popperjs/core": "2.11.8",
45
45
  "citeproc": "2.4.63",