@manuscripts/body-editor 3.5.0 → 3.5.2

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.
@@ -319,7 +319,7 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
319
319
  valuesRef.current = { ...updatedValues, priority: values.priority };
320
320
  const { given, family } = values.bibliographicName;
321
321
  const { email, isCorresponding } = values;
322
- const isNameFilled = given?.length && family?.length;
322
+ const isNameFilled = given?.length || family?.length;
323
323
  if (hasChanges && isNameFilled) {
324
324
  if (isCorresponding) {
325
325
  setDisableSave(!email?.length);
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.changeIndentation = exports.unindentParagraph = exports.unindentSection = exports.indentParagraph = exports.indentSection = exports.isIndentationAllowed = exports.promoteParagraphToSection = exports.demoteSectionToParagraph = exports.findSelectedOption = exports.titleCase = exports.optionName = void 0;
3
+ exports.changeIndentation = exports.unindentParagraph = exports.unindentSection = exports.indentParagraph = exports.indentSection = exports.isIndentationAllowed = exports.promoteParagraphToSection = exports.demoteSectionToParagraph = exports.findSelectedOption = exports.titleCase = exports.optionName = exports.shouldSkipNode = void 0;
4
4
  const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
5
5
  const transform_1 = require("@manuscripts/transform");
6
6
  const prosemirror_model_1 = require("prosemirror-model");
7
7
  const prosemirror_state_1 = require("prosemirror-state");
8
8
  const prosemirror_utils_1 = require("prosemirror-utils");
9
+ const filtered_document_1 = require("../../lib/filtered-document");
9
10
  const track_changes_utils_1 = require("../../lib/track-changes-utils");
11
+ const shouldSkipNode = (node) => {
12
+ return (0, filtered_document_1.isMoved)(node) || (0, track_changes_utils_1.isDeleted)(node);
13
+ };
14
+ exports.shouldSkipNode = shouldSkipNode;
10
15
  const optionName = (nodeType) => {
11
16
  switch (nodeType) {
12
17
  case nodeType.schema.nodes.section:
@@ -183,24 +188,46 @@ const indentSection = () => (state, dispatch, view) => {
183
188
  const parentSectionDepth = sectionDepth - 1;
184
189
  const parentSection = $from.node(parentSectionDepth);
185
190
  const startIndex = $from.index(parentSectionDepth);
186
- const previousSection = startIndex > 0 ? parentSection.child(startIndex - 1) : null;
187
- const isValidContainer = previousSection?.type === nodes.section;
191
+ let previousSection = null;
192
+ for (let i = startIndex - 1; i >= 0; i--) {
193
+ const candidate = parentSection.child(i);
194
+ if (candidate.type === nodes.section && !(0, exports.shouldSkipNode)(candidate)) {
195
+ previousSection = candidate;
196
+ break;
197
+ }
198
+ }
188
199
  let anchor;
189
- if (!previousSection || !isValidContainer) {
200
+ if (!previousSection) {
190
201
  const emptyTitle = nodes.section_title.create();
191
202
  const newParentSectionContent = prosemirror_model_1.Fragment.fromArray([emptyTitle, section]);
192
203
  const newParentSection = nodes.section.create({}, newParentSectionContent);
193
- tr.replaceWith(beforeSection, afterSection, newParentSection);
204
+ tr.insert(beforeSection, newParentSection);
205
+ const newBeforeSection = beforeSection + newParentSection.nodeSize;
206
+ const newAfterSection = afterSection + newParentSection.nodeSize;
207
+ tr.delete(newBeforeSection, newAfterSection);
194
208
  anchor = beforeSection + 1;
195
209
  }
196
210
  else {
197
- const newPreviousSection = previousSection.copy(previousSection.content.append(prosemirror_model_1.Fragment.from(section)));
198
- const beforePreviousSection = beforeSection - previousSection.nodeSize;
199
- tr.replaceWith(beforePreviousSection, afterSection, newPreviousSection);
200
- anchor = beforePreviousSection + 1;
211
+ let beforePreviousSection = null;
212
+ $from.doc.descendants((node, pos) => {
213
+ if (node === previousSection) {
214
+ beforePreviousSection = pos;
215
+ return false;
216
+ }
217
+ });
218
+ if (beforePreviousSection === null) {
219
+ return false;
220
+ }
221
+ const insertPos = beforePreviousSection + previousSection.nodeSize - 1;
222
+ tr.insert(insertPos, section);
223
+ const newBeforeSection = beforeSection + section.nodeSize;
224
+ const newAfterSection = afterSection + section.nodeSize;
225
+ tr.delete(newBeforeSection, newAfterSection);
226
+ anchor = insertPos + 1;
201
227
  }
202
228
  tr.setSelection(prosemirror_state_1.TextSelection.create(tr.doc, anchor));
203
- dispatch((0, track_changes_plugin_1.skipTracking)(tr));
229
+ (0, track_changes_plugin_1.setAction)(tr, track_changes_plugin_1.TrackChangesAction.indentationAction, { action: 'indent' });
230
+ dispatch(tr);
204
231
  view && view.focus();
205
232
  };
206
233
  exports.indentSection = indentSection;
@@ -214,15 +241,16 @@ const indentParagraph = () => (state, dispatch, view) => {
214
241
  const sectionEnd = $from.end(sectionDepth);
215
242
  const sectionContent = prosemirror_model_1.Fragment.from(schema.nodes.section_title.create()).append(parentSection.content.cut(beforeParagraph - sectionStart));
216
243
  const newSection = schema.nodes.section.create({ id: (0, transform_1.generateNodeID)(schema.nodes.section) }, sectionContent);
217
- tr.replaceWith(beforeParagraph, sectionEnd, newSection);
218
- tr.setSelection(prosemirror_state_1.TextSelection.create(tr.doc, beforeParagraph + 2));
219
- dispatch((0, track_changes_plugin_1.skipTracking)(tr));
244
+ (0, track_changes_plugin_1.setAction)(tr, track_changes_plugin_1.TrackChangesAction.indentationAction, { action: 'indent' });
245
+ tr.delete(beforeParagraph, sectionEnd);
246
+ tr.insert(beforeParagraph, newSection);
247
+ tr.setSelection(prosemirror_state_1.TextSelection.create(tr.doc, beforeParagraph + newSection.nodeSize - 2));
248
+ dispatch(tr);
220
249
  view?.focus();
221
250
  };
222
251
  exports.indentParagraph = indentParagraph;
223
252
  const unindentSection = () => (state, dispatch, view) => {
224
- const { selection: { $from }, schema, tr, } = state;
225
- const { nodes } = schema;
253
+ const { selection: { $from }, tr, } = state;
226
254
  const sectionDepth = $from.depth - 1;
227
255
  const section = $from.node(sectionDepth);
228
256
  const beforeSection = $from.before(sectionDepth);
@@ -232,26 +260,20 @@ const unindentSection = () => (state, dispatch, view) => {
232
260
  const afterSectionOffset = beforeSectionOffset + section.nodeSize;
233
261
  const parentSectionDepth = $from.depth - 2;
234
262
  const parentSection = $from.node(parentSectionDepth);
235
- const startIndex = $from.index(parentSectionDepth);
236
263
  const endIndex = $from.indexAfter(parentSectionDepth);
237
- const beforeParentSection = $from.before(parentSectionDepth);
238
264
  const afterParentSection = $from.after(parentSectionDepth);
239
- const items = [];
240
- let offset = 0;
241
- if (startIndex > 0) {
242
- const precedingSection = parentSection.cut(0, beforeSectionOffset);
243
- items.push(precedingSection);
244
- offset += precedingSection.nodeSize;
245
- }
246
- items.push(section);
247
- if (endIndex < parentSection.childCount) {
248
- const fragment = prosemirror_model_1.Fragment.from(nodes.section_title.create()).append(parentSection.content.cut(afterSectionOffset));
249
- items.push(parentSection.copy(fragment));
265
+ const hasFollowingSiblings = endIndex < parentSection.childCount;
266
+ let extendedSection = section;
267
+ if (hasFollowingSiblings) {
268
+ const siblingsContent = parentSection.content.cut(afterSectionOffset);
269
+ extendedSection = section.copy(section.content.append(siblingsContent));
250
270
  }
251
- tr.replaceWith(beforeParentSection, afterParentSection, items);
252
- const anchor = beforeParentSection + offset + 2;
271
+ tr.insert(afterParentSection, prosemirror_model_1.Fragment.from(extendedSection));
272
+ tr.delete(beforeSection, beforeSection + extendedSection.nodeSize);
273
+ const anchor = afterParentSection + 2;
253
274
  tr.setSelection(prosemirror_state_1.TextSelection.create(tr.doc, anchor, anchor + sectionTitle.content.size));
254
- dispatch((0, track_changes_plugin_1.skipTracking)(tr));
275
+ (0, track_changes_plugin_1.setAction)(tr, track_changes_plugin_1.TrackChangesAction.indentationAction, { action: 'unindent' });
276
+ dispatch(tr);
255
277
  view && view.focus();
256
278
  };
257
279
  exports.unindentSection = unindentSection;
@@ -273,8 +295,9 @@ const unindentParagraph = () => (state, dispatch, view) => {
273
295
  const newSection = schema.nodes.section.create({ id: (0, transform_1.generateNodeID)(schema.nodes.section) }, sectionContent);
274
296
  tr.delete(paragraphPos, parentSectionEnd);
275
297
  tr.insert(paragraphPos + 2, newSection);
276
- tr.setSelection(prosemirror_state_1.TextSelection.create(tr.doc, tr.mapping.map(paragraphPos) + 4));
277
- dispatch((0, track_changes_plugin_1.skipTracking)(tr));
298
+ tr.setSelection(prosemirror_state_1.TextSelection.create(tr.doc, paragraphPos + newSection.nodeSize));
299
+ (0, track_changes_plugin_1.setAction)(tr, track_changes_plugin_1.TrackChangesAction.indentationAction, { action: 'unindent' });
300
+ dispatch(tr);
278
301
  view?.focus();
279
302
  };
280
303
  exports.unindentParagraph = unindentParagraph;
@@ -43,7 +43,7 @@ const authorLabel = (author) => {
43
43
  const name = author.bibliographicName;
44
44
  const parts = [
45
45
  author.prefix,
46
- (0, exports.initials)(name),
46
+ name.family ? (0, exports.initials)(name) : name.given,
47
47
  name.family,
48
48
  name.suffix,
49
49
  ].filter(Boolean);
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2025 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.getDocWithoutMovedContent = void 0;
19
+ exports.isMoved = isMoved;
20
+ const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
21
+ function isMoved(node) {
22
+ if (node.attrs.dataTracked) {
23
+ const changes = node.attrs.dataTracked;
24
+ return changes.some(({ operation, status, moveNodeId }) => operation === track_changes_plugin_1.CHANGE_OPERATION.delete &&
25
+ status === track_changes_plugin_1.CHANGE_STATUS.pending &&
26
+ moveNodeId);
27
+ }
28
+ return false;
29
+ }
30
+ const filterMovedContent = (node) => {
31
+ const nodes = [];
32
+ node.forEach((child) => {
33
+ const { attrs } = child;
34
+ if (isMoved(child)) {
35
+ return;
36
+ }
37
+ if (child.isText) {
38
+ nodes.push(child);
39
+ }
40
+ else {
41
+ nodes.push(child.type.create(attrs, filterMovedContent(child), child.marks));
42
+ }
43
+ });
44
+ return nodes;
45
+ };
46
+ const getDocWithoutMovedContent = (doc) => {
47
+ return doc.type.create(doc.attrs, filterMovedContent(doc), doc.marks);
48
+ };
49
+ exports.getDocWithoutMovedContent = getDocWithoutMovedContent;
@@ -20,16 +20,19 @@ const transform_1 = require("@manuscripts/transform");
20
20
  const prosemirror_model_1 = require("prosemirror-model");
21
21
  const prosemirror_state_1 = require("prosemirror-state");
22
22
  const prosemirror_view_1 = require("prosemirror-view");
23
+ const filtered_document_1 = require("../lib/filtered-document");
23
24
  exports.objectsKey = new prosemirror_state_1.PluginKey('objects');
24
25
  exports.default = () => {
25
26
  return new prosemirror_state_1.Plugin({
26
27
  key: exports.objectsKey,
27
28
  state: {
28
29
  init: (config, state) => {
29
- return (0, transform_1.buildTargets)(prosemirror_model_1.Fragment.from(state.doc.content));
30
+ const filteredDoc = (0, filtered_document_1.getDocWithoutMovedContent)(state.doc);
31
+ return (0, transform_1.buildTargets)(prosemirror_model_1.Fragment.from(filteredDoc.content));
30
32
  },
31
33
  apply: (tr) => {
32
- return (0, transform_1.buildTargets)(prosemirror_model_1.Fragment.from(tr.doc.content));
34
+ const filteredDoc = (0, filtered_document_1.getDocWithoutMovedContent)(tr.doc);
35
+ return (0, transform_1.buildTargets)(prosemirror_model_1.Fragment.from(filteredDoc.content));
33
36
  },
34
37
  },
35
38
  props: {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
4
4
  const transform_1 = require("@manuscripts/transform");
5
5
  const prosemirror_state_1 = require("prosemirror-state");
6
+ const filtered_document_1 = require("../lib/filtered-document");
6
7
  const plugins_1 = require("../lib/plugins");
7
8
  const isManuscriptNode = (node) => {
8
9
  return node && node.type === transform_1.schema.nodes.manuscript;
@@ -19,7 +20,8 @@ exports.default = () => {
19
20
  if (!(node.type.spec.attrs && 'id' in node.type.spec.attrs) ||
20
21
  (0, transform_1.isHighlightMarkerNode)(node) ||
21
22
  isManuscriptNode(node) ||
22
- isManuscriptNode(parent)) {
23
+ isManuscriptNode(parent) ||
24
+ (0, filtered_document_1.isMoved)(node)) {
23
25
  return;
24
26
  }
25
27
  let id = node.attrs.id;
@@ -5,10 +5,14 @@ const transform_1 = require("@manuscripts/transform");
5
5
  const prosemirror_state_1 = require("prosemirror-state");
6
6
  const prosemirror_utils_1 = require("prosemirror-utils");
7
7
  const prosemirror_view_1 = require("prosemirror-view");
8
+ const filtered_document_1 = require("../../lib/filtered-document");
8
9
  const autocompletion_1 = require("./autocompletion");
9
10
  exports.sectionTitleKey = new prosemirror_state_1.PluginKey('sectionNumbering');
10
11
  const calculateSectionLevels = (node, startPos, sectionNumberMap, numbering = [0]) => {
11
12
  node.forEach((childNode, offset) => {
13
+ if ((0, filtered_document_1.isMoved)(childNode)) {
14
+ return;
15
+ }
12
16
  if (childNode.type === transform_1.schema.nodes.section ||
13
17
  childNode.type === transform_1.schema.nodes.box_element) {
14
18
  numbering[numbering.length - 1] += 1;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MATHJAX_VERSION = exports.VERSION = void 0;
4
- exports.VERSION = '3.5.0';
4
+ exports.VERSION = '3.5.2';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -280,7 +280,7 @@ export const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, a
280
280
  valuesRef.current = { ...updatedValues, priority: values.priority };
281
281
  const { given, family } = values.bibliographicName;
282
282
  const { email, isCorresponding } = values;
283
- const isNameFilled = given?.length && family?.length;
283
+ const isNameFilled = given?.length || family?.length;
284
284
  if (hasChanges && isNameFilled) {
285
285
  if (isCorresponding) {
286
286
  setDisableSave(!email?.length);
@@ -1,9 +1,13 @@
1
- import { skipTracking } from '@manuscripts/track-changes-plugin';
1
+ import { setAction, skipTracking, TrackChangesAction, } from '@manuscripts/track-changes-plugin';
2
2
  import { generateNodeID, isSectionNodeType, nodeNames, schema, } from '@manuscripts/transform';
3
3
  import { Fragment } from 'prosemirror-model';
4
4
  import { TextSelection } from 'prosemirror-state';
5
5
  import { hasParentNodeOfType } from 'prosemirror-utils';
6
+ import { isMoved } from '../../lib/filtered-document';
6
7
  import { isDeleted } from '../../lib/track-changes-utils';
8
+ export const shouldSkipNode = (node) => {
9
+ return isMoved(node) || isDeleted(node);
10
+ };
7
11
  export const optionName = (nodeType) => {
8
12
  switch (nodeType) {
9
13
  case nodeType.schema.nodes.section:
@@ -174,24 +178,46 @@ export const indentSection = () => (state, dispatch, view) => {
174
178
  const parentSectionDepth = sectionDepth - 1;
175
179
  const parentSection = $from.node(parentSectionDepth);
176
180
  const startIndex = $from.index(parentSectionDepth);
177
- const previousSection = startIndex > 0 ? parentSection.child(startIndex - 1) : null;
178
- const isValidContainer = previousSection?.type === nodes.section;
181
+ let previousSection = null;
182
+ for (let i = startIndex - 1; i >= 0; i--) {
183
+ const candidate = parentSection.child(i);
184
+ if (candidate.type === nodes.section && !shouldSkipNode(candidate)) {
185
+ previousSection = candidate;
186
+ break;
187
+ }
188
+ }
179
189
  let anchor;
180
- if (!previousSection || !isValidContainer) {
190
+ if (!previousSection) {
181
191
  const emptyTitle = nodes.section_title.create();
182
192
  const newParentSectionContent = Fragment.fromArray([emptyTitle, section]);
183
193
  const newParentSection = nodes.section.create({}, newParentSectionContent);
184
- tr.replaceWith(beforeSection, afterSection, newParentSection);
194
+ tr.insert(beforeSection, newParentSection);
195
+ const newBeforeSection = beforeSection + newParentSection.nodeSize;
196
+ const newAfterSection = afterSection + newParentSection.nodeSize;
197
+ tr.delete(newBeforeSection, newAfterSection);
185
198
  anchor = beforeSection + 1;
186
199
  }
187
200
  else {
188
- const newPreviousSection = previousSection.copy(previousSection.content.append(Fragment.from(section)));
189
- const beforePreviousSection = beforeSection - previousSection.nodeSize;
190
- tr.replaceWith(beforePreviousSection, afterSection, newPreviousSection);
191
- anchor = beforePreviousSection + 1;
201
+ let beforePreviousSection = null;
202
+ $from.doc.descendants((node, pos) => {
203
+ if (node === previousSection) {
204
+ beforePreviousSection = pos;
205
+ return false;
206
+ }
207
+ });
208
+ if (beforePreviousSection === null) {
209
+ return false;
210
+ }
211
+ const insertPos = beforePreviousSection + previousSection.nodeSize - 1;
212
+ tr.insert(insertPos, section);
213
+ const newBeforeSection = beforeSection + section.nodeSize;
214
+ const newAfterSection = afterSection + section.nodeSize;
215
+ tr.delete(newBeforeSection, newAfterSection);
216
+ anchor = insertPos + 1;
192
217
  }
193
218
  tr.setSelection(TextSelection.create(tr.doc, anchor));
194
- dispatch(skipTracking(tr));
219
+ setAction(tr, TrackChangesAction.indentationAction, { action: 'indent' });
220
+ dispatch(tr);
195
221
  view && view.focus();
196
222
  };
197
223
  export const indentParagraph = () => (state, dispatch, view) => {
@@ -204,14 +230,15 @@ export const indentParagraph = () => (state, dispatch, view) => {
204
230
  const sectionEnd = $from.end(sectionDepth);
205
231
  const sectionContent = Fragment.from(schema.nodes.section_title.create()).append(parentSection.content.cut(beforeParagraph - sectionStart));
206
232
  const newSection = schema.nodes.section.create({ id: generateNodeID(schema.nodes.section) }, sectionContent);
207
- tr.replaceWith(beforeParagraph, sectionEnd, newSection);
208
- tr.setSelection(TextSelection.create(tr.doc, beforeParagraph + 2));
209
- dispatch(skipTracking(tr));
233
+ setAction(tr, TrackChangesAction.indentationAction, { action: 'indent' });
234
+ tr.delete(beforeParagraph, sectionEnd);
235
+ tr.insert(beforeParagraph, newSection);
236
+ tr.setSelection(TextSelection.create(tr.doc, beforeParagraph + newSection.nodeSize - 2));
237
+ dispatch(tr);
210
238
  view?.focus();
211
239
  };
212
240
  export const unindentSection = () => (state, dispatch, view) => {
213
- const { selection: { $from }, schema, tr, } = state;
214
- const { nodes } = schema;
241
+ const { selection: { $from }, tr, } = state;
215
242
  const sectionDepth = $from.depth - 1;
216
243
  const section = $from.node(sectionDepth);
217
244
  const beforeSection = $from.before(sectionDepth);
@@ -221,26 +248,20 @@ export const unindentSection = () => (state, dispatch, view) => {
221
248
  const afterSectionOffset = beforeSectionOffset + section.nodeSize;
222
249
  const parentSectionDepth = $from.depth - 2;
223
250
  const parentSection = $from.node(parentSectionDepth);
224
- const startIndex = $from.index(parentSectionDepth);
225
251
  const endIndex = $from.indexAfter(parentSectionDepth);
226
- const beforeParentSection = $from.before(parentSectionDepth);
227
252
  const afterParentSection = $from.after(parentSectionDepth);
228
- const items = [];
229
- let offset = 0;
230
- if (startIndex > 0) {
231
- const precedingSection = parentSection.cut(0, beforeSectionOffset);
232
- items.push(precedingSection);
233
- offset += precedingSection.nodeSize;
234
- }
235
- items.push(section);
236
- if (endIndex < parentSection.childCount) {
237
- const fragment = Fragment.from(nodes.section_title.create()).append(parentSection.content.cut(afterSectionOffset));
238
- items.push(parentSection.copy(fragment));
253
+ const hasFollowingSiblings = endIndex < parentSection.childCount;
254
+ let extendedSection = section;
255
+ if (hasFollowingSiblings) {
256
+ const siblingsContent = parentSection.content.cut(afterSectionOffset);
257
+ extendedSection = section.copy(section.content.append(siblingsContent));
239
258
  }
240
- tr.replaceWith(beforeParentSection, afterParentSection, items);
241
- const anchor = beforeParentSection + offset + 2;
259
+ tr.insert(afterParentSection, Fragment.from(extendedSection));
260
+ tr.delete(beforeSection, beforeSection + extendedSection.nodeSize);
261
+ const anchor = afterParentSection + 2;
242
262
  tr.setSelection(TextSelection.create(tr.doc, anchor, anchor + sectionTitle.content.size));
243
- dispatch(skipTracking(tr));
263
+ setAction(tr, TrackChangesAction.indentationAction, { action: 'unindent' });
264
+ dispatch(tr);
244
265
  view && view.focus();
245
266
  };
246
267
  export const unindentParagraph = () => (state, dispatch, view) => {
@@ -261,8 +282,9 @@ export const unindentParagraph = () => (state, dispatch, view) => {
261
282
  const newSection = schema.nodes.section.create({ id: generateNodeID(schema.nodes.section) }, sectionContent);
262
283
  tr.delete(paragraphPos, parentSectionEnd);
263
284
  tr.insert(paragraphPos + 2, newSection);
264
- tr.setSelection(TextSelection.create(tr.doc, tr.mapping.map(paragraphPos) + 4));
265
- dispatch(skipTracking(tr));
285
+ tr.setSelection(TextSelection.create(tr.doc, paragraphPos + newSection.nodeSize));
286
+ setAction(tr, TrackChangesAction.indentationAction, { action: 'unindent' });
287
+ dispatch(tr);
266
288
  view?.focus();
267
289
  };
268
290
  const indentationHandlers = {
@@ -38,7 +38,7 @@ export const authorLabel = (author) => {
38
38
  const name = author.bibliographicName;
39
39
  const parts = [
40
40
  author.prefix,
41
- initials(name),
41
+ name.family ? initials(name) : name.given,
42
42
  name.family,
43
43
  name.suffix,
44
44
  ].filter(Boolean);
@@ -0,0 +1,44 @@
1
+ /*!
2
+ * © 2025 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { CHANGE_OPERATION, CHANGE_STATUS, } from '@manuscripts/track-changes-plugin';
17
+ export function isMoved(node) {
18
+ if (node.attrs.dataTracked) {
19
+ const changes = node.attrs.dataTracked;
20
+ return changes.some(({ operation, status, moveNodeId }) => operation === CHANGE_OPERATION.delete &&
21
+ status === CHANGE_STATUS.pending &&
22
+ moveNodeId);
23
+ }
24
+ return false;
25
+ }
26
+ const filterMovedContent = (node) => {
27
+ const nodes = [];
28
+ node.forEach((child) => {
29
+ const { attrs } = child;
30
+ if (isMoved(child)) {
31
+ return;
32
+ }
33
+ if (child.isText) {
34
+ nodes.push(child);
35
+ }
36
+ else {
37
+ nodes.push(child.type.create(attrs, filterMovedContent(child), child.marks));
38
+ }
39
+ });
40
+ return nodes;
41
+ };
42
+ export const getDocWithoutMovedContent = (doc) => {
43
+ return doc.type.create(doc.attrs, filterMovedContent(doc), doc.marks);
44
+ };
@@ -17,16 +17,19 @@ import { buildTargets, isInGraphicalAbstractSection, } from '@manuscripts/transf
17
17
  import { Fragment } from 'prosemirror-model';
18
18
  import { Plugin, PluginKey } from 'prosemirror-state';
19
19
  import { Decoration, DecorationSet } from 'prosemirror-view';
20
+ import { getDocWithoutMovedContent } from '../lib/filtered-document';
20
21
  export const objectsKey = new PluginKey('objects');
21
22
  export default () => {
22
23
  return new Plugin({
23
24
  key: objectsKey,
24
25
  state: {
25
26
  init: (config, state) => {
26
- return buildTargets(Fragment.from(state.doc.content));
27
+ const filteredDoc = getDocWithoutMovedContent(state.doc);
28
+ return buildTargets(Fragment.from(filteredDoc.content));
27
29
  },
28
30
  apply: (tr) => {
29
- return buildTargets(Fragment.from(tr.doc.content));
31
+ const filteredDoc = getDocWithoutMovedContent(tr.doc);
32
+ return buildTargets(Fragment.from(filteredDoc.content));
30
33
  },
31
34
  },
32
35
  props: {
@@ -1,6 +1,7 @@
1
1
  import { skipTracking } from '@manuscripts/track-changes-plugin';
2
2
  import { generateNodeID, isHighlightMarkerNode, schema, } from '@manuscripts/transform';
3
3
  import { Plugin } from 'prosemirror-state';
4
+ import { isMoved } from '../lib/filtered-document';
4
5
  import { isInit } from '../lib/plugins';
5
6
  const isManuscriptNode = (node) => {
6
7
  return node && node.type === schema.nodes.manuscript;
@@ -17,7 +18,8 @@ export default () => {
17
18
  if (!(node.type.spec.attrs && 'id' in node.type.spec.attrs) ||
18
19
  isHighlightMarkerNode(node) ||
19
20
  isManuscriptNode(node) ||
20
- isManuscriptNode(parent)) {
21
+ isManuscriptNode(parent) ||
22
+ isMoved(node)) {
21
23
  return;
22
24
  }
23
25
  let id = node.attrs.id;
@@ -2,10 +2,14 @@ import { schema } from '@manuscripts/transform';
2
2
  import { Plugin, PluginKey } from 'prosemirror-state';
3
3
  import { findChildrenByType } from 'prosemirror-utils';
4
4
  import { Decoration, DecorationSet } from 'prosemirror-view';
5
+ import { isMoved } from '../../lib/filtered-document';
5
6
  import { checkForCompletion } from './autocompletion';
6
7
  export const sectionTitleKey = new PluginKey('sectionNumbering');
7
8
  const calculateSectionLevels = (node, startPos, sectionNumberMap, numbering = [0]) => {
8
9
  node.forEach((childNode, offset) => {
10
+ if (isMoved(childNode)) {
11
+ return;
12
+ }
9
13
  if (childNode.type === schema.nodes.section ||
10
14
  childNode.type === schema.nodes.box_element) {
11
15
  numbering[numbering.length - 1] += 1;
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.5.0';
1
+ export const VERSION = '3.5.2';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -1,15 +1,17 @@
1
1
  import { ManuscriptEditorView, ManuscriptNodeType } from '@manuscripts/transform';
2
+ import { Node } from 'prosemirror-model';
2
3
  import { EditorState, Transaction } from 'prosemirror-state';
3
4
  import { EditorView } from 'prosemirror-view';
4
5
  import { Dispatch } from '../../commands';
5
6
  import { Option } from './type-selector/TypeSelector';
7
+ export declare const shouldSkipNode: (node: Node) => boolean;
6
8
  export declare const optionName: (nodeType: ManuscriptNodeType) => string;
7
9
  export declare const titleCase: (text: string) => string;
8
10
  export declare const findSelectedOption: (options: Option[]) => Option | undefined;
9
11
  export declare const demoteSectionToParagraph: (state: EditorState, dispatch: (tr: Transaction) => void, view?: ManuscriptEditorView) => void;
10
12
  export declare const promoteParagraphToSection: (state: EditorState, dispatch: (tr: Transaction) => void, view?: ManuscriptEditorView) => void;
11
13
  export declare const isIndentationAllowed: (action: string) => (state: EditorState) => boolean;
12
- export declare const indentSection: () => (state: EditorState, dispatch: Dispatch, view?: EditorView) => void;
14
+ export declare const indentSection: () => (state: EditorState, dispatch: Dispatch, view?: EditorView) => false | undefined;
13
15
  export declare const indentParagraph: () => (state: EditorState, dispatch: Dispatch, view?: EditorView) => void;
14
16
  export declare const unindentSection: () => (state: EditorState, dispatch: Dispatch, view?: EditorView) => void;
15
17
  export declare const unindentParagraph: () => (state: EditorState, dispatch: Dispatch, view?: EditorView) => void;
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * © 2025 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { ManuscriptNode } from '@manuscripts/transform';
17
+ export declare function isMoved(node: ManuscriptNode): boolean;
18
+ export declare const getDocWithoutMovedContent: (doc: ManuscriptNode) => import("prosemirror-model").Node;
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.5.0";
1
+ export declare const VERSION = "3.5.2";
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.5.0",
4
+ "version": "3.5.2",
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
  "@iarna/word-count": "1.1.2",
41
41
  "@manuscripts/json-schema": "2.2.12",
42
42
  "@manuscripts/style-guide": "3.3.0",
43
- "@manuscripts/track-changes-plugin": "2.0.10",
43
+ "@manuscripts/track-changes-plugin": "2.0.11",
44
44
  "@manuscripts/transform": "4.2.14",
45
45
  "@popperjs/core": "2.11.8",
46
46
  "citeproc": "2.4.63",