@manuscripts/article-editor 3.3.1 → 3.3.2-LEAN-3958.1

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 (42) hide show
  1. package/dist/cjs/components/track-changes/suggestion-list/SnippetContent.js +72 -0
  2. package/dist/cjs/components/track-changes/suggestion-list/SnippetContent.js.map +1 -0
  3. package/dist/cjs/components/track-changes/suggestion-list/Suggestion.js +3 -3
  4. package/dist/cjs/components/track-changes/suggestion-list/Suggestion.js.map +1 -1
  5. package/dist/cjs/components/track-changes/suggestion-list/SuggestionSnippet.js +26 -118
  6. package/dist/cjs/components/track-changes/suggestion-list/SuggestionSnippet.js.map +1 -1
  7. package/dist/cjs/lib/change-handlers.js +123 -0
  8. package/dist/cjs/lib/change-handlers.js.map +1 -0
  9. package/dist/cjs/lib/fonts.js +3 -0
  10. package/dist/cjs/lib/fonts.js.map +1 -1
  11. package/dist/cjs/lib/node-content-retriever.js +130 -0
  12. package/dist/cjs/lib/node-content-retriever.js.map +1 -0
  13. package/dist/cjs/lib/tracking.js +3 -0
  14. package/dist/cjs/lib/tracking.js.map +1 -1
  15. package/dist/cjs/lib/utils.js +11 -28
  16. package/dist/cjs/lib/utils.js.map +1 -1
  17. package/dist/es/components/track-changes/suggestion-list/SnippetContent.js +44 -0
  18. package/dist/es/components/track-changes/suggestion-list/SnippetContent.js.map +1 -0
  19. package/dist/es/components/track-changes/suggestion-list/Suggestion.js +3 -3
  20. package/dist/es/components/track-changes/suggestion-list/Suggestion.js.map +1 -1
  21. package/dist/es/components/track-changes/suggestion-list/SuggestionSnippet.js +27 -119
  22. package/dist/es/components/track-changes/suggestion-list/SuggestionSnippet.js.map +1 -1
  23. package/dist/es/lib/change-handlers.js +117 -0
  24. package/dist/es/lib/change-handlers.js.map +1 -0
  25. package/dist/es/lib/fonts.js +3 -0
  26. package/dist/es/lib/fonts.js.map +1 -1
  27. package/dist/es/lib/node-content-retriever.js +123 -0
  28. package/dist/es/lib/node-content-retriever.js.map +1 -0
  29. package/dist/es/lib/tracking.js +3 -0
  30. package/dist/es/lib/tracking.js.map +1 -1
  31. package/dist/es/lib/utils.js +10 -25
  32. package/dist/es/lib/utils.js.map +1 -1
  33. package/dist/types/{lib/footnotes.d.ts → components/track-changes/suggestion-list/SnippetContent.d.ts} +8 -5
  34. package/dist/types/lib/change-handlers.d.ts +22 -0
  35. package/dist/types/lib/fonts.d.ts +3 -0
  36. package/dist/types/lib/node-content-retriever.d.ts +37 -0
  37. package/dist/types/lib/utils.d.ts +1 -8
  38. package/package.json +3 -3
  39. package/dist/cjs/lib/footnotes.js +0 -49
  40. package/dist/cjs/lib/footnotes.js.map +0 -1
  41. package/dist/es/lib/footnotes.js +0 -43
  42. package/dist/es/lib/footnotes.js.map +0 -1
@@ -1,32 +1,17 @@
1
- export const getNodeTextContent = (node) => {
2
- let textContent = '';
3
- // Traverse the node and its descendants
4
- node.forEach((child) => {
5
- if (child.isText) {
6
- // If the child is a text node, add its text content
7
- textContent += child.text;
8
- }
9
- else {
10
- // If the child is not a text node, recursively collect text content
11
- textContent += getNodeTextContent(child);
12
- }
13
- });
14
- return textContent;
15
- };
16
- export const findPluginByKey = (state, keyName) => {
17
- for (let i = 0; i < state.plugins.length; i++) {
18
- const plugin = state.plugins[i];
19
- if (plugin.key === keyName + '$') {
20
- return plugin;
21
- }
22
- }
23
- return null;
24
- };
25
1
  export const getParentNode = (state, pos) => {
26
2
  const resolvedPos = state.doc.resolve(pos);
27
3
  for (let depth = resolvedPos.depth; depth > 0; depth--) {
28
4
  const parent = resolvedPos.node(depth);
29
- if (parent.isTextblock === false) {
5
+ if (parent.isText === false) {
6
+ if (parent.type == state.schema.nodes.paragraph) {
7
+ const grandParent = resolvedPos.node(depth - 1);
8
+ if (grandParent.type == state.schema.nodes.footnote) {
9
+ return grandParent;
10
+ }
11
+ else {
12
+ return parent;
13
+ }
14
+ }
30
15
  return parent;
31
16
  }
32
17
  }
@@ -1 +1 @@
1
- {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,CAAC,KAAK,CAAC,CAAA;IACxC,EAAE,CAAC,SAAS,GAAG,IAAI,CAAA;IACnB,OAAO,EAAE,CAAC,SAAS,CAAA;AACrB,CAAC,CAAA"}
@@ -7,9 +7,12 @@
7
7
  *
8
8
  * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
9
9
  *
10
- * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
10
+ * All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
11
11
  */
12
- import { ManuscriptEditorState, ManuscriptNode } from '@manuscripts/transform';
13
- export declare const findFootnoteById: (doc: ManuscriptNode, id: string) => ManuscriptNode | null;
14
- export declare const getInlineFootnoteContent: (doc: ManuscriptNode, attrs: Record<any, any>) => string;
15
- export declare const getFootnoteText: (state: ManuscriptEditorState, node: ManuscriptNode) => string;
12
+ import React from 'react';
13
+ interface ContentProps {
14
+ content: string;
15
+ isEquation?: boolean;
16
+ }
17
+ declare const SnippetContent: React.FC<ContentProps>;
18
+ export default SnippetContent;
@@ -0,0 +1,22 @@
1
+ /*!
2
+ * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
3
+ *
4
+ * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
5
+ *
6
+ * The Original Code is manuscripts-frontend.
7
+ *
8
+ * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
9
+ *
10
+ * All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
11
+ */
12
+ import { NodeAttrChange, NodeChange, TextChange } from '@manuscripts/track-changes-plugin';
13
+ interface SnippetData {
14
+ operation: string;
15
+ nodeName: string;
16
+ content: string | null;
17
+ isEquation?: boolean;
18
+ }
19
+ export declare const handleTextChange: (suggestion: TextChange, view: any, dataTracked: any) => SnippetData | null;
20
+ export declare const handleNodeChange: (suggestion: NodeChange | NodeAttrChange, view: any, doc: any, dataTracked: any) => SnippetData | null;
21
+ export declare const handleUnknownChange: () => SnippetData;
22
+ export {};
@@ -12,3 +12,6 @@
12
12
  import '@fontsource/lato';
13
13
  import '@fontsource/pt-sans';
14
14
  import '@fontsource/pt-serif';
15
+ import '@fontsource/lato/300.css';
16
+ import '@fontsource/lato/400.css';
17
+ import '@fontsource/lato/700.css';
@@ -0,0 +1,37 @@
1
+ import { ManuscriptEditorState, ManuscriptNode } from '@manuscripts/transform';
2
+ export declare class NodeTextContentRetriever {
3
+ private state;
4
+ constructor(state: ManuscriptEditorState);
5
+ /**
6
+ * Recursively retrieves text content from a ManuscriptNode.
7
+ */
8
+ getNodeTextContent(node: ManuscriptNode): string;
9
+ /**
10
+ * Retrieves the text content of the first child node.
11
+ */
12
+ getFirstChildContent(node: ManuscriptNode): string;
13
+ /**
14
+ * Retrieves the text content from a bibliography node.
15
+ */
16
+ getContentFromBibliography(id: string, node: ManuscriptNode): string;
17
+ /**
18
+ * Retrieves the content of an equation node.
19
+ */
20
+ getEquationContent(node: ManuscriptNode): string;
21
+ /**
22
+ * Retrieves the label of a figure node.
23
+ */
24
+ getFigureLabel(node: ManuscriptNode): string;
25
+ /**
26
+ * Finds a footnote node by its ID.
27
+ */
28
+ private findFootnoteById;
29
+ /**
30
+ * Retrieves the inline footnote content.
31
+ */
32
+ getInlineFootnoteContent(doc: ManuscriptNode, attrs: Record<any, any>): string;
33
+ /**
34
+ * Retrieves the text content of a footnote node with decoration.
35
+ */
36
+ getFootnoteContent(node: ManuscriptNode): string;
37
+ }
@@ -9,13 +9,6 @@
9
9
  *
10
10
  * All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
11
11
  */
12
- import { ManuscriptEditorState, ManuscriptNode } from '@manuscripts/transform';
13
- import { EditorState, Plugin } from 'prosemirror-state';
14
- interface ExtendedPlugin extends Plugin {
15
- key: string;
16
- }
17
- export declare const getNodeTextContent: (node: ManuscriptNode) => string;
18
- export declare const findPluginByKey: (state: ManuscriptEditorState, keyName: string) => ExtendedPlugin | null;
12
+ import { EditorState } from 'prosemirror-state';
19
13
  export declare const getParentNode: (state: EditorState, pos: number) => import("prosemirror-model").Node | null;
20
14
  export declare const decodeHTMLEntities: (text: string) => string;
21
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manuscripts/article-editor",
3
- "version": "3.3.1",
3
+ "version": "3.3.2-LEAN-3958.1",
4
4
  "license": "CPAL-1.0",
5
5
  "description": "React components for editing and viewing manuscripts",
6
6
  "repository": "github:Atypon-OpenSource/manuscripts-article-editor",
@@ -35,12 +35,12 @@
35
35
  "@fontsource/lato": "^4.5.10",
36
36
  "@fontsource/pt-sans": "^4.5.11",
37
37
  "@fontsource/pt-serif": "^4.5.11",
38
- "@manuscripts/body-editor": "2.3.0",
38
+ "@manuscripts/body-editor": "2.3.1-LEAN-3958.0",
39
39
  "@manuscripts/json-schema": "2.2.11",
40
40
  "@manuscripts/library": "1.3.11",
41
41
  "@manuscripts/style-guide": "2.0.21",
42
42
  "@manuscripts/track-changes-plugin": "1.8.0",
43
- "@manuscripts/transform": "3.0.6",
43
+ "@manuscripts/transform": "3.0.7-LEAN-3958.0",
44
44
  "@popperjs/core": "^2.11.8",
45
45
  "@reach/tabs": "^0.18.0",
46
46
  "@types/use-sync-external-store": "^0.0.6",
@@ -1,49 +0,0 @@
1
- "use strict";
2
- /*!
3
- * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
4
- *
5
- * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
6
- *
7
- * The Original Code is manuscripts-frontend.
8
- *
9
- * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
10
- *
11
- * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
12
- */
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.getFootnoteText = exports.getInlineFootnoteContent = exports.findFootnoteById = void 0;
15
- const utils_1 = require("./utils");
16
- const findFootnoteById = (doc, id) => {
17
- let footnoteNode = null;
18
- doc.descendants((node) => {
19
- if (node.type.name === 'footnote' && node.attrs.id === id) {
20
- footnoteNode = node;
21
- return false; // stop traversal
22
- }
23
- if (footnoteNode) {
24
- return false;
25
- }
26
- return true; // continue traversal
27
- });
28
- return footnoteNode;
29
- };
30
- exports.findFootnoteById = findFootnoteById;
31
- const getInlineFootnoteContent = (doc, attrs) => {
32
- let footnote = null;
33
- if (attrs.rids && attrs.rids.length > 0) {
34
- footnote = (0, exports.findFootnoteById)(doc, attrs.rids[0]);
35
- }
36
- return `<sup class="footnote-decoration">${attrs.contents ? attrs.contents : ''}</sup>${footnote ? footnote.textContent : ''}`;
37
- };
38
- exports.getInlineFootnoteContent = getInlineFootnoteContent;
39
- const getFootnoteText = (state, node) => {
40
- const footnotesPlugin = (0, utils_1.findPluginByKey)(state, 'footnotes');
41
- const pluginState = footnotesPlugin?.getState(state);
42
- let decorationText = '';
43
- if (pluginState) {
44
- decorationText = pluginState.labels.get(node.attrs.id);
45
- }
46
- return `<sup class="footnote-decoration">${decorationText ? decorationText : ''}</sup>${(0, utils_1.getNodeTextContent)(node)}`;
47
- };
48
- exports.getFootnoteText = getFootnoteText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CAC7B,KAA4B,EAC5B,IAAoB,EACpB,EAAE;IACF,MAAM,eAAe,GAAG,IAAA,uBAAe,EAAC,KAAK,EAAE,WAAW,CAAC,CAAA;IAC3D,MAAM,WAAW,GAAG,eAAe,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;IACpD,IAAI,cAAc,GAAG,EAAE,CAAA;IACvB,IAAI,WAAW,EAAE;QACf,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;KACvD;IACD,OAAO,oCACL,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EACpC,SAAS,IAAA,0BAAkB,EAAC,IAAI,CAAC,EAAE,CAAA;AACrC,CAAC,CAAA;AAbY,QAAA,eAAe,mBAa3B"}
@@ -1,43 +0,0 @@
1
- /*!
2
- * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
3
- *
4
- * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
5
- *
6
- * The Original Code is manuscripts-frontend.
7
- *
8
- * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
9
- *
10
- * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
11
- */
12
- import { findPluginByKey, getNodeTextContent } from './utils';
13
- export const findFootnoteById = (doc, id) => {
14
- let footnoteNode = null;
15
- doc.descendants((node) => {
16
- if (node.type.name === 'footnote' && node.attrs.id === id) {
17
- footnoteNode = node;
18
- return false; // stop traversal
19
- }
20
- if (footnoteNode) {
21
- return false;
22
- }
23
- return true; // continue traversal
24
- });
25
- return footnoteNode;
26
- };
27
- export const getInlineFootnoteContent = (doc, attrs) => {
28
- let footnote = null;
29
- if (attrs.rids && attrs.rids.length > 0) {
30
- footnote = findFootnoteById(doc, attrs.rids[0]);
31
- }
32
- return `<sup class="footnote-decoration">${attrs.contents ? attrs.contents : ''}</sup>${footnote ? footnote.textContent : ''}`;
33
- };
34
- export const getFootnoteText = (state, node) => {
35
- const footnotesPlugin = findPluginByKey(state, 'footnotes');
36
- const pluginState = footnotesPlugin?.getState(state);
37
- let decorationText = '';
38
- if (pluginState) {
39
- decorationText = pluginState.labels.get(node.attrs.id);
40
- }
41
- return `<sup class="footnote-decoration">${decorationText ? decorationText : ''}</sup>${getNodeTextContent(node)}`;
42
- };
43
- //# sourceMappingURL=footnotes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"footnotes.js","sourceRoot":"","sources":["../../../src/lib/footnotes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,GAAmB,EACnB,EAAU,EACa,EAAE;IACzB,IAAI,YAAY,GAA0B,IAAI,CAAA;IAE9C,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;QACvB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE;YACzD,YAAY,GAAG,IAAI,CAAA;YACnB,OAAO,KAAK,CAAA,CAAC,iBAAiB;SAC/B;QACD,IAAI,YAAY,EAAE;YAChB,OAAO,KAAK,CAAA;SACb;QACD,OAAO,IAAI,CAAA,CAAC,qBAAqB;IACnC,CAAC,CAAC,CAAA;IACF,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,GAAmB,EAC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