@manuscripts/body-editor 1.7.23 → 1.7.24

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.
@@ -20,6 +20,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  require("prosemirror-gapcursor/style/gapcursor.css");
22
22
  require("prosemirror-tables/style/tables.css");
23
+ const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
23
24
  const prosemirror_collab_1 = require("prosemirror-collab");
24
25
  const prosemirror_dropcursor_1 = require("prosemirror-dropcursor");
25
26
  const prosemirror_history_1 = require("prosemirror-history");
@@ -41,13 +42,18 @@ const tables_cursor_fix_1 = __importDefault(require("../plugins/tables-cursor-fi
41
42
  const toc_1 = __importDefault(require("../plugins/toc"));
42
43
  const rules_1 = __importDefault(require("../rules"));
43
44
  exports.default = (props) => {
44
- const plugins = props.plugins || [];
45
45
  const allPlugins = [
46
46
  rules_1.default,
47
47
  ...keys_1.default,
48
48
  (0, prosemirror_dropcursor_1.dropCursor)(),
49
49
  (0, prosemirror_history_1.history)(),
50
- ...plugins,
50
+ (0, track_changes_plugin_1.trackChangesPlugin)({
51
+ userID: props.userID,
52
+ debug: props.debug,
53
+ initialStatus: props.getCapabilities().editWithoutTracking
54
+ ? track_changes_plugin_1.TrackChangesStatus.disabled
55
+ : track_changes_plugin_1.TrackChangesStatus.enabled,
56
+ }),
51
57
  (0, tables_cursor_fix_1.default)(),
52
58
  (0, elements_1.default)(),
53
59
  (0, persist_1.default)(),
@@ -81,10 +81,8 @@ exports.defaultEditorProps = {
81
81
  locale: '',
82
82
  },
83
83
  getCitationProvider: () => undefined,
84
- plugins: [],
85
84
  retrySync: () => Promise.resolve(),
86
85
  setComment: () => undefined,
87
86
  setSelectedComment: () => undefined,
88
87
  setEditorSelectedSuggestion: () => undefined,
89
- environment: undefined,
90
88
  };
@@ -60,8 +60,7 @@ const useEditor = (props) => {
60
60
  view.current.updateState(nextState);
61
61
  const trackState = track_changes_plugin_1.trackChangesPluginKey.getState(view.current.state);
62
62
  if (collabProvider &&
63
- trackState &&
64
- trackState.status !== track_changes_plugin_1.TrackChangesStatus.viewSnapshots) {
63
+ (!trackState || trackState.status !== track_changes_plugin_1.TrackChangesStatus.viewSnapshots)) {
65
64
  const sendable = (0, prosemirror_collab_1.sendableSteps)(nextState);
66
65
  if (sendable) {
67
66
  collabProvider.sendSteps(sendable.version, sendable.steps, sendable.clientID, !tr.isGeneric);
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import 'prosemirror-gapcursor/style/gapcursor.css';
17
17
  import 'prosemirror-tables/style/tables.css';
18
+ import { trackChangesPlugin, TrackChangesStatus, } from '@manuscripts/track-changes-plugin';
18
19
  import { collab } from 'prosemirror-collab';
19
20
  import { dropCursor } from 'prosemirror-dropcursor';
20
21
  import { history } from 'prosemirror-history';
@@ -36,13 +37,18 @@ import table_editing_fix from '../plugins/tables-cursor-fix';
36
37
  import toc from '../plugins/toc';
37
38
  import rules from '../rules';
38
39
  export default (props) => {
39
- const plugins = props.plugins || [];
40
40
  const allPlugins = [
41
41
  rules,
42
42
  ...keys,
43
43
  dropCursor(),
44
44
  history(),
45
- ...plugins,
45
+ trackChangesPlugin({
46
+ userID: props.userID,
47
+ debug: props.debug,
48
+ initialStatus: props.getCapabilities().editWithoutTracking
49
+ ? TrackChangesStatus.disabled
50
+ : TrackChangesStatus.enabled,
51
+ }),
46
52
  table_editing_fix(),
47
53
  elements(),
48
54
  persist(),
@@ -75,10 +75,8 @@ export const defaultEditorProps = {
75
75
  locale: '',
76
76
  },
77
77
  getCitationProvider: () => undefined,
78
- plugins: [],
79
78
  retrySync: () => Promise.resolve(),
80
79
  setComment: () => undefined,
81
80
  setSelectedComment: () => undefined,
82
81
  setEditorSelectedSuggestion: () => undefined,
83
- environment: undefined,
84
82
  };
@@ -57,8 +57,7 @@ export const useEditor = (props) => {
57
57
  view.current.updateState(nextState);
58
58
  const trackState = trackChangesPluginKey.getState(view.current.state);
59
59
  if (collabProvider &&
60
- trackState &&
61
- trackState.status !== TrackChangesStatus.viewSnapshots) {
60
+ (!trackState || trackState.status !== TrackChangesStatus.viewSnapshots)) {
62
61
  const sendable = sendableSteps(nextState);
63
62
  if (sendable) {
64
63
  collabProvider.sendSteps(sendable.version, sendable.steps, sendable.clientID, !tr.isGeneric);
@@ -18,7 +18,7 @@ import { CommentAnnotation, Manuscript, UserProfile } from '@manuscripts/json-sc
18
18
  import { Capabilities, FileAttachment, FileManagement } from '@manuscripts/style-guide';
19
19
  import { ManuscriptNode } from '@manuscripts/transform';
20
20
  import { History } from 'history';
21
- import { EditorState, Plugin } from 'prosemirror-state';
21
+ import { EditorState } from 'prosemirror-state';
22
22
  import { EditorView } from 'prosemirror-view';
23
23
  import { DefaultTheme } from 'styled-components';
24
24
  import { CollabProvider } from '../classes/collabProvider';
@@ -34,7 +34,6 @@ export interface EditorProps {
34
34
  };
35
35
  locale: string;
36
36
  theme: DefaultTheme;
37
- plugins?: Plugin[];
38
37
  getCurrentUser: () => UserProfile;
39
38
  projectID: string;
40
39
  doc: ManuscriptNode;
@@ -44,12 +43,13 @@ export interface EditorProps {
44
43
  popper: PopperManager;
45
44
  history: History;
46
45
  getCapabilities: () => Capabilities;
46
+ userID: string;
47
+ debug: boolean;
47
48
  cslProps: CSLProps;
48
49
  setComment: (comment?: CommentAnnotation) => void;
49
50
  setSelectedComment: (id?: string) => void;
50
51
  setEditorSelectedSuggestion: (id?: string) => void;
51
52
  retrySync: (componentIDs: string[]) => Promise<void>;
52
- environment?: string;
53
53
  collabProvider?: CollabProvider;
54
54
  }
55
55
  export declare const createEditorState: (props: EditorProps) => EditorState;
@@ -32,6 +32,8 @@ interface PluginProps {
32
32
  cslProps: CSLProps;
33
33
  popper: PopperManager;
34
34
  collabProvider?: CollabProvider;
35
+ userID: string;
36
+ debug: boolean;
35
37
  }
36
38
  declare const _default: (props: PluginProps) => any[];
37
39
  export default _default;
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": "1.7.23",
4
+ "version": "1.7.24",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -31,8 +31,8 @@
31
31
  "@manuscripts/assets": "^0.6.4",
32
32
  "@manuscripts/json-schema": "^2.2.6",
33
33
  "@manuscripts/library": "^1.3.5",
34
- "@manuscripts/style-guide": "^1.8.0",
35
- "@manuscripts/track-changes-plugin": "^1.7.7",
34
+ "@manuscripts/style-guide": "1.8.1",
35
+ "@manuscripts/track-changes-plugin": "1.7.8",
36
36
  "@manuscripts/transform": "^2.1.6",
37
37
  "astrocite-eutils": "^0.16.4",
38
38
  "axios": "^1.6.7",
@@ -109,6 +109,7 @@
109
109
  "uuid": "^9.0.0"
110
110
  },
111
111
  "resolutions": {
112
- "@types/react": "^17.0.2"
112
+ "@types/react": "^17.0.2",
113
+ "prosemirror-tables": "^1.3.5"
113
114
  }
114
115
  }