@manuscripts/body-editor 3.7.7 → 3.7.8
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/AffiliationsModal.js +4 -4
- package/dist/cjs/components/authors/AuthorsModal.js +2 -2
- package/dist/cjs/components/awards/AwardModal.js +1 -1
- package/dist/cjs/components/outline/DraggableTree.js +1 -1
- package/dist/cjs/components/references/ReferencesModal.js +2 -2
- package/dist/cjs/lib/use-do-with-debounce.js +1 -1
- package/dist/cjs/useEditor.js +5 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/es/components/affiliations/AffiliationsModal.js +4 -4
- package/dist/es/components/authors/AuthorsModal.js +2 -2
- package/dist/es/components/awards/AwardModal.js +1 -1
- package/dist/es/components/outline/DraggableTree.js +1 -1
- package/dist/es/components/references/ReferencesModal.js +2 -2
- package/dist/es/lib/use-do-with-debounce.js +1 -1
- package/dist/es/useEditor.js +5 -1
- package/dist/es/versions.js +1 -1
- package/dist/types/versions.d.ts +1 -1
- package/package.json +7 -7
|
@@ -64,8 +64,8 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, aff
|
|
|
64
64
|
const [isOpen, setIsOpen] = (0, react_1.useState)(true);
|
|
65
65
|
const [selection, setSelection] = (0, react_1.useState)(affiliation);
|
|
66
66
|
const [showingDeleteDialog, setShowDeleteDialog] = (0, react_1.useState)(false);
|
|
67
|
-
const valuesRef = (0, react_1.useRef)();
|
|
68
|
-
const actionsRef = (0, react_1.useRef)();
|
|
67
|
+
const valuesRef = (0, react_1.useRef)(undefined);
|
|
68
|
+
const actionsRef = (0, react_1.useRef)(undefined);
|
|
69
69
|
const [authors, dispatchAuthors] = (0, react_1.useReducer)(AuthorsModal_1.authorsReducer, $authors.sort(authors_1.authorComparator));
|
|
70
70
|
const [affiliations, dispatchAffiliations] = (0, react_1.useReducer)(useManageAffiliations_1.affiliationsReducer, $affiliations);
|
|
71
71
|
const [isDisableSave, setIsDisableSave] = (0, react_1.useState)(true);
|
|
@@ -97,7 +97,7 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, aff
|
|
|
97
97
|
const values = valuesRef.current;
|
|
98
98
|
const hasAffiliationChanges = selection && !(0, lodash_1.isEqual)(values, (0, normalize_1.checkID)(selection, 'affiliation'));
|
|
99
99
|
const originalAuthors = selection
|
|
100
|
-
? affiliationAuthorMap.get(selection.id) ?? []
|
|
100
|
+
? (affiliationAuthorMap.get(selection.id) ?? [])
|
|
101
101
|
: [];
|
|
102
102
|
const hasAuthorChanges = !(0, lodash_1.isEqual)(originalAuthors.sort(), selectedAuthorIds.sort());
|
|
103
103
|
const hasChanges = hasAffiliationChanges || (selection && hasAuthorChanges);
|
|
@@ -120,7 +120,7 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, aff
|
|
|
120
120
|
const values = valuesRef.current;
|
|
121
121
|
const hasAffiliationChanges = selection && !(0, lodash_1.isEqual)(values, (0, normalize_1.checkID)(selection, 'affiliation'));
|
|
122
122
|
const originalAuthors = selection
|
|
123
|
-
? affiliationAuthorMap.get(selection.id) ?? []
|
|
123
|
+
? (affiliationAuthorMap.get(selection.id) ?? [])
|
|
124
124
|
: [];
|
|
125
125
|
const hasAuthorChanges = !(0, lodash_1.isEqual)(originalAuthors.sort(), selectedAuthorIds.sort());
|
|
126
126
|
const hasChanges = hasAffiliationChanges || hasAuthorChanges;
|
|
@@ -87,8 +87,8 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
|
|
|
87
87
|
const [isSwitchingAuthor, setIsSwitchingAuthor] = (0, react_1.useState)(false);
|
|
88
88
|
const [isCreatingNewAuthor, setIsCreatingNewAuthor] = (0, react_1.useState)(false);
|
|
89
89
|
const [showCreditDrawer, setShowCreditDrawer] = (0, react_1.useState)(false);
|
|
90
|
-
const valuesRef = (0, react_1.useRef)();
|
|
91
|
-
const actionsRef = (0, react_1.useRef)();
|
|
90
|
+
const valuesRef = (0, react_1.useRef)(undefined);
|
|
91
|
+
const actionsRef = (0, react_1.useRef)(undefined);
|
|
92
92
|
const authorFormRef = (0, react_1.useRef)(null);
|
|
93
93
|
const [authors, dispatchAuthors] = (0, react_1.useReducer)(exports.authorsReducer, $authors.sort(authors_1.authorComparator));
|
|
94
94
|
(0, react_1.useEffect)(() => {
|
|
@@ -64,7 +64,7 @@ const normalizeData = (award) => ({
|
|
|
64
64
|
});
|
|
65
65
|
const AwardModal = ({ initialData, onSaveAward, onCancelAward, }) => {
|
|
66
66
|
const [isOpen, setOpen] = (0, react_1.useState)(true);
|
|
67
|
-
const valuesRef = (0, react_1.useRef)();
|
|
67
|
+
const valuesRef = (0, react_1.useRef)(null);
|
|
68
68
|
const handleSave = () => {
|
|
69
69
|
const updatedValues = valuesRef.current;
|
|
70
70
|
if (updatedValues) {
|
|
@@ -122,7 +122,7 @@ const DraggableTree = ({ tree, view, depth, can, }) => {
|
|
|
122
122
|
const itemText = (node) => {
|
|
123
123
|
const text = (0, transform_1.nodeTitle)(node);
|
|
124
124
|
let sectionNumber = node.type.name === 'section' && sectionTitleState
|
|
125
|
-
? sectionTitleState.get(node.attrs.id) ?? ''
|
|
125
|
+
? (sectionTitleState.get(node.attrs.id) ?? '')
|
|
126
126
|
: '';
|
|
127
127
|
sectionNumber = sectionNumber ? `${sectionNumber}.` : '';
|
|
128
128
|
if (text) {
|
|
@@ -140,7 +140,7 @@ const normalize = (item) => ({
|
|
|
140
140
|
});
|
|
141
141
|
const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave, onDelete, }) => {
|
|
142
142
|
const [confirm, setConfirm] = (0, react_1.useState)(false);
|
|
143
|
-
const valuesRef = (0, react_1.useRef)();
|
|
143
|
+
const valuesRef = (0, react_1.useRef)(undefined);
|
|
144
144
|
const [selection, setSelection] = (0, react_1.useState)();
|
|
145
145
|
const selectionRef = (0, react_1.useRef)(null);
|
|
146
146
|
const isSelected = (item) => {
|
|
@@ -178,7 +178,7 @@ const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave
|
|
|
178
178
|
setStartIndex(Math.max(newLast - dropLimit, startIndex));
|
|
179
179
|
}
|
|
180
180
|
}, [triggers, items]);
|
|
181
|
-
const actionsRef = (0, react_1.useRef)();
|
|
181
|
+
const actionsRef = (0, react_1.useRef)(undefined);
|
|
182
182
|
const reset = () => {
|
|
183
183
|
actionsRef.current?.reset();
|
|
184
184
|
setConfirm(false);
|
|
@@ -4,7 +4,7 @@ exports.useDoWithDebounce = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useDoWithDebounce = () => {
|
|
6
6
|
const debounced = (0, react_1.useRef)(() => undefined);
|
|
7
|
-
const timeout = (0, react_1.useRef)();
|
|
7
|
+
const timeout = (0, react_1.useRef)(undefined);
|
|
8
8
|
const doWithDebounce = (fn, interval = 1000, flush = false) => {
|
|
9
9
|
debounced.current = fn;
|
|
10
10
|
if (flush) {
|
package/dist/cjs/useEditor.js
CHANGED
|
@@ -26,7 +26,7 @@ const popper_1 = require("./lib/popper");
|
|
|
26
26
|
const use_do_with_debounce_1 = require("./lib/use-do-with-debounce");
|
|
27
27
|
const search_replace_1 = require("./plugins/search-replace");
|
|
28
28
|
const useEditor = (externalProps) => {
|
|
29
|
-
const view = (0, react_1.useRef)();
|
|
29
|
+
const view = (0, react_1.useRef)(undefined);
|
|
30
30
|
const props = { ...externalProps, popper: new popper_1.PopperManager() };
|
|
31
31
|
const [state, setState] = (0, react_1.useState)(() => (0, ManuscriptsEditor_1.createEditorState)(props));
|
|
32
32
|
const location = (0, react_router_dom_1.useLocation)();
|
|
@@ -79,6 +79,10 @@ const useEditor = (externalProps) => {
|
|
|
79
79
|
}, []);
|
|
80
80
|
const isViewingMode = props.isViewingMode;
|
|
81
81
|
const onRender = (0, react_1.useCallback)((el) => {
|
|
82
|
+
if (view.current) {
|
|
83
|
+
view.current.destroy();
|
|
84
|
+
view.current = undefined;
|
|
85
|
+
}
|
|
82
86
|
if (!el) {
|
|
83
87
|
return;
|
|
84
88
|
}
|
package/dist/cjs/versions.js
CHANGED
|
@@ -25,8 +25,8 @@ export const AffiliationsModal = ({ authors: $authors, affiliations: $affiliatio
|
|
|
25
25
|
const [isOpen, setIsOpen] = useState(true);
|
|
26
26
|
const [selection, setSelection] = useState(affiliation);
|
|
27
27
|
const [showingDeleteDialog, setShowDeleteDialog] = useState(false);
|
|
28
|
-
const valuesRef = useRef();
|
|
29
|
-
const actionsRef = useRef();
|
|
28
|
+
const valuesRef = useRef(undefined);
|
|
29
|
+
const actionsRef = useRef(undefined);
|
|
30
30
|
const [authors, dispatchAuthors] = useReducer(authorsReducer, $authors.sort(authorComparator));
|
|
31
31
|
const [affiliations, dispatchAffiliations] = useReducer(affiliationsReducer, $affiliations);
|
|
32
32
|
const [isDisableSave, setIsDisableSave] = useState(true);
|
|
@@ -58,7 +58,7 @@ export const AffiliationsModal = ({ authors: $authors, affiliations: $affiliatio
|
|
|
58
58
|
const values = valuesRef.current;
|
|
59
59
|
const hasAffiliationChanges = selection && !isEqual(values, checkID(selection, 'affiliation'));
|
|
60
60
|
const originalAuthors = selection
|
|
61
|
-
? affiliationAuthorMap.get(selection.id) ?? []
|
|
61
|
+
? (affiliationAuthorMap.get(selection.id) ?? [])
|
|
62
62
|
: [];
|
|
63
63
|
const hasAuthorChanges = !isEqual(originalAuthors.sort(), selectedAuthorIds.sort());
|
|
64
64
|
const hasChanges = hasAffiliationChanges || (selection && hasAuthorChanges);
|
|
@@ -81,7 +81,7 @@ export const AffiliationsModal = ({ authors: $authors, affiliations: $affiliatio
|
|
|
81
81
|
const values = valuesRef.current;
|
|
82
82
|
const hasAffiliationChanges = selection && !isEqual(values, checkID(selection, 'affiliation'));
|
|
83
83
|
const originalAuthors = selection
|
|
84
|
-
? affiliationAuthorMap.get(selection.id) ?? []
|
|
84
|
+
? (affiliationAuthorMap.get(selection.id) ?? [])
|
|
85
85
|
: [];
|
|
86
86
|
const hasAuthorChanges = !isEqual(originalAuthors.sort(), selectedAuthorIds.sort());
|
|
87
87
|
const hasChanges = hasAffiliationChanges || hasAuthorChanges;
|
|
@@ -48,8 +48,8 @@ export const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, a
|
|
|
48
48
|
const [isSwitchingAuthor, setIsSwitchingAuthor] = useState(false);
|
|
49
49
|
const [isCreatingNewAuthor, setIsCreatingNewAuthor] = useState(false);
|
|
50
50
|
const [showCreditDrawer, setShowCreditDrawer] = useState(false);
|
|
51
|
-
const valuesRef = useRef();
|
|
52
|
-
const actionsRef = useRef();
|
|
51
|
+
const valuesRef = useRef(undefined);
|
|
52
|
+
const actionsRef = useRef(undefined);
|
|
53
53
|
const authorFormRef = useRef(null);
|
|
54
54
|
const [authors, dispatchAuthors] = useReducer(authorsReducer, $authors.sort(authorComparator));
|
|
55
55
|
useEffect(() => {
|
|
@@ -25,7 +25,7 @@ const normalizeData = (award) => ({
|
|
|
25
25
|
});
|
|
26
26
|
export const AwardModal = ({ initialData, onSaveAward, onCancelAward, }) => {
|
|
27
27
|
const [isOpen, setOpen] = useState(true);
|
|
28
|
-
const valuesRef = useRef();
|
|
28
|
+
const valuesRef = useRef(null);
|
|
29
29
|
const handleSave = () => {
|
|
30
30
|
const updatedValues = valuesRef.current;
|
|
31
31
|
if (updatedValues) {
|
|
@@ -85,7 +85,7 @@ export const DraggableTree = ({ tree, view, depth, can, }) => {
|
|
|
85
85
|
const itemText = (node) => {
|
|
86
86
|
const text = nodeTitle(node);
|
|
87
87
|
let sectionNumber = node.type.name === 'section' && sectionTitleState
|
|
88
|
-
? sectionTitleState.get(node.attrs.id) ?? ''
|
|
88
|
+
? (sectionTitleState.get(node.attrs.id) ?? '')
|
|
89
89
|
: '';
|
|
90
90
|
sectionNumber = sectionNumber ? `${sectionNumber}.` : '';
|
|
91
91
|
if (text) {
|
|
@@ -101,7 +101,7 @@ const normalize = (item) => ({
|
|
|
101
101
|
});
|
|
102
102
|
export const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave, onDelete, }) => {
|
|
103
103
|
const [confirm, setConfirm] = useState(false);
|
|
104
|
-
const valuesRef = useRef();
|
|
104
|
+
const valuesRef = useRef(undefined);
|
|
105
105
|
const [selection, setSelection] = useState();
|
|
106
106
|
const selectionRef = useRef(null);
|
|
107
107
|
const isSelected = (item) => {
|
|
@@ -139,7 +139,7 @@ export const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts,
|
|
|
139
139
|
setStartIndex(Math.max(newLast - dropLimit, startIndex));
|
|
140
140
|
}
|
|
141
141
|
}, [triggers, items]);
|
|
142
|
-
const actionsRef = useRef();
|
|
142
|
+
const actionsRef = useRef(undefined);
|
|
143
143
|
const reset = () => {
|
|
144
144
|
actionsRef.current?.reset();
|
|
145
145
|
setConfirm(false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRef } from 'react';
|
|
2
2
|
export const useDoWithDebounce = () => {
|
|
3
3
|
const debounced = useRef(() => undefined);
|
|
4
|
-
const timeout = useRef();
|
|
4
|
+
const timeout = useRef(undefined);
|
|
5
5
|
const doWithDebounce = (fn, interval = 1000, flush = false) => {
|
|
6
6
|
debounced.current = fn;
|
|
7
7
|
if (flush) {
|
package/dist/es/useEditor.js
CHANGED
|
@@ -23,7 +23,7 @@ import { PopperManager } from './lib/popper';
|
|
|
23
23
|
import { useDoWithDebounce } from './lib/use-do-with-debounce';
|
|
24
24
|
import { searchReplaceKey } from './plugins/search-replace';
|
|
25
25
|
export const useEditor = (externalProps) => {
|
|
26
|
-
const view = useRef();
|
|
26
|
+
const view = useRef(undefined);
|
|
27
27
|
const props = { ...externalProps, popper: new PopperManager() };
|
|
28
28
|
const [state, setState] = useState(() => createEditorState(props));
|
|
29
29
|
const location = useLocation();
|
|
@@ -76,6 +76,10 @@ export const useEditor = (externalProps) => {
|
|
|
76
76
|
}, []);
|
|
77
77
|
const isViewingMode = props.isViewingMode;
|
|
78
78
|
const onRender = useCallback((el) => {
|
|
79
|
+
if (view.current) {
|
|
80
|
+
view.current.destroy();
|
|
81
|
+
view.current = undefined;
|
|
82
|
+
}
|
|
79
83
|
if (!el) {
|
|
80
84
|
return;
|
|
81
85
|
}
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.7.
|
|
1
|
+
export const VERSION = '3.7.8';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.7.
|
|
1
|
+
export declare const VERSION = "3.7.8";
|
|
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.7.
|
|
4
|
+
"version": "3.7.8",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@citation-js/plugin-ris": "0.7.18",
|
|
39
39
|
"@iarna/word-count": "1.1.2",
|
|
40
40
|
"@manuscripts/json-schema": "2.2.12",
|
|
41
|
-
"@manuscripts/style-guide": "3.3.
|
|
41
|
+
"@manuscripts/style-guide": "3.3.8",
|
|
42
42
|
"@manuscripts/track-changes-plugin": "2.2.1",
|
|
43
43
|
"@manuscripts/transform": "4.3.11",
|
|
44
44
|
"@popperjs/core": "2.11.8",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"prosemirror-transform": "1.10.4",
|
|
68
68
|
"prosemirror-utils": "1.2.2",
|
|
69
69
|
"prosemirror-view": "1.40.0",
|
|
70
|
-
"react": "
|
|
70
|
+
"react": "19.2.0",
|
|
71
71
|
"react-dnd": "16.0.1",
|
|
72
72
|
"react-dnd-html5-backend": "16.0.1",
|
|
73
|
-
"react-dom": "
|
|
74
|
-
"react-is": "
|
|
73
|
+
"react-dom": "19.2.0",
|
|
74
|
+
"react-is": "19.2.0",
|
|
75
75
|
"react-router-dom": "6.30.0",
|
|
76
76
|
"react-select": "5.10.1",
|
|
77
77
|
"styled-components": "5.3.11"
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"@types/jest": "30.0.0",
|
|
90
90
|
"@types/lodash": "4.17.16",
|
|
91
91
|
"@types/node": "20.17.46",
|
|
92
|
-
"@types/react": "
|
|
93
|
-
"@types/react-dom": "
|
|
92
|
+
"@types/react": "19.2.3",
|
|
93
|
+
"@types/react-dom": "19.2.3",
|
|
94
94
|
"@types/react-router-dom": "5.3.3",
|
|
95
95
|
"@types/styled-components": "5.1.34",
|
|
96
96
|
"@types/uuid": "9.0.8",
|