@manuscripts/article-editor 3.1.47-LEAN-3756.0 → 3.1.47-LEAN-3958.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.
- 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 +116 -87
- package/dist/cjs/components/track-changes/suggestion-list/SuggestionSnippet.js.map +1 -1
- package/dist/cjs/lib/fonts.js +4 -0
- package/dist/cjs/lib/fonts.js.map +1 -1
- package/dist/cjs/lib/utils.js +108 -3
- package/dist/cjs/lib/utils.js.map +1 -1
- 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 -90
- package/dist/es/components/track-changes/suggestion-list/SuggestionSnippet.js.map +1 -1
- package/dist/es/lib/fonts.js +4 -0
- package/dist/es/lib/fonts.js.map +1 -1
- package/dist/es/lib/utils.js +98 -2
- package/dist/es/lib/utils.js.map +1 -1
- package/dist/types/components/track-changes/suggestion-list/SuggestionSnippet.d.ts +0 -11
- package/dist/types/lib/fonts.d.ts +3 -0
- package/dist/types/lib/utils.d.ts +9 -0
- package/package.json +3 -4
- package/dist/cjs/lib/footnotes.js +0 -49
- package/dist/cjs/lib/footnotes.js.map +0 -1
- package/dist/es/lib/footnotes.js +0 -43
- package/dist/es/lib/footnotes.js.map +0 -1
- package/dist/types/lib/footnotes.d.ts +0 -15
@@ -81,8 +81,7 @@ const Wrapper = styled_components_1.default.li `
|
|
81
81
|
justify-content: space-between;
|
82
82
|
align-items: center;
|
83
83
|
gap: ${(props) => props.theme.grid.unit * 4}px;
|
84
|
-
padding:
|
85
|
-
${(props) => props.theme.grid.unit * 2}px !important;
|
84
|
+
padding: 6px 8px;
|
86
85
|
min-height: 28px;
|
87
86
|
margin-bottom: 6px;
|
88
87
|
border: ${(props) => props.isFocused
|
@@ -93,7 +92,8 @@ const Wrapper = styled_components_1.default.li `
|
|
93
92
|
: `none`};
|
94
93
|
list-style-type: none;
|
95
94
|
font-size: ${(props) => props.theme.font.size.small};
|
96
|
-
|
95
|
+
border-radius: 4px;
|
96
|
+
max-height: 40px;
|
97
97
|
/* FocusHandle should cover entire card: */
|
98
98
|
position: relative;
|
99
99
|
color: ${(props) => props.theme.colors.text.primary};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Suggestion.js","sourceRoot":"","sources":["../../../../../src/components/track-changes/suggestion-list/Suggestion.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,+CAA0D;AAC1D,0EAAsC;AAEtC,+DAAsC;AACtC,4EAAmD;AACnD,2DAAuD;AAEvD,MAAM,cAAc,GAAG,CAAC,OAAoB,EAAE,EAAE;IAC9C,MAAM,IAAI,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAA;IAC5C,IAAI,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,GAAG,GAAG,GAAG,EAAE;QACtD,OAAO,CAAC,cAAc,EAAE,CAAA;KACzB;AACH,CAAC,CAAA;AAWM,MAAM,UAAU,GAAoB,CAAC,EAC1C,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,IAAA,cAAM,EAAgB,IAAI,CAAC,CAAA;IAC9C,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAA;IAE5D,MAAM,WAAW,GAAG,CAAC,CAAmB,EAAE,EAAE;QAC1C,CAAC,CAAC,cAAc,EAAE,CAAA;QAClB,eAAe,CAAC,IAAI,CAAC,CAAA;QACrB,IAAI,QAAQ,EAAE;YACZ,QAAQ,EAAE,CAAA;SACX;IACH,CAAC,CAAA;IAED,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,UAAU,IAAI,UAAU,CAAC,OAAO,EAAE;YACpC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;SACnC;IACH,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAA;IAEhB,OAAO,CACL,8BAAC,OAAO,eAAS,YAAY,EAAC,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU;QAClE,8BAAC,WAAW,IAAC,IAAI,EAAC,GAAG,EAAC,OAAO,EAAE,WAAW;YACxC,8BAAC,qCAAiB,IAAC,UAAU,EAAE,UAAU,GAAI,CACjC;QAEd,8BAAC,OAAO;YACN,8BAAC,2BAAiB,IAChB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,QAAQ,EACtB,YAAY,EAAE,QAAQ,EACtB,WAAW,EAAE,OAAO,GACpB,CACM;QAET,iBAAiB,IAAI,CACpB,8BAAC,oBAAU,IACT,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,iBAAiB,EAC5B,QAAQ,EAAE,UAAU,CAAC,EAAE,EACvB,UAAU,EAAE,eAAe,GACf,CACf,CACO,CACX,CAAA;AACH,CAAC,CAAA;AAlDY,QAAA,UAAU,cAkDtB;AAED,MAAM,OAAO,GAAG,2BAAM,CAAC,GAAG,CAAA;;CAEzB,CAAA;AAED,MAAM,OAAO,GAAG,2BAAM,CAAC,EAAE,CAEvB;;;;;SAKO,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC
|
1
|
+
{"version":3,"file":"Suggestion.js","sourceRoot":"","sources":["../../../../../src/components/track-changes/suggestion-list/Suggestion.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,+CAA0D;AAC1D,0EAAsC;AAEtC,+DA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AAU,CAAC,OAAO,CAAC,MAAM,GAAG,aAAa;IAC9D,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO;;IAEjD,CAAC,KAAK,EAAE,EAAE,CACV,KAAK,CAAC,SAAS;IACb,CAAC,CAAC,GAAG,OAAO;;QAEV;IACF,CAAC,CAAC,EAAE;;;kBAGQ,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK;;MAElE,OAAO;;;;CAIZ,CAAA;AAED,MAAM,WAAW,GAAG,2BAAM,CAAC,CAAC,CAAA;;SAEnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;;;;;;CAO5C,CAAA"}
|
@@ -38,12 +38,12 @@ exports.SuggestionSnippet = void 0;
|
|
38
38
|
*
|
39
39
|
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
|
40
40
|
*/
|
41
|
+
const body_editor_1 = require("@manuscripts/body-editor");
|
41
42
|
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
42
43
|
const transform_1 = require("@manuscripts/transform");
|
43
|
-
const
|
44
|
+
const dompurify_1 = __importDefault(require("dompurify"));
|
44
45
|
const react_1 = __importStar(require("react"));
|
45
46
|
const styled_components_1 = __importDefault(require("styled-components"));
|
46
|
-
const footnotes_1 = require("../../../lib/footnotes");
|
47
47
|
const tracking_1 = require("../../../lib/tracking");
|
48
48
|
const utils_1 = require("../../../lib/utils");
|
49
49
|
const store_1 = require("../../../store");
|
@@ -53,100 +53,130 @@ const SuggestionSnippet = ({ suggestion, }) => {
|
|
53
53
|
doc: store.doc,
|
54
54
|
}));
|
55
55
|
const [snippet, setSnippet] = (0, react_1.useState)(null);
|
56
|
-
const [message, setMessage] = (0, react_1.useState)('');
|
57
56
|
const { dataTracked } = suggestion;
|
57
|
+
const contentRef = (0, react_1.useRef)(null);
|
58
|
+
const isContainLaTeX = (text) => {
|
59
|
+
const latexPattern = /(\$|\\\(|\\\[|\\begin\{|\\[a-zA-Z]+(\{.*?\})?)/;
|
60
|
+
return latexPattern.test(text);
|
61
|
+
};
|
62
|
+
(0, react_1.useEffect)(() => {
|
63
|
+
if (contentRef.current && snippet?.content) {
|
64
|
+
contentRef.current.innerHTML =
|
65
|
+
dompurify_1.default.sanitize(': ' + snippet.content) || '';
|
66
|
+
if (isContainLaTeX(snippet.content)) {
|
67
|
+
(0, body_editor_1.renderMath)(contentRef.current);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}, [snippet?.content]);
|
58
71
|
(0, react_1.useEffect)(() => {
|
59
72
|
const getSnippetData = () => {
|
60
73
|
if (track_changes_plugin_1.ChangeSet.isTextChange(suggestion)) {
|
61
|
-
const
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
};
|
71
|
-
}
|
72
|
-
else {
|
73
|
-
return { snippet: null, message: suggestion.text };
|
74
|
-
}
|
74
|
+
const parentNodeName = (0, utils_1.getParentNode)(view.state, suggestion.from)?.type
|
75
|
+
.name;
|
76
|
+
return {
|
77
|
+
snippet: {
|
78
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
79
|
+
nodeName: parentNodeName || suggestion.nodeType.name,
|
80
|
+
content: suggestion.text,
|
81
|
+
},
|
82
|
+
};
|
75
83
|
}
|
76
|
-
if (track_changes_plugin_1.ChangeSet.isNodeChange(suggestion)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
84
|
+
else if (track_changes_plugin_1.ChangeSet.isNodeChange(suggestion) ||
|
85
|
+
track_changes_plugin_1.ChangeSet.isNodeAttrChange(suggestion)) {
|
86
|
+
switch (suggestion.node.type) {
|
87
|
+
case transform_1.schema.nodes.inline_footnote:
|
88
|
+
return {
|
89
|
+
snippet: {
|
90
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
91
|
+
nodeName: suggestion.node.type.spec.name,
|
92
|
+
content: (0, utils_1.getInlineFootnoteContent)(doc, suggestion.node.attrs),
|
93
|
+
},
|
94
|
+
};
|
95
|
+
case transform_1.schema.nodes.footnote:
|
96
|
+
return {
|
97
|
+
snippet: {
|
98
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
99
|
+
nodeName: suggestion.node.type.name,
|
100
|
+
content: (0, utils_1.getFootnoteText)(view.state, suggestion.node),
|
101
|
+
},
|
102
|
+
};
|
103
|
+
case transform_1.schema.nodes.contributor:
|
104
|
+
return {
|
105
|
+
snippet: {
|
106
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
107
|
+
nodeName: suggestion.node.type.name,
|
108
|
+
content: (0, utils_1.getContributorTextContent)(suggestion.node, suggestion.oldAttrs),
|
109
|
+
},
|
110
|
+
};
|
111
|
+
case transform_1.schema.nodes.affiliation:
|
112
|
+
return {
|
113
|
+
snippet: {
|
114
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
115
|
+
nodeName: suggestion.node.type.name,
|
116
|
+
content: (0, utils_1.getAffiliationTextContent)(suggestion.node, suggestion.oldAttrs),
|
117
|
+
},
|
118
|
+
};
|
119
|
+
case transform_1.schema.nodes.citation:
|
120
|
+
return {
|
121
|
+
snippet: {
|
122
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
123
|
+
nodeName: suggestion.node.type.name,
|
124
|
+
content: (0, utils_1.getTextContentFromBibliography)(view.state, suggestion.node.attrs.rids[0]),
|
125
|
+
},
|
126
|
+
};
|
127
|
+
case transform_1.schema.nodes.bibliography_item:
|
128
|
+
return {
|
129
|
+
snippet: {
|
130
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
131
|
+
nodeName: suggestion.node.type.spec.name,
|
132
|
+
content: (0, utils_1.getTextContentFromBibliography)(view.state, suggestion.node.attrs.id),
|
133
|
+
},
|
134
|
+
};
|
135
|
+
case transform_1.schema.nodes.figure_element:
|
136
|
+
case transform_1.schema.nodes.table_element: {
|
137
|
+
return {
|
138
|
+
snippet: {
|
139
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
140
|
+
nodeName: suggestion.node.type.spec.name,
|
141
|
+
content: (0, utils_1.getFigureLabel)(view.state, suggestion.node),
|
142
|
+
},
|
143
|
+
};
|
144
|
+
}
|
145
|
+
case transform_1.schema.nodes.inline_equation:
|
146
|
+
case transform_1.schema.nodes.equation_element: {
|
147
|
+
console.log('suggestion.node', suggestion);
|
148
|
+
return {
|
149
|
+
snippet: {
|
150
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
151
|
+
nodeName: suggestion.node.type.spec.name,
|
152
|
+
content: (0, utils_1.getEquationContent)(suggestion.node),
|
153
|
+
},
|
154
|
+
};
|
155
|
+
}
|
156
|
+
default:
|
157
|
+
return {
|
158
|
+
snippet: {
|
159
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
160
|
+
nodeName: suggestion.node.type.spec.name || suggestion.node.type.name,
|
161
|
+
content: (0, utils_1.getNodeTextContent)(suggestion.node),
|
162
|
+
},
|
163
|
+
};
|
104
164
|
}
|
105
165
|
}
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
snippet: {
|
110
|
-
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
111
|
-
nodeName: suggestion.node.type.spec.name,
|
112
|
-
content: (0, footnotes_1.getInlineFootnoteContent)(doc, suggestion.newAttrs),
|
113
|
-
},
|
114
|
-
message: '',
|
115
|
-
};
|
116
|
-
}
|
117
|
-
else if (suggestion.node.type === transform_1.schema.nodes.footnote) {
|
118
|
-
return {
|
119
|
-
snippet: {
|
120
|
-
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
121
|
-
nodeName: suggestion.node.type.name,
|
122
|
-
content: (0, footnotes_1.getFootnoteText)(view.state, suggestion.node),
|
123
|
-
},
|
124
|
-
message: '',
|
125
|
-
};
|
126
|
-
}
|
127
|
-
else {
|
128
|
-
return {
|
129
|
-
snippet: null,
|
130
|
-
message: `${suggestion.node.type.name
|
131
|
-
.charAt(0)
|
132
|
-
.toUpperCase()}${suggestion.node.type.name.slice(1)} ${dataTracked.operation}`,
|
133
|
-
};
|
134
|
-
}
|
135
|
-
}
|
136
|
-
return { snippet: null, message: 'Unknown change!' };
|
166
|
+
return {
|
167
|
+
snippet: { operation: '', nodeName: '', content: 'Unknown change!' },
|
168
|
+
};
|
137
169
|
};
|
138
|
-
const { snippet: newSnippet
|
170
|
+
const { snippet: newSnippet } = getSnippetData();
|
139
171
|
setSnippet(newSnippet);
|
140
|
-
setMessage(newMessage);
|
141
172
|
}, [suggestion, doc, view.state, dataTracked.operation]);
|
142
|
-
return (react_1.default.createElement(SnippetText, { isRejected: dataTracked.status === track_changes_plugin_1.CHANGE_STATUS.rejected },
|
143
|
-
react_1.default.createElement(
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
snippet
|
148
|
-
|
149
|
-
react_1.default.createElement(Content, null, (0, html_react_parser_1.default)(snippet.content)))) : dataTracked.operation === track_changes_plugin_1.CHANGE_OPERATION.delete ? (react_1.default.createElement("del", null, message)) : (message)));
|
173
|
+
return (react_1.default.createElement(SnippetText, { isRejected: dataTracked.status === track_changes_plugin_1.CHANGE_STATUS.rejected },
|
174
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
175
|
+
react_1.default.createElement(Operation, { color: dataTracked.operation },
|
176
|
+
snippet?.operation,
|
177
|
+
":"),
|
178
|
+
react_1.default.createElement(NodeName, null, snippet?.nodeName),
|
179
|
+
react_1.default.createElement(Content, { ref: contentRef }))));
|
150
180
|
};
|
151
181
|
exports.SuggestionSnippet = SuggestionSnippet;
|
152
182
|
const SnippetText = styled_components_1.default.div `
|
@@ -186,7 +216,6 @@ const NodeName = styled_components_1.default.span `
|
|
186
216
|
font-size: 12px;
|
187
217
|
font-weight: bold;
|
188
218
|
line-height: 16px;
|
189
|
-
margin-right: 3.2px;
|
190
219
|
`;
|
191
220
|
const Content = styled_components_1.default.span `
|
192
221
|
color: #353535;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SuggestionSnippet.js","sourceRoot":"","sources":["../../../../../src/components/track-changes/suggestion-list/SuggestionSnippet.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,4EAK0C;AAC1C,sDAA+C;AAC/C,
|
1
|
+
{"version":3,"file":"SuggestionSnippet.js","sourceRoot":"","sources":["../../../../../src/components/track-changes/suggestion-list/SuggestionSnippet.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAAqD;AACrD,4EAK0C;AAC1C,sDAA+C;AAC/C,0DAA8B;AAC9B,+CAA0D;AAC1D,0EAAsC;AAEtC,oDAA4D;AAC5D,8CAU2B;AAC3B,0CAAyC;AAOlC,MAAM,iBAAiB,GAA4C,CAAC,EACzE,UAAU,GACX,EAAE,EAAE;IACH,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3C,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,GAAG,EAAE,KAAK,CAAC,GAAG;KACf,CAAC,CAAC,CAAA;IACH,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ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ACT;YACZ,8BAAC,QAAQ,QAAE,OAAO,EAAE,QAAQ,CAAY;YACxC,8BAAC,OAAO,IAAC,GAAG,EAAE,UAAU,GAAI,CAC3B,CACS,CACf,CAAA;AACH,CAAC,CAAA;AA5JY,QAAA,iBAAiB,qBA4J7B;AAED,MAAM,WAAW,GAAG,2BAAM,CAAC,GAAG,CAAyB;eACxC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;iBACpC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM;;;;WAInD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;;;CAGpD,CAAA;AAED,MAAM,SAAS,GAAG,2BAAM,CAAC,IAAI,CAAmB;;;;;;;WAOrC,CAAC,KAAK,EAAE,EAAE;IACjB,QAAQ,KAAK,CAAC,KAAK,EAAE;QACnB,KAAK,QAAQ;YACX,OAAO,SAAS,CAAA;QAClB,KAAK,QAAQ;YACX,OAAO,SAAS,CAAA;QAClB,KAAK,WAAW;YACd,OAAO,SAAS,CAAA;QAClB;YACE,OAAO,SAAS,CAAA;KACnB;AACH,CAAC;CACF,CAAA;AAED,MAAM,QAAQ,GAAG,2BAAM,CAAC,IAAI,CAAA;;;;;;;CAO3B,CAAA;AAED,MAAM,OAAO,GAAG,2BAAM,CAAC,IAAI,CAAA;;;;;;CAM1B,CAAA"}
|
package/dist/cjs/lib/fonts.js
CHANGED
@@ -14,4 +14,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
require("@fontsource/lato");
|
15
15
|
require("@fontsource/pt-sans");
|
16
16
|
require("@fontsource/pt-serif");
|
17
|
+
// Importing specific weights
|
18
|
+
require("@fontsource/lato/300.css");
|
19
|
+
require("@fontsource/lato/400.css");
|
20
|
+
require("@fontsource/lato/700.css");
|
17
21
|
//# sourceMappingURL=fonts.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../../src/lib/fonts.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAEH,4BAAyB;AACzB,+BAA4B;AAC5B,gCAA6B"}
|
1
|
+
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../../src/lib/fonts.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAEH,4BAAyB;AACzB,+BAA4B;AAC5B,gCAA6B;AAC7B,6BAA6B;AAC7B,oCAAiC;AACjC,oCAAiC;AACjC,oCAAiC"}
|
package/dist/cjs/lib/utils.js
CHANGED
@@ -1,9 +1,20 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getParentNode = exports.findPluginByKey = exports.getNodeTextContent = void 0;
|
3
|
+
exports.getParentNode = exports.getFootnoteText = exports.getInlineFootnoteContent = exports.findFootnoteById = exports.getEquationContent = exports.findPluginByKey = exports.getFigureLabel = exports.getTextContentFromBibliography = exports.findBibliographyById = exports.getAffiliationTextContent = exports.getContributorTextContent = exports.getNodeTextContent = void 0;
|
4
|
+
/*!
|
5
|
+
* 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.
|
6
|
+
*
|
7
|
+
* 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.
|
8
|
+
*
|
9
|
+
* The Original Code is manuscripts-frontend.
|
10
|
+
*
|
11
|
+
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
12
|
+
*
|
13
|
+
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
|
14
|
+
*/
|
15
|
+
const transform_1 = require("@manuscripts/transform");
|
4
16
|
const getNodeTextContent = (node) => {
|
5
17
|
let textContent = '';
|
6
|
-
// Traverse the node and its descendants
|
7
18
|
node.forEach((child) => {
|
8
19
|
if (child.isText) {
|
9
20
|
// If the child is a text node, add its text content
|
@@ -17,6 +28,57 @@ const getNodeTextContent = (node) => {
|
|
17
28
|
return textContent;
|
18
29
|
};
|
19
30
|
exports.getNodeTextContent = getNodeTextContent;
|
31
|
+
const getContributorTextContent = (node, oldAttrs) => {
|
32
|
+
let textContent = '';
|
33
|
+
textContent += `${node.attrs.bibliographicName.given} ${node.attrs.bibliographicName.family}`;
|
34
|
+
if (oldAttrs) {
|
35
|
+
textContent =
|
36
|
+
`${oldAttrs.bibliographicName.given} ${oldAttrs.bibliographicName.family} to ` +
|
37
|
+
textContent;
|
38
|
+
}
|
39
|
+
return textContent;
|
40
|
+
};
|
41
|
+
exports.getContributorTextContent = getContributorTextContent;
|
42
|
+
const getAffiliationTextContent = (node, oldAttrs) => {
|
43
|
+
let textContent = '';
|
44
|
+
textContent += `${node.attrs.institution}`;
|
45
|
+
if (oldAttrs) {
|
46
|
+
textContent = `${oldAttrs.institution} to ` + textContent;
|
47
|
+
}
|
48
|
+
return textContent;
|
49
|
+
};
|
50
|
+
exports.getAffiliationTextContent = getAffiliationTextContent;
|
51
|
+
const findBibliographyById = (doc, id) => {
|
52
|
+
let bibNode = null;
|
53
|
+
doc.descendants((node) => {
|
54
|
+
if (node.type === transform_1.schema.nodes.bibliography_item && node.attrs.id === id) {
|
55
|
+
bibNode = node;
|
56
|
+
return false; // stop traversal
|
57
|
+
}
|
58
|
+
if (bibNode) {
|
59
|
+
return false;
|
60
|
+
}
|
61
|
+
return true; // continue traversal
|
62
|
+
});
|
63
|
+
return bibNode;
|
64
|
+
};
|
65
|
+
exports.findBibliographyById = findBibliographyById;
|
66
|
+
const getTextContentFromBibliography = (state, id) => {
|
67
|
+
const bib = (0, exports.findPluginByKey)(state, 'bibliography')?.getState(state);
|
68
|
+
const [meta, bibliography] = bib.provider.makeBibliography();
|
69
|
+
const selectedBib = meta.entry_ids.findIndex((entry) => entry[0] == id);
|
70
|
+
const parser = new DOMParser();
|
71
|
+
const textContent = parser.parseFromString(bibliography[selectedBib], 'text/html').body.textContent;
|
72
|
+
return textContent ? textContent : '';
|
73
|
+
};
|
74
|
+
exports.getTextContentFromBibliography = getTextContentFromBibliography;
|
75
|
+
const getFigureLabel = (state, node) => {
|
76
|
+
const objectsPlugin = (0, exports.findPluginByKey)(state, 'objects');
|
77
|
+
const pluginState = objectsPlugin?.getState(state);
|
78
|
+
const target = pluginState?.get(node.attrs.id);
|
79
|
+
return target?.label || '';
|
80
|
+
};
|
81
|
+
exports.getFigureLabel = getFigureLabel;
|
20
82
|
const findPluginByKey = (state, keyName) => {
|
21
83
|
for (let i = 0; i < state.plugins.length; i++) {
|
22
84
|
const plugin = state.plugins[i];
|
@@ -27,11 +89,54 @@ const findPluginByKey = (state, keyName) => {
|
|
27
89
|
return null;
|
28
90
|
};
|
29
91
|
exports.findPluginByKey = findPluginByKey;
|
92
|
+
const getEquationContent = (node) => {
|
93
|
+
if (node.firstChild && node.type === transform_1.schema.nodes.equation_element) {
|
94
|
+
return node.firstChild.attrs.contents;
|
95
|
+
}
|
96
|
+
else if (node) {
|
97
|
+
return node.attrs.contents;
|
98
|
+
}
|
99
|
+
return '';
|
100
|
+
};
|
101
|
+
exports.getEquationContent = getEquationContent;
|
102
|
+
const findFootnoteById = (doc, id) => {
|
103
|
+
let footnoteNode = null;
|
104
|
+
doc.descendants((node) => {
|
105
|
+
if (node.type === transform_1.schema.nodes.footnote && node.attrs.id === id) {
|
106
|
+
footnoteNode = node;
|
107
|
+
return false;
|
108
|
+
}
|
109
|
+
if (footnoteNode) {
|
110
|
+
return false;
|
111
|
+
}
|
112
|
+
return true;
|
113
|
+
});
|
114
|
+
return footnoteNode;
|
115
|
+
};
|
116
|
+
exports.findFootnoteById = findFootnoteById;
|
117
|
+
const getInlineFootnoteContent = (doc, attrs) => {
|
118
|
+
let footnote = null;
|
119
|
+
if (attrs.rids && attrs.rids.length > 0) {
|
120
|
+
footnote = (0, exports.findFootnoteById)(doc, attrs.rids[0]);
|
121
|
+
}
|
122
|
+
return `<sup class="footnote-decoration">${attrs.contents ? attrs.contents : ''}</sup>${footnote ? footnote.textContent : ''}`;
|
123
|
+
};
|
124
|
+
exports.getInlineFootnoteContent = getInlineFootnoteContent;
|
125
|
+
const getFootnoteText = (state, node) => {
|
126
|
+
const footnotesPlugin = (0, exports.findPluginByKey)(state, 'footnotes');
|
127
|
+
const pluginState = footnotesPlugin?.getState(state);
|
128
|
+
let decorationText = '';
|
129
|
+
if (pluginState) {
|
130
|
+
decorationText = pluginState.labels.get(node.attrs.id);
|
131
|
+
}
|
132
|
+
return `<sup class="footnote-decoration">${decorationText ? decorationText : ''}</sup>${(0, exports.getNodeTextContent)(node)}`;
|
133
|
+
};
|
134
|
+
exports.getFootnoteText = getFootnoteText;
|
30
135
|
const getParentNode = (state, pos) => {
|
31
136
|
const resolvedPos = state.doc.resolve(pos);
|
32
137
|
for (let depth = resolvedPos.depth; depth > 0; depth--) {
|
33
138
|
const parent = resolvedPos.node(depth);
|
34
|
-
if (parent.
|
139
|
+
if (parent.isText === false) {
|
35
140
|
return parent;
|
36
141
|
}
|
37
142
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,sDAI+B;AAMxB,MAAM,kBAAkB,GAAG,CAAC,IAAoB,EAAE,EAAE;IACzD,IAAI,WAAW,GAAG,EAAE,CAAA;IACpB,IAAI,C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AAC,cAAc,CAAC,CAAC,CAAC,EACpC,SAAS,IAAA,0BAAkB,EAAC,IAAI,CAAC,EAAE,CAAA;AACrC,CAAC,CAAA;AAbY,QAAA,eAAe,mBAa3B;AAEM,MAAM,aAAa,GAAG,CAAC,KAAkB,EAAE,GAAW,EAAE,EAAE;IAC/D,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAE1C,KAAK,IAAI,KAAK,GAAG,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE;QACtD,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACtC,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE;YAC3B,OAAO,MAAM,CAAA;SACd;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAXY,QAAA,aAAa,iBAWzB"}
|
@@ -51,8 +51,7 @@ const Wrapper = styled.li `
|
|
51
51
|
justify-content: space-between;
|
52
52
|
align-items: center;
|
53
53
|
gap: ${(props) => props.theme.grid.unit * 4}px;
|
54
|
-
padding:
|
55
|
-
${(props) => props.theme.grid.unit * 2}px !important;
|
54
|
+
padding: 6px 8px;
|
56
55
|
min-height: 28px;
|
57
56
|
margin-bottom: 6px;
|
58
57
|
border: ${(props) => props.isFocused
|
@@ -63,7 +62,8 @@ const Wrapper = styled.li `
|
|
63
62
|
: `none`};
|
64
63
|
list-style-type: none;
|
65
64
|
font-size: ${(props) => props.theme.font.size.small};
|
66
|
-
|
65
|
+
border-radius: 4px;
|
66
|
+
max-height: 40px;
|
67
67
|
/* FocusHandle should cover entire card: */
|
68
68
|
position: relative;
|
69
69
|
color: ${(props) => props.theme.colors.text.primary};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Suggestion.js","sourceRoot":"","sources":["../../../../../src/components/track-changes/suggestion-list/Suggestion.tsx"],"names":[],"mappings":"AAAA;;;;;;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E,UAAU,EAAE,GAAG,EAAE,UAAU;QAClE,oBAAC,WAAW,IAAC,IAAI,EAAC,GAAG,EAAC,OAAO,EAAE,WAAW;YACxC,oBAAC,iBAAiB,IAAC,UAAU,EAAE,UAAU,GAAI,CACjC;QAEd,oBAAC,OAAO;YACN,oBAAC,iBAAiB,IAChB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,QAAQ,EACtB,YAAY,EAAE,QAAQ,EACtB,WAAW,EAAE,OAAO,GACpB,CACM;QAET,iBAAiB,IAAI,CACpB,oBAAC,UAAU,IACT,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,iBAAiB,EAC5B,QAAQ,EAAE,UAAU,CAAC,EAAE,EACvB,UAAU,EAAE,eAAe,GACf,CACf,CACO,CACX,CAAA;AACH,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEzB,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAEvB;;;;;SAKO,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC
|
1
|
+
{"version":3,"file":"Suggestion.js","sourceRoot":"","sources":["../../../../../src/components/track-changes/suggestion-list/Suggestion.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC1D,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,UAAU,MAAM,eAAe,CAAA;AACtC,OAAO,iBAAiB,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,cAAc,GAAG,CAAC,OAAoB,EAAE,EAAE;IAC9C,MAAM,IAAI,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAA;IAC5C,IAAI,IAAI,CAAC,MAAM,GAAG,MAAM,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AC,CAAC,EAAE;;;kBAGQ,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK;;MAElE,OAAO;;;;CAIZ,CAAA;AAED,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,CAAA;;SAEnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;;;;;;CAO5C,CAAA"}
|
@@ -9,14 +9,14 @@
|
|
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 {
|
12
|
+
import { renderMath } from '@manuscripts/body-editor';
|
13
|
+
import { CHANGE_STATUS, ChangeSet, } from '@manuscripts/track-changes-plugin';
|
13
14
|
import { schema } from '@manuscripts/transform';
|
14
|
-
import
|
15
|
-
import React, { useEffect, useState } from 'react';
|
15
|
+
import purify from 'dompurify';
|
16
|
+
import React, { useEffect, useRef, useState } from 'react';
|
16
17
|
import styled from 'styled-components';
|
17
|
-
import { getFootnoteText, getInlineFootnoteContent, } from '../../../lib/footnotes';
|
18
18
|
import { changeOperationAlias } from '../../../lib/tracking';
|
19
|
-
import { getParentNode } from '../../../lib/utils';
|
19
|
+
import { getAffiliationTextContent, getContributorTextContent, getEquationContent, getFigureLabel, getFootnoteText, getInlineFootnoteContent, getNodeTextContent, getParentNode, getTextContentFromBibliography, } from '../../../lib/utils';
|
20
20
|
import { useStore } from '../../../store';
|
21
21
|
export const SuggestionSnippet = ({ suggestion, }) => {
|
22
22
|
const [{ doc, view }] = useStore((store) => ({
|
@@ -24,100 +24,130 @@ export const SuggestionSnippet = ({ suggestion, }) => {
|
|
24
24
|
doc: store.doc,
|
25
25
|
}));
|
26
26
|
const [snippet, setSnippet] = useState(null);
|
27
|
-
const [message, setMessage] = useState('');
|
28
27
|
const { dataTracked } = suggestion;
|
28
|
+
const contentRef = useRef(null);
|
29
|
+
const isContainLaTeX = (text) => {
|
30
|
+
const latexPattern = /(\$|\\\(|\\\[|\\begin\{|\\[a-zA-Z]+(\{.*?\})?)/;
|
31
|
+
return latexPattern.test(text);
|
32
|
+
};
|
33
|
+
useEffect(() => {
|
34
|
+
if (contentRef.current && snippet?.content) {
|
35
|
+
contentRef.current.innerHTML =
|
36
|
+
purify.sanitize(': ' + snippet.content) || '';
|
37
|
+
if (isContainLaTeX(snippet.content)) {
|
38
|
+
renderMath(contentRef.current);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}, [snippet?.content]);
|
29
42
|
useEffect(() => {
|
30
43
|
const getSnippetData = () => {
|
31
44
|
if (ChangeSet.isTextChange(suggestion)) {
|
32
|
-
const
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
};
|
42
|
-
}
|
43
|
-
else {
|
44
|
-
return { snippet: null, message: suggestion.text };
|
45
|
-
}
|
45
|
+
const parentNodeName = getParentNode(view.state, suggestion.from)?.type
|
46
|
+
.name;
|
47
|
+
return {
|
48
|
+
snippet: {
|
49
|
+
operation: changeOperationAlias(dataTracked.operation),
|
50
|
+
nodeName: parentNodeName || suggestion.nodeType.name,
|
51
|
+
content: suggestion.text,
|
52
|
+
},
|
53
|
+
};
|
46
54
|
}
|
47
|
-
if (ChangeSet.isNodeChange(suggestion)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
55
|
+
else if (ChangeSet.isNodeChange(suggestion) ||
|
56
|
+
ChangeSet.isNodeAttrChange(suggestion)) {
|
57
|
+
switch (suggestion.node.type) {
|
58
|
+
case schema.nodes.inline_footnote:
|
59
|
+
return {
|
60
|
+
snippet: {
|
61
|
+
operation: changeOperationAlias(dataTracked.operation),
|
62
|
+
nodeName: suggestion.node.type.spec.name,
|
63
|
+
content: getInlineFootnoteContent(doc, suggestion.node.attrs),
|
64
|
+
},
|
65
|
+
};
|
66
|
+
case schema.nodes.footnote:
|
67
|
+
return {
|
68
|
+
snippet: {
|
69
|
+
operation: changeOperationAlias(dataTracked.operation),
|
70
|
+
nodeName: suggestion.node.type.name,
|
71
|
+
content: getFootnoteText(view.state, suggestion.node),
|
72
|
+
},
|
73
|
+
};
|
74
|
+
case schema.nodes.contributor:
|
75
|
+
return {
|
76
|
+
snippet: {
|
77
|
+
operation: changeOperationAlias(dataTracked.operation),
|
78
|
+
nodeName: suggestion.node.type.name,
|
79
|
+
content: getContributorTextContent(suggestion.node, suggestion.oldAttrs),
|
80
|
+
},
|
81
|
+
};
|
82
|
+
case schema.nodes.affiliation:
|
83
|
+
return {
|
84
|
+
snippet: {
|
85
|
+
operation: changeOperationAlias(dataTracked.operation),
|
86
|
+
nodeName: suggestion.node.type.name,
|
87
|
+
content: getAffiliationTextContent(suggestion.node, suggestion.oldAttrs),
|
88
|
+
},
|
89
|
+
};
|
90
|
+
case schema.nodes.citation:
|
91
|
+
return {
|
92
|
+
snippet: {
|
93
|
+
operation: changeOperationAlias(dataTracked.operation),
|
94
|
+
nodeName: suggestion.node.type.name,
|
95
|
+
content: getTextContentFromBibliography(view.state, suggestion.node.attrs.rids[0]),
|
96
|
+
},
|
97
|
+
};
|
98
|
+
case schema.nodes.bibliography_item:
|
99
|
+
return {
|
100
|
+
snippet: {
|
101
|
+
operation: changeOperationAlias(dataTracked.operation),
|
102
|
+
nodeName: suggestion.node.type.spec.name,
|
103
|
+
content: getTextContentFromBibliography(view.state, suggestion.node.attrs.id),
|
104
|
+
},
|
105
|
+
};
|
106
|
+
case schema.nodes.figure_element:
|
107
|
+
case schema.nodes.table_element: {
|
108
|
+
return {
|
109
|
+
snippet: {
|
110
|
+
operation: changeOperationAlias(dataTracked.operation),
|
111
|
+
nodeName: suggestion.node.type.spec.name,
|
112
|
+
content: getFigureLabel(view.state, suggestion.node),
|
113
|
+
},
|
114
|
+
};
|
115
|
+
}
|
116
|
+
case schema.nodes.inline_equation:
|
117
|
+
case schema.nodes.equation_element: {
|
118
|
+
console.log('suggestion.node', suggestion);
|
119
|
+
return {
|
120
|
+
snippet: {
|
121
|
+
operation: changeOperationAlias(dataTracked.operation),
|
122
|
+
nodeName: suggestion.node.type.spec.name,
|
123
|
+
content: getEquationContent(suggestion.node),
|
124
|
+
},
|
125
|
+
};
|
126
|
+
}
|
127
|
+
default:
|
128
|
+
return {
|
129
|
+
snippet: {
|
130
|
+
operation: changeOperationAlias(dataTracked.operation),
|
131
|
+
nodeName: suggestion.node.type.spec.name || suggestion.node.type.name,
|
132
|
+
content: getNodeTextContent(suggestion.node),
|
133
|
+
},
|
134
|
+
};
|
75
135
|
}
|
76
136
|
}
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
snippet: {
|
81
|
-
operation: changeOperationAlias(dataTracked.operation),
|
82
|
-
nodeName: suggestion.node.type.spec.name,
|
83
|
-
content: getInlineFootnoteContent(doc, suggestion.newAttrs),
|
84
|
-
},
|
85
|
-
message: '',
|
86
|
-
};
|
87
|
-
}
|
88
|
-
else if (suggestion.node.type === schema.nodes.footnote) {
|
89
|
-
return {
|
90
|
-
snippet: {
|
91
|
-
operation: changeOperationAlias(dataTracked.operation),
|
92
|
-
nodeName: suggestion.node.type.name,
|
93
|
-
content: getFootnoteText(view.state, suggestion.node),
|
94
|
-
},
|
95
|
-
message: '',
|
96
|
-
};
|
97
|
-
}
|
98
|
-
else {
|
99
|
-
return {
|
100
|
-
snippet: null,
|
101
|
-
message: `${suggestion.node.type.name
|
102
|
-
.charAt(0)
|
103
|
-
.toUpperCase()}${suggestion.node.type.name.slice(1)} ${dataTracked.operation}`,
|
104
|
-
};
|
105
|
-
}
|
106
|
-
}
|
107
|
-
return { snippet: null, message: 'Unknown change!' };
|
137
|
+
return {
|
138
|
+
snippet: { operation: '', nodeName: '', content: 'Unknown change!' },
|
139
|
+
};
|
108
140
|
};
|
109
|
-
const { snippet: newSnippet
|
141
|
+
const { snippet: newSnippet } = getSnippetData();
|
110
142
|
setSnippet(newSnippet);
|
111
|
-
setMessage(newMessage);
|
112
143
|
}, [suggestion, doc, view.state, dataTracked.operation]);
|
113
|
-
return (React.createElement(SnippetText, { isRejected: dataTracked.status === CHANGE_STATUS.rejected },
|
114
|
-
React.createElement(
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
snippet
|
119
|
-
|
120
|
-
React.createElement(Content, null, parse(snippet.content)))) : dataTracked.operation === CHANGE_OPERATION.delete ? (React.createElement("del", null, message)) : (message)));
|
144
|
+
return (React.createElement(SnippetText, { isRejected: dataTracked.status === CHANGE_STATUS.rejected },
|
145
|
+
React.createElement(React.Fragment, null,
|
146
|
+
React.createElement(Operation, { color: dataTracked.operation },
|
147
|
+
snippet?.operation,
|
148
|
+
":"),
|
149
|
+
React.createElement(NodeName, null, snippet?.nodeName),
|
150
|
+
React.createElement(Content, { ref: contentRef }))));
|
121
151
|
};
|
122
152
|
const SnippetText = styled.div `
|
123
153
|
font-size: ${(props) => props.theme.font.size.small};
|
@@ -156,7 +186,6 @@ const NodeName = styled.span `
|
|
156
186
|
font-size: 12px;
|
157
187
|
font-weight: bold;
|
158
188
|
line-height: 16px;
|
159
|
-
margin-right: 3.2px;
|
160
189
|
`;
|
161
190
|
const Content = styled.span `
|
162
191
|
color: #353535;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SuggestionSnippet.js","sourceRoot":"","sources":["../../../../../src/components/track-changes/suggestion-list/SuggestionSnippet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,
|
1
|
+
{"version":3,"file":"SuggestionSnippet.js","sourceRoot":"","sources":["../../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EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;;;CAGpD,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAmB;;;;;;;WAOrC,CAAC,KAAK,EAAE,EAAE;IACjB,QAAQ,KAAK,CAAC,KAAK,EAAE;QACnB,KAAK,QAAQ;YACX,OAAO,SAAS,CAAA;QAClB,KAAK,QAAQ;YACX,OAAO,SAAS,CAAA;QAClB,KAAK,WAAW;YACd,OAAO,SAAS,CAAA;QAClB;YACE,OAAO,SAAS,CAAA;KACnB;AACH,CAAC;CACF,CAAA;AAED,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAA;;;;;;;CAO3B,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAA;;;;;;CAM1B,CAAA"}
|
package/dist/es/lib/fonts.js
CHANGED
@@ -12,4 +12,8 @@
|
|
12
12
|
import '@fontsource/lato';
|
13
13
|
import '@fontsource/pt-sans';
|
14
14
|
import '@fontsource/pt-serif';
|
15
|
+
// Importing specific weights
|
16
|
+
import '@fontsource/lato/300.css';
|
17
|
+
import '@fontsource/lato/400.css';
|
18
|
+
import '@fontsource/lato/700.css';
|
15
19
|
//# sourceMappingURL=fonts.js.map
|
package/dist/es/lib/fonts.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../../src/lib/fonts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,kBAAkB,CAAA;AACzB,OAAO,qBAAqB,CAAA;AAC5B,OAAO,sBAAsB,CAAA"}
|
1
|
+
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../../src/lib/fonts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,kBAAkB,CAAA;AACzB,OAAO,qBAAqB,CAAA;AAC5B,OAAO,sBAAsB,CAAA;AAC7B,6BAA6B;AAC7B,OAAO,0BAA0B,CAAA;AACjC,OAAO,0BAA0B,CAAA;AACjC,OAAO,0BAA0B,CAAA"}
|
package/dist/es/lib/utils.js
CHANGED
@@ -1,6 +1,17 @@
|
|
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 { schema, } from '@manuscripts/transform';
|
1
13
|
export const getNodeTextContent = (node) => {
|
2
14
|
let textContent = '';
|
3
|
-
// Traverse the node and its descendants
|
4
15
|
node.forEach((child) => {
|
5
16
|
if (child.isText) {
|
6
17
|
// If the child is a text node, add its text content
|
@@ -13,6 +24,52 @@ export const getNodeTextContent = (node) => {
|
|
13
24
|
});
|
14
25
|
return textContent;
|
15
26
|
};
|
27
|
+
export const getContributorTextContent = (node, oldAttrs) => {
|
28
|
+
let textContent = '';
|
29
|
+
textContent += `${node.attrs.bibliographicName.given} ${node.attrs.bibliographicName.family}`;
|
30
|
+
if (oldAttrs) {
|
31
|
+
textContent =
|
32
|
+
`${oldAttrs.bibliographicName.given} ${oldAttrs.bibliographicName.family} to ` +
|
33
|
+
textContent;
|
34
|
+
}
|
35
|
+
return textContent;
|
36
|
+
};
|
37
|
+
export const getAffiliationTextContent = (node, oldAttrs) => {
|
38
|
+
let textContent = '';
|
39
|
+
textContent += `${node.attrs.institution}`;
|
40
|
+
if (oldAttrs) {
|
41
|
+
textContent = `${oldAttrs.institution} to ` + textContent;
|
42
|
+
}
|
43
|
+
return textContent;
|
44
|
+
};
|
45
|
+
export const findBibliographyById = (doc, id) => {
|
46
|
+
let bibNode = null;
|
47
|
+
doc.descendants((node) => {
|
48
|
+
if (node.type === schema.nodes.bibliography_item && node.attrs.id === id) {
|
49
|
+
bibNode = node;
|
50
|
+
return false; // stop traversal
|
51
|
+
}
|
52
|
+
if (bibNode) {
|
53
|
+
return false;
|
54
|
+
}
|
55
|
+
return true; // continue traversal
|
56
|
+
});
|
57
|
+
return bibNode;
|
58
|
+
};
|
59
|
+
export const getTextContentFromBibliography = (state, id) => {
|
60
|
+
const bib = findPluginByKey(state, 'bibliography')?.getState(state);
|
61
|
+
const [meta, bibliography] = bib.provider.makeBibliography();
|
62
|
+
const selectedBib = meta.entry_ids.findIndex((entry) => entry[0] == id);
|
63
|
+
const parser = new DOMParser();
|
64
|
+
const textContent = parser.parseFromString(bibliography[selectedBib], 'text/html').body.textContent;
|
65
|
+
return textContent ? textContent : '';
|
66
|
+
};
|
67
|
+
export const getFigureLabel = (state, node) => {
|
68
|
+
const objectsPlugin = findPluginByKey(state, 'objects');
|
69
|
+
const pluginState = objectsPlugin?.getState(state);
|
70
|
+
const target = pluginState?.get(node.attrs.id);
|
71
|
+
return target?.label || '';
|
72
|
+
};
|
16
73
|
export const findPluginByKey = (state, keyName) => {
|
17
74
|
for (let i = 0; i < state.plugins.length; i++) {
|
18
75
|
const plugin = state.plugins[i];
|
@@ -22,11 +79,50 @@ export const findPluginByKey = (state, keyName) => {
|
|
22
79
|
}
|
23
80
|
return null;
|
24
81
|
};
|
82
|
+
export const getEquationContent = (node) => {
|
83
|
+
if (node.firstChild && node.type === schema.nodes.equation_element) {
|
84
|
+
return node.firstChild.attrs.contents;
|
85
|
+
}
|
86
|
+
else if (node) {
|
87
|
+
return node.attrs.contents;
|
88
|
+
}
|
89
|
+
return '';
|
90
|
+
};
|
91
|
+
export const findFootnoteById = (doc, id) => {
|
92
|
+
let footnoteNode = null;
|
93
|
+
doc.descendants((node) => {
|
94
|
+
if (node.type === schema.nodes.footnote && node.attrs.id === id) {
|
95
|
+
footnoteNode = node;
|
96
|
+
return false;
|
97
|
+
}
|
98
|
+
if (footnoteNode) {
|
99
|
+
return false;
|
100
|
+
}
|
101
|
+
return true;
|
102
|
+
});
|
103
|
+
return footnoteNode;
|
104
|
+
};
|
105
|
+
export const getInlineFootnoteContent = (doc, attrs) => {
|
106
|
+
let footnote = null;
|
107
|
+
if (attrs.rids && attrs.rids.length > 0) {
|
108
|
+
footnote = findFootnoteById(doc, attrs.rids[0]);
|
109
|
+
}
|
110
|
+
return `<sup class="footnote-decoration">${attrs.contents ? attrs.contents : ''}</sup>${footnote ? footnote.textContent : ''}`;
|
111
|
+
};
|
112
|
+
export const getFootnoteText = (state, node) => {
|
113
|
+
const footnotesPlugin = findPluginByKey(state, 'footnotes');
|
114
|
+
const pluginState = footnotesPlugin?.getState(state);
|
115
|
+
let decorationText = '';
|
116
|
+
if (pluginState) {
|
117
|
+
decorationText = pluginState.labels.get(node.attrs.id);
|
118
|
+
}
|
119
|
+
return `<sup class="footnote-decoration">${decorationText ? decorationText : ''}</sup>${getNodeTextContent(node)}`;
|
120
|
+
};
|
25
121
|
export const getParentNode = (state, pos) => {
|
26
122
|
const resolvedPos = state.doc.resolve(pos);
|
27
123
|
for (let depth = resolvedPos.depth; depth > 0; depth--) {
|
28
124
|
const parent = resolvedPos.node(depth);
|
29
|
-
if (parent.
|
125
|
+
if (parent.isText === false) {
|
30
126
|
return parent;
|
31
127
|
}
|
32
128
|
}
|
package/dist/es/lib/utils.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"
|
1
|
+
{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OAAO,oCACL,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EACpC,SAAS,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAA;AACrC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAkB,EAAE,GAAW,EAAE,EAAE;IAC/D,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAE1C,KAAK,IAAI,KAAK,GAAG,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE;QACtD,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACtC,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE;YAC3B,OAAO,MAAM,CAAA;SACd;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
@@ -1,14 +1,3 @@
|
|
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
1
|
import { TrackedChange } from '@manuscripts/track-changes-plugin';
|
13
2
|
import React from 'react';
|
14
3
|
export declare const SuggestionSnippet: React.FC<{
|
@@ -15,6 +15,15 @@ interface ExtendedPlugin extends Plugin {
|
|
15
15
|
key: string;
|
16
16
|
}
|
17
17
|
export declare const getNodeTextContent: (node: ManuscriptNode) => string;
|
18
|
+
export declare const getContributorTextContent: (node: ManuscriptNode, oldAttrs: Record<any, any> | undefined) => string;
|
19
|
+
export declare const getAffiliationTextContent: (node: ManuscriptNode, oldAttrs: Record<any, any> | undefined) => string;
|
20
|
+
export declare const findBibliographyById: (doc: ManuscriptNode, id: string) => ManuscriptNode | null;
|
21
|
+
export declare const getTextContentFromBibliography: (state: ManuscriptEditorState, id: string) => string;
|
22
|
+
export declare const getFigureLabel: (state: ManuscriptEditorState, node: ManuscriptNode) => any;
|
18
23
|
export declare const findPluginByKey: (state: ManuscriptEditorState, keyName: string) => ExtendedPlugin | null;
|
24
|
+
export declare const getEquationContent: (node: ManuscriptNode) => any;
|
25
|
+
export declare const findFootnoteById: (doc: ManuscriptNode, id: string) => ManuscriptNode | null;
|
26
|
+
export declare const getInlineFootnoteContent: (doc: ManuscriptNode, attrs: Record<any, any>) => string;
|
27
|
+
export declare const getFootnoteText: (state: ManuscriptEditorState, node: ManuscriptNode) => string;
|
19
28
|
export declare const getParentNode: (state: EditorState, pos: number) => import("prosemirror-model").Node | null;
|
20
29
|
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@manuscripts/article-editor",
|
3
|
-
"version": "3.1.47-LEAN-
|
3
|
+
"version": "3.1.47-LEAN-3958.2",
|
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,18 +35,17 @@
|
|
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.0.57-LEAN-
|
38
|
+
"@manuscripts/body-editor": "2.0.57-LEAN-3958.1",
|
39
39
|
"@manuscripts/json-schema": "2.2.11",
|
40
40
|
"@manuscripts/library": "1.3.11",
|
41
41
|
"@manuscripts/style-guide": "2.0.19",
|
42
42
|
"@manuscripts/track-changes-plugin": "1.7.22",
|
43
|
-
"@manuscripts/transform": "2.3.36",
|
43
|
+
"@manuscripts/transform": "2.3.36-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",
|
47
47
|
"autotrack": "^2.4.1",
|
48
48
|
"axios": "^1.6.7",
|
49
|
-
"html-react-parser": "^5.1.16",
|
50
49
|
"http-status-codes": "^2.2.0",
|
51
50
|
"jwt-decode": "^3.1.2",
|
52
51
|
"lodash": "^4.17.21",
|
@@ -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;
|
49
|
-
//# sourceMappingURL=footnotes.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"footnotes.js","sourceRoot":"","sources":["../../../src/lib/footnotes.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAIH,mCAA6D;AAEtD,MAAM,gBAAgB,GAAG,CAC9B,GAAmB,EACnB,EAAU,EACa,EAAE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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"}
|
package/dist/es/lib/footnotes.js
DELETED
@@ -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,EACnB,KAAuB,EACf,EAAE;IACV,IAAI,QAAQ,GAAG,IAAI,CAAA;IACnB,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QACvC,QAAQ,GAAG,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;KAChD;IACD,OAAO,oCACL,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EACpC,SAAS,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;AACjD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAA4B,EAC5B,IAAoB,EACpB,EAAE;IACF,MAAM,eAAe,GAAG,eAAe,CAAC,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,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAA;AACrC,CAAC,CAAA"}
|
@@ -1,15 +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 { 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;
|