@manuscripts/body-editor 3.2.5 → 3.2.6
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/configs/editor-plugins.js +1 -1
- package/dist/cjs/useEditor.js +11 -2
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/contributors.js +2 -3
- package/dist/es/configs/editor-plugins.js +1 -1
- package/dist/es/useEditor.js +11 -2
- package/dist/es/versions.js +1 -1
- package/dist/es/views/contributors.js +2 -3
- package/dist/types/configs/ManuscriptsEditor.d.ts +1 -0
- package/dist/types/versions.d.ts +1 -1
- package/package.json +2 -2
- package/styles/AdvancedEditor.css +13 -0
|
@@ -58,7 +58,7 @@ exports.default = (props) => {
|
|
|
58
58
|
(0, track_changes_plugin_1.trackChangesPlugin)({
|
|
59
59
|
userID: props.userID,
|
|
60
60
|
debug: props.debug,
|
|
61
|
-
initialStatus: props.isViewingMode
|
|
61
|
+
initialStatus: props.isViewingMode || props.isComparingMode
|
|
62
62
|
? track_changes_plugin_1.TrackChangesStatus.viewSnapshots
|
|
63
63
|
: props.getCapabilities().editWithoutTracking
|
|
64
64
|
? track_changes_plugin_1.TrackChangesStatus.disabled
|
package/dist/cjs/useEditor.js
CHANGED
|
@@ -31,7 +31,14 @@ const useEditor = (externalProps) => {
|
|
|
31
31
|
const [state, setState] = (0, react_1.useState)(() => (0, ManuscriptsEditor_1.createEditorState)(props));
|
|
32
32
|
const location = (0, react_router_dom_1.useLocation)();
|
|
33
33
|
const { collabProvider } = props;
|
|
34
|
-
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
if (view.current && props.isComparingMode) {
|
|
36
|
+
const newState = (0, ManuscriptsEditor_1.createEditorState)(props);
|
|
37
|
+
setState(newState);
|
|
38
|
+
view.current.updateState(newState);
|
|
39
|
+
}
|
|
40
|
+
}, [props.doc, props.isComparingMode]);
|
|
41
|
+
if (collabProvider && !props.isComparingMode) {
|
|
35
42
|
collabProvider.onNewSteps(async () => {
|
|
36
43
|
if (state && view.current) {
|
|
37
44
|
const localVersion = (0, prosemirror_collab_1.getVersion)(view.current.state);
|
|
@@ -57,7 +64,9 @@ const useEditor = (externalProps) => {
|
|
|
57
64
|
view.current.updateState(nextState);
|
|
58
65
|
const trackState = track_changes_plugin_1.trackChangesPluginKey.getState(view.current.state);
|
|
59
66
|
if (collabProvider &&
|
|
60
|
-
(!trackState ||
|
|
67
|
+
(!trackState ||
|
|
68
|
+
trackState.status !== track_changes_plugin_1.TrackChangesStatus.viewSnapshots) &&
|
|
69
|
+
!props.isComparingMode) {
|
|
61
70
|
const sendable = (0, prosemirror_collab_1.sendableSteps)(nextState);
|
|
62
71
|
if (sendable) {
|
|
63
72
|
collabProvider.sendSteps(sendable.version, sendable.steps, sendable.clientID, false);
|
package/dist/cjs/versions.js
CHANGED
|
@@ -134,10 +134,9 @@ class ContributorsView extends block_view_1.default {
|
|
|
134
134
|
action: () => this.handleEdit(''),
|
|
135
135
|
icon: 'Edit',
|
|
136
136
|
});
|
|
137
|
-
this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
|
|
138
|
-
return this.contextMenu;
|
|
139
137
|
}
|
|
140
|
-
|
|
138
|
+
this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
|
|
139
|
+
return this.contextMenu;
|
|
141
140
|
};
|
|
142
141
|
this.actionGutterButtons = () => {
|
|
143
142
|
const contextMenu = this.authorContextMenu();
|
|
@@ -53,7 +53,7 @@ export default (props) => {
|
|
|
53
53
|
trackChangesPlugin({
|
|
54
54
|
userID: props.userID,
|
|
55
55
|
debug: props.debug,
|
|
56
|
-
initialStatus: props.isViewingMode
|
|
56
|
+
initialStatus: props.isViewingMode || props.isComparingMode
|
|
57
57
|
? TrackChangesStatus.viewSnapshots
|
|
58
58
|
: props.getCapabilities().editWithoutTracking
|
|
59
59
|
? TrackChangesStatus.disabled
|
package/dist/es/useEditor.js
CHANGED
|
@@ -28,7 +28,14 @@ export const useEditor = (externalProps) => {
|
|
|
28
28
|
const [state, setState] = useState(() => createEditorState(props));
|
|
29
29
|
const location = useLocation();
|
|
30
30
|
const { collabProvider } = props;
|
|
31
|
-
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (view.current && props.isComparingMode) {
|
|
33
|
+
const newState = createEditorState(props);
|
|
34
|
+
setState(newState);
|
|
35
|
+
view.current.updateState(newState);
|
|
36
|
+
}
|
|
37
|
+
}, [props.doc, props.isComparingMode]);
|
|
38
|
+
if (collabProvider && !props.isComparingMode) {
|
|
32
39
|
collabProvider.onNewSteps(async () => {
|
|
33
40
|
if (state && view.current) {
|
|
34
41
|
const localVersion = getVersion(view.current.state);
|
|
@@ -54,7 +61,9 @@ export const useEditor = (externalProps) => {
|
|
|
54
61
|
view.current.updateState(nextState);
|
|
55
62
|
const trackState = trackChangesPluginKey.getState(view.current.state);
|
|
56
63
|
if (collabProvider &&
|
|
57
|
-
(!trackState ||
|
|
64
|
+
(!trackState ||
|
|
65
|
+
trackState.status !== TrackChangesStatus.viewSnapshots) &&
|
|
66
|
+
!props.isComparingMode) {
|
|
58
67
|
const sendable = sendableSteps(nextState);
|
|
59
68
|
if (sendable) {
|
|
60
69
|
collabProvider.sendSteps(sendable.version, sendable.steps, sendable.clientID, false);
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.2.
|
|
1
|
+
export const VERSION = '3.2.6';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -128,10 +128,9 @@ export class ContributorsView extends BlockView {
|
|
|
128
128
|
action: () => this.handleEdit(''),
|
|
129
129
|
icon: 'Edit',
|
|
130
130
|
});
|
|
131
|
-
this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
|
|
132
|
-
return this.contextMenu;
|
|
133
131
|
}
|
|
134
|
-
|
|
132
|
+
this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu']);
|
|
133
|
+
return this.contextMenu;
|
|
135
134
|
};
|
|
136
135
|
this.actionGutterButtons = () => {
|
|
137
136
|
const contextMenu = this.authorContextMenu();
|
|
@@ -49,6 +49,7 @@ export interface EditorProps {
|
|
|
49
49
|
collabProvider?: CollabProvider;
|
|
50
50
|
navigate: NavigateFunction;
|
|
51
51
|
location: Location;
|
|
52
|
+
isComparingMode?: boolean;
|
|
52
53
|
dispatch?: Dispatch;
|
|
53
54
|
onEditorClick: (pos: number, node: ManuscriptNode, nodePos: number, event: MouseEvent) => void;
|
|
54
55
|
lockBody: boolean;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.2.
|
|
1
|
+
export declare const VERSION = "3.2.6";
|
|
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.2.
|
|
4
|
+
"version": "3.2.6",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@manuscripts/json-schema": "2.2.12",
|
|
41
41
|
"@manuscripts/style-guide": "3.1.0",
|
|
42
42
|
"@manuscripts/track-changes-plugin": "2.0.1",
|
|
43
|
-
"@manuscripts/transform": "4.2.
|
|
43
|
+
"@manuscripts/transform": "4.2.1",
|
|
44
44
|
"@popperjs/core": "2.11.8",
|
|
45
45
|
"citeproc": "2.4.63",
|
|
46
46
|
"codemirror": "5.65.19",
|
|
@@ -1053,6 +1053,19 @@ figure.block:has(.equation.selected-suggestion) {
|
|
|
1053
1053
|
border-color: var(--updated-border-color);
|
|
1054
1054
|
}
|
|
1055
1055
|
|
|
1056
|
+
/* Needed for the snapshot comparison */
|
|
1057
|
+
.tracking-visible .block-list [data-track-op="insert"][data-track-status="pending"] {
|
|
1058
|
+
background: var(--inserted-pending-bg-color);
|
|
1059
|
+
color: var(--inserted-pending-color);
|
|
1060
|
+
text-decoration: underline;
|
|
1061
|
+
}
|
|
1062
|
+
/* Needed for the snapshot comparison */
|
|
1063
|
+
.tracking-visible .block-list [data-track-op="delete"][data-track-status="pending"] {
|
|
1064
|
+
background: var(--deleted-pending-bg-color);
|
|
1065
|
+
color: var(--deleted-color);
|
|
1066
|
+
text-decoration: line-through;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1056
1069
|
.selected-suggestion.contributor,
|
|
1057
1070
|
.selected-suggestion.affiliation {
|
|
1058
1071
|
text-decoration: none !important;
|