@manuscripts/body-editor 2.8.73 → 2.8.74
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/outline/DraggableTree.js +3 -1
- package/dist/cjs/configs/editor-plugins.js +3 -1
- package/dist/cjs/useEditor.js +4 -3
- package/dist/cjs/versions.js +1 -1
- package/dist/es/components/outline/DraggableTree.js +3 -1
- package/dist/es/configs/editor-plugins.js +3 -1
- package/dist/es/useEditor.js +4 -3
- package/dist/es/versions.js +1 -1
- package/dist/types/versions.d.ts +1 -1
- package/package.json +2 -2
|
@@ -95,7 +95,9 @@ const DraggableTree = ({ tree, view, depth, can, }) => {
|
|
|
95
95
|
const [dropSide, setDropSide] = (0, react_1.useState)();
|
|
96
96
|
const [isOpen, setOpen] = (0, react_1.useState)(depth === 0);
|
|
97
97
|
const ref = (0, react_1.useRef)(null);
|
|
98
|
-
const disableDragAndDrop = view
|
|
98
|
+
const disableDragAndDrop = view
|
|
99
|
+
? (0, utils_1.isBodyLocked)(view.state) || !(can === null || can === void 0 ? void 0 : can.editArticle)
|
|
100
|
+
: true;
|
|
99
101
|
const { node, items, parent } = tree;
|
|
100
102
|
const itemText = (node) => {
|
|
101
103
|
const text = (0, transform_1.nodeTitle)(node);
|
|
@@ -59,7 +59,9 @@ exports.default = (props) => {
|
|
|
59
59
|
debug: props.debug,
|
|
60
60
|
initialStatus: props.getCapabilities().editWithoutTracking
|
|
61
61
|
? track_changes_plugin_1.TrackChangesStatus.disabled
|
|
62
|
-
:
|
|
62
|
+
: props.getCapabilities().editArticle
|
|
63
|
+
? track_changes_plugin_1.TrackChangesStatus.enabled
|
|
64
|
+
: track_changes_plugin_1.TrackChangesStatus.viewSnapshots,
|
|
63
65
|
}),
|
|
64
66
|
(0, section_title_1.default)(),
|
|
65
67
|
(0, tables_cursor_fix_1.default)(),
|
package/dist/cjs/useEditor.js
CHANGED
|
@@ -77,14 +77,15 @@ const useEditor = (externalProps) => {
|
|
|
77
77
|
}, 250, !tr.isGeneric || !tr.docChanged || !tr.getMeta(search_replace_1.searchReplaceKey));
|
|
78
78
|
return nextState;
|
|
79
79
|
}, []);
|
|
80
|
+
const canEdit = props.getCapabilities().editArticle;
|
|
80
81
|
const onRender = (0, react_1.useCallback)((el) => {
|
|
81
|
-
var _a;
|
|
82
82
|
if (!el) {
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
const freshState = (0, ManuscriptsEditor_1.createEditorState)(props);
|
|
86
|
+
view.current = (0, ManuscriptsEditor_1.createEditorView)(props, el, freshState || state, dispatch);
|
|
86
87
|
setState(view.current.state);
|
|
87
|
-
}, []);
|
|
88
|
+
}, [canEdit]);
|
|
88
89
|
const isCommandValid = (0, react_1.useCallback)((command) => command(state), [state]);
|
|
89
90
|
const doCommand = (0, react_1.useCallback)((command) => command(state, dispatch, view.current), [state, dispatch]);
|
|
90
91
|
const replaceState = (0, react_1.useCallback)((state) => {
|
package/dist/cjs/versions.js
CHANGED
|
@@ -68,7 +68,9 @@ export const DraggableTree = ({ tree, view, depth, can, }) => {
|
|
|
68
68
|
const [dropSide, setDropSide] = useState();
|
|
69
69
|
const [isOpen, setOpen] = useState(depth === 0);
|
|
70
70
|
const ref = useRef(null);
|
|
71
|
-
const disableDragAndDrop = view
|
|
71
|
+
const disableDragAndDrop = view
|
|
72
|
+
? isBodyLocked(view.state) || !(can === null || can === void 0 ? void 0 : can.editArticle)
|
|
73
|
+
: true;
|
|
72
74
|
const { node, items, parent } = tree;
|
|
73
75
|
const itemText = (node) => {
|
|
74
76
|
const text = nodeTitle(node);
|
|
@@ -54,7 +54,9 @@ export default (props) => {
|
|
|
54
54
|
debug: props.debug,
|
|
55
55
|
initialStatus: props.getCapabilities().editWithoutTracking
|
|
56
56
|
? TrackChangesStatus.disabled
|
|
57
|
-
:
|
|
57
|
+
: props.getCapabilities().editArticle
|
|
58
|
+
? TrackChangesStatus.enabled
|
|
59
|
+
: TrackChangesStatus.viewSnapshots,
|
|
58
60
|
}),
|
|
59
61
|
section_title(),
|
|
60
62
|
table_editing_fix(),
|
package/dist/es/useEditor.js
CHANGED
|
@@ -74,14 +74,15 @@ export const useEditor = (externalProps) => {
|
|
|
74
74
|
}, 250, !tr.isGeneric || !tr.docChanged || !tr.getMeta(searchReplaceKey));
|
|
75
75
|
return nextState;
|
|
76
76
|
}, []);
|
|
77
|
+
const canEdit = props.getCapabilities().editArticle;
|
|
77
78
|
const onRender = useCallback((el) => {
|
|
78
|
-
var _a;
|
|
79
79
|
if (!el) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
const freshState = createEditorState(props);
|
|
83
|
+
view.current = createEditorView(props, el, freshState || state, dispatch);
|
|
83
84
|
setState(view.current.state);
|
|
84
|
-
}, []);
|
|
85
|
+
}, [canEdit]);
|
|
85
86
|
const isCommandValid = useCallback((command) => command(state), [state]);
|
|
86
87
|
const doCommand = useCallback((command) => command(state, dispatch, view.current), [state, dispatch]);
|
|
87
88
|
const replaceState = useCallback((state) => {
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.8.
|
|
1
|
+
export const VERSION = '2.8.74';
|
|
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 = "2.8.
|
|
1
|
+
export declare const VERSION = "2.8.74";
|
|
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.8.
|
|
4
|
+
"version": "2.8.74",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@iarna/word-count": "^1.1.2",
|
|
33
33
|
"@manuscripts/json-schema": "2.2.11",
|
|
34
34
|
"@manuscripts/library": "1.3.14",
|
|
35
|
-
"@manuscripts/style-guide": "2.1.
|
|
35
|
+
"@manuscripts/style-guide": "2.1.12",
|
|
36
36
|
"@manuscripts/track-changes-plugin": "1.10.7",
|
|
37
37
|
"@manuscripts/transform": "3.0.67",
|
|
38
38
|
"@popperjs/core": "^2.11.8",
|