@manuscripts/article-editor 3.1.47-LEAN-3958.2 → 3.1.48-LEAN-3881.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/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 +87 -116
- package/dist/cjs/components/track-changes/suggestion-list/SuggestionSnippet.js.map +1 -1
- package/dist/cjs/lib/fonts.js +0 -4
- 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/utils.js +3 -108
- 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 +90 -119
- package/dist/es/components/track-changes/suggestion-list/SuggestionSnippet.js.map +1 -1
- package/dist/es/lib/fonts.js +0 -4
- 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/utils.js +2 -98
- package/dist/es/lib/utils.js.map +1 -1
- package/dist/types/components/track-changes/suggestion-list/SuggestionSnippet.d.ts +11 -0
- 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 +0 -9
- package/package.json +4 -3
@@ -81,7 +81,8 @@ 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:
|
84
|
+
padding: ${(props) => props.theme.grid.unit * 1.5}px
|
85
|
+
${(props) => props.theme.grid.unit * 2}px !important;
|
85
86
|
min-height: 28px;
|
86
87
|
margin-bottom: 6px;
|
87
88
|
border: ${(props) => props.isFocused
|
@@ -92,8 +93,7 @@ const Wrapper = styled_components_1.default.li `
|
|
92
93
|
: `none`};
|
93
94
|
list-style-type: none;
|
94
95
|
font-size: ${(props) => props.theme.font.size.small};
|
95
|
-
|
96
|
-
max-height: 40px;
|
96
|
+
|
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;AAE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AAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;gBACrC,CAAC,KAAK,EAAE,EAAE,CACtB,KAAK,CAAC,SAAS;IACb,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,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");
|
42
41
|
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
43
42
|
const transform_1 = require("@manuscripts/transform");
|
44
|
-
const
|
43
|
+
const html_react_parser_1 = __importDefault(require("html-react-parser"));
|
45
44
|
const react_1 = __importStar(require("react"));
|
46
45
|
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,130 +53,100 @@ 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)('');
|
56
57
|
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]);
|
71
58
|
(0, react_1.useEffect)(() => {
|
72
59
|
const getSnippetData = () => {
|
73
60
|
if (track_changes_plugin_1.ChangeSet.isTextChange(suggestion)) {
|
74
|
-
const
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
61
|
+
const parentNode = (0, utils_1.getParentNode)(view.state, suggestion.from);
|
62
|
+
if (parentNode?.type === transform_1.schema.nodes.footnote) {
|
63
|
+
return {
|
64
|
+
snippet: {
|
65
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
66
|
+
nodeName: parentNode.type.name || suggestion.nodeType.name,
|
67
|
+
content: suggestion.text,
|
68
|
+
},
|
69
|
+
message: '',
|
70
|
+
};
|
71
|
+
}
|
72
|
+
else {
|
73
|
+
return { snippet: null, message: suggestion.text };
|
74
|
+
}
|
83
75
|
}
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
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
|
-
};
|
76
|
+
if (track_changes_plugin_1.ChangeSet.isNodeChange(suggestion)) {
|
77
|
+
if (suggestion.node.type === transform_1.schema.nodes.inline_footnote) {
|
78
|
+
return {
|
79
|
+
snippet: {
|
80
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
81
|
+
nodeName: suggestion.node.type.spec.name,
|
82
|
+
content: (0, footnotes_1.getInlineFootnoteContent)(doc, suggestion.attrs),
|
83
|
+
},
|
84
|
+
message: '',
|
85
|
+
};
|
86
|
+
}
|
87
|
+
else if (suggestion.node.type === transform_1.schema.nodes.footnote) {
|
88
|
+
return {
|
89
|
+
snippet: {
|
90
|
+
operation: (0, tracking_1.changeOperationAlias)(dataTracked.operation),
|
91
|
+
nodeName: suggestion.node.type.name,
|
92
|
+
content: (0, footnotes_1.getFootnoteText)(view.state, suggestion.node),
|
93
|
+
},
|
94
|
+
message: '',
|
95
|
+
};
|
96
|
+
}
|
97
|
+
else {
|
98
|
+
return {
|
99
|
+
snippet: null,
|
100
|
+
message: `${suggestion.node.type.name
|
101
|
+
.charAt(0)
|
102
|
+
.toUpperCase()}${suggestion.node.type.name.slice(1)} ${dataTracked.operation}`,
|
103
|
+
};
|
164
104
|
}
|
165
105
|
}
|
166
|
-
|
167
|
-
|
168
|
-
|
106
|
+
if (track_changes_plugin_1.ChangeSet.isNodeAttrChange(suggestion)) {
|
107
|
+
if (suggestion.node.type === transform_1.schema.nodes.inline_footnote) {
|
108
|
+
return {
|
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!' };
|
169
137
|
};
|
170
|
-
const { snippet: newSnippet } = getSnippetData();
|
138
|
+
const { snippet: newSnippet, message: newMessage } = getSnippetData();
|
171
139
|
setSnippet(newSnippet);
|
140
|
+
setMessage(newMessage);
|
172
141
|
}, [suggestion, doc, view.state, dataTracked.operation]);
|
173
|
-
return (react_1.default.createElement(SnippetText, { isRejected: dataTracked.status === track_changes_plugin_1.CHANGE_STATUS.rejected },
|
174
|
-
react_1.default.createElement(
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
142
|
+
return (react_1.default.createElement(SnippetText, { isRejected: dataTracked.status === track_changes_plugin_1.CHANGE_STATUS.rejected }, snippet ? (react_1.default.createElement(react_1.default.Fragment, null,
|
143
|
+
react_1.default.createElement(Operation, { color: dataTracked.operation },
|
144
|
+
snippet.operation,
|
145
|
+
":"),
|
146
|
+
react_1.default.createElement(NodeName, null,
|
147
|
+
snippet.nodeName,
|
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)));
|
180
150
|
};
|
181
151
|
exports.SuggestionSnippet = SuggestionSnippet;
|
182
152
|
const SnippetText = styled_components_1.default.div `
|
@@ -216,6 +186,7 @@ const NodeName = styled_components_1.default.span `
|
|
216
186
|
font-size: 12px;
|
217
187
|
font-weight: bold;
|
218
188
|
line-height: 16px;
|
189
|
+
margin-right: 3.2px;
|
219
190
|
`;
|
220
191
|
const Content = styled_components_1.default.span `
|
221
192
|
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,
|
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,0EAAqC;AACrC,+CAAkD;AAClD,0EAAsC;AAEtC,sDAG+B;AAC/B,oDAA4D;AAC5D,8CAAkD;AAClD,0CAAyC;AAQlC,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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ineProperty(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");
|
21
17
|
//# 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"}
|
@@ -0,0 +1,49 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"footnotes.js","sourceRoot":"","sources":["../../../src/lib/footnotes.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAIH,mCAA6D;AAEtD,MAAM,gBAAgB,GAAG,CAC9B,GAAmB,EAC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,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"}
|
package/dist/cjs/lib/utils.js
CHANGED
@@ -1,20 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getParentNode = exports.
|
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");
|
3
|
+
exports.getParentNode = exports.findPluginByKey = exports.getNodeTextContent = void 0;
|
16
4
|
const getNodeTextContent = (node) => {
|
17
5
|
let textContent = '';
|
6
|
+
// Traverse the node and its descendants
|
18
7
|
node.forEach((child) => {
|
19
8
|
if (child.isText) {
|
20
9
|
// If the child is a text node, add its text content
|
@@ -28,57 +17,6 @@ const getNodeTextContent = (node) => {
|
|
28
17
|
return textContent;
|
29
18
|
};
|
30
19
|
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;
|
82
20
|
const findPluginByKey = (state, keyName) => {
|
83
21
|
for (let i = 0; i < state.plugins.length; i++) {
|
84
22
|
const plugin = state.plugins[i];
|
@@ -89,54 +27,11 @@ const findPluginByKey = (state, keyName) => {
|
|
89
27
|
return null;
|
90
28
|
};
|
91
29
|
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;
|
135
30
|
const getParentNode = (state, pos) => {
|
136
31
|
const resolvedPos = state.doc.resolve(pos);
|
137
32
|
for (let depth = resolvedPos.depth; depth > 0; depth--) {
|
138
33
|
const parent = resolvedPos.node(depth);
|
139
|
-
if (parent.
|
34
|
+
if (parent.isTextblock === false) {
|
140
35
|
return parent;
|
141
36
|
}
|
142
37
|
}
|
@@ -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":";;;AAkBO,MAAM,kBAAkB,GAAG,CAAC,IAAoB,EAAE,EAAE;IACzD,IAAI,WAAW,GAAG,EAAE,CAAA;IAEpB,wCAAwC;IACxC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,IAAI,KAAK,CAAC,MAAM,EAAE;YAChB,oDAAoD;YACpD,WAAW,IAAI,KAAK,CAAC,IAAI,CAAA;SAC1B;aAAM;YACL,oEAAoE;YACpE,WAAW,IAAI,IAAA,0BAAkB,EAAC,KAAK,CAAC,CAAA;SACzC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAfY,QAAA,kBAAkB,sBAe9B;AAEM,MAAM,eAAe,GAAG,CAC7B,KAA4B,EAC5B,OAAe,EACQ,EAAE;IACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7C,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAmB,CAAA;QAEjD,IAAI,MAAM,CAAC,GAAG,KAAK,OAAO,GAAG,GAAG,EAAE;YAChC,OAAO,MAAM,CAAA;SACd;KACF;IAED,OAAO,IAAI,CAAA;AACb,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,WAAW,KAAK,KAAK,EAAE;YAChC,OAAO,MAAM,CAAA;SACd;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAXY,QAAA,aAAa,iBAWzB"}
|
@@ -51,7 +51,8 @@ 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:
|
54
|
+
padding: ${(props) => props.theme.grid.unit * 1.5}px
|
55
|
+
${(props) => props.theme.grid.unit * 2}px !important;
|
55
56
|
min-height: 28px;
|
56
57
|
margin-bottom: 6px;
|
57
58
|
border: ${(props) => props.isFocused
|
@@ -62,8 +63,7 @@ const Wrapper = styled.li `
|
|
62
63
|
: `none`};
|
63
64
|
list-style-type: none;
|
64
65
|
font-size: ${(props) => props.theme.font.size.small};
|
65
|
-
|
66
|
-
max-height: 40px;
|
66
|
+
|
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;;;;;;;;;;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,CAAC,WAAW,IAAI,IAAI,CAAC,GAAG,GAAG,GAAG,EAAE;QACtD,OAAO,CAAC,cAAc,EAAE,CAAA;KACzB;AACH,CAAC,CAAA;AAWD,MAAM,CAAC,MAAM,UAAU,GAAoB,CAAC,EAC1C,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAA;IAC9C,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,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,SAAS,CAAC,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,oBAAC,OAAO,eAAS,YAAY,EAAC,SAAS,EAAE,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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EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;;;;WAI1C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;gBACrC,CAAC,KAAK,EAAE,EAAE,CACtB,KAAK,CAAC,SAAS;IACb,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,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,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 {
|
13
|
-
import { CHANGE_STATUS, ChangeSet, } from '@manuscripts/track-changes-plugin';
|
12
|
+
import { CHANGE_OPERATION, CHANGE_STATUS, ChangeSet, } from '@manuscripts/track-changes-plugin';
|
14
13
|
import { schema } from '@manuscripts/transform';
|
15
|
-
import
|
16
|
-
import React, { useEffect,
|
14
|
+
import parse from 'html-react-parser';
|
15
|
+
import React, { useEffect, useState } from 'react';
|
17
16
|
import styled from 'styled-components';
|
17
|
+
import { getFootnoteText, getInlineFootnoteContent, } from '../../../lib/footnotes';
|
18
18
|
import { changeOperationAlias } from '../../../lib/tracking';
|
19
|
-
import {
|
19
|
+
import { getParentNode } from '../../../lib/utils';
|
20
20
|
import { useStore } from '../../../store';
|
21
21
|
export const SuggestionSnippet = ({ suggestion, }) => {
|
22
22
|
const [{ doc, view }] = useStore((store) => ({
|
@@ -24,130 +24,100 @@ export const SuggestionSnippet = ({ suggestion, }) => {
|
|
24
24
|
doc: store.doc,
|
25
25
|
}));
|
26
26
|
const [snippet, setSnippet] = useState(null);
|
27
|
+
const [message, setMessage] = useState('');
|
27
28
|
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]);
|
42
29
|
useEffect(() => {
|
43
30
|
const getSnippetData = () => {
|
44
31
|
if (ChangeSet.isTextChange(suggestion)) {
|
45
|
-
const
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
32
|
+
const parentNode = getParentNode(view.state, suggestion.from);
|
33
|
+
if (parentNode?.type === schema.nodes.footnote) {
|
34
|
+
return {
|
35
|
+
snippet: {
|
36
|
+
operation: changeOperationAlias(dataTracked.operation),
|
37
|
+
nodeName: parentNode.type.name || suggestion.nodeType.name,
|
38
|
+
content: suggestion.text,
|
39
|
+
},
|
40
|
+
message: '',
|
41
|
+
};
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
return { snippet: null, message: suggestion.text };
|
45
|
+
}
|
54
46
|
}
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
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
|
-
};
|
47
|
+
if (ChangeSet.isNodeChange(suggestion)) {
|
48
|
+
if (suggestion.node.type === schema.nodes.inline_footnote) {
|
49
|
+
return {
|
50
|
+
snippet: {
|
51
|
+
operation: changeOperationAlias(dataTracked.operation),
|
52
|
+
nodeName: suggestion.node.type.spec.name,
|
53
|
+
content: getInlineFootnoteContent(doc, suggestion.attrs),
|
54
|
+
},
|
55
|
+
message: '',
|
56
|
+
};
|
57
|
+
}
|
58
|
+
else if (suggestion.node.type === schema.nodes.footnote) {
|
59
|
+
return {
|
60
|
+
snippet: {
|
61
|
+
operation: changeOperationAlias(dataTracked.operation),
|
62
|
+
nodeName: suggestion.node.type.name,
|
63
|
+
content: getFootnoteText(view.state, suggestion.node),
|
64
|
+
},
|
65
|
+
message: '',
|
66
|
+
};
|
67
|
+
}
|
68
|
+
else {
|
69
|
+
return {
|
70
|
+
snippet: null,
|
71
|
+
message: `${suggestion.node.type.name
|
72
|
+
.charAt(0)
|
73
|
+
.toUpperCase()}${suggestion.node.type.name.slice(1)} ${dataTracked.operation}`,
|
74
|
+
};
|
135
75
|
}
|
136
76
|
}
|
137
|
-
|
138
|
-
|
139
|
-
|
77
|
+
if (ChangeSet.isNodeAttrChange(suggestion)) {
|
78
|
+
if (suggestion.node.type === schema.nodes.inline_footnote) {
|
79
|
+
return {
|
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!' };
|
140
108
|
};
|
141
|
-
const { snippet: newSnippet } = getSnippetData();
|
109
|
+
const { snippet: newSnippet, message: newMessage } = getSnippetData();
|
142
110
|
setSnippet(newSnippet);
|
111
|
+
setMessage(newMessage);
|
143
112
|
}, [suggestion, doc, view.state, dataTracked.operation]);
|
144
|
-
return (React.createElement(SnippetText, { isRejected: dataTracked.status === CHANGE_STATUS.rejected },
|
145
|
-
React.createElement(
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
113
|
+
return (React.createElement(SnippetText, { isRejected: dataTracked.status === CHANGE_STATUS.rejected }, snippet ? (React.createElement(React.Fragment, null,
|
114
|
+
React.createElement(Operation, { color: dataTracked.operation },
|
115
|
+
snippet.operation,
|
116
|
+
":"),
|
117
|
+
React.createElement(NodeName, null,
|
118
|
+
snippet.nodeName,
|
119
|
+
":"),
|
120
|
+
React.createElement(Content, null, parse(snippet.content)))) : dataTracked.operation === CHANGE_OPERATION.delete ? (React.createElement("del", null, message)) : (message)));
|
151
121
|
};
|
152
122
|
const SnippetText = styled.div `
|
153
123
|
font-size: ${(props) => props.theme.font.size.small};
|
@@ -186,6 +156,7 @@ const NodeName = styled.span `
|
|
186
156
|
font-size: 12px;
|
187
157
|
font-weight: bold;
|
188
158
|
line-height: 16px;
|
159
|
+
margin-right: 3.2px;
|
189
160
|
`;
|
190
161
|
const Content = styled.span `
|
191
162
|
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":["../../../../../src/components/track-changes/suggestion-list/SuggestionSnippet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,SAAS,GAEV,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,KAAK,MAAM,mBAAmB,CAAA;AACrC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EACL,eAAe,EACf,wBAAwB,GACzB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAQzC,MAAM,CAAC,MAAM,iBAAiB,GAA4C,CAAC,EACzE,UAAU,GACX,EAAE,EAAE;IACH,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3C,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,GAAG,EAAE,KAAK,CAAC,GAAG;KACf,CAAC,CA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AAO,CAAC,OAAO,CAAC,CAAW,CAC1C,CACJ,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,KAAK,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CACtD,iCAAM,OAAO,CAAO,CACrB,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CACW,CACf,CAAA;AACH,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,MAAM,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,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;;;;;;;;CAQ3B,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAA;;;;;;CAM1B,CAAA"}
|
package/dist/es/lib/fonts.js
CHANGED
@@ -12,8 +12,4 @@
|
|
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';
|
19
15
|
//# 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"}
|
@@ -0,0 +1,43 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
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,iBAA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|
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';
|
13
1
|
export const getNodeTextContent = (node) => {
|
14
2
|
let textContent = '';
|
3
|
+
// Traverse the node and its descendants
|
15
4
|
node.forEach((child) => {
|
16
5
|
if (child.isText) {
|
17
6
|
// If the child is a text node, add its text content
|
@@ -24,52 +13,6 @@ export const getNodeTextContent = (node) => {
|
|
24
13
|
});
|
25
14
|
return textContent;
|
26
15
|
};
|
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
|
-
};
|
73
16
|
export const findPluginByKey = (state, keyName) => {
|
74
17
|
for (let i = 0; i < state.plugins.length; i++) {
|
75
18
|
const plugin = state.plugins[i];
|
@@ -79,50 +22,11 @@ export const findPluginByKey = (state, keyName) => {
|
|
79
22
|
}
|
80
23
|
return null;
|
81
24
|
};
|
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
|
-
};
|
121
25
|
export const getParentNode = (state, pos) => {
|
122
26
|
const resolvedPos = state.doc.resolve(pos);
|
123
27
|
for (let depth = resolvedPos.depth; depth > 0; depth--) {
|
124
28
|
const parent = resolvedPos.node(depth);
|
125
|
-
if (parent.
|
29
|
+
if (parent.isTextblock === false) {
|
126
30
|
return parent;
|
127
31
|
}
|
128
32
|
}
|
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
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAoB,EAAE,EAAE;IACz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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
|
+
*/
|
1
12
|
import { TrackedChange } from '@manuscripts/track-changes-plugin';
|
2
13
|
import React from 'react';
|
3
14
|
export declare const SuggestionSnippet: React.FC<{
|
@@ -0,0 +1,15 @@
|
|
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;
|
@@ -15,15 +15,6 @@ 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;
|
23
18
|
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;
|
28
19
|
export declare const getParentNode: (state: EditorState, pos: number) => import("prosemirror-model").Node | null;
|
29
20
|
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@manuscripts/article-editor",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.48-LEAN-3881.0",
|
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,17 +35,18 @@
|
|
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.
|
38
|
+
"@manuscripts/body-editor": "2.0.58-LEAN-3881.0",
|
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.
|
43
|
+
"@manuscripts/transform": "2.3.38-LEAN-3881.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",
|
49
50
|
"http-status-codes": "^2.2.0",
|
50
51
|
"jwt-decode": "^3.1.2",
|
51
52
|
"lodash": "^4.17.21",
|