@manuscripts/body-editor 2.0.26-LEAN-3884.0 → 2.0.26
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 +14 -39
- package/dist/cjs/lib/context-menu.js +5 -1
- package/dist/cjs/lib/utils.js +11 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/es/commands.js +14 -39
- package/dist/es/lib/context-menu.js +6 -2
- package/dist/es/lib/utils.js +9 -0
- package/dist/es/versions.js +1 -1
- package/dist/types/commands.d.ts +2 -2
- package/dist/types/lib/utils.d.ts +2 -0
- package/dist/types/versions.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/commands.js
CHANGED
|
@@ -132,8 +132,7 @@ const createBlock = (nodeType, position, state, dispatch, attrs, tableConfig) =>
|
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
exports.createBlock = createBlock;
|
|
135
|
-
const insertGeneralFootnote = (
|
|
136
|
-
var _a;
|
|
135
|
+
const insertGeneralFootnote = (tableElementNode, position, view, tableElementFooter) => {
|
|
137
136
|
const { state, dispatch } = view;
|
|
138
137
|
const paragraph = state.schema.nodes.paragraph.create({
|
|
139
138
|
placeholder: 'Add general note here',
|
|
@@ -141,13 +140,14 @@ const insertGeneralFootnote = (tableNode, position, view, tableElementFooter) =>
|
|
|
141
140
|
const generalNote = state.schema.nodes.general_table_footnote.create({}, [
|
|
142
141
|
paragraph,
|
|
143
142
|
]);
|
|
144
|
-
const tableColGroup = (0, prosemirror_utils_1.findChildrenByType)(
|
|
143
|
+
const tableColGroup = (0, prosemirror_utils_1.findChildrenByType)(tableElementNode, transform_1.schema.nodes.table_colgroup)[0];
|
|
144
|
+
const table = (0, prosemirror_utils_1.findChildrenByType)(tableElementNode, transform_1.schema.nodes.table)[0];
|
|
145
145
|
const tr = state.tr;
|
|
146
146
|
const pos = (tableElementFooter === null || tableElementFooter === void 0 ? void 0 : tableElementFooter.length)
|
|
147
147
|
? position + tableElementFooter[0].pos + 2
|
|
148
148
|
: position +
|
|
149
149
|
(!tableColGroup
|
|
150
|
-
?
|
|
150
|
+
? table.pos + table.node.nodeSize
|
|
151
151
|
: tableColGroup.pos + tableColGroup.node.nodeSize);
|
|
152
152
|
if (tableElementFooter === null || tableElementFooter === void 0 ? void 0 : tableElementFooter.length) {
|
|
153
153
|
tr.insert(pos, generalNote);
|
|
@@ -236,25 +236,6 @@ const insertBreak = (state, dispatch) => {
|
|
|
236
236
|
};
|
|
237
237
|
exports.insertBreak = insertBreak;
|
|
238
238
|
const selectedText = () => (window.getSelection() || '').toString();
|
|
239
|
-
const findPosBeforeFirstSubsection = ($pos) => {
|
|
240
|
-
let posBeforeFirstSubsection = null;
|
|
241
|
-
for (let d = $pos.depth; d >= 0; d--) {
|
|
242
|
-
const parentNode = $pos.node(d);
|
|
243
|
-
if ((0, transform_1.isSectionNodeType)(parentNode.type)) {
|
|
244
|
-
const parentStartPos = $pos.start(d);
|
|
245
|
-
parentNode.descendants((node, pos) => {
|
|
246
|
-
if (node.type === transform_1.schema.nodes.section &&
|
|
247
|
-
posBeforeFirstSubsection === null) {
|
|
248
|
-
posBeforeFirstSubsection = parentStartPos + pos;
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
return true;
|
|
252
|
-
});
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return posBeforeFirstSubsection;
|
|
257
|
-
};
|
|
258
239
|
const findPosAfterParentSection = ($pos) => {
|
|
259
240
|
for (let d = $pos.depth; d >= 0; d--) {
|
|
260
241
|
const node = $pos.node(d);
|
|
@@ -449,10 +430,7 @@ const insertSection = (subsection = false) => (state, dispatch, view) => {
|
|
|
449
430
|
}
|
|
450
431
|
let pos;
|
|
451
432
|
if ((0, prosemirror_utils_1.hasParentNodeOfType)(transform_1.schema.nodes.body)(selection) || subsection) {
|
|
452
|
-
pos =
|
|
453
|
-
? findPosBeforeFirstSubsection(state.selection.$from) ||
|
|
454
|
-
findPosAfterParentSection(state.selection.$from)
|
|
455
|
-
: findPosAfterParentSection(state.selection.$from);
|
|
433
|
+
pos = findPosAfterParentSection(state.selection.$from);
|
|
456
434
|
}
|
|
457
435
|
else {
|
|
458
436
|
const body = (0, doc_1.findBody)(state.doc);
|
|
@@ -955,8 +933,7 @@ const addInlineComment = (state, dispatch) => {
|
|
|
955
933
|
return false;
|
|
956
934
|
};
|
|
957
935
|
exports.addInlineComment = addInlineComment;
|
|
958
|
-
const insertTableFootnote = (
|
|
959
|
-
var _a;
|
|
936
|
+
const insertTableFootnote = (tableElementNode, position, view, inlineFootnote) => {
|
|
960
937
|
const { state, dispatch } = view;
|
|
961
938
|
const tr = state.tr;
|
|
962
939
|
const footnote = state.schema.nodes.footnote.createAndFill({
|
|
@@ -974,9 +951,9 @@ const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
|
974
951
|
});
|
|
975
952
|
}
|
|
976
953
|
else {
|
|
977
|
-
const inlineFootnotes = (0, prosemirror_utils_1.findChildrenByType)(
|
|
954
|
+
const inlineFootnotes = (0, prosemirror_utils_1.findChildrenByType)(tableElementNode, transform_1.schema.nodes.inline_footnote);
|
|
978
955
|
footnoteIndex =
|
|
979
|
-
inlineFootnotes.filter(({ pos }) => !(0, track_changes_utils_1.isRejectedInsert)(
|
|
956
|
+
inlineFootnotes.filter(({ pos }) => !(0, track_changes_utils_1.isRejectedInsert)(tableElementNode) && position + pos <= insertedAt).length + 1;
|
|
980
957
|
const inlineFootnoteNode = state.schema.nodes.inline_footnote.create({
|
|
981
958
|
rids: [footnote.attrs.id],
|
|
982
959
|
contents: footnoteIndex === -1 ? inlineFootnotes.length : footnoteIndex,
|
|
@@ -984,7 +961,7 @@ const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
|
984
961
|
tr.insert(insertedAt, inlineFootnoteNode);
|
|
985
962
|
}
|
|
986
963
|
let insertionPos = position;
|
|
987
|
-
const footnotesElement = (0, prosemirror_utils_1.findChildrenByType)(
|
|
964
|
+
const footnotesElement = (0, prosemirror_utils_1.findChildrenByType)(tableElementNode, transform_1.schema.nodes.footnotes_element).pop();
|
|
988
965
|
if (footnotesElement &&
|
|
989
966
|
!(0, track_changes_utils_1.isDeleted)(footnotesElement.node) &&
|
|
990
967
|
!(0, track_changes_utils_1.isRejectedInsert)(footnotesElement.node)) {
|
|
@@ -994,7 +971,7 @@ const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
|
994
971
|
}
|
|
995
972
|
else {
|
|
996
973
|
const footnoteElement = state.schema.nodes.footnotes_element.create({}, footnote);
|
|
997
|
-
const tableElementFooter = (0, prosemirror_utils_1.findChildrenByType)(
|
|
974
|
+
const tableElementFooter = (0, prosemirror_utils_1.findChildrenByType)(tableElementNode, transform_1.schema.nodes.table_element_footer)[0];
|
|
998
975
|
if (tableElementFooter) {
|
|
999
976
|
const pos = tableElementFooter.pos;
|
|
1000
977
|
insertionPos = position + pos + tableElementFooter.node.nodeSize;
|
|
@@ -1004,18 +981,16 @@ const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
|
1004
981
|
const tableElementFooter = transform_1.schema.nodes.table_element_footer.create({
|
|
1005
982
|
id: (0, transform_1.generateID)(json_schema_1.ObjectTypes.TableElementFooter),
|
|
1006
983
|
}, [footnoteElement]);
|
|
1007
|
-
const tableColGroup = (0, prosemirror_utils_1.findChildrenByType)(
|
|
984
|
+
const tableColGroup = (0, prosemirror_utils_1.findChildrenByType)(tableElementNode, transform_1.schema.nodes.table_colgroup)[0];
|
|
985
|
+
const table = (0, prosemirror_utils_1.findChildrenByType)(tableElementNode, transform_1.schema.nodes.table)[0];
|
|
1008
986
|
if (tableColGroup) {
|
|
1009
987
|
insertionPos =
|
|
1010
988
|
position + tableColGroup.pos + tableColGroup.node.nodeSize;
|
|
1011
989
|
tr.insert(tr.mapping.map(insertionPos), tableElementFooter);
|
|
1012
990
|
}
|
|
1013
991
|
else {
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
insertionPos = position + tableSize;
|
|
1017
|
-
tr.insert(tr.mapping.map(insertionPos), tableElementFooter);
|
|
1018
|
-
}
|
|
992
|
+
insertionPos = position + table.pos + table.node.nodeSize;
|
|
993
|
+
tr.insert(tr.mapping.map(insertionPos), tableElementFooter);
|
|
1019
994
|
}
|
|
1020
995
|
}
|
|
1021
996
|
}
|
|
@@ -68,7 +68,11 @@ class ContextMenu {
|
|
|
68
68
|
const itemTitle = sectionTitle
|
|
69
69
|
? `“${this.trimTitle(sectionTitle, 30)}”`
|
|
70
70
|
: 'This Section';
|
|
71
|
-
if (types.has('section')
|
|
71
|
+
if (types.has('section') &&
|
|
72
|
+
!(0, utils_1.isChildOfNodeTypes)(this.view.state.doc, $pos.pos, [
|
|
73
|
+
transform_1.schema.nodes.abstracts,
|
|
74
|
+
transform_1.schema.nodes.backmatter,
|
|
75
|
+
])) {
|
|
72
76
|
const labelPosition = after ? 'After' : 'Before';
|
|
73
77
|
const level = (0, exports.sectionLevel)($pos.depth - 1);
|
|
74
78
|
const label = `New ${level} ${labelPosition} ${itemTitle}`;
|
package/dist/cjs/lib/utils.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.findParentElement = exports.findParentSection = exports.findParentNodeWithIdValue = exports.findParentNodeWithId = exports.getChildOfType = exports.getMatchingDescendant = exports.getMatchingChild = exports.iterateChildren = void 0;
|
|
18
|
+
exports.isChildOfNodeTypes = exports.findParentElement = exports.findParentSection = exports.findParentNodeWithIdValue = exports.findParentNodeWithId = exports.getChildOfType = exports.getMatchingDescendant = exports.getMatchingChild = exports.iterateChildren = void 0;
|
|
19
19
|
const transform_1 = require("@manuscripts/transform");
|
|
20
20
|
const prosemirror_utils_1 = require("prosemirror-utils");
|
|
21
21
|
function* iterateChildren(node, recurse = false) {
|
|
@@ -58,3 +58,13 @@ const findParentElement = (selection, validIds) => (0, prosemirror_utils_1.findP
|
|
|
58
58
|
return (0, transform_1.isElementNodeType)(node.type) && node.attrs.id;
|
|
59
59
|
})(selection);
|
|
60
60
|
exports.findParentElement = findParentElement;
|
|
61
|
+
const isChildOfNodeTypes = (doc, pos, parentNodeTypes) => {
|
|
62
|
+
const resolvedPos = doc.resolve(pos);
|
|
63
|
+
for (let depth = resolvedPos.depth - 1; depth >= 0; depth--) {
|
|
64
|
+
if (parentNodeTypes.includes(resolvedPos.node(depth).type)) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
};
|
|
70
|
+
exports.isChildOfNodeTypes = isChildOfNodeTypes;
|
package/dist/cjs/versions.js
CHANGED
package/dist/es/commands.js
CHANGED
|
@@ -123,8 +123,7 @@ export const createBlock = (nodeType, position, state, dispatch, attrs, tableCon
|
|
|
123
123
|
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
|
-
export const insertGeneralFootnote = (
|
|
127
|
-
var _a;
|
|
126
|
+
export const insertGeneralFootnote = (tableElementNode, position, view, tableElementFooter) => {
|
|
128
127
|
const { state, dispatch } = view;
|
|
129
128
|
const paragraph = state.schema.nodes.paragraph.create({
|
|
130
129
|
placeholder: 'Add general note here',
|
|
@@ -132,13 +131,14 @@ export const insertGeneralFootnote = (tableNode, position, view, tableElementFoo
|
|
|
132
131
|
const generalNote = state.schema.nodes.general_table_footnote.create({}, [
|
|
133
132
|
paragraph,
|
|
134
133
|
]);
|
|
135
|
-
const tableColGroup = findChildrenByType(
|
|
134
|
+
const tableColGroup = findChildrenByType(tableElementNode, schema.nodes.table_colgroup)[0];
|
|
135
|
+
const table = findChildrenByType(tableElementNode, schema.nodes.table)[0];
|
|
136
136
|
const tr = state.tr;
|
|
137
137
|
const pos = (tableElementFooter === null || tableElementFooter === void 0 ? void 0 : tableElementFooter.length)
|
|
138
138
|
? position + tableElementFooter[0].pos + 2
|
|
139
139
|
: position +
|
|
140
140
|
(!tableColGroup
|
|
141
|
-
?
|
|
141
|
+
? table.pos + table.node.nodeSize
|
|
142
142
|
: tableColGroup.pos + tableColGroup.node.nodeSize);
|
|
143
143
|
if (tableElementFooter === null || tableElementFooter === void 0 ? void 0 : tableElementFooter.length) {
|
|
144
144
|
tr.insert(pos, generalNote);
|
|
@@ -221,25 +221,6 @@ export const insertBreak = (state, dispatch) => {
|
|
|
221
221
|
return true;
|
|
222
222
|
};
|
|
223
223
|
const selectedText = () => (window.getSelection() || '').toString();
|
|
224
|
-
const findPosBeforeFirstSubsection = ($pos) => {
|
|
225
|
-
let posBeforeFirstSubsection = null;
|
|
226
|
-
for (let d = $pos.depth; d >= 0; d--) {
|
|
227
|
-
const parentNode = $pos.node(d);
|
|
228
|
-
if (isSectionNodeType(parentNode.type)) {
|
|
229
|
-
const parentStartPos = $pos.start(d);
|
|
230
|
-
parentNode.descendants((node, pos) => {
|
|
231
|
-
if (node.type === schema.nodes.section &&
|
|
232
|
-
posBeforeFirstSubsection === null) {
|
|
233
|
-
posBeforeFirstSubsection = parentStartPos + pos;
|
|
234
|
-
return false;
|
|
235
|
-
}
|
|
236
|
-
return true;
|
|
237
|
-
});
|
|
238
|
-
break;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return posBeforeFirstSubsection;
|
|
242
|
-
};
|
|
243
224
|
const findPosAfterParentSection = ($pos) => {
|
|
244
225
|
for (let d = $pos.depth; d >= 0; d--) {
|
|
245
226
|
const node = $pos.node(d);
|
|
@@ -425,10 +406,7 @@ export const insertSection = (subsection = false) => (state, dispatch, view) =>
|
|
|
425
406
|
}
|
|
426
407
|
let pos;
|
|
427
408
|
if (hasParentNodeOfType(schema.nodes.body)(selection) || subsection) {
|
|
428
|
-
pos =
|
|
429
|
-
? findPosBeforeFirstSubsection(state.selection.$from) ||
|
|
430
|
-
findPosAfterParentSection(state.selection.$from)
|
|
431
|
-
: findPosAfterParentSection(state.selection.$from);
|
|
409
|
+
pos = findPosAfterParentSection(state.selection.$from);
|
|
432
410
|
}
|
|
433
411
|
else {
|
|
434
412
|
const body = findBody(state.doc);
|
|
@@ -913,8 +891,7 @@ export const addInlineComment = (state, dispatch) => {
|
|
|
913
891
|
}
|
|
914
892
|
return false;
|
|
915
893
|
};
|
|
916
|
-
export const insertTableFootnote = (
|
|
917
|
-
var _a;
|
|
894
|
+
export const insertTableFootnote = (tableElementNode, position, view, inlineFootnote) => {
|
|
918
895
|
const { state, dispatch } = view;
|
|
919
896
|
const tr = state.tr;
|
|
920
897
|
const footnote = state.schema.nodes.footnote.createAndFill({
|
|
@@ -932,9 +909,9 @@ export const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
|
932
909
|
});
|
|
933
910
|
}
|
|
934
911
|
else {
|
|
935
|
-
const inlineFootnotes = findChildrenByType(
|
|
912
|
+
const inlineFootnotes = findChildrenByType(tableElementNode, schema.nodes.inline_footnote);
|
|
936
913
|
footnoteIndex =
|
|
937
|
-
inlineFootnotes.filter(({ pos }) => !isRejectedInsert(
|
|
914
|
+
inlineFootnotes.filter(({ pos }) => !isRejectedInsert(tableElementNode) && position + pos <= insertedAt).length + 1;
|
|
938
915
|
const inlineFootnoteNode = state.schema.nodes.inline_footnote.create({
|
|
939
916
|
rids: [footnote.attrs.id],
|
|
940
917
|
contents: footnoteIndex === -1 ? inlineFootnotes.length : footnoteIndex,
|
|
@@ -942,7 +919,7 @@ export const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
|
942
919
|
tr.insert(insertedAt, inlineFootnoteNode);
|
|
943
920
|
}
|
|
944
921
|
let insertionPos = position;
|
|
945
|
-
const footnotesElement = findChildrenByType(
|
|
922
|
+
const footnotesElement = findChildrenByType(tableElementNode, schema.nodes.footnotes_element).pop();
|
|
946
923
|
if (footnotesElement &&
|
|
947
924
|
!isDeleted(footnotesElement.node) &&
|
|
948
925
|
!isRejectedInsert(footnotesElement.node)) {
|
|
@@ -952,7 +929,7 @@ export const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
|
952
929
|
}
|
|
953
930
|
else {
|
|
954
931
|
const footnoteElement = state.schema.nodes.footnotes_element.create({}, footnote);
|
|
955
|
-
const tableElementFooter = findChildrenByType(
|
|
932
|
+
const tableElementFooter = findChildrenByType(tableElementNode, schema.nodes.table_element_footer)[0];
|
|
956
933
|
if (tableElementFooter) {
|
|
957
934
|
const pos = tableElementFooter.pos;
|
|
958
935
|
insertionPos = position + pos + tableElementFooter.node.nodeSize;
|
|
@@ -962,18 +939,16 @@ export const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
|
962
939
|
const tableElementFooter = schema.nodes.table_element_footer.create({
|
|
963
940
|
id: generateID(ObjectTypes.TableElementFooter),
|
|
964
941
|
}, [footnoteElement]);
|
|
965
|
-
const tableColGroup = findChildrenByType(
|
|
942
|
+
const tableColGroup = findChildrenByType(tableElementNode, schema.nodes.table_colgroup)[0];
|
|
943
|
+
const table = findChildrenByType(tableElementNode, schema.nodes.table)[0];
|
|
966
944
|
if (tableColGroup) {
|
|
967
945
|
insertionPos =
|
|
968
946
|
position + tableColGroup.pos + tableColGroup.node.nodeSize;
|
|
969
947
|
tr.insert(tr.mapping.map(insertionPos), tableElementFooter);
|
|
970
948
|
}
|
|
971
949
|
else {
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
insertionPos = position + tableSize;
|
|
975
|
-
tr.insert(tr.mapping.map(insertionPos), tableElementFooter);
|
|
976
|
-
}
|
|
950
|
+
insertionPos = position + table.pos + table.node.nodeSize;
|
|
951
|
+
tr.insert(tr.mapping.map(insertionPos), tableElementFooter);
|
|
977
952
|
}
|
|
978
953
|
}
|
|
979
954
|
}
|
|
@@ -21,7 +21,7 @@ import { buildTableFootnoteLabels } from '../plugins/footnotes/footnotes-utils';
|
|
|
21
21
|
import ReactSubView from '../views/ReactSubView';
|
|
22
22
|
import { PopperManager } from './popper';
|
|
23
23
|
import { getActualAttrs, isDeleted, isRejectedInsert, } from './track-changes-utils';
|
|
24
|
-
import { getChildOfType } from './utils';
|
|
24
|
+
import { getChildOfType, isChildOfNodeTypes } from './utils';
|
|
25
25
|
const popper = new PopperManager();
|
|
26
26
|
const readonlyTypes = [schema.nodes.keywords, schema.nodes.bibliography_element];
|
|
27
27
|
export const sectionLevel = (depth) => {
|
|
@@ -61,7 +61,11 @@ export class ContextMenu {
|
|
|
61
61
|
const itemTitle = sectionTitle
|
|
62
62
|
? `“${this.trimTitle(sectionTitle, 30)}”`
|
|
63
63
|
: 'This Section';
|
|
64
|
-
if (types.has('section')
|
|
64
|
+
if (types.has('section') &&
|
|
65
|
+
!isChildOfNodeTypes(this.view.state.doc, $pos.pos, [
|
|
66
|
+
schema.nodes.abstracts,
|
|
67
|
+
schema.nodes.backmatter,
|
|
68
|
+
])) {
|
|
65
69
|
const labelPosition = after ? 'After' : 'Before';
|
|
66
70
|
const level = sectionLevel($pos.depth - 1);
|
|
67
71
|
const label = `New ${level} ${labelPosition} ${itemTitle}`;
|
package/dist/es/lib/utils.js
CHANGED
|
@@ -50,3 +50,12 @@ export const findParentElement = (selection, validIds) => findParentNode((node)
|
|
|
50
50
|
}
|
|
51
51
|
return isElementNodeType(node.type) && node.attrs.id;
|
|
52
52
|
})(selection);
|
|
53
|
+
export const isChildOfNodeTypes = (doc, pos, parentNodeTypes) => {
|
|
54
|
+
const resolvedPos = doc.resolve(pos);
|
|
55
|
+
for (let depth = resolvedPos.depth - 1; depth >= 0; depth--) {
|
|
56
|
+
if (parentNodeTypes.includes(resolvedPos.node(depth).type)) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
};
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.0.26
|
|
1
|
+
export const VERSION = '2.0.26';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
package/dist/types/commands.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare const blockActive: (type: ManuscriptNodeType) => (state: Manuscri
|
|
|
28
28
|
export declare const canInsert: (type: ManuscriptNodeType) => (state: ManuscriptEditorState) => boolean;
|
|
29
29
|
export declare const createSelection: (nodeType: ManuscriptNodeType, position: number, doc: ManuscriptNode) => Selection;
|
|
30
30
|
export declare const createBlock: (nodeType: ManuscriptNodeType, position: number, state: ManuscriptEditorState, dispatch?: Dispatch, attrs?: Attrs, tableConfig?: TableConfig) => void;
|
|
31
|
-
export declare const insertGeneralFootnote: (
|
|
31
|
+
export declare const insertGeneralFootnote: (tableElementNode: ManuscriptNode, position: number, view: ManuscriptEditorView, tableElementFooter?: NodeWithPos[]) => void;
|
|
32
32
|
export declare const insertFigure: (file: FileAttachment, state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
33
33
|
export declare const insertSupplement: (file: FileAttachment, state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
34
34
|
export declare const insertBlock: (nodeType: ManuscriptNodeType) => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView, tableConfig?: TableConfig) => boolean;
|
|
@@ -65,7 +65,7 @@ interface NodeWithPosition {
|
|
|
65
65
|
node: InlineFootnoteNode;
|
|
66
66
|
pos: number;
|
|
67
67
|
}
|
|
68
|
-
export declare const insertTableFootnote: (
|
|
68
|
+
export declare const insertTableFootnote: (tableElementNode: ManuscriptNode, position: number, view: EditorView, inlineFootnote?: NodeWithPosition) => void;
|
|
69
69
|
export declare const addRows: (direction: 'top' | 'bottom') => (state: EditorState, dispatch?: ((tr: Transaction) => void) | undefined) => boolean;
|
|
70
70
|
export declare const addColumns: (direction: 'right' | 'left') => (state: EditorState, dispatch?: ((tr: Transaction) => void) | undefined) => boolean;
|
|
71
71
|
export declare function mergeCellsWithSpace(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { ManuscriptNode, ManuscriptNodeType } from '@manuscripts/transform';
|
|
17
|
+
import { NodeType } from 'prosemirror-model';
|
|
17
18
|
import { Selection } from 'prosemirror-state';
|
|
18
19
|
export declare function iterateChildren(node: ManuscriptNode, recurse?: boolean): Iterable<ManuscriptNode>;
|
|
19
20
|
export declare const getMatchingChild: (parent: ManuscriptNode, matcher: (node: ManuscriptNode) => boolean, deep?: boolean) => ManuscriptNode | undefined;
|
|
@@ -23,3 +24,4 @@ export declare const findParentNodeWithId: (selection: Selection) => import("pro
|
|
|
23
24
|
export declare const findParentNodeWithIdValue: (selection: Selection) => import("prosemirror-utils").ContentNodeWithPos | undefined;
|
|
24
25
|
export declare const findParentSection: (selection: Selection) => import("prosemirror-utils").ContentNodeWithPos | undefined;
|
|
25
26
|
export declare const findParentElement: (selection: Selection, validIds?: string[]) => import("prosemirror-utils").ContentNodeWithPos | undefined;
|
|
27
|
+
export declare const isChildOfNodeTypes: (doc: ManuscriptNode, pos: number, parentNodeTypes: NodeType[]) => boolean;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.26
|
|
1
|
+
export declare const VERSION = "2.0.26";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
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": "2.0.26
|
|
4
|
+
"version": "2.0.26",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|