@manuscripts/body-editor 1.7.23-LEAN-3321-2 → 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.
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.deleteIcon = exports.alertIcon = exports.editAttrsTrackingIcon = exports.commentIcon = exports.editIcon = void 0;
18
+ exports.alertIcon = exports.editAttrsTrackingIcon = exports.commentIcon = exports.editIcon = void 0;
19
19
  exports.editIcon = `
20
20
  <svg
21
21
  width="14"
@@ -118,49 +118,3 @@ exports.alertIcon = `
118
118
  />
119
119
  </svg>
120
120
  `;
121
- exports.deleteIcon = `
122
- <svg
123
- width="13"
124
- height="15"
125
- viewBox="0 0 13 15"
126
- fill="none"
127
- xmlns="http://www.w3.org/2000/svg"
128
- >
129
- <path
130
- fill-rule="evenodd"
131
- clip-rule="evenodd"
132
- d="M2.00001 3C2 3.00135 2 3.00269 2 3.00404V13.004C2 13.5563 2.44772 14.004 3 14.004H10C10.5523 14.004 11 13.5563 11 13.004V3.00404C11 3.00269 11 3.00135 11 3C11.5978 3.34581 12 3.99215 12 4.73244V13.004C12 14.1086 11.1046 15.004 10 15.004H3C1.89543 15.004 1 14.1086 1 13.004V4.73244C1 3.99215 1.4022 3.34581 2.00001 3Z"
133
- fill="#C9C9C9"
134
- />
135
- <path
136
- fill-rule="evenodd"
137
- clip-rule="evenodd"
138
- d="M4.5 0C3.67157 0 3 0.671573 3 1.5V3.5C3 4.32843 3.67157 5 4.5 5H8.5C9.32843 5 10 4.32843 10 3.5V1.5C10 0.671573 9.32843 0 8.5 0H4.5ZM9 1.5C9 1.22386 8.77614 1 8.5 1H4.5C4.22386 1 4 1.22386 4 1.5C4 1.77614 4.22386 2 4.5 2H8.5C8.77614 2 9 1.77614 9 1.5Z"
139
- fill="#C9C9C9"
140
- />
141
- <rect
142
- y="2"
143
- width="13"
144
- height="3"
145
- rx="1.5"
146
- fill="#C9C9C9"
147
- />
148
- <path
149
- fill-rule="evenodd"
150
- clip-rule="evenodd"
151
- d="M8 7.5C8 7.22386 8.22386 7 8.5 7C8.77614 7 9 7.22386 9 7.5V11.5C9 11.7761 8.77614 12 8.5 12C8.22386 12 8 11.7761 8 11.5V7.5Z"
152
- fill="#C9C9C9"
153
- />
154
- <path
155
- fill-rule="evenodd"
156
- clip-rule="evenodd"
157
- d="M4 7.5C4 7.22386 4.22386 7 4.5 7C4.77614 7 5 7.22386 5 7.5V11.5C5 11.7761 4.77614 12 4.5 12C4.22386 12 4 11.7761 4 11.5V7.5Z"
158
- fill="#C9C9C9"
159
- />
160
- <path
161
- fill-rule="evenodd"
162
- clip-rule="evenodd"
163
- d="M11.5 3C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4L1.5 4C1.22386 4 1 3.77614 1 3.5C1 3.22386 1.22386 3 1.5 3L11.5 3Z"
164
- fill="white"
165
- />
166
- </svg>`;
@@ -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)(),
@@ -62,7 +68,7 @@ exports.default = (props) => {
62
68
  (0, prosemirror_tables_1.tableEditing)(),
63
69
  (0, highlight_1.default)(props),
64
70
  (0, selected_suggestion_ui_1.default)(props),
65
- (0, footnotes_1.default)(props),
71
+ (0, footnotes_1.default)(),
66
72
  ];
67
73
  if (props.collabProvider) {
68
74
  allPlugins.push((0, prosemirror_collab_1.collab)({ version: props.collabProvider.currentVersion }));
@@ -14,9 +14,6 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
17
  Object.defineProperty(exports, "__esModule", { value: true });
21
18
  exports.uncitedFootnoteWidget = exports.buildPluginState = exports.footnotesKey = void 0;
22
19
  const transform_1 = require("@manuscripts/transform");
@@ -25,9 +22,7 @@ const prosemirror_state_1 = require("prosemirror-state");
25
22
  const prosemirror_utils_1 = require("prosemirror-utils");
26
23
  const prosemirror_view_1 = require("prosemirror-view");
27
24
  const assets_1 = require("../../assets");
28
- const DeleteFootnoteDialog_1 = require("../../components/views/DeleteFootnoteDialog");
29
25
  const utils_1 = require("../../lib/utils");
30
- const ReactSubView_1 = __importDefault(require("../../views/ReactSubView"));
31
26
  const placeholder_1 = require("../placeholder");
32
27
  const footnotes_utils_1 = require("./footnotes-utils");
33
28
  exports.footnotesKey = new prosemirror_state_1.PluginKey('footnotes');
@@ -73,32 +68,7 @@ const uncitedFootnoteWidget = () => () => {
73
68
  return element;
74
69
  };
75
70
  exports.uncitedFootnoteWidget = uncitedFootnoteWidget;
76
- const deleteFootnoteWidget = (node, pos, props, footnoteType) => (view) => {
77
- const deleteBtn = document.createElement('span');
78
- deleteBtn.className = 'delete-icon';
79
- deleteBtn.innerHTML = assets_1.deleteIcon;
80
- deleteBtn.addEventListener('click', () => {
81
- const handleDelete = () => {
82
- const tr = view.state.tr;
83
- node.content.forEach((item) => {
84
- if (item.type === transform_1.schema.nodes.paragraph) {
85
- tr.delete(pos, pos + item.nodeSize + 1);
86
- }
87
- });
88
- if (!node.childCount) {
89
- tr.delete(pos, pos + node.nodeSize);
90
- }
91
- view.dispatch(tr);
92
- };
93
- const componentProps = {
94
- footnoteType: footnoteType,
95
- handleDelete: handleDelete,
96
- };
97
- (0, ReactSubView_1.default)(Object.assign(Object.assign({}, props), { dispatch: view.dispatch }), DeleteFootnoteDialog_1.DeleteFootnoteDialog, componentProps, node, () => pos, view);
98
- });
99
- return deleteBtn;
100
- };
101
- exports.default = (props) => {
71
+ exports.default = () => {
102
72
  return new prosemirror_state_1.Plugin({
103
73
  key: exports.footnotesKey,
104
74
  state: {
@@ -130,18 +100,13 @@ exports.default = (props) => {
130
100
  props: {
131
101
  decorations: (state) => {
132
102
  const decorations = [];
133
- const tableElementFooter = (0, prosemirror_utils_1.findParentNodeOfType)(transform_1.schema.nodes.table_element_footer)(state.selection);
134
- if (tableElementFooter) {
103
+ const isInTableElementFooter = (0, prosemirror_utils_1.hasParentNodeOfType)(transform_1.schema.nodes.table_element_footer)(state.selection);
104
+ if (isInTableElementFooter) {
135
105
  const parent = (0, utils_1.findParentNodeWithIdValue)(state.selection);
136
106
  if (parent) {
137
107
  decorations.push(prosemirror_view_1.Decoration.node(parent.pos, parent.pos + parent.node.nodeSize, {
138
108
  class: 'footnote-selected',
139
109
  }));
140
- if (parent.node.type === transform_1.schema.nodes.paragraph) {
141
- decorations.push(prosemirror_view_1.Decoration.widget(parent.pos + 1, deleteFootnoteWidget(tableElementFooter.node, tableElementFooter.pos, props, 'table general note'), {
142
- key: parent.node.attrs.id,
143
- }));
144
- }
145
110
  }
146
111
  }
147
112
  const { labels } = exports.footnotesKey.getState(state);
@@ -167,10 +132,10 @@ exports.default = (props) => {
167
132
  }
168
133
  }
169
134
  if (node.type === transform_1.schema.nodes.footnotes_element) {
170
- decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
171
- class: 'table-footnotes-element',
172
- }));
173
135
  if ((parent === null || parent === void 0 ? void 0 : parent.type) === transform_1.schema.nodes.table_element_footer) {
136
+ decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
137
+ class: 'table-footnotes-element',
138
+ }));
174
139
  tableInlineFootnoteIds = (0, footnotes_utils_1.findTableInlineFootnoteIds)(state.doc.resolve(pos));
175
140
  }
176
141
  else {
@@ -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);
package/dist/es/assets.js CHANGED
@@ -115,49 +115,3 @@ export const alertIcon = `
115
115
  />
116
116
  </svg>
117
117
  `;
118
- export const deleteIcon = `
119
- <svg
120
- width="13"
121
- height="15"
122
- viewBox="0 0 13 15"
123
- fill="none"
124
- xmlns="http://www.w3.org/2000/svg"
125
- >
126
- <path
127
- fill-rule="evenodd"
128
- clip-rule="evenodd"
129
- d="M2.00001 3C2 3.00135 2 3.00269 2 3.00404V13.004C2 13.5563 2.44772 14.004 3 14.004H10C10.5523 14.004 11 13.5563 11 13.004V3.00404C11 3.00269 11 3.00135 11 3C11.5978 3.34581 12 3.99215 12 4.73244V13.004C12 14.1086 11.1046 15.004 10 15.004H3C1.89543 15.004 1 14.1086 1 13.004V4.73244C1 3.99215 1.4022 3.34581 2.00001 3Z"
130
- fill="#C9C9C9"
131
- />
132
- <path
133
- fill-rule="evenodd"
134
- clip-rule="evenodd"
135
- d="M4.5 0C3.67157 0 3 0.671573 3 1.5V3.5C3 4.32843 3.67157 5 4.5 5H8.5C9.32843 5 10 4.32843 10 3.5V1.5C10 0.671573 9.32843 0 8.5 0H4.5ZM9 1.5C9 1.22386 8.77614 1 8.5 1H4.5C4.22386 1 4 1.22386 4 1.5C4 1.77614 4.22386 2 4.5 2H8.5C8.77614 2 9 1.77614 9 1.5Z"
136
- fill="#C9C9C9"
137
- />
138
- <rect
139
- y="2"
140
- width="13"
141
- height="3"
142
- rx="1.5"
143
- fill="#C9C9C9"
144
- />
145
- <path
146
- fill-rule="evenodd"
147
- clip-rule="evenodd"
148
- d="M8 7.5C8 7.22386 8.22386 7 8.5 7C8.77614 7 9 7.22386 9 7.5V11.5C9 11.7761 8.77614 12 8.5 12C8.22386 12 8 11.7761 8 11.5V7.5Z"
149
- fill="#C9C9C9"
150
- />
151
- <path
152
- fill-rule="evenodd"
153
- clip-rule="evenodd"
154
- d="M4 7.5C4 7.22386 4.22386 7 4.5 7C4.77614 7 5 7.22386 5 7.5V11.5C5 11.7761 4.77614 12 4.5 12C4.22386 12 4 11.7761 4 11.5V7.5Z"
155
- fill="#C9C9C9"
156
- />
157
- <path
158
- fill-rule="evenodd"
159
- clip-rule="evenodd"
160
- d="M11.5 3C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4L1.5 4C1.22386 4 1 3.77614 1 3.5C1 3.22386 1.22386 3 1.5 3L11.5 3Z"
161
- fill="white"
162
- />
163
- </svg>`;
@@ -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(),
@@ -57,7 +63,7 @@ export default (props) => {
57
63
  tableEditing(),
58
64
  highlights(props),
59
65
  selected_suggestion_ui(props),
60
- footnotes(props),
66
+ footnotes(),
61
67
  ];
62
68
  if (props.collabProvider) {
63
69
  allPlugins.push(collab({ version: props.collabProvider.currentVersion }));
@@ -16,12 +16,10 @@
16
16
  import { isFootnoteNode, isInlineFootnoteNode, schema, } from '@manuscripts/transform';
17
17
  import { isEqual } from 'lodash';
18
18
  import { NodeSelection, Plugin, PluginKey } from 'prosemirror-state';
19
- import { findParentNodeOfType } from 'prosemirror-utils';
19
+ import { hasParentNodeOfType } from 'prosemirror-utils';
20
20
  import { Decoration, DecorationSet } from 'prosemirror-view';
21
- import { alertIcon, deleteIcon } from '../../assets';
22
- import { DeleteFootnoteDialog, } from '../../components/views/DeleteFootnoteDialog';
21
+ import { alertIcon } from '../../assets';
23
22
  import { findParentNodeWithIdValue } from '../../lib/utils';
24
- import ReactSubView from '../../views/ReactSubView';
25
23
  import { placeholderWidget } from '../placeholder';
26
24
  import { findTableInlineFootnoteIds } from './footnotes-utils';
27
25
  export const footnotesKey = new PluginKey('footnotes');
@@ -65,32 +63,7 @@ export const uncitedFootnoteWidget = () => () => {
65
63
  element.innerHTML = alertIcon;
66
64
  return element;
67
65
  };
68
- const deleteFootnoteWidget = (node, pos, props, footnoteType) => (view) => {
69
- const deleteBtn = document.createElement('span');
70
- deleteBtn.className = 'delete-icon';
71
- deleteBtn.innerHTML = deleteIcon;
72
- deleteBtn.addEventListener('click', () => {
73
- const handleDelete = () => {
74
- const tr = view.state.tr;
75
- node.content.forEach((item) => {
76
- if (item.type === schema.nodes.paragraph) {
77
- tr.delete(pos, pos + item.nodeSize + 1);
78
- }
79
- });
80
- if (!node.childCount) {
81
- tr.delete(pos, pos + node.nodeSize);
82
- }
83
- view.dispatch(tr);
84
- };
85
- const componentProps = {
86
- footnoteType: footnoteType,
87
- handleDelete: handleDelete,
88
- };
89
- ReactSubView(Object.assign(Object.assign({}, props), { dispatch: view.dispatch }), DeleteFootnoteDialog, componentProps, node, () => pos, view);
90
- });
91
- return deleteBtn;
92
- };
93
- export default (props) => {
66
+ export default () => {
94
67
  return new Plugin({
95
68
  key: footnotesKey,
96
69
  state: {
@@ -122,18 +95,13 @@ export default (props) => {
122
95
  props: {
123
96
  decorations: (state) => {
124
97
  const decorations = [];
125
- const tableElementFooter = findParentNodeOfType(schema.nodes.table_element_footer)(state.selection);
126
- if (tableElementFooter) {
98
+ const isInTableElementFooter = hasParentNodeOfType(schema.nodes.table_element_footer)(state.selection);
99
+ if (isInTableElementFooter) {
127
100
  const parent = findParentNodeWithIdValue(state.selection);
128
101
  if (parent) {
129
102
  decorations.push(Decoration.node(parent.pos, parent.pos + parent.node.nodeSize, {
130
103
  class: 'footnote-selected',
131
104
  }));
132
- if (parent.node.type === schema.nodes.paragraph) {
133
- decorations.push(Decoration.widget(parent.pos + 1, deleteFootnoteWidget(tableElementFooter.node, tableElementFooter.pos, props, 'table general note'), {
134
- key: parent.node.attrs.id,
135
- }));
136
- }
137
105
  }
138
106
  }
139
107
  const { labels } = footnotesKey.getState(state);
@@ -159,10 +127,10 @@ export default (props) => {
159
127
  }
160
128
  }
161
129
  if (node.type === schema.nodes.footnotes_element) {
162
- decorations.push(Decoration.node(pos, pos + node.nodeSize, {
163
- class: 'table-footnotes-element',
164
- }));
165
130
  if ((parent === null || parent === void 0 ? void 0 : parent.type) === schema.nodes.table_element_footer) {
131
+ decorations.push(Decoration.node(pos, pos + node.nodeSize, {
132
+ class: 'table-footnotes-element',
133
+ }));
166
134
  tableInlineFootnoteIds = findTableInlineFootnoteIds(state.doc.resolve(pos));
167
135
  }
168
136
  else {
@@ -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);
@@ -17,4 +17,3 @@ export declare const editIcon = "\n <svg\n width=\"14\"\n height=\"14\"\n
17
17
  export declare const commentIcon = "\n<svg\n width=\"20\"\n height=\"15\"\n viewBox=\"0 0 20 15\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M7.94841 4.18311C7.98238 3.9602 8 3.73191 8 3.49951C8 3.22073 7.97465 2.94787 7.92613 2.68311H13.5C14.8854 2.68311 16.25 3.6425 16.25 5.09977V9.02453L19.1086 12.9949C19.2731 13.2233 19.2958 13.5245 19.1675 13.775C19.0392 14.0255 18.7814 14.1831 18.5 14.1831H5.5C4.11463 14.1831 2.75 13.2237 2.75 11.7664V7.93729C2.9939 7.97821 3.24446 7.99951 3.5 7.99951C3.75553 7.99951 4.00609 7.97821 4.25 7.93729V11.7664C4.25 12.1508 4.67537 12.6831 5.5 12.6831H17.0358L14.8913 9.70467C14.7994 9.57703 14.75 9.42372 14.75 9.26644V5.09977C14.75 4.71538 14.3246 4.18311 13.5 4.18311H7.94841Z\"\n fill=\"#FFBD26\"\n />\n <path\n d=\"M11.5 6.99951H8.5\"\n stroke=\"#FFBD26\"\n stroke-width=\"1.5\"\n stroke-miterlimit=\"10\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n <path\n d=\"M12 9.99951H7\"\n stroke=\"#FFBD26\"\n stroke-width=\"1.5\"\n stroke-miterlimit=\"10\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n <path\n d=\"M3.5 1L3.5 6\"\n stroke=\"#FFBD26\"\n stroke-width=\"1.5\"\n stroke-miterlimit=\"10\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n <path\n d=\"M6 3.5L1 3.5\"\n stroke=\"#FFBD26\"\n stroke-width=\"1.5\"\n stroke-miterlimit=\"10\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n";
18
18
  export declare const editAttrsTrackingIcon = "\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M12 2L14 4L9 9L6 10L7 7L12 2Z\"\n stroke=\"#353535\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n <path\n d=\"M13 10V11.5C13 12.328 12.328 13 11.5 13H4.5C3.672 13 3 12.328 3 11.5V4.5C3 3.672 3.672 3 4.5 3H6\"\n stroke=\"#353535\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n";
19
19
  export declare const alertIcon = "\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 12 12\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M6 12C2.68629 12 1.18852e-06 9.31371 1.47821e-06 6C1.7679e-06 2.68629 2.68629 1.39444e-07 6 4.29138e-07C9.31371 7.18831e-07 12 2.68629 12 6C12 9.31371 9.31371 12 6 12ZM6.74998 2.99996L6.75 6.37462C6.75 6.78819 6.41522 7.12243 6.00166 7.12334C5.58681 7.12426 5.25001 6.78821 5.25001 6.37335L5.25 3.00082C5.25 2.58629 5.58629 2.25037 6.00082 2.25083C6.4147 2.25128 6.74998 2.58607 6.74998 2.99996ZM6.75 8.99263C6.75 9.46884 6.47288 9.75 5.99853 9.75C5.52419 9.75 5.25 9.47179 5.25 8.99558C5.25 8.51937 5.52421 8.25 5.99855 8.25C6.47289 8.25 6.75 8.51642 6.75 8.99263Z\"\n fill=\"#FE8F1F\"\n />\n </svg>\n";
20
- export declare const deleteIcon = "\n <svg \n width=\"13\" \n height=\"15\" \n viewBox=\"0 0 13 15\" \n fill=\"none\" \n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path \n fill-rule=\"evenodd\" \n clip-rule=\"evenodd\" \n d=\"M2.00001 3C2 3.00135 2 3.00269 2 3.00404V13.004C2 13.5563 2.44772 14.004 3 14.004H10C10.5523 14.004 11 13.5563 11 13.004V3.00404C11 3.00269 11 3.00135 11 3C11.5978 3.34581 12 3.99215 12 4.73244V13.004C12 14.1086 11.1046 15.004 10 15.004H3C1.89543 15.004 1 14.1086 1 13.004V4.73244C1 3.99215 1.4022 3.34581 2.00001 3Z\" \n fill=\"#C9C9C9\"\n />\n <path \n fill-rule=\"evenodd\" \n clip-rule=\"evenodd\" \n d=\"M4.5 0C3.67157 0 3 0.671573 3 1.5V3.5C3 4.32843 3.67157 5 4.5 5H8.5C9.32843 5 10 4.32843 10 3.5V1.5C10 0.671573 9.32843 0 8.5 0H4.5ZM9 1.5C9 1.22386 8.77614 1 8.5 1H4.5C4.22386 1 4 1.22386 4 1.5C4 1.77614 4.22386 2 4.5 2H8.5C8.77614 2 9 1.77614 9 1.5Z\" \n fill=\"#C9C9C9\"\n />\n <rect \n y=\"2\" \n width=\"13\" \n height=\"3\" \n rx=\"1.5\" \n fill=\"#C9C9C9\"\n />\n <path \n fill-rule=\"evenodd\" \n clip-rule=\"evenodd\" \n d=\"M8 7.5C8 7.22386 8.22386 7 8.5 7C8.77614 7 9 7.22386 9 7.5V11.5C9 11.7761 8.77614 12 8.5 12C8.22386 12 8 11.7761 8 11.5V7.5Z\" \n fill=\"#C9C9C9\"\n />\n <path \n fill-rule=\"evenodd\" \n clip-rule=\"evenodd\" \n d=\"M4 7.5C4 7.22386 4.22386 7 4.5 7C4.77614 7 5 7.22386 5 7.5V11.5C5 11.7761 4.77614 12 4.5 12C4.22386 12 4 11.7761 4 11.5V7.5Z\" \n fill=\"#C9C9C9\"\n />\n <path \n fill-rule=\"evenodd\" \n clip-rule=\"evenodd\" \n d=\"M11.5 3C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4L1.5 4C1.22386 4 1 3.77614 1 3.5C1 3.22386 1.22386 3 1.5 3L11.5 3Z\" \n fill=\"white\"\n />\n</svg>";
@@ -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;
@@ -22,7 +22,7 @@ import { Plugin } from 'prosemirror-state';
22
22
  import { CollabProvider } from '../classes/collabProvider';
23
23
  import { PopperManager } from '../lib/popper';
24
24
  import { CSLProps } from './ManuscriptsEditor';
25
- export interface PluginProps {
25
+ interface PluginProps {
26
26
  getManuscript: () => Manuscript;
27
27
  setComment: (comment?: CommentAnnotation) => void;
28
28
  setSelectedComment: (id?: string) => void;
@@ -32,6 +32,8 @@ export 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;
@@ -15,7 +15,6 @@
15
15
  */
16
16
  import { InlineFootnoteNode, ManuscriptNode } from '@manuscripts/transform';
17
17
  import { Plugin, PluginKey } from 'prosemirror-state';
18
- import { PluginProps } from '../../configs/editor-plugins';
19
18
  interface PluginState {
20
19
  nodes: [InlineFootnoteNode, number][];
21
20
  labels: Map<string, string>;
@@ -23,5 +22,5 @@ interface PluginState {
23
22
  export declare const footnotesKey: PluginKey<PluginState>;
24
23
  export declare const buildPluginState: (doc: ManuscriptNode) => PluginState;
25
24
  export declare const uncitedFootnoteWidget: () => () => HTMLSpanElement;
26
- declare const _default: (props: PluginProps) => Plugin<PluginState>;
25
+ declare const _default: () => Plugin<PluginState>;
27
26
  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-LEAN-3321-2",
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,9 +31,9 @@
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",
36
- "@manuscripts/transform": "2.1.7-LEAN-3321",
34
+ "@manuscripts/style-guide": "1.8.1",
35
+ "@manuscripts/track-changes-plugin": "1.7.8",
36
+ "@manuscripts/transform": "^2.1.6",
37
37
  "astrocite-eutils": "^0.16.4",
38
38
  "axios": "^1.6.7",
39
39
  "mathjax-full": "^3.2.2",
@@ -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
+ }
package/styles/Editor.css CHANGED
@@ -954,21 +954,8 @@
954
954
  .ProseMirror .table-footnotes-element {
955
955
  counter-reset: table_footnote;
956
956
  }
957
- .table-footer .delete-icon {
958
- display: none;
959
- position: absolute;
960
- right: -20px;
961
- top: -13px;
962
- cursor: pointer;
963
- z-index: 1;
964
- }
965
- .table-footer .delete-icon:hover svg path {
966
- fill: #353535;
967
- }
968
- .table-footer .table-footnotes-element .delete-icon { /* remove this after implemnting LEAN-3143*/
969
- display: none !important;
970
- }
971
- .ProseMirror .table-footer .table-footnotes-element > div:not(:has(.unctied-table-footnote)) p::before {
957
+
958
+ .ProseMirror .table-footnotes-element > div:not(:has(.unctied-table-footnote)) p::before {
972
959
  counter-increment: table_footnote;
973
960
  content: counter(table_footnote);
974
961
  display: inline-block;
@@ -988,20 +975,9 @@
988
975
  background-color: #f2fbfc;
989
976
  padding: 4px;
990
977
  }
991
-
992
- .ProseMirror .table-footer .footnote-selected .delete-icon ,.ProseMirror .table-footer .footnote-selected .deleted.rejected .delete-icon {
993
- display: block;
994
- }
995
- .ProseMirror table .deleted-footnote::before , .ProseMirror .table-footer .deleted-footnote::before{
996
- content: '' !important;
997
- }
998
978
  .table-footer > div > p {
999
979
  padding-bottom: 10px;
1000
980
  }
1001
- .ProseMirror .table-footer .footnote-selected {
1002
- position: relative;
1003
- }
1004
-
1005
981
  .ProseMirror .table-footnotes-element .footnote-selected {
1006
982
  border: 1px solid #bce7f6;
1007
983
  }
@@ -1052,4 +1028,4 @@
1052
1028
  }
1053
1029
  .highlight {
1054
1030
  background-color: #ffeebf !important;
1055
- }
1031
+ }
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.DeleteFootnoteDialog = void 0;
27
- const style_guide_1 = require("@manuscripts/style-guide");
28
- const react_1 = __importStar(require("react"));
29
- const DeleteFootnoteDialog = ({ footnoteType, handleDelete, }) => {
30
- const [isOpen, setOpen] = (0, react_1.useState)(true);
31
- return (react_1.default.createElement(style_guide_1.Dialog, { isOpen: isOpen, actions: {
32
- primary: {
33
- action: () => setOpen(false),
34
- title: 'Cancel',
35
- },
36
- secondary: {
37
- action: () => {
38
- setOpen(false);
39
- handleDelete();
40
- },
41
- title: 'Delete',
42
- },
43
- }, category: style_guide_1.Category.confirmation, header: `Delete ${footnoteType}`, message: `This action will entirely remove the ${footnoteType}
44
- ` }));
45
- };
46
- exports.DeleteFootnoteDialog = DeleteFootnoteDialog;
@@ -1,19 +0,0 @@
1
- import { Category, Dialog } from '@manuscripts/style-guide';
2
- import React, { useState } from 'react';
3
- export const DeleteFootnoteDialog = ({ footnoteType, handleDelete, }) => {
4
- const [isOpen, setOpen] = useState(true);
5
- return (React.createElement(Dialog, { isOpen: isOpen, actions: {
6
- primary: {
7
- action: () => setOpen(false),
8
- title: 'Cancel',
9
- },
10
- secondary: {
11
- action: () => {
12
- setOpen(false);
13
- handleDelete();
14
- },
15
- title: 'Delete',
16
- },
17
- }, category: Category.confirmation, header: `Delete ${footnoteType}`, message: `This action will entirely remove the ${footnoteType}
18
- ` }));
19
- };
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- export interface DeleteFootnoteDialogProps {
3
- footnoteType: string;
4
- handleDelete: () => void;
5
- }
6
- export declare const DeleteFootnoteDialog: React.FC<DeleteFootnoteDialogProps>;