@manuscripts/body-editor 3.12.1 → 3.12.3
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.
- package/dist/cjs/components/affiliations/AffiliationItem.js +7 -11
- package/dist/cjs/components/affiliations/AffiliationList.js +3 -5
- package/dist/cjs/components/affiliations/AffiliationsModal.js +13 -4
- package/dist/cjs/components/authors/AuthorDetailsForm.js +44 -34
- package/dist/cjs/components/authors/AuthorList.js +4 -2
- package/dist/cjs/components/authors/AuthorsModal.js +10 -3
- package/dist/cjs/components/authors/DraggableAuthor.js +7 -11
- package/dist/cjs/components/awards/AwardForm.js +108 -100
- package/dist/cjs/components/hooks/use-debounce.js +15 -0
- package/dist/cjs/components/modal-drawer/GenericDrawerGroup.js +1 -0
- package/dist/cjs/components/references/CitationEditor.js +6 -7
- package/dist/cjs/components/references/ImportBibliographyForm.js +12 -3
- package/dist/cjs/components/references/ReferenceForm/PersonDropDown.js +1 -1
- package/dist/cjs/components/references/ReferenceForm/styled-components.js +12 -3
- package/dist/cjs/components/references/ReferenceSearch.js +2 -2
- package/dist/cjs/components/references/ReferenceSearchResults.js +58 -11
- package/dist/cjs/components/references/ReferenceSearchSection.js +3 -11
- package/dist/cjs/components/references/ReferencesModal.js +5 -4
- package/dist/cjs/components/toolbar/InsertTableDialog.js +11 -3
- package/dist/cjs/components/views/CrossReferenceItems.js +8 -14
- package/dist/cjs/components/views/FootnotesSelector.js +6 -6
- package/dist/cjs/components/views/InsertSpecialCharacter.js +24 -10
- package/dist/cjs/components/views/LinkForm.js +8 -1
- package/dist/cjs/lib/normalize.js +8 -6
- package/dist/cjs/lib/popper.js +4 -2
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/cross_reference_editable.js +1 -0
- package/dist/cjs/views/equation_editable.js +6 -0
- package/dist/cjs/views/inline_equation_editable.js +6 -0
- package/dist/cjs/views/inline_footnote.js +1 -0
- package/dist/es/components/affiliations/AffiliationItem.js +8 -12
- package/dist/es/components/affiliations/AffiliationList.js +3 -5
- package/dist/es/components/affiliations/AffiliationsModal.js +14 -5
- package/dist/es/components/authors/AuthorDetailsForm.js +43 -33
- package/dist/es/components/authors/AuthorList.js +4 -2
- package/dist/es/components/authors/AuthorsModal.js +11 -4
- package/dist/es/components/authors/DraggableAuthor.js +8 -12
- package/dist/es/components/awards/AwardForm.js +110 -102
- package/dist/es/components/hooks/use-debounce.js +15 -1
- package/dist/es/components/modal-drawer/GenericDrawerGroup.js +2 -1
- package/dist/es/components/references/CitationEditor.js +7 -8
- package/dist/es/components/references/ImportBibliographyForm.js +14 -5
- package/dist/es/components/references/ReferenceForm/PersonDropDown.js +1 -1
- package/dist/es/components/references/ReferenceForm/styled-components.js +13 -4
- package/dist/es/components/references/ReferenceSearch.js +3 -3
- package/dist/es/components/references/ReferenceSearchResults.js +26 -12
- package/dist/es/components/references/ReferenceSearchSection.js +4 -12
- package/dist/es/components/references/ReferencesModal.js +6 -5
- package/dist/es/components/toolbar/InsertTableDialog.js +11 -3
- package/dist/es/components/views/CrossReferenceItems.js +9 -15
- package/dist/es/components/views/FootnotesSelector.js +7 -7
- package/dist/es/components/views/InsertSpecialCharacter.js +25 -11
- package/dist/es/components/views/LinkForm.js +9 -2
- package/dist/es/lib/normalize.js +8 -6
- package/dist/es/lib/popper.js +4 -2
- package/dist/es/versions.js +1 -1
- package/dist/es/views/cross_reference_editable.js +1 -0
- package/dist/es/views/equation_editable.js +6 -0
- package/dist/es/views/inline_equation_editable.js +6 -0
- package/dist/es/views/inline_footnote.js +1 -0
- package/dist/types/components/authors/AuthorDetailsForm.d.ts +2 -2
- package/dist/types/components/hooks/use-debounce.d.ts +1 -0
- package/dist/types/components/references/ReferenceForm/styled-components.d.ts +11 -1
- package/dist/types/components/references/ReferenceSearchResults.d.ts +20 -2
- package/dist/types/versions.d.ts +1 -1
- package/package.json +2 -2
- package/styles/popper.css +2 -0
|
@@ -48,6 +48,7 @@ const ImportBibliographyModal_1 = require("./ImportBibliographyModal");
|
|
|
48
48
|
const ReferenceLine_1 = require("./ReferenceLine");
|
|
49
49
|
const ReferenceSearch_1 = require("./ReferenceSearch");
|
|
50
50
|
const ReferencesModal_1 = require("./ReferencesModal");
|
|
51
|
+
const Container = (0, style_guide_1.withFocusTrap)(styled_components_1.default.div ``);
|
|
51
52
|
const CitedItemActions = styled_components_1.default.div `
|
|
52
53
|
display: flex;
|
|
53
54
|
align-items: center;
|
|
@@ -80,10 +81,10 @@ const ActionButton = (0, styled_components_1.default)(style_guide_1.IconButton).
|
|
|
80
81
|
const EditReferenceButton = (0, styled_components_1.default)(ActionButton) `
|
|
81
82
|
margin-right: ${(props) => props.theme.grid.unit * 3}px;
|
|
82
83
|
`;
|
|
83
|
-
const Actions = styled_components_1.default.
|
|
84
|
+
const Actions = (0, styled_components_1.default)(style_guide_1.ButtonGroup) `
|
|
84
85
|
margin: ${(props) => props.theme.grid.unit * 4}px;
|
|
85
86
|
display: flex;
|
|
86
|
-
justify-content:
|
|
87
|
+
justify-content: flex-end;
|
|
87
88
|
align-items: center;
|
|
88
89
|
`;
|
|
89
90
|
const itemsReducer = (0, array_reducer_1.attrsReducer)();
|
|
@@ -171,7 +172,7 @@ const CitationEditor = ({ query, rids: $rids, items: $items, citationCounts, sou
|
|
|
171
172
|
if (!rids.length) {
|
|
172
173
|
return (react_1.default.createElement(ReferenceSearch_1.ReferenceSearch, { query: query, sources: sources, items: items, onAdd: handleAdd, onImport: handleImport, onCite: handleCite, onCancel: onCancel }));
|
|
173
174
|
}
|
|
174
|
-
return (react_1.default.createElement(
|
|
175
|
+
return (react_1.default.createElement(Container, null,
|
|
175
176
|
react_1.default.createElement(style_guide_1.Dialog, { isOpen: deleteDialog.show, category: style_guide_1.Category.confirmation, header: "Remove cited item", message: "Are you sure you want to remove this cited item? It will still exist in the reference list.", actions: {
|
|
176
177
|
secondary: {
|
|
177
178
|
action: () => {
|
|
@@ -195,9 +196,7 @@ const CitationEditor = ({ query, rids: $rids, items: $items, citationCounts, sou
|
|
|
195
196
|
react_1.default.createElement(ActionButton, { disabled: !canEdit, onClick: () => setDeleteDialog({ show: true, id: item.id }) },
|
|
196
197
|
react_1.default.createElement(style_guide_1.DeleteSolidIcon, { className: 'remove-icon' }))))))),
|
|
197
198
|
react_1.default.createElement(Actions, null,
|
|
198
|
-
react_1.default.createElement(style_guide_1.
|
|
199
|
-
react_1.default.createElement(style_guide_1.
|
|
200
|
-
react_1.default.createElement(style_guide_1.SecondaryButton, { onClick: onCancel }, "Done"),
|
|
201
|
-
react_1.default.createElement(style_guide_1.PrimaryButton, { disabled: !canEdit, onClick: () => setSearching(true) }, "Add Citation")))));
|
|
199
|
+
react_1.default.createElement(style_guide_1.SecondaryButton, { onClick: onCancel }, "Done"),
|
|
200
|
+
react_1.default.createElement(style_guide_1.PrimaryButton, { disabled: !canEdit, onClick: () => setSearching(true) }, "Add Citation"))));
|
|
202
201
|
};
|
|
203
202
|
exports.CitationEditor = CitationEditor;
|
|
@@ -58,6 +58,7 @@ const references_1 = require("../../lib/references");
|
|
|
58
58
|
const ReferenceLine_1 = require("./ReferenceLine");
|
|
59
59
|
const ImportBibliographyForm = ({ onCancel, onSave, }) => {
|
|
60
60
|
const [dragging, setDragging] = (0, react_1.useState)(false);
|
|
61
|
+
const fileInputRef = (0, react_1.useRef)(null);
|
|
61
62
|
const formik = (0, formik_1.useFormik)({
|
|
62
63
|
initialValues: {
|
|
63
64
|
content: '',
|
|
@@ -116,13 +117,19 @@ const ImportBibliographyForm = ({ onCancel, onSave, }) => {
|
|
|
116
117
|
};
|
|
117
118
|
reader.readAsText(file);
|
|
118
119
|
};
|
|
120
|
+
const handleOnKeyDown = (e) => {
|
|
121
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
fileInputRef?.current?.click();
|
|
124
|
+
}
|
|
125
|
+
};
|
|
119
126
|
return (react_1.default.createElement("form", { onSubmit: formik.handleSubmit, onReset: formik.handleReset },
|
|
120
127
|
react_1.default.createElement(style_guide_1.FormRow, null,
|
|
121
|
-
react_1.default.createElement(DropContainer, { onDrop: handleDrop, onDragOver: (e) => {
|
|
128
|
+
react_1.default.createElement(DropContainer, { tabIndex: 0, role: "button", onDrop: handleDrop, onDragOver: (e) => {
|
|
122
129
|
e.preventDefault();
|
|
123
130
|
setDragging(true);
|
|
124
|
-
}, onDragLeave: () => setDragging(false), active: dragging },
|
|
125
|
-
react_1.default.createElement("input", { id: "file", name: "file", type: "file", onChange: handleFileChange, style: { display: 'none' } }),
|
|
131
|
+
}, onDragLeave: () => setDragging(false), onKeyDown: handleOnKeyDown, active: dragging },
|
|
132
|
+
react_1.default.createElement("input", { id: "file", name: "file", type: "file", ref: fileInputRef, onChange: handleFileChange, style: { display: 'none' } }),
|
|
126
133
|
react_1.default.createElement(style_guide_1.Label, { htmlFor: "file" }, "Drag & Drop or Click here to upload a file."))),
|
|
127
134
|
react_1.default.createElement(style_guide_1.FormRow, null,
|
|
128
135
|
react_1.default.createElement(style_guide_1.Label, { htmlFor: "content" }, "Alternatively, you can directly Copy&Paste below, the text of the bibliography items."),
|
|
@@ -171,4 +178,6 @@ const DropContainer = styled_components_1.default.div `
|
|
|
171
178
|
font-family: ${(props) => props.theme.font.family.Lato};
|
|
172
179
|
color: ${(props) => props.theme.colors.text.onLight};
|
|
173
180
|
}
|
|
181
|
+
|
|
182
|
+
${style_guide_1.outlineStyle}
|
|
174
183
|
`;
|
|
@@ -49,7 +49,7 @@ const PersonDropDown = (props) => {
|
|
|
49
49
|
react_1.default.createElement(styled_components_1.ToggleButton, { type: "button", onClick: () => setIsOpen(!isOpen), isOpen: isOpen },
|
|
50
50
|
react_1.default.createElement(styled_components_1.DropdownIndicator, null),
|
|
51
51
|
title),
|
|
52
|
-
react_1.default.createElement(styled_components_1.RemoveButton, { type: "button", "aria-label": "Delete this editor", onClick: () => remove(index) },
|
|
52
|
+
react_1.default.createElement(styled_components_1.RemoveButton, { size: 13, type: "button", "aria-label": "Delete this editor", onClick: () => remove(index) },
|
|
53
53
|
react_1.default.createElement(style_guide_1.DeleteIcon, null))),
|
|
54
54
|
isOpen && (react_1.default.createElement(styled_components_1.PersonForm, null,
|
|
55
55
|
react_1.default.createElement(style_guide_1.FormRow, null,
|
|
@@ -92,7 +92,7 @@ exports.ToggleButton = styled_components_1.default.button `
|
|
|
92
92
|
text-align: left;
|
|
93
93
|
font-family: ${(props) => props.theme.font.family.sans};
|
|
94
94
|
font-size: 1rem;
|
|
95
|
-
|
|
95
|
+
margin: 0.6em;
|
|
96
96
|
|
|
97
97
|
outline: none;
|
|
98
98
|
|
|
@@ -103,11 +103,20 @@ exports.ToggleButton = styled_components_1.default.button `
|
|
|
103
103
|
svg {
|
|
104
104
|
transform: ${(props) => (props.isOpen ? 'rotateX(180deg)' : 'initial')};
|
|
105
105
|
}
|
|
106
|
+
${style_guide_1.outlineStyle}
|
|
106
107
|
`;
|
|
107
|
-
exports.RemoveButton = styled_components_1.default.
|
|
108
|
+
exports.RemoveButton = (0, styled_components_1.default)(style_guide_1.SecondaryIconButton) `
|
|
108
109
|
border: none;
|
|
109
110
|
background: transparent;
|
|
110
111
|
padding: 0;
|
|
111
|
-
|
|
112
112
|
outline: none;
|
|
113
|
+
svg {
|
|
114
|
+
path[fill='white'] {
|
|
115
|
+
fill: white;
|
|
116
|
+
}
|
|
117
|
+
rect[fill],
|
|
118
|
+
path:not([fill='white']) {
|
|
119
|
+
fill: #f35143;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
113
122
|
`;
|
|
@@ -70,10 +70,10 @@ const Actions = (0, styled_components_1.default)(style_guide_1.ButtonGroup) `
|
|
|
70
70
|
justify-content: space-between;
|
|
71
71
|
padding: ${(props) => props.theme.grid.unit * 4}px;
|
|
72
72
|
`;
|
|
73
|
-
const Container = styled_components_1.default.div `
|
|
73
|
+
const Container = (0, style_guide_1.withFocusTrap)(styled_components_1.default.div `
|
|
74
74
|
flex: 1;
|
|
75
75
|
font-family: ${(props) => props.theme.font.family.sans};
|
|
76
|
-
|
|
76
|
+
`);
|
|
77
77
|
const AddReferenceActions = (0, styled_components_1.default)(style_guide_1.ButtonGroup) `
|
|
78
78
|
button {
|
|
79
79
|
margin-right: ${(props) => props.theme.grid.unit * 8}px;
|
|
@@ -14,13 +14,46 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
34
|
+
var ownKeys = function(o) {
|
|
35
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
36
|
+
var ar = [];
|
|
37
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
return ownKeys(o);
|
|
41
|
+
};
|
|
42
|
+
return function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
46
|
+
__setModuleDefault(result, mod);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
})();
|
|
17
50
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
51
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
52
|
};
|
|
20
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
54
|
exports.ReferenceSearchResults = exports.ReferenceSearchResult = exports.ReferenceSearchResultsContainer = void 0;
|
|
22
55
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
23
|
-
const react_1 =
|
|
56
|
+
const react_1 = __importStar(require("react"));
|
|
24
57
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
25
58
|
const ReferenceLine_1 = require("./ReferenceLine");
|
|
26
59
|
const StatusIcon = styled_components_1.default.div `
|
|
@@ -42,12 +75,14 @@ const MoreButton = (0, styled_components_1.default)(style_guide_1.SecondaryButto
|
|
|
42
75
|
margin-left: ${(props) => props.theme.grid.unit * 4}px;
|
|
43
76
|
color: ${(props) => props.theme.colors.button.default.color.default};
|
|
44
77
|
`;
|
|
45
|
-
exports.ReferenceSearchResultsContainer = styled_components_1.default.div `
|
|
46
|
-
padding:
|
|
78
|
+
exports.ReferenceSearchResultsContainer = (0, style_guide_1.withListNavigation)(styled_components_1.default.div `
|
|
79
|
+
padding: ${(props) => props.theme.grid.unit * 2}px
|
|
80
|
+
${(props) => props.theme.grid.unit * 4}px;
|
|
47
81
|
flex: 1;
|
|
48
82
|
overflow-y: auto;
|
|
49
|
-
|
|
50
|
-
|
|
83
|
+
outline: none;
|
|
84
|
+
`);
|
|
85
|
+
exports.ReferenceSearchResult = (0, style_guide_1.withNavigableListItem)(styled_components_1.default.div `
|
|
51
86
|
cursor: pointer;
|
|
52
87
|
padding: ${(props) => props.theme.grid.unit * 2}px 0;
|
|
53
88
|
display: flex;
|
|
@@ -55,10 +90,22 @@ exports.ReferenceSearchResult = styled_components_1.default.div `
|
|
|
55
90
|
&:not(:last-of-type) {
|
|
56
91
|
border-bottom: 1px solid #f6f6f6;
|
|
57
92
|
}
|
|
58
|
-
|
|
59
|
-
const ReferenceSearchResults = ({ items, total, isSelected, onSelect, onShowMore }) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
93
|
+
`);
|
|
94
|
+
const ReferenceSearchResults = ({ items, total, isSelected, onSelect, onShowMore }) => {
|
|
95
|
+
const list = (0, react_1.useRef)(null);
|
|
96
|
+
const onExpandReferenceList = () => {
|
|
97
|
+
const element = list.current;
|
|
98
|
+
if (element) {
|
|
99
|
+
element.setAttribute('tabindex', '0');
|
|
100
|
+
element.focus();
|
|
101
|
+
element.setAttribute('tabindex', '-1');
|
|
102
|
+
}
|
|
103
|
+
onShowMore();
|
|
104
|
+
};
|
|
105
|
+
return (react_1.default.createElement(exports.ReferenceSearchResultsContainer, { ref: list },
|
|
106
|
+
items.map((item) => (react_1.default.createElement(exports.ReferenceSearchResult, { onClick: () => onSelect(item), key: item.id, "data-cy": `${isSelected(item) ? 'selected-reference' : 'reference'}` },
|
|
107
|
+
react_1.default.createElement(StatusIcon, null, isSelected(item) ? (react_1.default.createElement(style_guide_1.AddedIcon, { width: 24, height: 24 })) : (react_1.default.createElement(style_guide_1.AddIcon, { width: 24, height: 24 }))),
|
|
108
|
+
react_1.default.createElement(ReferenceLine_1.ReferenceLine, { item: item })))),
|
|
109
|
+
items.length < 25 && total > items.length ? (react_1.default.createElement(MoreButton, { onClick: onExpandReferenceList, "data-cy": 'more-button' }, "Show more")) : undefined));
|
|
110
|
+
};
|
|
64
111
|
exports.ReferenceSearchResults = ReferenceSearchResults;
|
|
@@ -57,19 +57,11 @@ const react_1 = __importStar(require("react"));
|
|
|
57
57
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
58
58
|
const ReferenceSearchResults_1 = require("./ReferenceSearchResults");
|
|
59
59
|
const ReferenceSearchResultsPlaceholder_1 = require("./ReferenceSearchResultsPlaceholder");
|
|
60
|
-
const SearchSourceLabel = styled_components_1.default.
|
|
61
|
-
margin:
|
|
60
|
+
const SearchSourceLabel = (0, styled_components_1.default)(style_guide_1.IconTextButton) `
|
|
61
|
+
margin: ${(props) => props.theme.grid.unit * 2}px
|
|
62
|
+
${(props) => props.theme.grid.unit * 4}px
|
|
62
63
|
${(props) => props.theme.grid.unit * 2}px;
|
|
63
64
|
color: ${(props) => props.theme.colors.text.secondary};
|
|
64
|
-
cursor: pointer;
|
|
65
|
-
|
|
66
|
-
display: flex;
|
|
67
|
-
align-items: center;
|
|
68
|
-
|
|
69
|
-
.icon {
|
|
70
|
-
margin-left: 8px;
|
|
71
|
-
margin-right: 13px;
|
|
72
|
-
}
|
|
73
65
|
|
|
74
66
|
&:hover {
|
|
75
67
|
color: ${(props) => props.theme.colors.text.muted};
|
|
@@ -52,10 +52,11 @@ const ReferencesSidebar = (0, styled_components_1.default)(style_guide_1.ModalSi
|
|
|
52
52
|
const ReferencesSidebarContent = (0, styled_components_1.default)(style_guide_1.SidebarContent) `
|
|
53
53
|
overflow-y: auto;
|
|
54
54
|
`;
|
|
55
|
-
const ReferencesInnerWrapper = styled_components_1.default.div `
|
|
55
|
+
const ReferencesInnerWrapper = (0, style_guide_1.withListNavigation)(styled_components_1.default.div `
|
|
56
56
|
width: 100%;
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
padding: 12px 0;
|
|
58
|
+
`);
|
|
59
|
+
const ReferenceButton = (0, style_guide_1.withNavigableListItem)(styled_components_1.default.div `
|
|
59
60
|
cursor: pointer;
|
|
60
61
|
display: flex;
|
|
61
62
|
justify-content: flex-start;
|
|
@@ -82,7 +83,7 @@ const ReferenceButton = styled_components_1.default.div `
|
|
|
82
83
|
padding: ${(props) => props.theme.grid.unit * 2}px;
|
|
83
84
|
border-radius: 6px;
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
+
`);
|
|
86
87
|
const IconContainer = styled_components_1.default.div `
|
|
87
88
|
padding-right: ${(props) => props.theme.grid.unit * 5}px;
|
|
88
89
|
position: relative;
|
|
@@ -77,7 +77,15 @@ const OptionWrapper = styled_components_1.default.div `
|
|
|
77
77
|
padding-top: ${(props) => props.theme.grid.unit * 2}px;
|
|
78
78
|
padding-bottom: ${(props) => props.theme.grid.unit * 2}px;
|
|
79
79
|
|
|
80
|
-
background-color: ${(props) =>
|
|
80
|
+
background-color: ${(props) => {
|
|
81
|
+
if (props.selected) {
|
|
82
|
+
return props.theme.colors.background.selected;
|
|
83
|
+
}
|
|
84
|
+
if (props.focused) {
|
|
85
|
+
return props.theme.colors.background.fifth;
|
|
86
|
+
}
|
|
87
|
+
return 'transparent';
|
|
88
|
+
}};
|
|
81
89
|
|
|
82
90
|
&:hover {
|
|
83
91
|
background-color: ${(props) => props.theme.colors.background.fifth};
|
|
@@ -98,8 +106,8 @@ const InsertTableDialog = ({ state, dispatch, }) => {
|
|
|
98
106
|
value: index + 1,
|
|
99
107
|
label: `${index + 1}`,
|
|
100
108
|
}));
|
|
101
|
-
const OptionComponent = ({ innerProps, data, }) => {
|
|
102
|
-
return (react_1.default.createElement(OptionWrapper, { ...innerProps, ref:
|
|
109
|
+
const OptionComponent = ({ innerProps, data, innerRef, isFocused, isSelected, }) => {
|
|
110
|
+
return (react_1.default.createElement(OptionWrapper, { ...innerProps, ref: innerRef, focused: isFocused, selected: isSelected }, data.label));
|
|
103
111
|
};
|
|
104
112
|
const actions = {
|
|
105
113
|
primary: {
|
|
@@ -55,27 +55,26 @@ exports.CrossReferenceItems = void 0;
|
|
|
55
55
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
56
56
|
const react_1 = __importStar(require("react"));
|
|
57
57
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
58
|
-
const Container = styled_components_1.default.div `
|
|
58
|
+
const Container = (0, style_guide_1.withFocusTrap)(styled_components_1.default.div `
|
|
59
59
|
padding: ${(props) => props.theme.grid.unit * 3}px
|
|
60
60
|
${(props) => props.theme.grid.unit * 4}px;
|
|
61
61
|
display: flex;
|
|
62
62
|
flex-direction: column;
|
|
63
63
|
max-height: 60vh;
|
|
64
64
|
overflow: hidden;
|
|
65
|
-
|
|
65
|
+
`);
|
|
66
66
|
const Actions = styled_components_1.default.div `
|
|
67
67
|
display: flex;
|
|
68
68
|
align-items: center;
|
|
69
69
|
justify-content: flex-end;
|
|
70
70
|
flex-shrink: 0;
|
|
71
71
|
`;
|
|
72
|
-
const Items = styled_components_1.default.div `
|
|
72
|
+
const Items = (0, style_guide_1.withListNavigation)(styled_components_1.default.div `
|
|
73
73
|
flex: 1;
|
|
74
74
|
overflow-y: auto;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const CrossReferenceItem = styled_components_1.default.div `
|
|
78
|
-
position: relative;
|
|
75
|
+
padding: ${(props) => props.theme.grid.unit * 3}px;
|
|
76
|
+
`);
|
|
77
|
+
const CrossReferenceItem = (0, style_guide_1.withNavigableListItem)(styled_components_1.default.div `
|
|
79
78
|
cursor: pointer;
|
|
80
79
|
padding: ${(props) => props.theme.grid.unit * 4}px;
|
|
81
80
|
background-color: ${(props) => props.isSelected
|
|
@@ -87,17 +86,12 @@ const CrossReferenceItem = styled_components_1.default.div `
|
|
|
87
86
|
? props.theme.colors.brand.medium
|
|
88
87
|
: props.theme.colors.border.secondary};
|
|
89
88
|
border-width: 1px 0;
|
|
90
|
-
margin-top: -1px;
|
|
91
89
|
z-index: ${(props) => (props.isSelected ? '1' : '0')};
|
|
92
90
|
|
|
93
|
-
&:first-child {
|
|
94
|
-
margin-top: 0;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
91
|
&:hover {
|
|
98
92
|
background-color: ${(props) => props.theme.colors.background.selected};
|
|
99
93
|
}
|
|
100
|
-
|
|
94
|
+
`);
|
|
101
95
|
const Label = styled_components_1.default.span `
|
|
102
96
|
color: ${(props) => props.theme.colors.text.primary};
|
|
103
97
|
`;
|
|
@@ -144,7 +138,7 @@ const CrossReferenceItems = ({ targets, handleSelect, handleCancel, currentTarge
|
|
|
144
138
|
}, [currentTargetId]);
|
|
145
139
|
return (react_1.default.createElement(Container, null,
|
|
146
140
|
react_1.default.createElement(Heading, null, "Insert Cross-reference"),
|
|
147
|
-
react_1.default.createElement(Items, null, targets.length ? (targets.map((target) => (react_1.default.createElement(CrossReferenceItem, { key: target.id, isSelected: selectedItem === target.id,
|
|
141
|
+
react_1.default.createElement(Items, null, targets.length ? (targets.map((target) => (react_1.default.createElement(CrossReferenceItem, { key: target.id, isSelected: selectedItem === target.id, onClick: () => setSelectedItem(target.id) },
|
|
148
142
|
react_1.default.createElement(DefaultLabelWrapper, null,
|
|
149
143
|
react_1.default.createElement(Label, null, target.label),
|
|
150
144
|
react_1.default.createElement(Caption, null, target.caption && ': ' + trimmedCaption(target.caption, 200))),
|
|
@@ -68,10 +68,10 @@ const Actions = (0, styled_components_1.default)(style_guide_1.ButtonGroup) `
|
|
|
68
68
|
justify-content: space-between;
|
|
69
69
|
padding: ${(props) => props.theme.grid.unit * 4}px;
|
|
70
70
|
`;
|
|
71
|
-
const Container = styled_components_1.default.div `
|
|
71
|
+
const Container = (0, style_guide_1.withFocusTrap)(styled_components_1.default.div `
|
|
72
72
|
flex: 1;
|
|
73
73
|
font-family: ${(props) => props.theme.font.family.sans};
|
|
74
|
-
|
|
74
|
+
`);
|
|
75
75
|
const AddNewFootnote = (0, styled_components_1.default)(style_guide_1.ButtonGroup) `
|
|
76
76
|
button {
|
|
77
77
|
margin-right: ${(props) => props.theme.grid.unit * 8}px;
|
|
@@ -153,17 +153,17 @@ const Separator = styled_components_1.default.div `
|
|
|
153
153
|
border-bottom: 1px solid #e2e2e2;
|
|
154
154
|
margin: 4px 0;
|
|
155
155
|
`;
|
|
156
|
-
const NotesListContainer = styled_components_1.default.div `
|
|
156
|
+
const NotesListContainer = (0, style_guide_1.withListNavigation)(styled_components_1.default.div `
|
|
157
157
|
padding: ${(props) => props.theme.grid.unit * 6}px
|
|
158
158
|
${(props) => props.theme.grid.unit * 5}px;
|
|
159
159
|
flex: 1;
|
|
160
160
|
overflow-y: auto;
|
|
161
|
-
|
|
162
|
-
const FootnoteItemContainer = styled_components_1.default.div `
|
|
161
|
+
`);
|
|
162
|
+
const FootnoteItemContainer = (0, style_guide_1.withNavigableListItem)(styled_components_1.default.div `
|
|
163
163
|
cursor: pointer;
|
|
164
164
|
padding: ${(props) => props.theme.grid.unit * 2}px 0;
|
|
165
165
|
display: flex;
|
|
166
|
-
|
|
166
|
+
`);
|
|
167
167
|
const StatusIcon = styled_components_1.default.div `
|
|
168
168
|
flex-shrink: 1;
|
|
169
169
|
margin-right: ${(props) => props.theme.grid.unit * 3}px;
|
|
@@ -78,8 +78,8 @@ const InsertSpecialCharacterDialog = ({ view }) => {
|
|
|
78
78
|
react_1.default.createElement(ButtonsContainer, null,
|
|
79
79
|
react_1.default.createElement(style_guide_1.PrimaryButton, { onClick: handleClose }, "Close")))))));
|
|
80
80
|
};
|
|
81
|
-
const OptionComponent = ({ innerProps, data, }) => {
|
|
82
|
-
return (react_1.default.createElement(OptionWrapper, { ...innerProps, ref:
|
|
81
|
+
const OptionComponent = ({ innerProps, innerRef, data, isFocused, isSelected, }) => {
|
|
82
|
+
return (react_1.default.createElement(OptionWrapper, { ...innerProps, ref: innerRef, focused: isFocused, selected: isSelected }, data.label));
|
|
83
83
|
};
|
|
84
84
|
const Container = (0, styled_components_1.default)(style_guide_1.ModalContainer) `
|
|
85
85
|
padding: 8px;
|
|
@@ -103,7 +103,15 @@ const OptionWrapper = styled_components_1.default.div `
|
|
|
103
103
|
padding-top: ${(props) => props.theme.grid.unit * 2}px;
|
|
104
104
|
padding-bottom: ${(props) => props.theme.grid.unit * 2}px;
|
|
105
105
|
|
|
106
|
-
background-color: ${(props) =>
|
|
106
|
+
background-color: ${(props) => {
|
|
107
|
+
if (props.selected) {
|
|
108
|
+
return props.theme.colors.background.selected;
|
|
109
|
+
}
|
|
110
|
+
if (props.focused) {
|
|
111
|
+
return props.theme.colors.background.fifth;
|
|
112
|
+
}
|
|
113
|
+
return 'transparent';
|
|
114
|
+
}};
|
|
107
115
|
|
|
108
116
|
&:hover {
|
|
109
117
|
background-color: ${(props) => props.theme.colors.background.fifth};
|
|
@@ -113,19 +121,20 @@ const CharactersSetContainer = styled_components_1.default.div `
|
|
|
113
121
|
flex: 1;
|
|
114
122
|
overflow-y: scroll;
|
|
115
123
|
margin: 18px 0;
|
|
116
|
-
|
|
124
|
+
padding: 8px;
|
|
117
125
|
`;
|
|
118
|
-
const CharactersSet = (0, styled_components_1.default)(style_guide_1.IconButtonGroup) `
|
|
126
|
+
const CharactersSet = (0, style_guide_1.withListNavigation)((0, styled_components_1.default)(style_guide_1.IconButtonGroup) `
|
|
119
127
|
display: grid;
|
|
120
128
|
grid-template-columns: repeat(auto-fit, minmax(28px, max-content));
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const Character = (0, styled_components_1.default)(style_guide_1.IconButton) `
|
|
129
|
+
border: 1px solid #ddd;
|
|
130
|
+
`);
|
|
131
|
+
const Character = (0, style_guide_1.withNavigableListItem)((0, styled_components_1.default)(style_guide_1.IconButton) `
|
|
124
132
|
border-bottom: 1px solid #ddd;
|
|
125
133
|
border-right: 1px solid #ddd;
|
|
126
134
|
border-radius: unset;
|
|
127
135
|
|
|
128
|
-
:hover
|
|
136
|
+
:hover,
|
|
137
|
+
:focus {
|
|
129
138
|
background-color: #f0f0f0 !important;
|
|
130
139
|
}
|
|
131
140
|
|
|
@@ -135,7 +144,12 @@ const Character = (0, styled_components_1.default)(style_guide_1.IconButton) `
|
|
|
135
144
|
border-bottom: 1px solid #ddd !important;
|
|
136
145
|
border-right: 1px solid #ddd !important;
|
|
137
146
|
}
|
|
138
|
-
|
|
147
|
+
|
|
148
|
+
&&:not([disabled]):focus-visible {
|
|
149
|
+
outline: 1px solid ${(props) => props.theme.colors.outline.focus};
|
|
150
|
+
outline-offset: 2px;
|
|
151
|
+
}
|
|
152
|
+
`);
|
|
139
153
|
const openInsertSpecialCharacterDialog = (view) => {
|
|
140
154
|
if (!view) {
|
|
141
155
|
return;
|
|
@@ -83,6 +83,7 @@ const RemoveButton = (0, styled_components_1.default)(style_guide_1.SecondaryBut
|
|
|
83
83
|
exports.Open = styled_components_1.default.a `
|
|
84
84
|
display: inline-block;
|
|
85
85
|
margin-left: ${(props) => props.theme.grid.unit * 2}px;
|
|
86
|
+
margin-top: 4px;
|
|
86
87
|
text-transform: uppercase;
|
|
87
88
|
color: inherit;
|
|
88
89
|
font-size: ${(props) => props.theme.font.size.small};
|
|
@@ -92,7 +93,13 @@ exports.Open = styled_components_1.default.a `
|
|
|
92
93
|
content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAQElEQVR42qXKwQkAIAxDUUdxtO6/RBQkQZvSi8I/pL4BoGw/XPkh4XigPmsUgh0626AjRsgxHTkUThsG2T/sIlzdTsp52kSS1wAAAABJRU5ErkJggg==);
|
|
93
94
|
margin-left: 4px;
|
|
94
95
|
}
|
|
96
|
+
|
|
97
|
+
&&:not([disabled]):focus-visible {
|
|
98
|
+
outline: 2px solid ${(props) => props.theme.colors.outline.focus};
|
|
99
|
+
outline-offset: 3px;
|
|
100
|
+
}
|
|
95
101
|
`;
|
|
102
|
+
const Form = (0, style_guide_1.withFocusTrap)(styled_components_1.default.form ``);
|
|
96
103
|
const LinkForm = ({ onCancel, onRemove, onSave, value, }) => {
|
|
97
104
|
const [href, setHref] = (0, react_1.useState)(value.href);
|
|
98
105
|
const [text, setText] = (0, react_1.useState)(value.text);
|
|
@@ -132,7 +139,7 @@ const LinkForm = ({ onCancel, onRemove, onSave, value, }) => {
|
|
|
132
139
|
onSave({ href, text, title });
|
|
133
140
|
}
|
|
134
141
|
}, [href, text, title, onSave, validate]);
|
|
135
|
-
return (react_1.default.createElement(
|
|
142
|
+
return (react_1.default.createElement(Form, { onSubmit: handleSubmit, noValidate: true },
|
|
136
143
|
react_1.default.createElement(style_guide_1.FormContainer, null,
|
|
137
144
|
react_1.default.createElement(style_guide_1.FormRow, null,
|
|
138
145
|
react_1.default.createElement("div", { style: { display: 'flex', alignItems: 'center', gap: '8px' } },
|
|
@@ -17,21 +17,23 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.checkID = exports.normalizeAuthor = void 0;
|
|
19
19
|
const transform_1 = require("@manuscripts/transform");
|
|
20
|
+
const trim = (value) => (value ?? '').trim();
|
|
20
21
|
const normalizeAuthor = (author) => {
|
|
21
22
|
const basic = {
|
|
22
23
|
id: author.id,
|
|
23
|
-
role: author.role
|
|
24
|
+
role: trim(author.role),
|
|
24
25
|
affiliationIDs: (author.affiliationIDs || []).sort(),
|
|
25
|
-
given: author.given
|
|
26
|
-
family: author.family
|
|
27
|
-
email: author.email
|
|
26
|
+
given: trim(author.given),
|
|
27
|
+
family: trim(author.family),
|
|
28
|
+
email: trim(author.email),
|
|
28
29
|
isCorresponding: author.isCorresponding || false,
|
|
29
|
-
ORCID: author.ORCID
|
|
30
|
+
ORCID: trim(author.ORCID),
|
|
30
31
|
priority: author.priority,
|
|
31
32
|
isJointContributor: author.isJointContributor || false,
|
|
32
33
|
footnoteIDs: author.footnoteIDs || [],
|
|
33
34
|
correspIDs: author.correspIDs || [],
|
|
34
|
-
prefix: author.prefix
|
|
35
|
+
prefix: trim(author.prefix),
|
|
36
|
+
suffix: trim(author.suffix),
|
|
35
37
|
};
|
|
36
38
|
if (author.creditRoles && Array.isArray(author.creditRoles)) {
|
|
37
39
|
basic.creditRoles = author.creditRoles;
|
package/dist/cjs/lib/popper.js
CHANGED
|
@@ -40,11 +40,13 @@ class PopperManager {
|
|
|
40
40
|
this.triggerElement.focus();
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
+
const isMenu = contents.classList.contains('context-menu') ||
|
|
44
|
+
contents.classList.contains('menu');
|
|
43
45
|
(0, navigation_utils_1.createKeyboardInteraction)({
|
|
44
46
|
container,
|
|
45
47
|
additionalKeys: {
|
|
46
48
|
Escape: closeAndRestoreFocus,
|
|
47
|
-
Tab: closeAndRestoreFocus,
|
|
49
|
+
Tab: isMenu ? closeAndRestoreFocus : undefined,
|
|
48
50
|
},
|
|
49
51
|
});
|
|
50
52
|
if (showArrow) {
|
|
@@ -116,7 +118,7 @@ class PopperManager {
|
|
|
116
118
|
return;
|
|
117
119
|
}
|
|
118
120
|
if (autoFocus) {
|
|
119
|
-
const button = container.querySelector('button:not([disabled])');
|
|
121
|
+
const button = container.querySelector('button:not([disabled]), [tabindex]:not([tabindex="-1"])');
|
|
120
122
|
button?.focus();
|
|
121
123
|
}
|
|
122
124
|
}
|
package/dist/cjs/versions.js
CHANGED
|
@@ -45,6 +45,7 @@ class CrossReferenceEditableView extends cross_reference_1.CrossReferenceView {
|
|
|
45
45
|
currentCustomLabel: this.node.attrs.label,
|
|
46
46
|
};
|
|
47
47
|
this.popperContainer = (0, ReactSubView_1.default)(this.props, CrossReferenceItems_1.CrossReferenceItems, componentProps, this.node, this.getPos, this.view, ['cross-reference-editor']);
|
|
48
|
+
this.popperContainer.setAttribute('tabindex', '0');
|
|
48
49
|
this.props.popper.show(this.dom, this.popperContainer, 'auto');
|
|
49
50
|
};
|
|
50
51
|
this.destroy = () => {
|
|
@@ -66,6 +66,12 @@ class EquationEditableView extends equation_1.EquationView {
|
|
|
66
66
|
mode: 'stex',
|
|
67
67
|
placeholder,
|
|
68
68
|
autofocus: true,
|
|
69
|
+
extraKeys: {
|
|
70
|
+
Esc: () => {
|
|
71
|
+
this.props.popper.destroy();
|
|
72
|
+
this.view.focus();
|
|
73
|
+
},
|
|
74
|
+
},
|
|
69
75
|
});
|
|
70
76
|
input.on('changes', async () => {
|
|
71
77
|
const contents = input.getValue();
|
|
@@ -66,6 +66,12 @@ class InlineEquationEditableView extends inline_equation_1.InlineEquationView {
|
|
|
66
66
|
mode: 'stex',
|
|
67
67
|
placeholder,
|
|
68
68
|
autofocus: true,
|
|
69
|
+
extraKeys: {
|
|
70
|
+
Esc: () => {
|
|
71
|
+
this.props.popper.destroy();
|
|
72
|
+
this.view.focus();
|
|
73
|
+
},
|
|
74
|
+
},
|
|
69
75
|
});
|
|
70
76
|
input.on('changes', async () => {
|
|
71
77
|
const contents = input.getValue();
|
|
@@ -104,6 +104,7 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
|
|
|
104
104
|
onInsert: this.handleInsert,
|
|
105
105
|
};
|
|
106
106
|
this.popperContainer = (0, ReactSubView_1.default)(this.props, FootnotesSelector_1.FootnotesSelector, props, this.node, this.getPos, this.view, ['footnote-editor']);
|
|
107
|
+
this.popperContainer.setAttribute('tabindex', '0');
|
|
107
108
|
this.props.popper.show(this.dom, this.popperContainer, 'auto', false);
|
|
108
109
|
};
|
|
109
110
|
this.initialise = () => {
|