@manuscripts/body-editor 1.7.17 → 1.7.18-LEAN-3458-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/commands.js +19 -7
- package/dist/es/commands.js +19 -7
- package/package.json +6 -6
package/dist/cjs/commands.js
CHANGED
|
@@ -127,10 +127,14 @@ const insertGeneralFootnote = (tableNode, position, view, tableElementFooter) =>
|
|
|
127
127
|
const generalNote = state.schema.nodes.paragraph.create({
|
|
128
128
|
placeholder: 'Add general note here',
|
|
129
129
|
});
|
|
130
|
+
const tableColGroup = (0, prosemirror_utils_1.findChildrenByType)(tableNode, transform_1.schema.nodes.table_colgroup)[0];
|
|
130
131
|
const tr = state.tr;
|
|
131
132
|
const pos = (tableElementFooter === null || tableElementFooter === void 0 ? void 0 : tableElementFooter.length)
|
|
132
133
|
? position + tableElementFooter[0].pos + 2
|
|
133
|
-
: position +
|
|
134
|
+
: position +
|
|
135
|
+
(!tableColGroup
|
|
136
|
+
? ((_a = tableNode.content.firstChild) === null || _a === void 0 ? void 0 : _a.nodeSize) || 0
|
|
137
|
+
: tableColGroup.pos + tableColGroup.node.nodeSize);
|
|
134
138
|
if (tableElementFooter === null || tableElementFooter === void 0 ? void 0 : tableElementFooter.length) {
|
|
135
139
|
tr.insert(pos, generalNote);
|
|
136
140
|
}
|
|
@@ -752,14 +756,22 @@ const insertTableFootnote = (node, position, state, dispatch) => {
|
|
|
752
756
|
tr.insert(insertionPos, footnoteElement);
|
|
753
757
|
}
|
|
754
758
|
else {
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
759
|
+
const tableElementFooter = transform_1.schema.nodes.table_element_footer.create({
|
|
760
|
+
id: (0, transform_1.generateID)(json_schema_1.ObjectTypes.TableElementFooter),
|
|
761
|
+
}, [footnoteElement]);
|
|
762
|
+
const tableColGroup = (0, prosemirror_utils_1.findChildrenByType)(node, transform_1.schema.nodes.table_colgroup)[0];
|
|
763
|
+
if (tableColGroup) {
|
|
764
|
+
insertionPos =
|
|
765
|
+
position + tableColGroup.pos + tableColGroup.node.nodeSize + 2;
|
|
761
766
|
tr.insert(insertionPos, tableElementFooter);
|
|
762
767
|
}
|
|
768
|
+
else {
|
|
769
|
+
const tableSize = (_a = node.content.firstChild) === null || _a === void 0 ? void 0 : _a.nodeSize;
|
|
770
|
+
if (tableSize) {
|
|
771
|
+
insertionPos = position + tableSize + 2;
|
|
772
|
+
tr.insert(insertionPos, tableElementFooter);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
763
775
|
}
|
|
764
776
|
}
|
|
765
777
|
if (dispatch && insertionPos) {
|
package/dist/es/commands.js
CHANGED
|
@@ -118,10 +118,14 @@ export const insertGeneralFootnote = (tableNode, position, view, tableElementFoo
|
|
|
118
118
|
const generalNote = state.schema.nodes.paragraph.create({
|
|
119
119
|
placeholder: 'Add general note here',
|
|
120
120
|
});
|
|
121
|
+
const tableColGroup = findChildrenByType(tableNode, schema.nodes.table_colgroup)[0];
|
|
121
122
|
const tr = state.tr;
|
|
122
123
|
const pos = (tableElementFooter === null || tableElementFooter === void 0 ? void 0 : tableElementFooter.length)
|
|
123
124
|
? position + tableElementFooter[0].pos + 2
|
|
124
|
-
: position +
|
|
125
|
+
: position +
|
|
126
|
+
(!tableColGroup
|
|
127
|
+
? ((_a = tableNode.content.firstChild) === null || _a === void 0 ? void 0 : _a.nodeSize) || 0
|
|
128
|
+
: tableColGroup.pos + tableColGroup.node.nodeSize);
|
|
125
129
|
if (tableElementFooter === null || tableElementFooter === void 0 ? void 0 : tableElementFooter.length) {
|
|
126
130
|
tr.insert(pos, generalNote);
|
|
127
131
|
}
|
|
@@ -715,14 +719,22 @@ export const insertTableFootnote = (node, position, state, dispatch) => {
|
|
|
715
719
|
tr.insert(insertionPos, footnoteElement);
|
|
716
720
|
}
|
|
717
721
|
else {
|
|
718
|
-
const
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
722
|
+
const tableElementFooter = schema.nodes.table_element_footer.create({
|
|
723
|
+
id: generateID(ObjectTypes.TableElementFooter),
|
|
724
|
+
}, [footnoteElement]);
|
|
725
|
+
const tableColGroup = findChildrenByType(node, schema.nodes.table_colgroup)[0];
|
|
726
|
+
if (tableColGroup) {
|
|
727
|
+
insertionPos =
|
|
728
|
+
position + tableColGroup.pos + tableColGroup.node.nodeSize + 2;
|
|
724
729
|
tr.insert(insertionPos, tableElementFooter);
|
|
725
730
|
}
|
|
731
|
+
else {
|
|
732
|
+
const tableSize = (_a = node.content.firstChild) === null || _a === void 0 ? void 0 : _a.nodeSize;
|
|
733
|
+
if (tableSize) {
|
|
734
|
+
insertionPos = position + tableSize + 2;
|
|
735
|
+
tr.insert(insertionPos, tableElementFooter);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
726
738
|
}
|
|
727
739
|
}
|
|
728
740
|
if (dispatch && insertionPos) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/body-editor",
|
|
3
3
|
"description": "Prosemirror components for editing and viewing manuscripts",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.18-LEAN-3458-0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@iarna/word-count": "^1.1.2",
|
|
31
31
|
"@manuscripts/assets": "^0.6.4",
|
|
32
|
-
"@manuscripts/json-schema": "^2.2.
|
|
33
|
-
"@manuscripts/library": "^1.3.
|
|
34
|
-
"@manuscripts/style-guide": "^1.7.
|
|
32
|
+
"@manuscripts/json-schema": "^2.2.6",
|
|
33
|
+
"@manuscripts/library": "^1.3.5",
|
|
34
|
+
"@manuscripts/style-guide": "^1.7.11",
|
|
35
35
|
"@manuscripts/track-changes-plugin": "^1.7.6",
|
|
36
|
-
"@manuscripts/transform": "^2.1.
|
|
36
|
+
"@manuscripts/transform": "^2.1.6",
|
|
37
37
|
"astrocite-eutils": "^0.16.4",
|
|
38
38
|
"axios": "^1.6.7",
|
|
39
39
|
"mathjax-full": "^3.2.2",
|
|
@@ -110,4 +110,4 @@
|
|
|
110
110
|
"resolutions": {
|
|
111
111
|
"@types/react": "^17.0.2"
|
|
112
112
|
}
|
|
113
|
-
}
|
|
113
|
+
}
|