@manuscripts/body-editor 1.9.1-LEAN-3553.0 → 1.9.1
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 +2 -1
- package/dist/cjs/lib/context-menu.js +1 -3
- package/dist/cjs/plugins/footnotes/footnotes-utils.js +1 -6
- package/dist/cjs/views/inline_footnote.js +0 -1
- package/dist/es/commands.js +2 -1
- package/dist/es/lib/context-menu.js +1 -3
- package/dist/es/plugins/footnotes/footnotes-utils.js +1 -6
- package/dist/es/views/inline_footnote.js +1 -2
- package/package.json +2 -2
package/dist/cjs/commands.js
CHANGED
|
@@ -750,7 +750,8 @@ const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
|
750
750
|
else {
|
|
751
751
|
const inlineFootnotes = (0, prosemirror_utils_1.findChildrenByType)(node, transform_1.schema.nodes.inline_footnote);
|
|
752
752
|
footnoteIndex =
|
|
753
|
-
inlineFootnotes.filter(({ pos }) =>
|
|
753
|
+
inlineFootnotes.filter(({ pos }) => position + pos <= insertedAt).length +
|
|
754
|
+
1;
|
|
754
755
|
const inlineFootnoteNode = state.schema.nodes.inline_footnote.create({
|
|
755
756
|
rids: [footnote.attrs.id],
|
|
756
757
|
contents: footnoteIndex === -1 ? inlineFootnotes.length : footnoteIndex,
|
|
@@ -208,7 +208,6 @@ class ContextMenu {
|
|
|
208
208
|
const tablesFootnoteLabels = (0, footnotes_utils_1.buildTableFootnoteLabels)(this.node);
|
|
209
209
|
const footnotesWithPos = (0, prosemirror_utils_1.findChildrenByType)(footnotesElementWithPos.node, transform_1.schema.nodes.footnote);
|
|
210
210
|
const footnotes = footnotesWithPos
|
|
211
|
-
.filter(({ node }) => !(0, track_changes_utils_1.isDeleted)(node) && !(0, track_changes_utils_1.isRejectedInsert)(node))
|
|
212
211
|
.map(({ node }) => ({
|
|
213
212
|
node: node,
|
|
214
213
|
index: tablesFootnoteLabels.get(node.attrs.id),
|
|
@@ -229,8 +228,7 @@ class ContextMenu {
|
|
|
229
228
|
this.view.state.doc
|
|
230
229
|
.slice(this.getPos(), insertedAt)
|
|
231
230
|
.content.descendants((node) => {
|
|
232
|
-
if (node.type === transform_1.schema.nodes.inline_footnote
|
|
233
|
-
!(0, track_changes_utils_1.isRejectedInsert)(node)) {
|
|
231
|
+
if (node.type === transform_1.schema.nodes.inline_footnote) {
|
|
234
232
|
inlineFootnoteIndex++;
|
|
235
233
|
return false;
|
|
236
234
|
}
|
|
@@ -20,13 +20,11 @@ const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
|
20
20
|
const transform_1 = require("@manuscripts/transform");
|
|
21
21
|
const prosemirror_model_1 = require("prosemirror-model");
|
|
22
22
|
const prosemirror_utils_1 = require("prosemirror-utils");
|
|
23
|
-
const track_changes_utils_1 = require("../../lib/track-changes-utils");
|
|
24
23
|
const findTableInlineFootnoteIds = ($pos) => {
|
|
25
24
|
var _a;
|
|
26
25
|
const tableElement = (_a = (0, prosemirror_utils_1.findParentNodeClosestToPos)($pos, (node) => node.type === transform_1.schema.nodes.table_element)) === null || _a === void 0 ? void 0 : _a.node.firstChild;
|
|
27
26
|
return new Set(tableElement
|
|
28
27
|
? (0, prosemirror_utils_1.findChildren)(tableElement, (node) => node.type === transform_1.schema.nodes.inline_footnote)
|
|
29
|
-
.filter(({ node }) => !(0, track_changes_utils_1.isRejectedInsert)(node))
|
|
30
28
|
.map(({ node }) => node.attrs.rids)
|
|
31
29
|
.flat()
|
|
32
30
|
: []);
|
|
@@ -51,7 +49,6 @@ const buildTableFootnoteLabels = (node) => {
|
|
|
51
49
|
]));
|
|
52
50
|
let index = 0;
|
|
53
51
|
(0, prosemirror_utils_1.findChildrenByType)(node, transform_1.schema.nodes.inline_footnote)
|
|
54
|
-
.filter(({ node }) => !(0, track_changes_utils_1.isRejectedInsert)(node))
|
|
55
52
|
.map(({ node }) => node.attrs.rids)
|
|
56
53
|
.flat()
|
|
57
54
|
.map((rid) => {
|
|
@@ -85,9 +82,7 @@ const orderTableFootnotes = (tr, footnotesElementWithPos, position) => {
|
|
|
85
82
|
exports.orderTableFootnotes = orderTableFootnotes;
|
|
86
83
|
const updateTableInlineFootnoteLabels = (tr, table) => {
|
|
87
84
|
const labels = (0, exports.buildTableFootnoteLabels)(table.node);
|
|
88
|
-
(0, prosemirror_utils_1.findChildrenByType)(table.node, transform_1.schema.nodes.inline_footnote)
|
|
89
|
-
.filter(({ node }) => !(0, track_changes_utils_1.isRejectedInsert)(node))
|
|
90
|
-
.map(({ node, pos }) => {
|
|
85
|
+
(0, prosemirror_utils_1.findChildrenByType)(table.node, transform_1.schema.nodes.inline_footnote).map(({ node, pos }) => {
|
|
91
86
|
const contents = node.attrs.rids
|
|
92
87
|
.map((rid) => labels.get(rid))
|
|
93
88
|
.join(',');
|
|
@@ -81,7 +81,6 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
|
|
|
81
81
|
if (footnotesElement) {
|
|
82
82
|
const tablesFootnoteLabels = (0, footnotes_utils_1.buildTableFootnoteLabels)(tableElement.node);
|
|
83
83
|
footnotes = (0, prosemirror_utils_1.findChildrenByType)(footnotesElement, transform_1.schema.nodes.footnote)
|
|
84
|
-
.filter(({ node }) => !(0, track_changes_utils_1.isDeleted)(node) && !(0, track_changes_utils_1.isRejectedInsert)(node))
|
|
85
84
|
.map(({ node }) => ({
|
|
86
85
|
node: node,
|
|
87
86
|
index: tablesFootnoteLabels.get(node.attrs.id),
|
package/dist/es/commands.js
CHANGED
|
@@ -713,7 +713,8 @@ export const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
|
713
713
|
else {
|
|
714
714
|
const inlineFootnotes = findChildrenByType(node, schema.nodes.inline_footnote);
|
|
715
715
|
footnoteIndex =
|
|
716
|
-
inlineFootnotes.filter(({ pos }) =>
|
|
716
|
+
inlineFootnotes.filter(({ pos }) => position + pos <= insertedAt).length +
|
|
717
|
+
1;
|
|
717
718
|
const inlineFootnoteNode = state.schema.nodes.inline_footnote.create({
|
|
718
719
|
rids: [footnote.attrs.id],
|
|
719
720
|
contents: footnoteIndex === -1 ? inlineFootnotes.length : footnoteIndex,
|
|
@@ -201,7 +201,6 @@ export class ContextMenu {
|
|
|
201
201
|
const tablesFootnoteLabels = buildTableFootnoteLabels(this.node);
|
|
202
202
|
const footnotesWithPos = findChildrenByType(footnotesElementWithPos.node, schema.nodes.footnote);
|
|
203
203
|
const footnotes = footnotesWithPos
|
|
204
|
-
.filter(({ node }) => !isDeleted(node) && !isRejectedInsert(node))
|
|
205
204
|
.map(({ node }) => ({
|
|
206
205
|
node: node,
|
|
207
206
|
index: tablesFootnoteLabels.get(node.attrs.id),
|
|
@@ -222,8 +221,7 @@ export class ContextMenu {
|
|
|
222
221
|
this.view.state.doc
|
|
223
222
|
.slice(this.getPos(), insertedAt)
|
|
224
223
|
.content.descendants((node) => {
|
|
225
|
-
if (node.type === schema.nodes.inline_footnote
|
|
226
|
-
!isRejectedInsert(node)) {
|
|
224
|
+
if (node.type === schema.nodes.inline_footnote) {
|
|
227
225
|
inlineFootnoteIndex++;
|
|
228
226
|
return false;
|
|
229
227
|
}
|
|
@@ -17,13 +17,11 @@ import { skipTracking } from '@manuscripts/track-changes-plugin';
|
|
|
17
17
|
import { isFootnoteNode, schema, } from '@manuscripts/transform';
|
|
18
18
|
import { Fragment } from 'prosemirror-model';
|
|
19
19
|
import { findChildren, findChildrenByType, findParentNodeClosestToPos, } from 'prosemirror-utils';
|
|
20
|
-
import { isRejectedInsert } from '../../lib/track-changes-utils';
|
|
21
20
|
export const findTableInlineFootnoteIds = ($pos) => {
|
|
22
21
|
var _a;
|
|
23
22
|
const tableElement = (_a = findParentNodeClosestToPos($pos, (node) => node.type === schema.nodes.table_element)) === null || _a === void 0 ? void 0 : _a.node.firstChild;
|
|
24
23
|
return new Set(tableElement
|
|
25
24
|
? findChildren(tableElement, (node) => node.type === schema.nodes.inline_footnote)
|
|
26
|
-
.filter(({ node }) => !isRejectedInsert(node))
|
|
27
25
|
.map(({ node }) => node.attrs.rids)
|
|
28
26
|
.flat()
|
|
29
27
|
: []);
|
|
@@ -46,7 +44,6 @@ export const buildTableFootnoteLabels = (node) => {
|
|
|
46
44
|
]));
|
|
47
45
|
let index = 0;
|
|
48
46
|
findChildrenByType(node, schema.nodes.inline_footnote)
|
|
49
|
-
.filter(({ node }) => !isRejectedInsert(node))
|
|
50
47
|
.map(({ node }) => node.attrs.rids)
|
|
51
48
|
.flat()
|
|
52
49
|
.map((rid) => {
|
|
@@ -78,9 +75,7 @@ export const orderTableFootnotes = (tr, footnotesElementWithPos, position) => {
|
|
|
78
75
|
};
|
|
79
76
|
export const updateTableInlineFootnoteLabels = (tr, table) => {
|
|
80
77
|
const labels = buildTableFootnoteLabels(table.node);
|
|
81
|
-
findChildrenByType(table.node, schema.nodes.inline_footnote)
|
|
82
|
-
.filter(({ node }) => !isRejectedInsert(node))
|
|
83
|
-
.map(({ node, pos }) => {
|
|
78
|
+
findChildrenByType(table.node, schema.nodes.inline_footnote).map(({ node, pos }) => {
|
|
84
79
|
const contents = node.attrs.rids
|
|
85
80
|
.map((rid) => labels.get(rid))
|
|
86
81
|
.join(',');
|
|
@@ -17,7 +17,7 @@ import { TableFootnotesSelector, } from '@manuscripts/style-guide';
|
|
|
17
17
|
import { schema, } from '@manuscripts/transform';
|
|
18
18
|
import { findChildrenByType, findParentNodeClosestToPos, } from 'prosemirror-utils';
|
|
19
19
|
import { insertTableFootnote } from '../commands';
|
|
20
|
-
import { getChangeClasses, isDeleted,
|
|
20
|
+
import { getChangeClasses, isDeleted, } from '../lib/track-changes-utils';
|
|
21
21
|
import { buildTableFootnoteLabels } from '../plugins/footnotes/footnotes-utils';
|
|
22
22
|
import { BaseNodeView } from './base_node_view';
|
|
23
23
|
import { createNodeView } from './creators';
|
|
@@ -75,7 +75,6 @@ export class InlineFootnoteView extends BaseNodeView {
|
|
|
75
75
|
if (footnotesElement) {
|
|
76
76
|
const tablesFootnoteLabels = buildTableFootnoteLabels(tableElement.node);
|
|
77
77
|
footnotes = findChildrenByType(footnotesElement, schema.nodes.footnote)
|
|
78
|
-
.filter(({ node }) => !isDeleted(node) && !isRejectedInsert(node))
|
|
79
78
|
.map(({ node }) => ({
|
|
80
79
|
node: node,
|
|
81
80
|
index: tablesFootnoteLabels.get(node.attrs.id),
|
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.9.1
|
|
4
|
+
"version": "1.9.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@manuscripts/assets": "^0.6.4",
|
|
32
32
|
"@manuscripts/json-schema": "^2.2.7",
|
|
33
33
|
"@manuscripts/library": "^1.3.6",
|
|
34
|
-
"@manuscripts/style-guide": "1.12.
|
|
34
|
+
"@manuscripts/style-guide": "1.12.1",
|
|
35
35
|
"@manuscripts/track-changes-plugin": "1.7.10",
|
|
36
36
|
"@manuscripts/transform": "2.3.0",
|
|
37
37
|
"astrocite-eutils": "^0.16.4",
|