@manuscripts/body-editor 3.12.4 → 3.12.5

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.
Files changed (81) hide show
  1. package/dist/cjs/commands.js +4 -5
  2. package/dist/cjs/components/affiliations/AffiliationsModal.js +1 -3
  3. package/dist/cjs/components/keywords/AddKeywordInline.js +2 -2
  4. package/dist/cjs/components/outline/DraggableTree.js +4 -4
  5. package/dist/cjs/components/toolbar/helpers.js +7 -13
  6. package/dist/cjs/components/toolbar/type-selector/TypeSelector.js +5 -5
  7. package/dist/cjs/components/views/FootnotesSelector.js +2 -2
  8. package/dist/cjs/lib/track-changes-utils.js +3 -140
  9. package/dist/cjs/lib/utils.js +1 -1
  10. package/dist/cjs/lib/view.js +2 -1
  11. package/dist/cjs/menus.js +2 -2
  12. package/dist/cjs/plugins/affiliations.js +2 -2
  13. package/dist/cjs/plugins/objects.js +3 -6
  14. package/dist/cjs/plugins/persist.js +2 -4
  15. package/dist/cjs/plugins/search-replace/lib.js +2 -2
  16. package/dist/cjs/plugins/section_category.js +10 -43
  17. package/dist/cjs/plugins/section_title/autocompletion.js +2 -2
  18. package/dist/cjs/plugins/section_title/index.js +2 -5
  19. package/dist/cjs/plugins/selected-suggestion.js +1 -2
  20. package/dist/cjs/versions.js +1 -1
  21. package/dist/cjs/views/affiliations.js +4 -4
  22. package/dist/cjs/views/award.js +2 -2
  23. package/dist/cjs/views/base_node_view.js +3 -3
  24. package/dist/cjs/views/bibliography_element.js +3 -3
  25. package/dist/cjs/views/block_view.js +2 -2
  26. package/dist/cjs/views/citation_editable.js +3 -3
  27. package/dist/cjs/views/contributors.js +4 -4
  28. package/dist/cjs/views/creators.js +2 -2
  29. package/dist/cjs/views/figure_editable.js +5 -5
  30. package/dist/cjs/views/footnote.js +5 -5
  31. package/dist/cjs/views/general_table_footnote.js +4 -4
  32. package/dist/cjs/views/inline_footnote.js +3 -3
  33. package/dist/cjs/views/keyword.js +2 -2
  34. package/dist/cjs/views/keyword_group.js +2 -2
  35. package/dist/cjs/views/link_editable.js +2 -2
  36. package/dist/cjs/views/quote_image_editable.js +4 -4
  37. package/dist/es/commands.js +1 -2
  38. package/dist/es/components/affiliations/AffiliationsModal.js +1 -3
  39. package/dist/es/components/authors/AuthorsModal.js +1 -1
  40. package/dist/es/components/keywords/AddKeywordInline.js +1 -1
  41. package/dist/es/components/outline/DraggableTree.js +1 -1
  42. package/dist/es/components/toolbar/helpers.js +4 -9
  43. package/dist/es/components/toolbar/type-selector/TypeSelector.js +1 -1
  44. package/dist/es/components/views/FootnotesSelector.js +1 -1
  45. package/dist/es/lib/track-changes-utils.js +3 -128
  46. package/dist/es/lib/utils.js +1 -1
  47. package/dist/es/lib/view.js +2 -1
  48. package/dist/es/menus.js +2 -2
  49. package/dist/es/plugins/affiliations.js +1 -1
  50. package/dist/es/plugins/objects.js +3 -6
  51. package/dist/es/plugins/persist.js +3 -5
  52. package/dist/es/plugins/search-replace/lib.js +1 -1
  53. package/dist/es/plugins/section_category.js +10 -43
  54. package/dist/es/plugins/section_title/autocompletion.js +1 -1
  55. package/dist/es/plugins/section_title/index.js +2 -5
  56. package/dist/es/plugins/selected-suggestion.js +1 -2
  57. package/dist/es/versions.js +1 -1
  58. package/dist/es/views/affiliations.js +1 -1
  59. package/dist/es/views/award.js +1 -1
  60. package/dist/es/views/base_node_view.js +1 -1
  61. package/dist/es/views/bibliography_element.js +1 -1
  62. package/dist/es/views/block_view.js +1 -1
  63. package/dist/es/views/citation_editable.js +1 -1
  64. package/dist/es/views/contributors.js +1 -1
  65. package/dist/es/views/creators.js +1 -1
  66. package/dist/es/views/figure_editable.js +1 -1
  67. package/dist/es/views/footnote.js +1 -1
  68. package/dist/es/views/general_table_footnote.js +1 -1
  69. package/dist/es/views/inline_footnote.js +1 -1
  70. package/dist/es/views/keyword.js +1 -1
  71. package/dist/es/views/keyword_group.js +1 -1
  72. package/dist/es/views/link_editable.js +1 -1
  73. package/dist/es/views/quote_image_editable.js +1 -1
  74. package/dist/types/components/toolbar/helpers.d.ts +0 -1
  75. package/dist/types/lib/track-changes-utils.d.ts +2 -15
  76. package/dist/types/lib/utils.d.ts +1 -1
  77. package/dist/types/versions.d.ts +1 -1
  78. package/package.json +3 -3
  79. package/dist/cjs/lib/filtered-document.js +0 -49
  80. package/dist/es/lib/filtered-document.js +0 -44
  81. package/dist/types/lib/filtered-document.d.ts +0 -18
@@ -1,14 +1,9 @@
1
- import { setAction, TrackChangesAction, } from '@manuscripts/track-changes-plugin';
1
+ import { isDeleted, isValid, setAction, 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 { findChildrenByType, hasParentNodeOfType } from 'prosemirror-utils';
6
- import { isMoved } from '../../lib/filtered-document';
7
- import { isDeleted, isShadowDelete } from '../../lib/track-changes-utils';
8
6
  import { filterBlockNodes } from '../../lib/utils';
9
- export const shouldSkipNode = (node) => {
10
- return isMoved(node) || isDeleted(node);
11
- };
12
7
  export const optionName = (nodeType) => {
13
8
  switch (nodeType) {
14
9
  case nodeType.schema.nodes.section:
@@ -87,7 +82,7 @@ export const demoteSectionToParagraph = (state, dispatch, view) => {
87
82
  else {
88
83
  anchor = beforeSection + 1;
89
84
  }
90
- const content = filterBlockNodes(Fragment.from(paragraph).append(sectionContent), (node) => !isShadowDelete(node));
85
+ const content = filterBlockNodes(Fragment.from(paragraph).append(sectionContent));
91
86
  tr.insert(beforeSection, content);
92
87
  const afterSection = tr.mapping.map($from.after(sectionDepth));
93
88
  tr.delete(afterSection - section.nodeSize, afterSection);
@@ -140,7 +135,7 @@ export const promoteParagraphToSection = (state, dispatch, view) => {
140
135
  else {
141
136
  items.push(parentSection.type.create({ dataTracked: getInsertDataTracked(paragraph) }, sectionContent));
142
137
  }
143
- const content = filterBlockNodes(Fragment.from(items[items.length - 1]), (node) => !isShadowDelete(node));
138
+ const content = filterBlockNodes(Fragment.from(items[items.length - 1]));
144
139
  tr.insert(afterParentSection, content);
145
140
  tr.delete(beforeParagraph, afterParentSection - 1);
146
141
  const anchor = tr.mapping.map(afterParentSection) - content.size + 2;
@@ -198,7 +193,7 @@ export const indentSection = () => (state, dispatch, view) => {
198
193
  let previousSection = null;
199
194
  for (let i = startIndex - 1; i >= 0; i--) {
200
195
  const candidate = parentSection.child(i);
201
- if (candidate.type === nodes.section && !shouldSkipNode(candidate)) {
196
+ if (candidate.type === nodes.section && isValid(candidate)) {
202
197
  previousSection = candidate;
203
198
  break;
204
199
  }
@@ -2,11 +2,11 @@ import { schema, } from '@manuscripts/transform';
2
2
  import { hasParentNodeOfType } from 'prosemirror-utils';
3
3
  import React from 'react';
4
4
  import { findClosestParentElement } from '../../../lib/hierarchy';
5
- import { isDeleted } from '../../../lib/track-changes-utils';
6
5
  import { isEditAllowed } from '../../../lib/utils';
7
6
  import { demoteSectionToParagraph, findSelectedOption, optionName, promoteParagraphToSection, titleCase, } from '../helpers';
8
7
  import { CustomControl, OptionComponent } from './OptionComponent';
9
8
  import { customStyles, StyledSelect } from './styles';
9
+ import { isDeleted } from '@manuscripts/track-changes-plugin';
10
10
  const buildOptions = (state) => {
11
11
  const { doc, selection: { $from, $to }, schema, } = state;
12
12
  const { nodes } = schema;
@@ -14,9 +14,9 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { AddedIcon, AddIcon, AddNewIcon, ButtonGroup, IconTextButton, PrimaryButton, SecondaryButton, withFocusTrap, withListNavigation, withNavigableListItem, } from '@manuscripts/style-guide';
17
+ import { isDeleted } from '@manuscripts/track-changes-plugin';
17
18
  import React, { useState } from 'react';
18
19
  import styled from 'styled-components';
19
- import { isDeleted } from '../../lib/track-changes-utils';
20
20
  const NotesContainer = styled.div `
21
21
  height: 90vh;
22
22
  max-height: 400px;
@@ -14,66 +14,11 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { EditAttrsTrackingIcon } from '@manuscripts/style-guide';
17
- import { CHANGE_OPERATION, } from '@manuscripts/track-changes-plugin';
18
- import { schema } from '@manuscripts/transform';
17
+ import { isDeleted } from '@manuscripts/track-changes-plugin';
19
18
  import { createElement } from 'react';
20
19
  import { renderToStaticMarkup } from 'react-dom/server';
21
- export function isDeleted(node) {
22
- if (node.attrs.dataTracked) {
23
- const changes = node.attrs.dataTracked;
24
- return changes.some(({ operation }) => operation === 'delete');
25
- }
26
- return false;
27
- }
28
- export function isShadowDelete(node) {
29
- if (node.attrs.dataTracked) {
30
- const changes = node.attrs.dataTracked;
31
- return changes.some(({ operation, moveNodeId }) => operation === 'delete' && moveNodeId);
32
- }
33
- return false;
34
- }
35
- export function isPendingInsert(node) {
36
- if (node.attrs.dataTracked) {
37
- const changes = node.attrs.dataTracked;
38
- return changes.some(({ operation, status }) => operation === 'insert' && status == 'pending');
39
- }
40
- return false;
41
- }
42
- export function isPending(node) {
43
- if (node.attrs.dataTracked) {
44
- const changes = node.attrs.dataTracked;
45
- return changes.some(({ status }) => status == 'pending');
46
- }
47
- return false;
48
- }
49
- export function isPendingSetAttrs(node) {
50
- if (node.attrs.dataTracked) {
51
- const changes = node.attrs.dataTracked;
52
- return changes.some(({ operation, status }) => operation === 'set_attrs' && status == 'pending');
53
- }
54
- return false;
55
- }
56
- export function getChangeClasses(dataTracked) {
57
- const classes = [];
58
- if (dataTracked) {
59
- const changes = dataTracked;
60
- const operationClasses = new Map([
61
- ['insert', 'inserted'],
62
- ['delete', 'deleted'],
63
- ['set_attrs', 'set_attrs'],
64
- ]);
65
- changes.forEach(({ operation, status }) => classes.push(operationClasses.get(operation) || '', status));
66
- }
67
- return classes;
68
- }
69
- export function isTracked(node) {
70
- if (node.attrs.dataTracked) {
71
- const changes = node.attrs.dataTracked;
72
- return changes.some(({ operation }) => operation === 'insert' ||
73
- operation === 'delete' ||
74
- operation === 'set_attrs');
75
- }
76
- return false;
20
+ export function isHidden(node) {
21
+ return isDeleted(node);
77
22
  }
78
23
  export const getAttrsTrackingButton = (changeID) => {
79
24
  const el = document.createElement('button');
@@ -82,73 +27,3 @@ export const getAttrsTrackingButton = (changeID) => {
82
27
  el.innerHTML = renderToStaticMarkup(createElement(EditAttrsTrackingIcon));
83
28
  return el;
84
29
  };
85
- export function isHidden(node) {
86
- return isDeleted(node);
87
- }
88
- export function isDeletedText(node) {
89
- if (node.type === schema.nodes.text && node.marks.length) {
90
- const deleteMark = node.marks.find((mark) => mark.type === schema.marks.tracked_delete);
91
- if (deleteMark &&
92
- deleteMark.attrs?.dataTracked?.status &&
93
- 'pending' === deleteMark.attrs?.dataTracked?.status) {
94
- return true;
95
- }
96
- }
97
- return false;
98
- }
99
- export function getActualTextContent(fragment) {
100
- let finalContent = '';
101
- function getContent(fragment) {
102
- fragment.forEach((node) => {
103
- if (node.type !== schema.nodes.text) {
104
- finalContent += getContent(node.content);
105
- }
106
- if (!isDeletedText(node)) {
107
- finalContent += node.textContent;
108
- }
109
- });
110
- }
111
- getContent(fragment);
112
- return finalContent;
113
- }
114
- export function sanitizeAttrsChange(newAttr, currentAttrs) {
115
- return Object.keys(newAttr).reduce((acc, attr) => {
116
- const key = attr;
117
- if (!currentAttrs[key] &&
118
- currentAttrs[key] !== 0 &&
119
- !newAttr[key] &&
120
- newAttr[key] !== 0) {
121
- return acc;
122
- }
123
- acc[key] = newAttr[key];
124
- return acc;
125
- }, {});
126
- }
127
- const classNames = new Map([
128
- [CHANGE_OPERATION.insert, 'inserted'],
129
- [CHANGE_OPERATION.delete, 'deleted'],
130
- [CHANGE_OPERATION.set_node_attributes, 'set_attrs'],
131
- ]);
132
- export const addTrackChangesAttributes = (attrs, dom) => {
133
- dom.removeAttribute('data-track-id');
134
- dom.removeAttribute('data-track-op');
135
- dom.removeAttribute('data-track-status');
136
- const changes = attrs.dataTracked;
137
- if (!changes || !changes.length) {
138
- return;
139
- }
140
- const change = changes[0];
141
- dom.setAttribute('data-track-id', change.id);
142
- dom.setAttribute('data-track-op', change.operation);
143
- dom.setAttribute('data-track-status', change.status);
144
- };
145
- export const addTrackChangesClassNames = (attrs, dom) => {
146
- dom.classList.remove(...classNames.values());
147
- const changes = attrs.dataTracked;
148
- if (!changes || !changes.length) {
149
- return;
150
- }
151
- const change = changes[0];
152
- const className = classNames.get(change.operation);
153
- className && dom.classList.add(className);
154
- };
@@ -183,7 +183,7 @@ export const filterBlockNodes = (fragment, predicate) => {
183
183
  const newContent = child.content.size
184
184
  ? filterBlockNodes(child.content, predicate)
185
185
  : child.content;
186
- if (predicate(child)) {
186
+ if (!predicate || predicate(child)) {
187
187
  updatedNodes.push(child.type.create(child.attrs, newContent, child.marks));
188
188
  }
189
189
  });
@@ -16,7 +16,8 @@
16
16
  import { schema, } from '@manuscripts/transform';
17
17
  import { NodeSelection } from 'prosemirror-state';
18
18
  import * as utils from 'prosemirror-utils';
19
- import { isHidden, sanitizeAttrsChange } from './track-changes-utils';
19
+ import { isHidden } from './track-changes-utils';
20
+ import { sanitizeAttrsChange } from '@manuscripts/track-changes-plugin';
20
21
  const metaNodeTypes = [
21
22
  schema.nodes.bibliography_item,
22
23
  schema.nodes.affiliation,
package/dist/es/menus.js CHANGED
@@ -33,7 +33,7 @@ export const getEditorMenus = (editor) => {
33
33
  const command = insertBackmatterSection(category);
34
34
  return {
35
35
  id: `insert-${category.id}`,
36
- label: category.label || category.titles[0],
36
+ label: category.titles[0],
37
37
  isEnabled: isCommandValid(command),
38
38
  run: doCommand(command),
39
39
  };
@@ -44,7 +44,7 @@ export const getEditorMenus = (editor) => {
44
44
  : insertAbstractSection(category);
45
45
  return {
46
46
  id: `insert-${category.id}`,
47
- label: category.label || category.titles[0],
47
+ label: category.titles[0],
48
48
  isEnabled: isCommandValid(command),
49
49
  run: doCommand(command),
50
50
  };
@@ -13,12 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { isDeleted } from '@manuscripts/track-changes-plugin';
16
17
  import { isAffiliationNode, isContributorNode, } from '@manuscripts/transform';
17
18
  import { isEqual } from 'lodash';
18
19
  import { Plugin, PluginKey } from 'prosemirror-state';
19
20
  import { Decoration, DecorationSet } from 'prosemirror-view';
20
21
  import { authorComparator, } from '../lib/authors';
21
- import { isDeleted } from '../lib/track-changes-utils';
22
22
  export const affiliationsKey = new PluginKey('affiliations');
23
23
  let id = 1;
24
24
  export const buildPluginState = (doc, $old) => {
@@ -14,22 +14,19 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { buildTargets, isInGraphicalAbstractSection, } from '@manuscripts/transform';
17
- import { Fragment } from 'prosemirror-model';
18
17
  import { Plugin, PluginKey } from 'prosemirror-state';
19
18
  import { Decoration, DecorationSet } from 'prosemirror-view';
20
- import { getDocWithoutMovedContent } from '../lib/filtered-document';
19
+ import { clear } from '@manuscripts/track-changes-plugin';
21
20
  export const objectsKey = new PluginKey('objects');
22
21
  export default () => {
23
22
  return new Plugin({
24
23
  key: objectsKey,
25
24
  state: {
26
25
  init: (config, state) => {
27
- const filteredDoc = getDocWithoutMovedContent(state.doc);
28
- return buildTargets(Fragment.from(filteredDoc.content));
26
+ return buildTargets(clear(state.doc).descendants);
29
27
  },
30
28
  apply: (tr) => {
31
- const filteredDoc = getDocWithoutMovedContent(tr.doc);
32
- return buildTargets(Fragment.from(filteredDoc.content));
29
+ return buildTargets(clear(tr.doc).descendants);
33
30
  },
34
31
  },
35
32
  props: {
@@ -1,7 +1,6 @@
1
- import { skipTracking } from '@manuscripts/track-changes-plugin';
1
+ import { clear, 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';
5
4
  import { isInit } from '../lib/plugins';
6
5
  const isManuscriptNode = (node) => {
7
6
  return node && node.type === schema.nodes.manuscript;
@@ -14,12 +13,11 @@ export default () => {
14
13
  }
15
14
  const ids = new Set();
16
15
  const tr = newState.tr;
17
- newState.doc.descendants((node, pos, parent) => {
16
+ clear(newState.doc).descendants((node, pos, parent) => {
18
17
  if (!(node.type.spec.attrs && 'id' in node.type.spec.attrs) ||
19
18
  isHighlightMarkerNode(node) ||
20
19
  isManuscriptNode(node) ||
21
- isManuscriptNode(parent) ||
22
- isMoved(node)) {
20
+ isManuscriptNode(parent)) {
23
21
  return;
24
22
  }
25
23
  let id = node.attrs.id;
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { isDeleted, isDeletedText } from '../../lib/track-changes-utils';
16
+ import { isDeleted, isDeletedText } from '@manuscripts/track-changes-plugin';
17
17
  export function getNewMatch(side, current, selection, matches) {
18
18
  if (current < 0) {
19
19
  return getClosestMatch(side, selection, matches);
@@ -3,7 +3,6 @@ import { Plugin, PluginKey } from 'prosemirror-state';
3
3
  import { findChildrenByType, findParentNodeOfTypeClosestToPos, } from 'prosemirror-utils';
4
4
  import { Decoration, DecorationSet } from 'prosemirror-view';
5
5
  import { sectionCategoryIcon } from '../icons';
6
- import { handleEnterKey, createKeyboardInteraction, } from '../lib/navigation-utils';
7
6
  export const sectionCategoryKey = new PluginKey('section-category');
8
7
  export default (props) => new Plugin({
9
8
  key: sectionCategoryKey,
@@ -30,74 +29,42 @@ const createMenuItem = (props, contents, handler, isDisabled, isSelected) => {
30
29
  item.classList.add('disabled');
31
30
  }
32
31
  item.textContent = contents;
33
- item.setAttribute('tabindex', '0');
34
- item.addEventListener('mousedown', handler);
35
- item.addEventListener('keydown', handleEnterKey(handler));
32
+ item.addEventListener('mousedown', (event) => {
33
+ handler(event);
34
+ props.popper.destroy();
35
+ });
36
36
  return item;
37
37
  };
38
38
  const createMenu = (props, currentCategory, categories, usedCategoryIDs, onSelect) => {
39
39
  const menu = document.createElement('div');
40
40
  menu.className = 'section-category menu';
41
- const menuItems = [];
42
- const removeKeydownListener = createKeyboardInteraction({
43
- container: document,
44
- navigation: {
45
- getItems: () => menuItems,
46
- arrowKeys: {
47
- forward: 'ArrowDown',
48
- backward: 'ArrowUp',
49
- },
50
- getCurrentElement: () => document.activeElement,
51
- },
52
- });
53
- const destroy = () => {
54
- removeKeydownListener();
55
- props.popper.destroy();
56
- };
57
41
  categories.forEach((category) => {
58
- const item = createMenuItem(props, category.label || category.titles[0], () => {
59
- onSelect(category);
60
- destroy();
61
- }, category.isUnique && usedCategoryIDs.has(category.id), currentCategory === category);
62
- menuItems.push(item);
42
+ const item = createMenuItem(props, category.titles[0], () => onSelect(category), category.isUnique && usedCategoryIDs.has(category.id), currentCategory === category);
63
43
  menu.appendChild(item);
64
44
  });
65
- return { menu, destroy };
45
+ return menu;
66
46
  };
67
47
  const createButton = (props, view, pos, currentCategory, categories, usedCategoryIDs, canEdit = true, disabled) => {
68
- let menuInstance = null;
69
48
  const handleSelect = (category) => {
70
49
  const tr = view.state.tr;
71
50
  tr.setNodeAttribute(pos, 'category', category.id);
72
51
  view.dispatch(tr);
73
52
  };
74
- const openMenu = () => {
75
- menuInstance = createMenu(props, currentCategory, categories, usedCategoryIDs, handleSelect);
76
- props.popper.show(button, menuInstance.menu, 'bottom-end', false);
77
- };
78
53
  const button = document.createElement('button');
79
54
  button.innerHTML = sectionCategoryIcon;
80
55
  button.classList.add('section-category-button');
81
56
  button.setAttribute('aria-label', 'Section categories menu');
82
57
  if (currentCategory) {
83
- button.setAttribute('data-tooltip-content', currentCategory.label || currentCategory.titles[0]);
58
+ button.setAttribute('data-tooltip-content', currentCategory.titles[0]);
84
59
  button.classList.add('assigned');
85
60
  }
86
61
  if (disabled) {
87
62
  button.classList.add('disabled');
88
63
  }
89
64
  else if (canEdit) {
90
- button.addEventListener('click', openMenu);
91
- createKeyboardInteraction({
92
- container: button,
93
- additionalKeys: {
94
- Enter: openMenu,
95
- Escape: (e) => {
96
- e.preventDefault();
97
- menuInstance?.destroy();
98
- menuInstance = null;
99
- },
100
- },
65
+ button.addEventListener('mousedown', () => {
66
+ const menu = createMenu(props, currentCategory, categories, usedCategoryIDs, handleSelect);
67
+ props.popper.show(button, menu, 'bottom-end', false);
101
68
  });
102
69
  }
103
70
  return button;
@@ -1,7 +1,7 @@
1
1
  import { schema } from '@manuscripts/transform';
2
2
  import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
3
- import { getActualTextContent } from '../../lib/track-changes-utils';
4
3
  import { getEditorProps } from '../editor-props';
4
+ import { getActualTextContent } from '@manuscripts/track-changes-plugin';
5
5
  function cursorAtTheEndOfText(state, nodeSize, nodePos) {
6
6
  const { from, to } = state.selection;
7
7
  return from === to && to === nodePos + nodeSize - 1;
@@ -2,14 +2,11 @@ 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';
6
5
  import { checkForCompletion } from './autocompletion';
6
+ import { clear } from '@manuscripts/track-changes-plugin';
7
7
  export const sectionTitleKey = new PluginKey('sectionNumbering');
8
8
  const calculateSectionLevels = (node, startPos, sectionNumberMap, numbering = [0]) => {
9
- node.forEach((childNode, offset) => {
10
- if (isMoved(childNode)) {
11
- return;
12
- }
9
+ clear(node).forEach((childNode, offset) => {
13
10
  if (childNode.type === schema.nodes.section ||
14
11
  childNode.type === schema.nodes.box_element) {
15
12
  numbering[numbering.length - 1] += 1;
@@ -1,9 +1,8 @@
1
- import { CHANGE_OPERATION, CHANGE_STATUS, } from '@manuscripts/track-changes-plugin';
1
+ import { CHANGE_OPERATION, CHANGE_STATUS, isTracked, } from '@manuscripts/track-changes-plugin';
2
2
  import { schema, } from '@manuscripts/transform';
3
3
  import { Plugin, PluginKey } from 'prosemirror-state';
4
4
  import { Decoration, DecorationSet } from 'prosemirror-view';
5
5
  import { isTextSelection } from '../commands';
6
- import { isTracked } from '../lib/track-changes-utils';
7
6
  import { getSelectionChangeGroup } from '../selection';
8
7
  export const selectedSuggestionKey = new PluginKey('selected-suggestion');
9
8
  const EMPTY = {
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.12.4';
1
+ export const VERSION = '3.12.5';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -14,13 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ContextMenu } from '@manuscripts/style-guide';
17
+ import { addTrackChangesAttributes, isDeleted, } from '@manuscripts/track-changes-plugin';
17
18
  import { schema } from '@manuscripts/transform';
18
19
  import { NodeSelection, Selection } from 'prosemirror-state';
19
20
  import { AffiliationsModal, } from '../components/affiliations/AffiliationsModal';
20
21
  import { alertIcon } from '../icons';
21
22
  import { affiliationName, } from '../lib/authors';
22
23
  import { handleComment } from '../lib/comments';
23
- import { addTrackChangesAttributes, isDeleted, } from '../lib/track-changes-utils';
24
24
  import { deleteNode, findChildByID, findChildrenAttrsByType, updateNodeAttrs, } from '../lib/view';
25
25
  import { affiliationsKey } from '../plugins/affiliations';
26
26
  import { selectedSuggestionKey } from '../plugins/selected-suggestion';
@@ -17,11 +17,11 @@ import { ContextMenu } from '@manuscripts/style-guide';
17
17
  import { schema } from '@manuscripts/transform';
18
18
  import { AwardModal } from '../components/awards/AwardModal';
19
19
  import { DeleteAwardDialog, } from '../components/awards/DeleteAwardDiaolog';
20
- import { isDeleted } from '../lib/track-changes-utils';
21
20
  import { updateNodeAttrs } from '../lib/view';
22
21
  import BlockView from './block_view';
23
22
  import { createNodeView } from './creators';
24
23
  import ReactSubView from './ReactSubView';
24
+ import { isDeleted } from '@manuscripts/track-changes-plugin';
25
25
  export class AwardView extends BlockView {
26
26
  constructor() {
27
27
  super(...arguments);
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { addTrackChangesAttributes, addTrackChangesClassNames, } from '../lib/track-changes-utils';
16
+ import { addTrackChangesAttributes, addTrackChangesClassNames, } from '@manuscripts/track-changes-plugin';
17
17
  export class BaseNodeView {
18
18
  constructor(props, node, view, getPos) {
19
19
  this.props = props;
@@ -21,7 +21,6 @@ import { createCommentMarker, handleComment } from '../lib/comments';
21
21
  import { handleEnterKey } from '../lib/navigation-utils';
22
22
  import { findNodeByID } from '../lib/doc';
23
23
  import { sanitize } from '../lib/dompurify';
24
- import { addTrackChangesAttributes, addTrackChangesClassNames, } from '../lib/track-changes-utils';
25
24
  import { deleteNode, findChildByID, updateNodeAttrs } from '../lib/view';
26
25
  import { getBibliographyPluginState } from '../plugins/bibliography';
27
26
  import { commentsKey, setCommentSelection } from '../plugins/comments';
@@ -29,6 +28,7 @@ import { selectedSuggestionKey } from '../plugins/selected-suggestion';
29
28
  import BlockView from './block_view';
30
29
  import { createNodeView } from './creators';
31
30
  import ReactSubView from './ReactSubView';
31
+ import { addTrackChangesAttributes, addTrackChangesClassNames, } from '@manuscripts/track-changes-plugin';
32
32
  export class BibliographyElementBlockView extends BlockView {
33
33
  constructor() {
34
34
  super(...arguments);
@@ -13,8 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { addTrackChangesAttributes } from '../lib/track-changes-utils';
17
16
  import { BaseNodeView } from './base_node_view';
17
+ import { addTrackChangesAttributes } from '@manuscripts/track-changes-plugin';
18
18
  export default class BlockView extends BaseNodeView {
19
19
  constructor() {
20
20
  super(...arguments);
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ContextMenu } from '@manuscripts/style-guide';
17
+ import { isDeleted } from '@manuscripts/track-changes-plugin';
17
18
  import { schema, } from '@manuscripts/transform';
18
19
  import { TextSelection } from 'prosemirror-state';
19
20
  import { findChildrenByType } from 'prosemirror-utils';
@@ -22,7 +23,6 @@ import { CitationViewer, } from '../components/references/CitationViewer';
22
23
  import { handleComment } from '../lib/comments';
23
24
  import { Crossref } from '../lib/crossref';
24
25
  import { handleEnterKey } from '../lib/navigation-utils';
25
- import { isDeleted } from '../lib/track-changes-utils';
26
26
  import { deleteNode, findChildByID, updateNodeAttrs } from '../lib/view';
27
27
  import { getBibliographyPluginState } from '../plugins/bibliography';
28
28
  import { CitationView } from './citation';
@@ -14,13 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ContextMenu } from '@manuscripts/style-guide';
17
+ import { addTrackChangesAttributes, isDeleted, } from '@manuscripts/track-changes-plugin';
17
18
  import { schema } from '@manuscripts/transform';
18
19
  import { NodeSelection } from 'prosemirror-state';
19
20
  import { AuthorsModal, } from '../components/authors/AuthorsModal';
20
21
  import { authorComparator, authorLabel, } from '../lib/authors';
21
22
  import { handleComment } from '../lib/comments';
22
23
  import { createKeyboardInteraction } from '../lib/navigation-utils';
23
- import { addTrackChangesAttributes, isDeleted, } from '../lib/track-changes-utils';
24
24
  import { findInsertionPosition } from '../lib/utils';
25
25
  import { deleteNode, findChildByID, findChildByType, findChildrenAttrsByType, updateNodeAttrs, } from '../lib/view';
26
26
  import { affiliationsKey } from '../plugins/affiliations';
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { addTrackChangesAttributes } from '../lib/track-changes-utils';
16
+ import { addTrackChangesAttributes } from '@manuscripts/track-changes-plugin';
17
17
  export const createEditableNodeView = (type) => (props, dispatch) => (node, view, getPos, decorations) => {
18
18
  const nodeView = new type({ ...props, dispatch }, node, view, getPos, decorations);
19
19
  nodeView.initialise();
@@ -17,9 +17,9 @@ import { schema } from '@manuscripts/transform';
17
17
  import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
18
18
  import { draggableIcon } from '../icons';
19
19
  import { addInteractionHandlers, createFileHandlers, createFileUploader, createMediaPlaceholder, createReactTools, createUnsupportedFormat, MediaType, } from '../lib/media';
20
- import { isDeleted } from '../lib/track-changes-utils';
21
20
  import { createEditableNodeView } from './creators';
22
21
  import { FigureView } from './figure';
22
+ import { isDeleted } from '@manuscripts/track-changes-plugin';
23
23
  export class FigureEditableView extends FigureView {
24
24
  constructor() {
25
25
  super(...arguments);
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ContextMenu } from '@manuscripts/style-guide';
17
+ import { isDeleted, isPendingInsert } from '@manuscripts/track-changes-plugin';
17
18
  import { schema } from '@manuscripts/transform';
18
19
  import { isEqual } from 'lodash';
19
20
  import { NodeSelection } from 'prosemirror-state';
@@ -21,7 +22,6 @@ import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
21
22
  import { DeleteFootnoteDialog, } from '../components/views/DeleteFootnoteDialog';
22
23
  import { alertIcon } from '../icons';
23
24
  import { getFootnotesElementState } from '../lib/footnotes';
24
- import { isDeleted, isPendingInsert } from '../lib/track-changes-utils';
25
25
  import { BaseNodeView } from './base_node_view';
26
26
  import { createNodeView } from './creators';
27
27
  import ReactSubView from './ReactSubView';
@@ -17,10 +17,10 @@ import { ContextMenu } from '@manuscripts/style-guide';
17
17
  import { schema } from '@manuscripts/transform';
18
18
  import { findChildrenByType, findParentNodeOfTypeClosestToPos, } from 'prosemirror-utils';
19
19
  import { DeleteFootnoteDialog, } from '../components/views/DeleteFootnoteDialog';
20
- import { isDeleted, isPendingInsert } from '../lib/track-changes-utils';
21
20
  import { BaseNodeView } from './base_node_view';
22
21
  import { createNodeView } from './creators';
23
22
  import ReactSubView from './ReactSubView';
23
+ import { isDeleted, isPendingInsert } from '@manuscripts/track-changes-plugin';
24
24
  export class GeneralTableFootnoteView extends BaseNodeView {
25
25
  constructor() {
26
26
  super(...arguments);
@@ -19,10 +19,10 @@ import { insertFootnotesElement } from '../commands';
19
19
  import { FootnotesSelector, } from '../components/views/FootnotesSelector';
20
20
  import { handleEnterKey } from '../lib/navigation-utils';
21
21
  import { createFootnote, findFootnotesContainerNode, getFootnotesElementState, } from '../lib/footnotes';
22
- import { isDeleted, isPendingInsert } from '../lib/track-changes-utils';
23
22
  import { BaseNodeView } from './base_node_view';
24
23
  import { createNodeView } from './creators';
25
24
  import ReactSubView from './ReactSubView';
25
+ import { isDeleted, isPendingInsert } from '@manuscripts/track-changes-plugin';
26
26
  export class InlineFootnoteView extends BaseNodeView {
27
27
  constructor() {
28
28
  super(...arguments);
@@ -19,7 +19,7 @@ import { handleEnterKey } from '../lib/navigation-utils';
19
19
  import { BaseNodeView } from './base_node_view';
20
20
  import { createNodeView } from './creators';
21
21
  import ReactSubView from './ReactSubView';
22
- import { isDeleted } from '../lib/track-changes-utils';
22
+ import { isDeleted } from '@manuscripts/track-changes-plugin';
23
23
  const deleteIcon = '<svg width="8px" height="8px" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg">\n' +
24
24
  ' <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n' +
25
25
  ' <g fill="#6E6E6E">\n' +