@manuscripts/body-editor 3.12.59 → 3.12.60
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/commands.js +8 -3
- package/dist/cjs/components/affiliations/AffiliationsModal.js +1 -1
- package/dist/cjs/components/affiliations/CreateAffiliationModal.js +1 -1
- package/dist/cjs/components/authors/AuthorsModal.js +1 -1
- package/dist/cjs/components/authors/CreateAuthorModal.js +1 -1
- package/dist/cjs/components/form/ModalFormActions.js +3 -5
- package/dist/cjs/versions.js +1 -1
- package/dist/es/commands.js +9 -4
- package/dist/es/components/affiliations/AffiliationsModal.js +1 -1
- package/dist/es/components/affiliations/CreateAffiliationModal.js +1 -1
- package/dist/es/components/authors/AuthorsModal.js +1 -1
- package/dist/es/components/authors/CreateAuthorModal.js +1 -1
- package/dist/es/components/form/ModalFormActions.js +3 -5
- package/dist/es/versions.js +1 -1
- package/dist/types/commands.d.ts +1 -1
- package/dist/types/components/form/ModalFormActions.d.ts +1 -3
- package/dist/types/versions.d.ts +1 -1
- package/package.json +3 -3
package/dist/cjs/commands.js
CHANGED
|
@@ -294,14 +294,19 @@ const insertTable = (config, state, dispatch) => {
|
|
|
294
294
|
return true;
|
|
295
295
|
};
|
|
296
296
|
exports.insertTable = insertTable;
|
|
297
|
-
const insertSupplement = (file, view) => {
|
|
297
|
+
const insertSupplement = (file, view, setSelection = true) => {
|
|
298
298
|
const supplement = transform_1.schema.nodes.supplement.createAndFill({
|
|
299
299
|
id: (0, transform_1.generateNodeID)(transform_1.schema.nodes.supplement),
|
|
300
300
|
href: file.id,
|
|
301
301
|
}, createAndFillCaption());
|
|
302
|
-
|
|
302
|
+
let tr = view.state.tr;
|
|
303
303
|
const { pos } = (0, doc_1.upsertSupplementsSection)(tr, supplement);
|
|
304
|
-
|
|
304
|
+
if (setSelection) {
|
|
305
|
+
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos));
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
tr = (0, track_changes_plugin_1.skipSelect)(tr);
|
|
309
|
+
}
|
|
305
310
|
view.focus();
|
|
306
311
|
view.dispatch(tr.scrollIntoView());
|
|
307
312
|
return true;
|
|
@@ -392,7 +392,7 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, aff
|
|
|
392
392
|
setPendingAction(null);
|
|
393
393
|
setAffiliationDetailsUnsavedContinue(true);
|
|
394
394
|
}, onSecondary: handleConfirmationCancel, type: ConfirmationDialog_1.DialogType.SAVE, entityType: "affiliation" }))) : (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) })))),
|
|
395
|
-
react_1.default.createElement(FormFooter_1.default, { onCancel: handleClose, primaryAction: selection ? (react_1.default.createElement(ModalFormActions_1.ModalFormSaveButton, { form: "affiliation-form",
|
|
395
|
+
react_1.default.createElement(FormFooter_1.default, { onCancel: handleClose, primaryAction: selection ? (react_1.default.createElement(ModalFormActions_1.ModalFormSaveButton, { form: "affiliation-form", isDisableSave: isDisableSave, onSubmitForm: () => actionsRef.current?.submitForm?.() })) : undefined }))));
|
|
396
396
|
};
|
|
397
397
|
exports.AffiliationsModal = AffiliationsModal;
|
|
398
398
|
function createEmptyAffiliation(priority) {
|
|
@@ -91,6 +91,6 @@ const CreateAffiliationModal = ({ affiliationsCount, onSave, onClose, }) => {
|
|
|
91
91
|
react_1.default.createElement(CreateModalStyles_1.StyledScrollableModalContent, null,
|
|
92
92
|
react_1.default.createElement(CreateModalStyles_1.FormTitle, null, "Create New Affiliation"),
|
|
93
93
|
react_1.default.createElement(AffiliationForm_1.AffiliationForm, { values: (0, normalize_1.checkID)(selection, 'affiliation'), onSave: handleSave, onChange: handleChange, actionsRef: actionsRef, newEntity: true, onAffiliationErrorChange: setHasError }))),
|
|
94
|
-
react_1.default.createElement(FormFooter_1.default, { onCancel: () => setIsOpen(false), primaryAction: react_1.default.createElement(ModalFormActions_1.ModalFormSaveButton, { form: "affiliation-form",
|
|
94
|
+
react_1.default.createElement(FormFooter_1.default, { onCancel: () => setIsOpen(false), primaryAction: react_1.default.createElement(ModalFormActions_1.ModalFormSaveButton, { form: "affiliation-form", isDisableSave: isDisableSave || hasError, label: "Create New Affiliation", onSubmitForm: () => actionsRef.current?.submitForm?.() }) }))));
|
|
95
95
|
};
|
|
96
96
|
exports.CreateAffiliationModal = CreateAffiliationModal;
|
|
@@ -383,7 +383,7 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
|
|
|
383
383
|
setNextAuthor(null);
|
|
384
384
|
setAuthorDetailsUnsavedContinue(true);
|
|
385
385
|
}, onSecondary: cancel, type: ConfirmationDialog_1.DialogType.SAVE, entityType: "author" }))) : (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) })))),
|
|
386
|
-
react_1.default.createElement(FormFooter_1.default, { onCancel: close, primaryAction: selection ? (react_1.default.createElement(ModalFormActions_1.ModalFormSaveButton, { form: "author-details-form",
|
|
386
|
+
react_1.default.createElement(FormFooter_1.default, { onCancel: close, primaryAction: selection ? (react_1.default.createElement(ModalFormActions_1.ModalFormSaveButton, { form: "author-details-form", isDisableSave: isDisableSave, onSubmitForm: () => actionsRef.current?.submitForm?.() })) : undefined }))));
|
|
387
387
|
};
|
|
388
388
|
exports.AuthorsModal = AuthorsModal;
|
|
389
389
|
function createEmptyAuthor(priority) {
|
|
@@ -96,7 +96,7 @@ const CreateAuthorModal = ({ authorsCount, affiliations: $affiliations, onSave,
|
|
|
96
96
|
react_1.default.createElement(CreateModalStyles_1.StyledScrollableModalContent, null,
|
|
97
97
|
react_1.default.createElement(CreateModalStyles_1.FormTitle, null, "Create New Author"),
|
|
98
98
|
react_1.default.createElement(AuthorDetailsForm_1.AuthorDetailsForm, { values: (0, normalize_1.normalizeAuthor)(selection), onChange: handleChange, onSave: handleSave, actionsRef: actionsRef, isEmailRequired: isEmailRequired, selectedAffiliations: selectedAffiliations.map((a) => a.id), authorFormRef: authorFormRef, selectedCreditRoles: selectedCreditRoles, newEntity: true, onAuthorDetailsTabErrorChange: setHasError }))),
|
|
99
|
-
react_1.default.createElement(FormFooter_1.default, { onCancel: () => setIsOpen(false), primaryAction: react_1.default.createElement(ModalFormActions_1.ModalFormSaveButton, { form: "author-details-form",
|
|
99
|
+
react_1.default.createElement(FormFooter_1.default, { onCancel: () => setIsOpen(false), primaryAction: react_1.default.createElement(ModalFormActions_1.ModalFormSaveButton, { form: "author-details-form", isDisableSave: isDisableSave || hasError, label: "Create New Author", onSubmitForm: () => actionsRef.current?.submitForm?.() }) }))));
|
|
100
100
|
};
|
|
101
101
|
exports.CreateAuthorModal = CreateAuthorModal;
|
|
102
102
|
function createEmptyAuthor(priority) {
|
|
@@ -8,11 +8,9 @@ const style_guide_1 = require("@manuscripts/style-guide");
|
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const ConfirmationDialog_1 = require("../dialog/ConfirmationDialog");
|
|
10
10
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
11
|
-
const ModalFormSaveButton = ({ form,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
: (updateLabel ?? 'Update Changes');
|
|
15
|
-
const saveButton = onSubmitForm ? (react_1.default.createElement(StylePrimaryButton, { disabled: isDisableSave, type: "button", onClick: () => {
|
|
11
|
+
const ModalFormSaveButton = ({ form, isDisableSave, onSubmitForm, label, }) => {
|
|
12
|
+
label = label || 'Save Changes';
|
|
13
|
+
const saveButton = onSubmitForm ? (react_1.default.createElement(StylePrimaryButton, { "data-cy": "save-changes", disabled: isDisableSave, type: "button", onClick: () => {
|
|
16
14
|
if (!isDisableSave) {
|
|
17
15
|
void onSubmitForm();
|
|
18
16
|
}
|
package/dist/cjs/versions.js
CHANGED
package/dist/es/commands.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { isDeleted, skipTracking } from '@manuscripts/track-changes-plugin';
|
|
16
|
+
import { isDeleted, skipTracking, skipSelect } from '@manuscripts/track-changes-plugin';
|
|
17
17
|
import { generateNodeID, isElementNodeType, isListNode, isSectionNodeType, isTableElementNode, schema, } from '@manuscripts/transform';
|
|
18
18
|
import { Fragment, NodeRange, Slice, } from 'prosemirror-model';
|
|
19
19
|
import { wrapInList } from 'prosemirror-schema-list';
|
|
@@ -278,14 +278,19 @@ export const insertTable = (config, state, dispatch) => {
|
|
|
278
278
|
dispatch && dispatch(tr);
|
|
279
279
|
return true;
|
|
280
280
|
};
|
|
281
|
-
export const insertSupplement = (file, view) => {
|
|
281
|
+
export const insertSupplement = (file, view, setSelection = true) => {
|
|
282
282
|
const supplement = schema.nodes.supplement.createAndFill({
|
|
283
283
|
id: generateNodeID(schema.nodes.supplement),
|
|
284
284
|
href: file.id,
|
|
285
285
|
}, createAndFillCaption());
|
|
286
|
-
|
|
286
|
+
let tr = view.state.tr;
|
|
287
287
|
const { pos } = upsertSupplementsSection(tr, supplement);
|
|
288
|
-
|
|
288
|
+
if (setSelection) {
|
|
289
|
+
tr.setSelection(NodeSelection.create(tr.doc, pos));
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
tr = skipSelect(tr);
|
|
293
|
+
}
|
|
289
294
|
view.focus();
|
|
290
295
|
view.dispatch(tr.scrollIntoView());
|
|
291
296
|
return true;
|
|
@@ -353,7 +353,7 @@ export const AffiliationsModal = ({ authors: $authors, affiliations: $affiliatio
|
|
|
353
353
|
setPendingAction(null);
|
|
354
354
|
setAffiliationDetailsUnsavedContinue(true);
|
|
355
355
|
}, onSecondary: handleConfirmationCancel, type: DialogType.SAVE, entityType: "affiliation" }))) : (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) })))),
|
|
356
|
-
React.createElement(FormFooter, { onCancel: handleClose, primaryAction: selection ? (React.createElement(ModalFormSaveButton, { form: "affiliation-form",
|
|
356
|
+
React.createElement(FormFooter, { onCancel: handleClose, primaryAction: selection ? (React.createElement(ModalFormSaveButton, { form: "affiliation-form", isDisableSave: isDisableSave, onSubmitForm: () => actionsRef.current?.submitForm?.() })) : undefined }))));
|
|
357
357
|
};
|
|
358
358
|
function createEmptyAffiliation(priority) {
|
|
359
359
|
return {
|
|
@@ -52,5 +52,5 @@ export const CreateAffiliationModal = ({ affiliationsCount, onSave, onClose, })
|
|
|
52
52
|
React.createElement(StyledScrollableModalContent, null,
|
|
53
53
|
React.createElement(FormTitle, null, "Create New Affiliation"),
|
|
54
54
|
React.createElement(AffiliationForm, { values: checkID(selection, 'affiliation'), onSave: handleSave, onChange: handleChange, actionsRef: actionsRef, newEntity: true, onAffiliationErrorChange: setHasError }))),
|
|
55
|
-
React.createElement(FormFooter, { onCancel: () => setIsOpen(false), primaryAction: React.createElement(ModalFormSaveButton, { form: "affiliation-form",
|
|
55
|
+
React.createElement(FormFooter, { onCancel: () => setIsOpen(false), primaryAction: React.createElement(ModalFormSaveButton, { form: "affiliation-form", isDisableSave: isDisableSave || hasError, label: "Create New Affiliation", onSubmitForm: () => actionsRef.current?.submitForm?.() }) }))));
|
|
56
56
|
};
|
|
@@ -344,7 +344,7 @@ export const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, a
|
|
|
344
344
|
setNextAuthor(null);
|
|
345
345
|
setAuthorDetailsUnsavedContinue(true);
|
|
346
346
|
}, onSecondary: cancel, type: DialogType.SAVE, entityType: "author" }))) : (React.createElement(FormPlaceholder, { type: "author", title: "Author Details", message: "Select an author from the list to display their details here.", placeholderIcon: React.createElement(AuthorPlaceholderIcon, null) })))),
|
|
347
|
-
React.createElement(FormFooter, { onCancel: close, primaryAction: selection ? (React.createElement(ModalFormSaveButton, { form: "author-details-form",
|
|
347
|
+
React.createElement(FormFooter, { onCancel: close, primaryAction: selection ? (React.createElement(ModalFormSaveButton, { form: "author-details-form", isDisableSave: isDisableSave, onSubmitForm: () => actionsRef.current?.submitForm?.() })) : undefined }))));
|
|
348
348
|
};
|
|
349
349
|
function createEmptyAuthor(priority) {
|
|
350
350
|
return {
|
|
@@ -57,7 +57,7 @@ export const CreateAuthorModal = ({ authorsCount, affiliations: $affiliations, o
|
|
|
57
57
|
React.createElement(StyledScrollableModalContent, null,
|
|
58
58
|
React.createElement(FormTitle, null, "Create New Author"),
|
|
59
59
|
React.createElement(AuthorDetailsForm, { values: normalizeAuthor(selection), onChange: handleChange, onSave: handleSave, actionsRef: actionsRef, isEmailRequired: isEmailRequired, selectedAffiliations: selectedAffiliations.map((a) => a.id), authorFormRef: authorFormRef, selectedCreditRoles: selectedCreditRoles, newEntity: true, onAuthorDetailsTabErrorChange: setHasError }))),
|
|
60
|
-
React.createElement(FormFooter, { onCancel: () => setIsOpen(false), primaryAction: React.createElement(ModalFormSaveButton, { form: "author-details-form",
|
|
60
|
+
React.createElement(FormFooter, { onCancel: () => setIsOpen(false), primaryAction: React.createElement(ModalFormSaveButton, { form: "author-details-form", isDisableSave: isDisableSave || hasError, label: "Create New Author", onSubmitForm: () => actionsRef.current?.submitForm?.() }) }))));
|
|
61
61
|
};
|
|
62
62
|
function createEmptyAuthor(priority) {
|
|
63
63
|
return {
|
|
@@ -2,11 +2,9 @@ import { PrimaryButton } from '@manuscripts/style-guide';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ConfirmationDialog, DialogType } from '../dialog/ConfirmationDialog';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
|
-
export const ModalFormSaveButton = ({ form,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
: (updateLabel ?? 'Update Changes');
|
|
9
|
-
const saveButton = onSubmitForm ? (React.createElement(StylePrimaryButton, { disabled: isDisableSave, type: "button", onClick: () => {
|
|
5
|
+
export const ModalFormSaveButton = ({ form, isDisableSave, onSubmitForm, label, }) => {
|
|
6
|
+
label = label || 'Save Changes';
|
|
7
|
+
const saveButton = onSubmitForm ? (React.createElement(StylePrimaryButton, { "data-cy": "save-changes", disabled: isDisableSave, type: "button", onClick: () => {
|
|
10
8
|
if (!isDisableSave) {
|
|
11
9
|
void onSubmitForm();
|
|
12
10
|
}
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.12.
|
|
1
|
+
export const VERSION = '3.12.60';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
package/dist/types/commands.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const insertGeneralTableFootnote: (element: [ManuscriptNode, numb
|
|
|
33
33
|
export declare const insertFigure: (file: FileAttachment, state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
34
34
|
export declare const insertEmbed: (state: ManuscriptEditorState, dispatch?: Dispatch, attrs?: Attrs) => boolean;
|
|
35
35
|
export declare const insertTable: (config: TableConfig, state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
36
|
-
export declare const insertSupplement: (file: FileAttachment, view: ManuscriptEditorView) => boolean;
|
|
36
|
+
export declare const insertSupplement: (file: FileAttachment, view: ManuscriptEditorView, setSelection?: boolean) => boolean;
|
|
37
37
|
export declare const insertAttachment: (file: FileAttachment, state: ManuscriptEditorState, type: string, dispatch?: Dispatch) => boolean;
|
|
38
38
|
export declare const insertBlock: (nodeType: ManuscriptNodeType) => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
39
39
|
export declare const deleteBlock: (typeToDelete: string) => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface ModalFormSaveButtonProps {
|
|
3
3
|
form: string;
|
|
4
|
-
newEntity: boolean;
|
|
5
4
|
isDisableSave: boolean;
|
|
6
5
|
onSubmitForm?: () => void | Promise<void>;
|
|
7
|
-
|
|
8
|
-
updateLabel?: string;
|
|
6
|
+
label?: string;
|
|
9
7
|
}
|
|
10
8
|
export declare const ModalFormSaveButton: React.FC<ModalFormSaveButtonProps>;
|
|
11
9
|
interface ModalFormActionsProps {
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.12.
|
|
1
|
+
export declare const VERSION = "3.12.60";
|
|
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.12.
|
|
4
|
+
"version": "3.12.60",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@citation-js/plugin-pubmed": "0.3.0",
|
|
41
41
|
"@citation-js/plugin-ris": "0.7.18",
|
|
42
42
|
"@iarna/word-count": "1.1.2",
|
|
43
|
-
"@manuscripts/style-guide": "3.5.
|
|
44
|
-
"@manuscripts/track-changes-plugin": "2.3.
|
|
43
|
+
"@manuscripts/style-guide": "3.5.28",
|
|
44
|
+
"@manuscripts/track-changes-plugin": "2.3.15",
|
|
45
45
|
"@manuscripts/transform": "4.3.51",
|
|
46
46
|
"@popperjs/core": "2.11.8",
|
|
47
47
|
"citeproc": "2.4.63",
|