@manuscripts/body-editor 3.12.3 → 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 (82) 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 +11 -11
  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 +7 -7
  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/dist/types/views/footnote.d.ts +2 -2
  79. package/package.json +3 -3
  80. package/dist/cjs/lib/filtered-document.js +0 -49
  81. package/dist/es/lib/filtered-document.js +0 -44
  82. package/dist/types/lib/filtered-document.d.ts +0 -18
@@ -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';
@@ -35,15 +35,15 @@ export class FootnoteView extends BaseNodeView {
35
35
  this.dom.tabIndex = 0;
36
36
  this.contentDOM = document.createElement('div');
37
37
  this.contentDOM.classList.add('footnote-text');
38
- this.dom.addEventListener('mousedown', this.handleClick);
39
- this.dom.addEventListener('keydown', handleEnterKey(this.handleClick));
38
+ this.dom.addEventListener('mousedown', (e) => this.handleClick(e, false));
39
+ this.dom.addEventListener('keydown', handleEnterKey((e) => this.handleClick(e, true)));
40
40
  this.updateContents();
41
41
  };
42
- this.handleClick = (event) => {
42
+ this.handleClick = (event, fromKeyboard = false) => {
43
43
  const element = event.target;
44
44
  const item = element.closest('.footnote');
45
45
  if (item) {
46
- this.showContextMenu(item);
46
+ this.showContextMenu(item, fromKeyboard);
47
47
  }
48
48
  };
49
49
  this.handleMarkerClick = (e) => {
@@ -134,7 +134,7 @@ export class FootnoteView extends BaseNodeView {
134
134
  const fn = getFootnotesElementState(this.view.state, id);
135
135
  return { id, fn };
136
136
  }
137
- showContextMenu(element) {
137
+ showContextMenu(element, autoFocus) {
138
138
  this.props.popper.destroy();
139
139
  const can = this.props.getCapabilities();
140
140
  const { id, fn } = this.getFootnoteState();
@@ -156,7 +156,7 @@ export class FootnoteView extends BaseNodeView {
156
156
  });
157
157
  }
158
158
  this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu', 'footnote-context-menu']);
159
- this.props.popper.show(element, this.contextMenu, 'right-start');
159
+ this.props.popper.show(element, this.contextMenu, 'right-start', true, [], autoFocus);
160
160
  }
161
161
  }
162
162
  const getEffectiveChildCount = (node) => {
@@ -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' +
@@ -15,10 +15,10 @@
15
15
  */
16
16
  import { AddKeywordInline } from '../components/keywords/AddKeywordInline';
17
17
  import { createKeyboardInteraction } from '../lib/navigation-utils';
18
- import { isDeleted } from '../lib/track-changes-utils';
19
18
  import BlockView from './block_view';
20
19
  import { createNodeView } from './creators';
21
20
  import ReactSubView from './ReactSubView';
21
+ import { isDeleted } from '@manuscripts/track-changes-plugin';
22
22
  export class KeywordGroupView extends BlockView {
23
23
  constructor() {
24
24
  super(...arguments);
@@ -16,11 +16,11 @@
16
16
  import { schema } from '@manuscripts/transform';
17
17
  import { TextSelection } from 'prosemirror-state';
18
18
  import { LinkForm, } from '../components/views/LinkForm';
19
- import { isDeleted } from '../lib/track-changes-utils';
20
19
  import { allowedHref } from '../lib/url';
21
20
  import { createEditableNodeView } from './creators';
22
21
  import { LinkView } from './link';
23
22
  import ReactSubView from './ReactSubView';
23
+ import { isDeleted } from '@manuscripts/track-changes-plugin';
24
24
  export class LinkEditableView extends LinkView {
25
25
  constructor() {
26
26
  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, addTrackChangesClassNames, isDeleted, } from '@manuscripts/track-changes-plugin';
16
17
  import { plusIcon } from '../icons';
17
- import { addTrackChangesAttributes, addTrackChangesClassNames, isDeleted, } from '../lib/track-changes-utils';
18
18
  import { createEditableNodeView } from './creators';
19
19
  import { FigureEditableView } from './figure_editable';
20
20
  export class QuoteImageEditableView extends FigureEditableView {
@@ -4,7 +4,6 @@ import { EditorState, Transaction } from 'prosemirror-state';
4
4
  import { EditorView } from 'prosemirror-view';
5
5
  import { Dispatch } from '../../commands';
6
6
  import { Option } from './type-selector/TypeSelector';
7
- export declare const shouldSkipNode: (node: Node) => boolean;
8
7
  export declare const optionName: (nodeType: ManuscriptNodeType) => string;
9
8
  export declare const titleCase: (text: string) => string;
10
9
  export declare const findSelectedOption: (options: Option[]) => Option | undefined;
@@ -13,19 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { TrackedAttrs } from '@manuscripts/track-changes-plugin';
17
- import { Attrs, Fragment, Mark, Node as ProsemirrorNode } from 'prosemirror-model';
18
- export declare function isDeleted(node: ProsemirrorNode | Mark): boolean;
19
- export declare function isShadowDelete(node: ProsemirrorNode): boolean;
20
- export declare function isPendingInsert(node: ProsemirrorNode): boolean;
21
- export declare function isPending(node: ProsemirrorNode): boolean;
22
- export declare function isPendingSetAttrs(node: ProsemirrorNode): boolean;
23
- export declare function getChangeClasses(dataTracked?: TrackedAttrs[]): string[];
24
- export declare function isTracked(node: ProsemirrorNode | Mark): boolean;
25
- export declare const getAttrsTrackingButton: (changeID: string) => HTMLButtonElement;
16
+ import { Node as ProsemirrorNode } from 'prosemirror-model';
26
17
  export declare function isHidden(node: ProsemirrorNode): boolean;
27
- export declare function isDeletedText(node: ProsemirrorNode): boolean;
28
- export declare function getActualTextContent(fragment: Fragment): string;
29
- export declare function sanitizeAttrsChange<T extends ProsemirrorNode>(newAttr: T['attrs'], currentAttrs: T['attrs']): T["attrs"];
30
- export declare const addTrackChangesAttributes: (attrs: Attrs, dom: Element) => void;
31
- export declare const addTrackChangesClassNames: (attrs: Attrs, dom: Element) => void;
18
+ export declare const getAttrsTrackingButton: (changeID: string) => HTMLButtonElement;
@@ -37,7 +37,7 @@ export declare const isEditAllowed: (state: EditorState) => boolean;
37
37
  export declare const createToggleButton: (listener: (event: MouseEvent | KeyboardEvent) => void, what: string) => HTMLButtonElement;
38
38
  export declare const getInsertPos: (type: ManuscriptNodeType, parent: ManuscriptNode, pos: number) => number;
39
39
  export declare const findInsertionPosition: (type: ManuscriptNodeType, doc: ManuscriptNode) => number;
40
- export declare const filterBlockNodes: (fragment: Fragment, predicate: (node: ProseMirrorNode) => boolean) => Fragment;
40
+ export declare const filterBlockNodes: (fragment: Fragment, predicate?: (node: ProseMirrorNode) => boolean) => Fragment;
41
41
  export declare const getLastTitleNode: (state: ManuscriptEditorState) => {
42
42
  node: ProseMirrorNode;
43
43
  pos: number;
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.12.3";
1
+ export declare const VERSION = "3.12.5";
2
2
  export declare const MATHJAX_VERSION = "3.2.2";
@@ -26,8 +26,8 @@ export declare class FootnoteView extends BaseNodeView<Trackable<FootnoteNode>>
26
26
  id: string;
27
27
  fn: import("../plugins/footnotes").FootnotesElementState | undefined;
28
28
  };
29
- showContextMenu(element: HTMLElement): void;
30
- handleClick: (event: Event) => void;
29
+ showContextMenu(element: HTMLElement, autoFocus: boolean): void;
30
+ handleClick: (event: Event, fromKeyboard?: boolean) => void;
31
31
  handleMarkerClick: (e?: Event) => void;
32
32
  handleDeleteClick: (e?: Event) => void;
33
33
  handleDelete: () => void;
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.12.3",
4
+ "version": "3.12.5",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -38,8 +38,8 @@
38
38
  "@citation-js/plugin-ris": "0.7.18",
39
39
  "@iarna/word-count": "1.1.2",
40
40
  "@manuscripts/style-guide": "3.5.6",
41
- "@manuscripts/track-changes-plugin": "2.3.8",
42
- "@manuscripts/transform": "4.3.27",
41
+ "@manuscripts/track-changes-plugin": "2.3.9",
42
+ "@manuscripts/transform": "4.3.28",
43
43
  "@popperjs/core": "2.11.8",
44
44
  "citeproc": "2.4.63",
45
45
  "codemirror": "5.65.19",
@@ -1,49 +0,0 @@
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;
@@ -1,44 +0,0 @@
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
- };
@@ -1,18 +0,0 @@
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;