@manuscripts/article-editor 3.2.19-LEAN-3958.2 → 3.2.19-LEAN-3894.0
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.
- package/dist/cjs/components/comments/CommentActions.js +11 -7
- package/dist/cjs/components/comments/CommentActions.js.map +1 -1
- package/dist/cjs/components/comments/CommentCard.js +162 -0
- package/dist/cjs/components/comments/CommentCard.js.map +1 -0
- package/dist/cjs/components/comments/CommentResolveButton.js +1 -1
- package/dist/cjs/components/comments/CommentThread.js +77 -89
- package/dist/cjs/components/comments/CommentThread.js.map +1 -1
- package/dist/cjs/components/comments/CommentsPanel.js +33 -10
- package/dist/cjs/components/comments/CommentsPanel.js.map +1 -1
- package/dist/cjs/components/comments/DeleteCommentConfirmation.js +69 -0
- package/dist/cjs/components/comments/DeleteCommentConfirmation.js.map +1 -0
- package/dist/cjs/components/comments/ReplyBox.js +118 -0
- package/dist/cjs/components/comments/ReplyBox.js.map +1 -0
- package/dist/cjs/components/track-changes/suggestion-list/Suggestion.js +3 -3
- package/dist/cjs/components/track-changes/suggestion-list/Suggestion.js.map +1 -1
- package/dist/cjs/components/track-changes/suggestion-list/SuggestionSnippet.js +118 -26
- package/dist/cjs/components/track-changes/suggestion-list/SuggestionSnippet.js.map +1 -1
- package/dist/cjs/lib/comments.js +26 -5
- package/dist/cjs/lib/comments.js.map +1 -1
- package/dist/cjs/lib/fonts.js +0 -3
- package/dist/cjs/lib/fonts.js.map +1 -1
- package/dist/cjs/lib/footnotes.js +49 -0
- package/dist/cjs/lib/footnotes.js.map +1 -0
- package/dist/cjs/lib/tracking.js +0 -3
- package/dist/cjs/lib/tracking.js.map +1 -1
- package/dist/cjs/lib/utils.js +28 -11
- package/dist/cjs/lib/utils.js.map +1 -1
- package/dist/es/components/comments/CommentActions.js +11 -7
- package/dist/es/components/comments/CommentActions.js.map +1 -1
- package/dist/es/components/comments/CommentCard.js +132 -0
- package/dist/es/components/comments/CommentCard.js.map +1 -0
- package/dist/es/components/comments/CommentResolveButton.js +1 -1
- package/dist/es/components/comments/CommentThread.js +80 -92
- package/dist/es/components/comments/CommentThread.js.map +1 -1
- package/dist/es/components/comments/CommentsPanel.js +35 -12
- package/dist/es/components/comments/CommentsPanel.js.map +1 -1
- package/dist/es/components/comments/DeleteCommentConfirmation.js +62 -0
- package/dist/es/components/comments/DeleteCommentConfirmation.js.map +1 -0
- package/dist/es/components/comments/ReplyBox.js +88 -0
- package/dist/es/components/comments/ReplyBox.js.map +1 -0
- package/dist/es/components/track-changes/suggestion-list/Suggestion.js +3 -3
- package/dist/es/components/track-changes/suggestion-list/Suggestion.js.map +1 -1
- package/dist/es/components/track-changes/suggestion-list/SuggestionSnippet.js +119 -27
- package/dist/es/components/track-changes/suggestion-list/SuggestionSnippet.js.map +1 -1
- package/dist/es/lib/comments.js +23 -3
- package/dist/es/lib/comments.js.map +1 -1
- package/dist/es/lib/fonts.js +0 -3
- package/dist/es/lib/fonts.js.map +1 -1
- package/dist/es/lib/footnotes.js +43 -0
- package/dist/es/lib/footnotes.js.map +1 -0
- package/dist/es/lib/tracking.js +0 -3
- package/dist/es/lib/tracking.js.map +1 -1
- package/dist/es/lib/utils.js +25 -10
- package/dist/es/lib/utils.js.map +1 -1
- package/dist/types/{lib/change-handlers.d.ts → components/comments/CommentCard.d.ts} +12 -9
- package/dist/types/components/comments/CommentThread.d.ts +3 -2
- package/dist/{es/components/track-changes/suggestion-list/SnippetContent.js → types/components/comments/DeleteCommentConfirmation.d.ts} +7 -33
- package/dist/types/components/{track-changes/suggestion-list/SnippetContent.d.ts → comments/ReplyBox.d.ts} +5 -5
- package/dist/types/lib/comments.d.ts +4 -3
- package/dist/types/lib/fonts.d.ts +0 -3
- package/dist/types/lib/footnotes.d.ts +15 -0
- package/dist/types/lib/utils.d.ts +8 -1
- package/package.json +3 -3
- package/dist/cjs/components/track-changes/suggestion-list/SnippetContent.js +0 -72
- package/dist/cjs/components/track-changes/suggestion-list/SnippetContent.js.map +0 -1
- package/dist/cjs/lib/change-handlers.js +0 -123
- package/dist/cjs/lib/change-handlers.js.map +0 -1
- package/dist/cjs/lib/node-content-retriever.js +0 -130
- package/dist/cjs/lib/node-content-retriever.js.map +0 -1
- package/dist/es/components/track-changes/suggestion-list/SnippetContent.js.map +0 -1
- package/dist/es/lib/change-handlers.js +0 -117
- package/dist/es/lib/change-handlers.js.map +0 -1
- package/dist/es/lib/node-content-retriever.js +0 -123
- package/dist/es/lib/node-content-retriever.js.map +0 -1
- package/dist/types/lib/node-content-retriever.d.ts +0 -37
@@ -1,123 +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) 2024 Atypon Systems LLC. All Rights Reserved.
|
11
|
-
*/
|
12
|
-
import { bibliographyPluginKey, footnotesPluginKey, metadata, objectsPluginKey, } from '@manuscripts/body-editor';
|
13
|
-
import { isElementNodeType, schema, } from '@manuscripts/transform';
|
14
|
-
import domPurify from 'dompurify';
|
15
|
-
export class NodeTextContentRetriever {
|
16
|
-
constructor(state) {
|
17
|
-
this.state = state;
|
18
|
-
}
|
19
|
-
/**
|
20
|
-
* Recursively retrieves text content from a ManuscriptNode.
|
21
|
-
*/
|
22
|
-
getNodeTextContent(node) {
|
23
|
-
let textContent = '';
|
24
|
-
if (!isElementNodeType(node.type)) {
|
25
|
-
node.forEach((child) => {
|
26
|
-
if (child.isText) {
|
27
|
-
textContent += child.text;
|
28
|
-
}
|
29
|
-
else {
|
30
|
-
textContent += this.getNodeTextContent(child);
|
31
|
-
}
|
32
|
-
});
|
33
|
-
}
|
34
|
-
return textContent;
|
35
|
-
}
|
36
|
-
/**
|
37
|
-
* Retrieves the text content of the first child node.
|
38
|
-
*/
|
39
|
-
getFirstChildContent(node) {
|
40
|
-
return node.firstChild ? node.firstChild.textContent : '';
|
41
|
-
}
|
42
|
-
/**
|
43
|
-
* Retrieves the text content from a bibliography node.
|
44
|
-
*/
|
45
|
-
getContentFromBibliography(id, node) {
|
46
|
-
const bibPlugin = bibliographyPluginKey.get(this.state);
|
47
|
-
const bib = bibPlugin?.getState(this.state);
|
48
|
-
if (!bib) {
|
49
|
-
return '';
|
50
|
-
}
|
51
|
-
if (node.type === schema.nodes.citation) {
|
52
|
-
const text = bib?.renderedCitations.get(id);
|
53
|
-
const citation = domPurify.sanitize(text && text !== '[NO_PRINTED_FORM]' ? text : ' ', {
|
54
|
-
ALLOWED_TAGS: ['i', 'b', 'span', 'sup', 'sub', '#text'],
|
55
|
-
});
|
56
|
-
return citation ? citation.replace(/<[^>]*>/g, '') : '';
|
57
|
-
}
|
58
|
-
else {
|
59
|
-
const [meta, bibliography] = bib.provider.makeBibliography();
|
60
|
-
const selectedBib = meta.entry_ids.findIndex((entry) => entry[0] === id);
|
61
|
-
if (selectedBib === -1) {
|
62
|
-
return `<span> ${node.attrs.title || 'untitled'} </span> ${metadata(node.attrs)}`;
|
63
|
-
}
|
64
|
-
const parser = new DOMParser();
|
65
|
-
const textContent = parser.parseFromString(bibliography[selectedBib], 'text/html').body.textContent;
|
66
|
-
return textContent || '';
|
67
|
-
}
|
68
|
-
}
|
69
|
-
/**
|
70
|
-
* Retrieves the content of an equation node.
|
71
|
-
*/
|
72
|
-
getEquationContent(node) {
|
73
|
-
if (node.firstChild && node.type === schema.nodes.equation_element) {
|
74
|
-
return node.firstChild.attrs.contents;
|
75
|
-
}
|
76
|
-
else if (node) {
|
77
|
-
return node.attrs.contents;
|
78
|
-
}
|
79
|
-
return '';
|
80
|
-
}
|
81
|
-
/**
|
82
|
-
* Retrieves the label of a figure node.
|
83
|
-
*/
|
84
|
-
getFigureLabel(node) {
|
85
|
-
const objectsPlugin = objectsPluginKey.get(this.state);
|
86
|
-
const pluginState = objectsPlugin?.getState(this.state);
|
87
|
-
const target = pluginState?.get(node.attrs.id);
|
88
|
-
return target?.label || '';
|
89
|
-
}
|
90
|
-
/**
|
91
|
-
* Finds a footnote node by its ID.
|
92
|
-
*/
|
93
|
-
findFootnoteById(doc, id) {
|
94
|
-
let footnoteNode = null;
|
95
|
-
doc.descendants((node) => {
|
96
|
-
if (node.type === schema.nodes.footnote && node.attrs.id === id) {
|
97
|
-
footnoteNode = node;
|
98
|
-
return false;
|
99
|
-
}
|
100
|
-
return !footnoteNode;
|
101
|
-
});
|
102
|
-
return footnoteNode;
|
103
|
-
}
|
104
|
-
/**
|
105
|
-
* Retrieves the inline footnote content.
|
106
|
-
*/
|
107
|
-
getInlineFootnoteContent(doc, attrs) {
|
108
|
-
const footnote = attrs.rids && attrs.rids.length > 0
|
109
|
-
? this.findFootnoteById(doc, attrs.rids[0])
|
110
|
-
: null;
|
111
|
-
return `<sup class="footnote-decoration">${attrs.contents || ''}</sup>${footnote ? footnote.textContent : ''}`;
|
112
|
-
}
|
113
|
-
/**
|
114
|
-
* Retrieves the text content of a footnote node with decoration.
|
115
|
-
*/
|
116
|
-
getFootnoteContent(node) {
|
117
|
-
const footnotesPlugin = footnotesPluginKey.get(this.state);
|
118
|
-
const pluginState = footnotesPlugin?.getState(this.state);
|
119
|
-
const decorationText = pluginState?.labels.get(node.attrs.id) || '';
|
120
|
-
return `<sup class="footnote-decoration">${decorationText}</sup>${this.getNodeTextContent(node)}`;
|
121
|
-
}
|
122
|
-
}
|
123
|
-
//# sourceMappingURL=node-content-retriever.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"node-content-retriever.js","sourceRoot":"","sources":["../../../src/lib/node-content-retriever.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAEL,qBAAqB,EACrB,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,GACjB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,iBAAiB,EAGjB,MAAM,GACP,MAAM,wBAAwB,CAAA;AAC/B,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,MAAM,OAAO,wBAAwB;IAGnC,YAAY,KAA4B;QACtC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED;;OAEG;IACI,kBAAkB,CAAC,IAAoB;QAC5C,IAAI,WAAW,GAAG,EAAE,CAAA;QACpB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACjC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBACrB,IAAI,KAAK,CAAC,MAAM,EAAE;oBAChB,WAAW,IAAI,KAAK,CAAC,IAAI,CAAA;iBAC1B;qBAAM;oBACL,WAAW,IAAI,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;iBAC9C;YACH,CAAC,CAAC,CAAA;SACH;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;IAED;;OAEG;IACI,oBAAoB,CAAC,IAAoB;QAC9C,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;IAC3D,CAAC;IAED;;OAEG;IACI,0BAA0B,CAAC,EAAU,EAAE,IAAoB;QAChE,MAAM,SAAS,GAAG,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACvD,MAAM,GAAG,GAAG,SAAS,EAAE,QAAQ,CAAC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CAAC;YACjC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC3C,CAAC,CAAC,IAAI,CAAA;QAEV,OAAO,oCAAoC,KAAK,CAAC,QAAQ,IAAI,EAAE,SAC7D,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,EACpC,EAAE,CAAA;IACJ,CAAC;IAED;;OAEG;IACI,kBAAkB,CAAC,IAAoB;QAC5C,MAAM,eAAe,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC1D,MAAM,WAAW,GAAG,eAAe,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACzD,MAAM,cAAc,GAAG,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,CAAA;QAEnE,OAAO,oCAAoC,cAAc,SAAS,IAAI,CAAC,kBAAkB,CACvF,IAAI,CACL,EAAE,CAAA;IACL,CAAC;CACF"}
|
@@ -1,37 +0,0 @@
|
|
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
|
-
}
|