@manuscripts/body-editor 2.7.9-LEAN-4259.0 → 2.7.9
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/authors/AuthorsModal.js +4 -14
- package/dist/cjs/components/authors/DraggableAuthor.js +3 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/es/components/authors/AuthorsModal.js +5 -15
- package/dist/es/components/authors/DraggableAuthor.js +3 -1
- package/dist/es/versions.js +1 -1
- package/dist/types/components/authors/AuthorList.d.ts +1 -1
- package/dist/types/components/authors/DraggableAuthor.d.ts +1 -1
- package/dist/types/versions.d.ts +1 -1
- package/package.json +1 -1
|
@@ -300,20 +300,10 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
|
|
|
300
300
|
items: [author],
|
|
301
301
|
});
|
|
302
302
|
};
|
|
303
|
-
const handleMoveAuthor = (from, to
|
|
304
|
-
const copy =
|
|
305
|
-
const order = copy.map((
|
|
306
|
-
|
|
307
|
-
if (to.priority) {
|
|
308
|
-
return to.priority + shift;
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
return authors.findIndex((i) => i === to) + shift;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
return i;
|
|
315
|
-
});
|
|
316
|
-
copy.sort((a, b) => order[copy.indexOf(a)] - order[copy.indexOf(b)]);
|
|
303
|
+
const handleMoveAuthor = (from, to) => {
|
|
304
|
+
const copy = [...authors];
|
|
305
|
+
const order = copy.map((_, i) => (i === from ? to : i));
|
|
306
|
+
copy.sort((a, b) => order[authors.indexOf(a)] - order[authors.indexOf(b)]);
|
|
317
307
|
copy.forEach((a, i) => {
|
|
318
308
|
if (a.priority !== i) {
|
|
319
309
|
a.priority = i;
|
|
@@ -159,8 +159,10 @@ exports.DraggableAuthor = react_1.default.memo(({ author, isSelected, onClick, o
|
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
161
|
const side = (0, dnd_1.getDropSide)(ref.current, monitor);
|
|
162
|
+
const from = item.author.priority;
|
|
163
|
+
const to = author.priority;
|
|
162
164
|
const diff = side === 'before' ? -0.5 : 0.5;
|
|
163
|
-
moveAuthor(
|
|
165
|
+
moveAuthor(from, to + diff);
|
|
164
166
|
},
|
|
165
167
|
collect: (monitor) => ({
|
|
166
168
|
isOver: monitor.isOver(),
|
package/dist/cjs/versions.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { buildBibliographicName, generateID, ObjectTypes, } from '@manuscripts/json-schema';
|
|
17
17
|
import { AddIcon, AddInstitutionIcon, AuthorPlaceholderIcon, CloseButton, Drawer, ModalBody, ModalContainer, ModalHeader, ModalSidebar, ModalSidebarHeader, ModalSidebarTitle, ScrollableModalContent, SelectedItemsBox, SidebarContent, StyledModal, } from '@manuscripts/style-guide';
|
|
18
|
-
import {
|
|
18
|
+
import { isEqual, omit } from 'lodash';
|
|
19
19
|
import React, { useEffect, useReducer, useRef, useState } from 'react';
|
|
20
20
|
import styled from 'styled-components';
|
|
21
21
|
import { arrayReducer } from '../../lib/array-reducer';
|
|
@@ -271,20 +271,10 @@ export const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, a
|
|
|
271
271
|
items: [author],
|
|
272
272
|
});
|
|
273
273
|
};
|
|
274
|
-
const handleMoveAuthor = (from, to
|
|
275
|
-
const copy =
|
|
276
|
-
const order = copy.map((
|
|
277
|
-
|
|
278
|
-
if (to.priority) {
|
|
279
|
-
return to.priority + shift;
|
|
280
|
-
}
|
|
281
|
-
else {
|
|
282
|
-
return authors.findIndex((i) => i === to) + shift;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return i;
|
|
286
|
-
});
|
|
287
|
-
copy.sort((a, b) => order[copy.indexOf(a)] - order[copy.indexOf(b)]);
|
|
274
|
+
const handleMoveAuthor = (from, to) => {
|
|
275
|
+
const copy = [...authors];
|
|
276
|
+
const order = copy.map((_, i) => (i === from ? to : i));
|
|
277
|
+
copy.sort((a, b) => order[authors.indexOf(a)] - order[authors.indexOf(b)]);
|
|
288
278
|
copy.forEach((a, i) => {
|
|
289
279
|
if (a.priority !== i) {
|
|
290
280
|
a.priority = i;
|
|
@@ -130,8 +130,10 @@ export const DraggableAuthor = React.memo(({ author, isSelected, onClick, onDele
|
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
const side = getDropSide(ref.current, monitor);
|
|
133
|
+
const from = item.author.priority;
|
|
134
|
+
const to = author.priority;
|
|
133
135
|
const diff = side === 'before' ? -0.5 : 0.5;
|
|
134
|
-
moveAuthor(
|
|
136
|
+
moveAuthor(from, to + diff);
|
|
135
137
|
},
|
|
136
138
|
collect: (monitor) => ({
|
|
137
139
|
isOver: monitor.isOver(),
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.7.9
|
|
1
|
+
export const VERSION = '2.7.9';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -20,7 +20,7 @@ interface AuthorListProps {
|
|
|
20
20
|
authors: ContributorAttrs[];
|
|
21
21
|
onSelect: (item: ContributorAttrs) => void;
|
|
22
22
|
onDelete: () => void;
|
|
23
|
-
moveAuthor: (
|
|
23
|
+
moveAuthor: (index: number, target: number) => void;
|
|
24
24
|
lastSavedAuthor: string | null;
|
|
25
25
|
}
|
|
26
26
|
export declare const AuthorList: React.FC<AuthorListProps>;
|
|
@@ -20,7 +20,7 @@ interface DraggableAuthorProps {
|
|
|
20
20
|
isSelected: boolean;
|
|
21
21
|
onClick: () => void;
|
|
22
22
|
onDelete: () => void;
|
|
23
|
-
moveAuthor: (from:
|
|
23
|
+
moveAuthor: (from: number, to: number) => void;
|
|
24
24
|
showSuccessIcon?: boolean;
|
|
25
25
|
}
|
|
26
26
|
export declare const DraggableAuthor: React.FC<DraggableAuthorProps>;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.7.9
|
|
1
|
+
export declare const VERSION = "2.7.9";
|
|
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": "2.7.9
|
|
4
|
+
"version": "2.7.9",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|