@manuscripts/transform 3.0.13 → 3.0.14
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/jats/exporter/jats-exporter.js +0 -2
- package/dist/cjs/schema/index.js +0 -6
- package/dist/cjs/schema/migration/migration-scripts/3.0.12.js +18 -0
- package/dist/cjs/schema/migration/migration-scripts/index.js +6 -1
- package/dist/cjs/transformer/node-names.js +0 -1
- package/dist/cjs/transformer/node-title.js +0 -1
- package/dist/cjs/transformer/node-types.js +0 -2
- package/dist/cjs/transformer/section-category.js +0 -5
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/exporter/jats-exporter.js +0 -2
- package/dist/es/schema/index.js +0 -6
- package/dist/es/schema/migration/migration-scripts/3.0.12.js +14 -0
- package/dist/es/schema/migration/migration-scripts/index.js +6 -1
- package/dist/es/transformer/node-names.js +0 -1
- package/dist/es/transformer/node-title.js +0 -1
- package/dist/es/transformer/node-types.js +0 -2
- package/dist/es/transformer/section-category.js +0 -5
- package/dist/es/version.js +1 -1
- package/dist/types/schema/index.d.ts +0 -2
- package/dist/types/schema/migration/migration-scripts/3.0.12.d.ts +7 -0
- package/dist/types/schema/migration/migration-scripts/index.d.ts +2 -1
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/schema/nodes/toc_element.js +0 -51
- package/dist/cjs/schema/nodes/toc_section.js +0 -46
- package/dist/es/schema/nodes/toc_element.js +0 -48
- package/dist/es/schema/nodes/toc_section.js +0 -42
- package/dist/types/schema/nodes/toc_element.d.ts +0 -26
- package/dist/types/schema/nodes/toc_section.d.ts +0 -26
|
@@ -811,8 +811,6 @@ class JATSExporter {
|
|
|
811
811
|
table_col: (node) => ['col', { width: node.attrs.width }],
|
|
812
812
|
table_colgroup: () => ['colgroup', 0],
|
|
813
813
|
text: (node) => node.text,
|
|
814
|
-
toc_element: () => '',
|
|
815
|
-
toc_section: () => '',
|
|
816
814
|
comment: () => '',
|
|
817
815
|
};
|
|
818
816
|
const marks = {
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -95,8 +95,6 @@ const table_element_1 = require("./nodes/table_element");
|
|
|
95
95
|
const table_element_footer_1 = require("./nodes/table_element_footer");
|
|
96
96
|
const text_1 = require("./nodes/text");
|
|
97
97
|
const title_1 = require("./nodes/title");
|
|
98
|
-
const toc_element_1 = require("./nodes/toc_element");
|
|
99
|
-
const toc_section_1 = require("./nodes/toc_section");
|
|
100
98
|
__exportStar(require("./groups"), exports);
|
|
101
99
|
__exportStar(require("./types"), exports);
|
|
102
100
|
__exportStar(require("./nodes/comment"), exports);
|
|
@@ -146,8 +144,6 @@ __exportStar(require("./nodes/table"), exports);
|
|
|
146
144
|
__exportStar(require("./nodes/table_col"), exports);
|
|
147
145
|
__exportStar(require("./nodes/table_element"), exports);
|
|
148
146
|
__exportStar(require("./nodes/text"), exports);
|
|
149
|
-
__exportStar(require("./nodes/toc_element"), exports);
|
|
150
|
-
__exportStar(require("./nodes/toc_section"), exports);
|
|
151
147
|
__exportStar(require("./nodes/affiliation"), exports);
|
|
152
148
|
__exportStar(require("./nodes/contributor"), exports);
|
|
153
149
|
__exportStar(require("./nodes/table_element_footer"), exports);
|
|
@@ -229,8 +225,6 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
229
225
|
table_colgroup: table_col_1.tableColGroup,
|
|
230
226
|
table_header: table_1.tableHeader,
|
|
231
227
|
text: text_1.text,
|
|
232
|
-
toc_element: toc_element_1.tocElement,
|
|
233
|
-
toc_section: toc_section_1.tocSection,
|
|
234
228
|
affiliation: affiliation_1.affiliation,
|
|
235
229
|
contributor: contributor_1.contributor,
|
|
236
230
|
table_element_footer: table_element_footer_1.tableElementFooter,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration3012 = void 0;
|
|
4
|
+
class Migration3012 {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.fromVersion = '3.0.12';
|
|
7
|
+
this.toVersion = '3.0.13';
|
|
8
|
+
}
|
|
9
|
+
migrateNode(node) {
|
|
10
|
+
var _a;
|
|
11
|
+
if (node.type === 'body') {
|
|
12
|
+
const content = (_a = node.content) === null || _a === void 0 ? void 0 : _a.filter((n) => n.type !== 'toc_section');
|
|
13
|
+
return Object.assign(Object.assign({}, node), { content });
|
|
14
|
+
}
|
|
15
|
+
return node;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.Migration3012 = Migration3012;
|
|
@@ -20,5 +20,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
const _1_2_5_1 = __importDefault(require("./1.2.5"));
|
|
22
22
|
const _2_3_22_1 = __importDefault(require("./2.3.22"));
|
|
23
|
-
const
|
|
23
|
+
const _3_0_12_1 = require("./3.0.12");
|
|
24
|
+
const migrations = [
|
|
25
|
+
new _1_2_5_1.default(),
|
|
26
|
+
new _2_3_22_1.default(),
|
|
27
|
+
new _3_0_12_1.Migration3012(),
|
|
28
|
+
];
|
|
24
29
|
exports.default = migrations;
|
|
@@ -54,6 +54,5 @@ exports.nodeNames = new Map([
|
|
|
54
54
|
[schema_1.schema.nodes.table_element, 'Table'],
|
|
55
55
|
[schema_1.schema.nodes.blockquote_element, 'Block Quote'],
|
|
56
56
|
[schema_1.schema.nodes.pullquote_element, 'Pull Quote'],
|
|
57
|
-
[schema_1.schema.nodes.toc_section, 'Section'],
|
|
58
57
|
[schema_1.schema.nodes.box_element, 'Box'],
|
|
59
58
|
]);
|
|
@@ -51,7 +51,6 @@ const nodeTitle = (node) => {
|
|
|
51
51
|
case nodes.bibliography_section:
|
|
52
52
|
case nodes.footnotes_section:
|
|
53
53
|
case nodes.keywords:
|
|
54
|
-
case nodes.toc_section:
|
|
55
54
|
case nodes.graphical_abstract_section:
|
|
56
55
|
return snippetOfNodeType(node, nodes.section_title);
|
|
57
56
|
case nodes.footnotes_element:
|
|
@@ -51,8 +51,6 @@ exports.nodeTypesMap = new Map([
|
|
|
51
51
|
[schema_1.schema.nodes.section, json_schema_1.ObjectTypes.Section],
|
|
52
52
|
[schema_1.schema.nodes.table, json_schema_1.ObjectTypes.Table],
|
|
53
53
|
[schema_1.schema.nodes.table_element, json_schema_1.ObjectTypes.TableElement],
|
|
54
|
-
[schema_1.schema.nodes.toc_element, json_schema_1.ObjectTypes.TOCElement],
|
|
55
|
-
[schema_1.schema.nodes.toc_section, json_schema_1.ObjectTypes.Section],
|
|
56
54
|
[schema_1.schema.nodes.affiliation, json_schema_1.ObjectTypes.Affiliation],
|
|
57
55
|
[schema_1.schema.nodes.contributor, json_schema_1.ObjectTypes.Contributor],
|
|
58
56
|
[schema_1.schema.nodes.table_element_footer, json_schema_1.ObjectTypes.TableElementFooter],
|
|
@@ -24,7 +24,6 @@ const sectionNodeTypes = [
|
|
|
24
24
|
schema_1.schema.nodes.footnotes_section,
|
|
25
25
|
schema_1.schema.nodes.keywords,
|
|
26
26
|
schema_1.schema.nodes.section,
|
|
27
|
-
schema_1.schema.nodes.toc_section,
|
|
28
27
|
];
|
|
29
28
|
const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
|
|
30
29
|
exports.isAnySectionNode = isAnySectionNode;
|
|
@@ -38,8 +37,6 @@ const chooseSectionNodeType = (category) => {
|
|
|
38
37
|
return schema_1.schema.nodes.footnotes_section;
|
|
39
38
|
case 'MPSectionCategory:keywords':
|
|
40
39
|
return schema_1.schema.nodes.keywords;
|
|
41
|
-
case 'MPSectionCategory:toc':
|
|
42
|
-
return schema_1.schema.nodes.toc_section;
|
|
43
40
|
case 'MPSectionCategory:box-element':
|
|
44
41
|
return schema_1.schema.nodes.box_element;
|
|
45
42
|
default:
|
|
@@ -82,8 +79,6 @@ const buildSectionCategory = (node) => {
|
|
|
82
79
|
return 'MPSectionCategory:endnotes';
|
|
83
80
|
case schema_1.schema.nodes.keywords:
|
|
84
81
|
return 'MPSectionCategory:keywords';
|
|
85
|
-
case schema_1.schema.nodes.toc_section:
|
|
86
|
-
return 'MPSectionCategory:toc';
|
|
87
82
|
case schema_1.schema.nodes.graphical_abstract_section:
|
|
88
83
|
return 'MPSectionCategory:abstract-graphical';
|
|
89
84
|
case schema_1.schema.nodes.box_element:
|
package/dist/cjs/version.js
CHANGED
|
@@ -803,8 +803,6 @@ export class JATSExporter {
|
|
|
803
803
|
table_col: (node) => ['col', { width: node.attrs.width }],
|
|
804
804
|
table_colgroup: () => ['colgroup', 0],
|
|
805
805
|
text: (node) => node.text,
|
|
806
|
-
toc_element: () => '',
|
|
807
|
-
toc_section: () => '',
|
|
808
806
|
comment: () => '',
|
|
809
807
|
};
|
|
810
808
|
const marks = {
|
package/dist/es/schema/index.js
CHANGED
|
@@ -78,8 +78,6 @@ import { tableElement } from './nodes/table_element';
|
|
|
78
78
|
import { tableElementFooter } from './nodes/table_element_footer';
|
|
79
79
|
import { text } from './nodes/text';
|
|
80
80
|
import { title } from './nodes/title';
|
|
81
|
-
import { tocElement } from './nodes/toc_element';
|
|
82
|
-
import { tocSection } from './nodes/toc_section';
|
|
83
81
|
export * from './groups';
|
|
84
82
|
export * from './types';
|
|
85
83
|
export * from './nodes/comment';
|
|
@@ -129,8 +127,6 @@ export * from './nodes/table';
|
|
|
129
127
|
export * from './nodes/table_col';
|
|
130
128
|
export * from './nodes/table_element';
|
|
131
129
|
export * from './nodes/text';
|
|
132
|
-
export * from './nodes/toc_element';
|
|
133
|
-
export * from './nodes/toc_section';
|
|
134
130
|
export * from './nodes/affiliation';
|
|
135
131
|
export * from './nodes/contributor';
|
|
136
132
|
export * from './nodes/table_element_footer';
|
|
@@ -212,8 +208,6 @@ export const schema = new Schema({
|
|
|
212
208
|
table_colgroup: tableColGroup,
|
|
213
209
|
table_header: tableHeader,
|
|
214
210
|
text,
|
|
215
|
-
toc_element: tocElement,
|
|
216
|
-
toc_section: tocSection,
|
|
217
211
|
affiliation,
|
|
218
212
|
contributor: contributor,
|
|
219
213
|
table_element_footer: tableElementFooter,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class Migration3012 {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.fromVersion = '3.0.12';
|
|
4
|
+
this.toVersion = '3.0.13';
|
|
5
|
+
}
|
|
6
|
+
migrateNode(node) {
|
|
7
|
+
var _a;
|
|
8
|
+
if (node.type === 'body') {
|
|
9
|
+
const content = (_a = node.content) === null || _a === void 0 ? void 0 : _a.filter((n) => n.type !== 'toc_section');
|
|
10
|
+
return Object.assign(Object.assign({}, node), { content });
|
|
11
|
+
}
|
|
12
|
+
return node;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -15,5 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import Migration125 from './1.2.5';
|
|
17
17
|
import Migration2322 from './2.3.22';
|
|
18
|
-
|
|
18
|
+
import { Migration3012 } from './3.0.12';
|
|
19
|
+
const migrations = [
|
|
20
|
+
new Migration125(),
|
|
21
|
+
new Migration2322(),
|
|
22
|
+
new Migration3012(),
|
|
23
|
+
];
|
|
19
24
|
export default migrations;
|
|
@@ -51,6 +51,5 @@ export const nodeNames = new Map([
|
|
|
51
51
|
[schema.nodes.table_element, 'Table'],
|
|
52
52
|
[schema.nodes.blockquote_element, 'Block Quote'],
|
|
53
53
|
[schema.nodes.pullquote_element, 'Pull Quote'],
|
|
54
|
-
[schema.nodes.toc_section, 'Section'],
|
|
55
54
|
[schema.nodes.box_element, 'Box'],
|
|
56
55
|
]);
|
|
@@ -48,7 +48,6 @@ export const nodeTitle = (node) => {
|
|
|
48
48
|
case nodes.bibliography_section:
|
|
49
49
|
case nodes.footnotes_section:
|
|
50
50
|
case nodes.keywords:
|
|
51
|
-
case nodes.toc_section:
|
|
52
51
|
case nodes.graphical_abstract_section:
|
|
53
52
|
return snippetOfNodeType(node, nodes.section_title);
|
|
54
53
|
case nodes.footnotes_element:
|
|
@@ -48,8 +48,6 @@ export const nodeTypesMap = new Map([
|
|
|
48
48
|
[schema.nodes.section, ObjectTypes.Section],
|
|
49
49
|
[schema.nodes.table, ObjectTypes.Table],
|
|
50
50
|
[schema.nodes.table_element, ObjectTypes.TableElement],
|
|
51
|
-
[schema.nodes.toc_element, ObjectTypes.TOCElement],
|
|
52
|
-
[schema.nodes.toc_section, ObjectTypes.Section],
|
|
53
51
|
[schema.nodes.affiliation, ObjectTypes.Affiliation],
|
|
54
52
|
[schema.nodes.contributor, ObjectTypes.Contributor],
|
|
55
53
|
[schema.nodes.table_element_footer, ObjectTypes.TableElementFooter],
|
|
@@ -21,7 +21,6 @@ const sectionNodeTypes = [
|
|
|
21
21
|
schema.nodes.footnotes_section,
|
|
22
22
|
schema.nodes.keywords,
|
|
23
23
|
schema.nodes.section,
|
|
24
|
-
schema.nodes.toc_section,
|
|
25
24
|
];
|
|
26
25
|
export const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
|
|
27
26
|
export const chooseSectionNodeType = (category) => {
|
|
@@ -34,8 +33,6 @@ export const chooseSectionNodeType = (category) => {
|
|
|
34
33
|
return schema.nodes.footnotes_section;
|
|
35
34
|
case 'MPSectionCategory:keywords':
|
|
36
35
|
return schema.nodes.keywords;
|
|
37
|
-
case 'MPSectionCategory:toc':
|
|
38
|
-
return schema.nodes.toc_section;
|
|
39
36
|
case 'MPSectionCategory:box-element':
|
|
40
37
|
return schema.nodes.box_element;
|
|
41
38
|
default:
|
|
@@ -75,8 +72,6 @@ export const buildSectionCategory = (node) => {
|
|
|
75
72
|
return 'MPSectionCategory:endnotes';
|
|
76
73
|
case schema.nodes.keywords:
|
|
77
74
|
return 'MPSectionCategory:keywords';
|
|
78
|
-
case schema.nodes.toc_section:
|
|
79
|
-
return 'MPSectionCategory:toc';
|
|
80
75
|
case schema.nodes.graphical_abstract_section:
|
|
81
76
|
return 'MPSectionCategory:abstract-graphical';
|
|
82
77
|
case schema.nodes.box_element:
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.
|
|
1
|
+
export const VERSION = "3.0.14";
|
|
@@ -64,8 +64,6 @@ export * from './nodes/table';
|
|
|
64
64
|
export * from './nodes/table_col';
|
|
65
65
|
export * from './nodes/table_element';
|
|
66
66
|
export * from './nodes/text';
|
|
67
|
-
export * from './nodes/toc_element';
|
|
68
|
-
export * from './nodes/toc_section';
|
|
69
67
|
export * from './nodes/affiliation';
|
|
70
68
|
export * from './nodes/contributor';
|
|
71
69
|
export * from './nodes/table_element_footer';
|
|
@@ -15,5 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import Migration125 from './1.2.5';
|
|
17
17
|
import Migration2322 from './2.3.22';
|
|
18
|
-
|
|
18
|
+
import { Migration3012 } from './3.0.12';
|
|
19
|
+
declare const migrations: (Migration125 | Migration2322 | Migration3012)[];
|
|
19
20
|
export default migrations;
|
|
@@ -17,7 +17,7 @@ import { Fragment, Mark as ProsemirrorMark, MarkType, Node as ProsemirrorNode, N
|
|
|
17
17
|
import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
|
|
18
18
|
import { EditorView, NodeView } from 'prosemirror-view';
|
|
19
19
|
export type Marks = 'bold' | 'code' | 'italic' | 'smallcaps' | 'strikethrough' | 'styled' | 'subscript' | 'superscript' | 'underline' | 'tracked_insert' | 'tracked_delete';
|
|
20
|
-
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | '
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp' | 'general_table_footnote' | 'box_element' | 'awards' | 'award';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.
|
|
1
|
+
export declare const VERSION = "3.0.14";
|
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": "3.0.
|
|
4
|
+
"version": "3.0.14",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* © 2019 Atypon Systems LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.tocElement = void 0;
|
|
19
|
-
const html_1 = require("../../lib/html");
|
|
20
|
-
const createBodyElement = (node) => {
|
|
21
|
-
const dom = document.createElement('div');
|
|
22
|
-
dom.classList.add('manuscript-toc');
|
|
23
|
-
dom.id = node.attrs.id;
|
|
24
|
-
return dom;
|
|
25
|
-
};
|
|
26
|
-
exports.tocElement = {
|
|
27
|
-
atom: true,
|
|
28
|
-
attrs: {
|
|
29
|
-
id: { default: '' },
|
|
30
|
-
contents: { default: '' },
|
|
31
|
-
dataTracked: { default: null },
|
|
32
|
-
},
|
|
33
|
-
group: 'block element',
|
|
34
|
-
selectable: false,
|
|
35
|
-
parseDOM: [
|
|
36
|
-
{
|
|
37
|
-
tag: 'div.manuscript-toc',
|
|
38
|
-
getAttrs: (p) => {
|
|
39
|
-
const dom = p;
|
|
40
|
-
return {
|
|
41
|
-
contents: dom.innerHTML,
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
toDOM: (node) => {
|
|
47
|
-
const tocElementNode = node;
|
|
48
|
-
return ((0, html_1.nodeFromHTML)(tocElementNode.attrs.contents) ||
|
|
49
|
-
createBodyElement(tocElementNode));
|
|
50
|
-
},
|
|
51
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* © 2019 Atypon Systems LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.isTOCSectionNode = exports.tocSection = void 0;
|
|
19
|
-
exports.tocSection = {
|
|
20
|
-
content: 'section_title (toc_element | placeholder_element)',
|
|
21
|
-
attrs: {
|
|
22
|
-
id: { default: '' },
|
|
23
|
-
dataTracked: { default: null },
|
|
24
|
-
},
|
|
25
|
-
group: 'block sections',
|
|
26
|
-
selectable: false,
|
|
27
|
-
parseDOM: [
|
|
28
|
-
{
|
|
29
|
-
tag: 'section.toc',
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
toDOM: (node) => {
|
|
33
|
-
const tocSectioNode = node;
|
|
34
|
-
return [
|
|
35
|
-
'section',
|
|
36
|
-
{
|
|
37
|
-
id: tocSectioNode.attrs.id,
|
|
38
|
-
class: 'toc',
|
|
39
|
-
spellcheck: 'false',
|
|
40
|
-
},
|
|
41
|
-
0,
|
|
42
|
-
];
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
const isTOCSectionNode = (node) => node.type === node.type.schema.nodes.toc_section;
|
|
46
|
-
exports.isTOCSectionNode = isTOCSectionNode;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { nodeFromHTML } from '../../lib/html';
|
|
17
|
-
const createBodyElement = (node) => {
|
|
18
|
-
const dom = document.createElement('div');
|
|
19
|
-
dom.classList.add('manuscript-toc');
|
|
20
|
-
dom.id = node.attrs.id;
|
|
21
|
-
return dom;
|
|
22
|
-
};
|
|
23
|
-
export const tocElement = {
|
|
24
|
-
atom: true,
|
|
25
|
-
attrs: {
|
|
26
|
-
id: { default: '' },
|
|
27
|
-
contents: { default: '' },
|
|
28
|
-
dataTracked: { default: null },
|
|
29
|
-
},
|
|
30
|
-
group: 'block element',
|
|
31
|
-
selectable: false,
|
|
32
|
-
parseDOM: [
|
|
33
|
-
{
|
|
34
|
-
tag: 'div.manuscript-toc',
|
|
35
|
-
getAttrs: (p) => {
|
|
36
|
-
const dom = p;
|
|
37
|
-
return {
|
|
38
|
-
contents: dom.innerHTML,
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
toDOM: (node) => {
|
|
44
|
-
const tocElementNode = node;
|
|
45
|
-
return (nodeFromHTML(tocElementNode.attrs.contents) ||
|
|
46
|
-
createBodyElement(tocElementNode));
|
|
47
|
-
},
|
|
48
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
export const tocSection = {
|
|
17
|
-
content: 'section_title (toc_element | placeholder_element)',
|
|
18
|
-
attrs: {
|
|
19
|
-
id: { default: '' },
|
|
20
|
-
dataTracked: { default: null },
|
|
21
|
-
},
|
|
22
|
-
group: 'block sections',
|
|
23
|
-
selectable: false,
|
|
24
|
-
parseDOM: [
|
|
25
|
-
{
|
|
26
|
-
tag: 'section.toc',
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
toDOM: (node) => {
|
|
30
|
-
const tocSectioNode = node;
|
|
31
|
-
return [
|
|
32
|
-
'section',
|
|
33
|
-
{
|
|
34
|
-
id: tocSectioNode.attrs.id,
|
|
35
|
-
class: 'toc',
|
|
36
|
-
spellcheck: 'false',
|
|
37
|
-
},
|
|
38
|
-
0,
|
|
39
|
-
];
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
export const isTOCSectionNode = (node) => node.type === node.type.schema.nodes.toc_section;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
17
|
-
import { ManuscriptNode } from '../types';
|
|
18
|
-
interface Attrs {
|
|
19
|
-
id: string;
|
|
20
|
-
contents: string;
|
|
21
|
-
}
|
|
22
|
-
export interface TOCElementNode extends ManuscriptNode {
|
|
23
|
-
attrs: Attrs;
|
|
24
|
-
}
|
|
25
|
-
export declare const tocElement: NodeSpec;
|
|
26
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
17
|
-
import { ManuscriptNode } from '../types';
|
|
18
|
-
interface Attrs {
|
|
19
|
-
id: string;
|
|
20
|
-
}
|
|
21
|
-
export interface TOCSectionNode extends ManuscriptNode {
|
|
22
|
-
attrs: Attrs;
|
|
23
|
-
}
|
|
24
|
-
export declare const tocSection: NodeSpec;
|
|
25
|
-
export declare const isTOCSectionNode: (node: ManuscriptNode) => node is TOCSectionNode;
|
|
26
|
-
export {};
|