@manuscripts/body-editor 1.6.16 → 1.6.18
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 +8 -5
- package/dist/es/commands.js +8 -5
- package/package.json +1 -1
package/dist/cjs/commands.js
CHANGED
|
@@ -287,9 +287,9 @@ const insertInlineFootnote = (kind) => (state, dispatch) => {
|
|
|
287
287
|
});
|
|
288
288
|
const tr = state.tr;
|
|
289
289
|
tr.insert(insertedAt, node);
|
|
290
|
-
const
|
|
290
|
+
const footnotesSection = (0, prosemirror_utils_1.findChildrenByType)(tr.doc, transform_1.schema.nodes.footnotes_section)[0];
|
|
291
291
|
let selectionPos;
|
|
292
|
-
if (!
|
|
292
|
+
if (!footnotesSection) {
|
|
293
293
|
const section = state.schema.nodes.footnotes_section.create({}, [
|
|
294
294
|
state.schema.nodes.section_title.create({}, state.schema.text('Notes')),
|
|
295
295
|
state.schema.nodes.footnotes_element.create({}, footnote),
|
|
@@ -299,8 +299,11 @@ const insertInlineFootnote = (kind) => (state, dispatch) => {
|
|
|
299
299
|
selectionPos = backmatter.pos + section.nodeSize - 3;
|
|
300
300
|
}
|
|
301
301
|
else {
|
|
302
|
-
const
|
|
303
|
-
const pos =
|
|
302
|
+
const footnoteElement = (0, prosemirror_utils_1.findChildrenByType)(footnotesSection.node, transform_1.schema.nodes.footnotes_element);
|
|
303
|
+
const pos = footnotesSection.pos +
|
|
304
|
+
footnoteElement[0].pos +
|
|
305
|
+
footnoteElement[0].node.nodeSize -
|
|
306
|
+
1;
|
|
304
307
|
tr.insert(pos, footnote);
|
|
305
308
|
selectionPos = pos + 2;
|
|
306
309
|
}
|
|
@@ -312,7 +315,7 @@ const insertInlineFootnote = (kind) => (state, dispatch) => {
|
|
|
312
315
|
};
|
|
313
316
|
exports.insertInlineFootnote = insertInlineFootnote;
|
|
314
317
|
const insertGraphicalAbstract = (state, dispatch) => {
|
|
315
|
-
if ((0, utils_1.getChildOfType)(state.doc, transform_1.schema.nodes.graphical_abstract_section)) {
|
|
318
|
+
if ((0, utils_1.getChildOfType)(state.doc, transform_1.schema.nodes.graphical_abstract_section, true)) {
|
|
316
319
|
return false;
|
|
317
320
|
}
|
|
318
321
|
const abstracts = (0, prosemirror_utils_1.findChildrenByType)(state.doc, transform_1.schema.nodes.abstracts)[0];
|
package/dist/es/commands.js
CHANGED
|
@@ -269,9 +269,9 @@ export const insertInlineFootnote = (kind) => (state, dispatch) => {
|
|
|
269
269
|
});
|
|
270
270
|
const tr = state.tr;
|
|
271
271
|
tr.insert(insertedAt, node);
|
|
272
|
-
const
|
|
272
|
+
const footnotesSection = findChildrenByType(tr.doc, schema.nodes.footnotes_section)[0];
|
|
273
273
|
let selectionPos;
|
|
274
|
-
if (!
|
|
274
|
+
if (!footnotesSection) {
|
|
275
275
|
const section = state.schema.nodes.footnotes_section.create({}, [
|
|
276
276
|
state.schema.nodes.section_title.create({}, state.schema.text('Notes')),
|
|
277
277
|
state.schema.nodes.footnotes_element.create({}, footnote),
|
|
@@ -281,8 +281,11 @@ export const insertInlineFootnote = (kind) => (state, dispatch) => {
|
|
|
281
281
|
selectionPos = backmatter.pos + section.nodeSize - 3;
|
|
282
282
|
}
|
|
283
283
|
else {
|
|
284
|
-
const
|
|
285
|
-
const pos =
|
|
284
|
+
const footnoteElement = findChildrenByType(footnotesSection.node, schema.nodes.footnotes_element);
|
|
285
|
+
const pos = footnotesSection.pos +
|
|
286
|
+
footnoteElement[0].pos +
|
|
287
|
+
footnoteElement[0].node.nodeSize -
|
|
288
|
+
1;
|
|
286
289
|
tr.insert(pos, footnote);
|
|
287
290
|
selectionPos = pos + 2;
|
|
288
291
|
}
|
|
@@ -293,7 +296,7 @@ export const insertInlineFootnote = (kind) => (state, dispatch) => {
|
|
|
293
296
|
return true;
|
|
294
297
|
};
|
|
295
298
|
export const insertGraphicalAbstract = (state, dispatch) => {
|
|
296
|
-
if (getChildOfType(state.doc, schema.nodes.graphical_abstract_section)) {
|
|
299
|
+
if (getChildOfType(state.doc, schema.nodes.graphical_abstract_section, true)) {
|
|
297
300
|
return false;
|
|
298
301
|
}
|
|
299
302
|
const abstracts = findChildrenByType(state.doc, schema.nodes.abstracts)[0];
|
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.6.
|
|
4
|
+
"version": "1.6.18",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|