@manuscripts/transform 1.4.2 → 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/cjs/schema/nodes/bibliography_element.js +1 -1
- package/dist/cjs/transformer/decode.js +0 -3
- package/dist/es/lib/utils.js +10 -0
- package/dist/es/schema/nodes/bibliography_element.js +1 -1
- package/dist/es/transformer/decode.js +0 -3
- 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);
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.bibliographyElement = void 0;
|
|
19
19
|
exports.bibliographyElement = {
|
|
20
|
-
content: '
|
|
20
|
+
content: 'bibliography_item*',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
23
|
contents: { default: '' },
|
|
@@ -140,9 +140,6 @@ class Decoder {
|
|
|
140
140
|
return references.push(this.decode(referenceModel));
|
|
141
141
|
}
|
|
142
142
|
});
|
|
143
|
-
if (!references.length) {
|
|
144
|
-
references.push(schema_1.schema.nodes.placeholder.createAndFill());
|
|
145
|
-
}
|
|
146
143
|
return schema_1.schema.nodes.bibliography_element.createChecked({
|
|
147
144
|
id: model._id,
|
|
148
145
|
contents: '',
|
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);
|
|
@@ -130,9 +130,6 @@ export class Decoder {
|
|
|
130
130
|
return references.push(this.decode(referenceModel));
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
|
-
if (!references.length) {
|
|
134
|
-
references.push(schema.nodes.placeholder.createAndFill());
|
|
135
|
-
}
|
|
136
133
|
return schema.nodes.bibliography_element.createChecked({
|
|
137
134
|
id: model._id,
|
|
138
135
|
contents: '',
|
|
@@ -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",
|