@manuscripts/transform 1.4.3 → 1.4.4
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/lib/utils.js +12 -1
- package/dist/es/lib/utils.js +10 -0
- package/dist/types/lib/utils.d.ts +1 -0
- package/package.json +1 -1
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.getTrimmedTextContent = exports.findParentNodeClosestToPos = exports.isInBibliographySection = exports.isInGraphicalAbstractSection = exports.findNodePositions = exports.iterateChildren = void 0;
|
|
18
|
+
exports.getTrimmedTextContent = exports.findParentNodeClosestToPos = exports.isInAbstractsSection = exports.isInBibliographySection = exports.isInGraphicalAbstractSection = exports.findNodePositions = exports.iterateChildren = void 0;
|
|
19
19
|
const bibliography_section_1 = require("../schema/nodes/bibliography_section");
|
|
20
20
|
const graphical_abstract_section_1 = require("../schema/nodes/graphical_abstract_section");
|
|
21
21
|
function* iterateChildren(node, recurse = false) {
|
|
@@ -61,6 +61,17 @@ const isInBibliographySection = ($pos) => {
|
|
|
61
61
|
return false;
|
|
62
62
|
};
|
|
63
63
|
exports.isInBibliographySection = isInBibliographySection;
|
|
64
|
+
const isAbstractsSectionNode = (node) => node.attrs.category === 'MPSectionCategory:abstracts';
|
|
65
|
+
const isInAbstractsSection = ($pos) => {
|
|
66
|
+
for (let i = $pos.depth; i > 0; i--) {
|
|
67
|
+
const node = $pos.node(i);
|
|
68
|
+
if (isAbstractsSectionNode(node)) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
};
|
|
74
|
+
exports.isInAbstractsSection = isInAbstractsSection;
|
|
64
75
|
const findParentNodeClosestToPos = ($pos, predicate) => {
|
|
65
76
|
for (let i = $pos.depth; i > 0; i--) {
|
|
66
77
|
const node = $pos.node(i);
|
package/dist/es/lib/utils.js
CHANGED
|
@@ -54,6 +54,16 @@ export const isInBibliographySection = ($pos) => {
|
|
|
54
54
|
}
|
|
55
55
|
return false;
|
|
56
56
|
};
|
|
57
|
+
const isAbstractsSectionNode = (node) => node.attrs.category === 'MPSectionCategory:abstracts';
|
|
58
|
+
export const isInAbstractsSection = ($pos) => {
|
|
59
|
+
for (let i = $pos.depth; i > 0; i--) {
|
|
60
|
+
const node = $pos.node(i);
|
|
61
|
+
if (isAbstractsSectionNode(node)) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
};
|
|
57
67
|
export const findParentNodeClosestToPos = ($pos, predicate) => {
|
|
58
68
|
for (let i = $pos.depth; i > 0; i--) {
|
|
59
69
|
const node = $pos.node(i);
|
|
@@ -19,6 +19,7 @@ export declare function iterateChildren(node: ManuscriptNode, recurse?: boolean)
|
|
|
19
19
|
export declare const findNodePositions: (state: ManuscriptEditorState, predicate: (node: ManuscriptNode) => boolean) => number[];
|
|
20
20
|
export declare const isInGraphicalAbstractSection: ($pos: ResolvedPos) => boolean;
|
|
21
21
|
export declare const isInBibliographySection: ($pos: ResolvedPos) => boolean;
|
|
22
|
+
export declare const isInAbstractsSection: ($pos: ResolvedPos) => boolean;
|
|
22
23
|
export declare const findParentNodeClosestToPos: ($pos: ResolvedPos, predicate: (node: ProsemirrorNode) => boolean) => {
|
|
23
24
|
pos: number;
|
|
24
25
|
start: number;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/transform",
|
|
3
3
|
"description": "ProseMirror transformer for Manuscripts applications",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.4",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|