@manuscripts/body-editor 2.0.18-LEAN-3757.0 → 2.0.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.
@@ -830,8 +830,7 @@ const getParentNode = (selection) => {
830
830
  }
831
831
  return node;
832
832
  };
833
- const isCommentingAllowed = (type) => type === transform_1.schema.nodes.title ||
834
- type === transform_1.schema.nodes.section ||
833
+ const isCommentingAllowed = (type) => type === transform_1.schema.nodes.section ||
835
834
  type === transform_1.schema.nodes.citation ||
836
835
  type === transform_1.schema.nodes.bibliography_item ||
837
836
  type === transform_1.schema.nodes.footnotes_section ||
@@ -23,7 +23,7 @@ const prosemirror_utils_1 = require("prosemirror-utils");
23
23
  const track_changes_utils_1 = require("../../lib/track-changes-utils");
24
24
  const findTableInlineFootnoteIds = ($pos) => {
25
25
  var _a;
26
- 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;
26
+ 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;
27
27
  return new Set(tableElement
28
28
  ? (0, prosemirror_utils_1.findChildren)(tableElement, (node) => node.type === transform_1.schema.nodes.inline_footnote)
29
29
  .filter(({ node }) => !(0, track_changes_utils_1.isRejectedInsert)(node))
@@ -53,7 +53,7 @@ const labelWidget = (label, id) => (view) => {
53
53
  };
54
54
  const uncitedFootnoteWidget = () => () => {
55
55
  const element = document.createElement('span');
56
- element.className = 'unctied-table-footnote';
56
+ element.className = 'uncited-footnote';
57
57
  element.innerHTML = assets_1.alertIcon;
58
58
  return element;
59
59
  };
@@ -269,15 +269,36 @@ exports.default = (props) => {
269
269
  let tableInlineFootnoteIds = undefined;
270
270
  state.doc.descendants((node, pos, parent) => {
271
271
  var _a;
272
+ if (node.type === transform_1.schema.nodes.footnotes_element) {
273
+ tableInlineFootnoteIds = undefined;
274
+ if ((parent === null || parent === void 0 ? void 0 : parent.type) === transform_1.schema.nodes.table_element_footer) {
275
+ decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
276
+ class: 'table-footnotes-element',
277
+ }));
278
+ tableInlineFootnoteIds = (0, footnotes_utils_1.findTableInlineFootnoteIds)(state.doc.resolve(pos));
279
+ }
280
+ }
272
281
  if ((0, transform_1.isFootnoteNode)(node)) {
273
- const id = node.attrs.id;
274
- if (labels) {
275
- const label = labels.get(id);
276
- if (label) {
277
- decorations.push(prosemirror_view_1.Decoration.widget(pos + 2, labelWidget(label, id), {
282
+ if (!tableInlineFootnoteIds) {
283
+ const id = node.attrs.id;
284
+ if (!labels || !labels.has(id)) {
285
+ decorations.push(prosemirror_view_1.Decoration.widget(pos + 2, (0, exports.uncitedFootnoteWidget)(), {
278
286
  side: -1,
279
287
  }));
280
288
  }
289
+ else {
290
+ const label = labels.get(id);
291
+ if (label) {
292
+ decorations.push(prosemirror_view_1.Decoration.widget(pos + 2, labelWidget(label, id), {
293
+ side: -1,
294
+ }));
295
+ }
296
+ else {
297
+ decorations.push(prosemirror_view_1.Decoration.widget(pos + 2, (0, exports.uncitedFootnoteWidget)(), {
298
+ side: -1,
299
+ }));
300
+ }
301
+ }
281
302
  }
282
303
  if (!((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.textContent)) {
283
304
  decorations.push(prosemirror_view_1.Decoration.widget(pos + 2, (0, placeholder_1.placeholderWidget)('Type new footnote here')));
@@ -287,17 +308,6 @@ exports.default = (props) => {
287
308
  decorations.push(prosemirror_view_1.Decoration.widget(pos + node.nodeSize - 1, (0, exports.uncitedFootnoteWidget)()));
288
309
  }
289
310
  }
290
- if (node.type === transform_1.schema.nodes.footnotes_element) {
291
- if ((parent === null || parent === void 0 ? void 0 : parent.type) === transform_1.schema.nodes.table_element_footer) {
292
- decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
293
- class: 'table-footnotes-element',
294
- }));
295
- tableInlineFootnoteIds = (0, footnotes_utils_1.findTableInlineFootnoteIds)(state.doc.resolve(pos));
296
- }
297
- else {
298
- tableInlineFootnoteIds = undefined;
299
- }
300
- }
301
311
  });
302
312
  return prosemirror_view_1.DecorationSet.create(state.doc, decorations);
303
313
  },
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MATHJAX_VERSION = exports.VERSION = void 0;
4
- exports.VERSION = '2.0.18-LEAN-3757.0';
4
+ exports.VERSION = '2.0.18';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -790,8 +790,7 @@ const getParentNode = (selection) => {
790
790
  }
791
791
  return node;
792
792
  };
793
- const isCommentingAllowed = (type) => type === schema.nodes.title ||
794
- type === schema.nodes.section ||
793
+ const isCommentingAllowed = (type) => type === schema.nodes.section ||
795
794
  type === schema.nodes.citation ||
796
795
  type === schema.nodes.bibliography_item ||
797
796
  type === schema.nodes.footnotes_section ||
@@ -20,7 +20,7 @@ import { findChildren, findChildrenByType, findParentNodeClosestToPos, } from 'p
20
20
  import { isRejectedInsert } from '../../lib/track-changes-utils';
21
21
  export const findTableInlineFootnoteIds = ($pos) => {
22
22
  var _a;
23
- const tableElement = (_a = findParentNodeClosestToPos($pos, (node) => node.type === schema.nodes.table_element)) === null || _a === void 0 ? void 0 : _a.node.firstChild;
23
+ const tableElement = (_a = findParentNodeClosestToPos($pos, (node) => node.type === schema.nodes.table_element)) === null || _a === void 0 ? void 0 : _a.node;
24
24
  return new Set(tableElement
25
25
  ? findChildren(tableElement, (node) => node.type === schema.nodes.inline_footnote)
26
26
  .filter(({ node }) => !isRejectedInsert(node))
@@ -47,7 +47,7 @@ const labelWidget = (label, id) => (view) => {
47
47
  };
48
48
  export const uncitedFootnoteWidget = () => () => {
49
49
  const element = document.createElement('span');
50
- element.className = 'unctied-table-footnote';
50
+ element.className = 'uncited-footnote';
51
51
  element.innerHTML = alertIcon;
52
52
  return element;
53
53
  };
@@ -261,15 +261,36 @@ export default (props) => {
261
261
  let tableInlineFootnoteIds = undefined;
262
262
  state.doc.descendants((node, pos, parent) => {
263
263
  var _a;
264
+ if (node.type === schema.nodes.footnotes_element) {
265
+ tableInlineFootnoteIds = undefined;
266
+ if ((parent === null || parent === void 0 ? void 0 : parent.type) === schema.nodes.table_element_footer) {
267
+ decorations.push(Decoration.node(pos, pos + node.nodeSize, {
268
+ class: 'table-footnotes-element',
269
+ }));
270
+ tableInlineFootnoteIds = findTableInlineFootnoteIds(state.doc.resolve(pos));
271
+ }
272
+ }
264
273
  if (isFootnoteNode(node)) {
265
- const id = node.attrs.id;
266
- if (labels) {
267
- const label = labels.get(id);
268
- if (label) {
269
- decorations.push(Decoration.widget(pos + 2, labelWidget(label, id), {
274
+ if (!tableInlineFootnoteIds) {
275
+ const id = node.attrs.id;
276
+ if (!labels || !labels.has(id)) {
277
+ decorations.push(Decoration.widget(pos + 2, uncitedFootnoteWidget(), {
270
278
  side: -1,
271
279
  }));
272
280
  }
281
+ else {
282
+ const label = labels.get(id);
283
+ if (label) {
284
+ decorations.push(Decoration.widget(pos + 2, labelWidget(label, id), {
285
+ side: -1,
286
+ }));
287
+ }
288
+ else {
289
+ decorations.push(Decoration.widget(pos + 2, uncitedFootnoteWidget(), {
290
+ side: -1,
291
+ }));
292
+ }
293
+ }
273
294
  }
274
295
  if (!((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.textContent)) {
275
296
  decorations.push(Decoration.widget(pos + 2, placeholderWidget('Type new footnote here')));
@@ -279,17 +300,6 @@ export default (props) => {
279
300
  decorations.push(Decoration.widget(pos + node.nodeSize - 1, uncitedFootnoteWidget()));
280
301
  }
281
302
  }
282
- if (node.type === schema.nodes.footnotes_element) {
283
- if ((parent === null || parent === void 0 ? void 0 : parent.type) === schema.nodes.table_element_footer) {
284
- decorations.push(Decoration.node(pos, pos + node.nodeSize, {
285
- class: 'table-footnotes-element',
286
- }));
287
- tableInlineFootnoteIds = findTableInlineFootnoteIds(state.doc.resolve(pos));
288
- }
289
- else {
290
- tableInlineFootnoteIds = undefined;
291
- }
292
- }
293
303
  });
294
304
  return DecorationSet.create(state.doc, decorations);
295
305
  },
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.0.18-LEAN-3757.0';
1
+ export const VERSION = '2.0.18';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.18-LEAN-3757.0";
1
+ export declare const VERSION = "2.0.18";
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.18-LEAN-3757.0",
4
+ "version": "2.0.18",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
package/styles/Editor.css CHANGED
@@ -965,7 +965,7 @@
965
965
 
966
966
  .ProseMirror
967
967
  .table-footnotes-element
968
- > div:not(:has(.unctied-table-footnote))
968
+ > div:not(:has(.uncited-footnote))
969
969
  p::before {
970
970
  counter-increment: table_footnote;
971
971
  content: counter(table_footnote);
@@ -1009,15 +1009,15 @@
1009
1009
  cursor: pointer;
1010
1010
  }
1011
1011
 
1012
- .ProseMirror .table-footnotes-element > div:has(.unctied-table-footnote) {
1012
+ .ProseMirror .table-footnotes-element > div:has(.uncited-footnote) {
1013
1013
  position: relative;
1014
1014
  }
1015
1015
 
1016
- .ProseMirror .unctied-table-footnote {
1016
+ .ProseMirror .uncited-footnote {
1017
1017
  display: flex;
1018
1018
  position: absolute;
1019
1019
  margin-right: 4px;
1020
- top: 15%;
1020
+ top: 6px;
1021
1021
  right: 100%;
1022
1022
  }
1023
1023