@manuscripts/body-editor 2.0.34-LEAN-3745.0 → 2.0.34
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/configs/editor-views.js +2 -0
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/author_notes.js +2 -77
- package/dist/cjs/views/corresp.js +32 -0
- package/dist/es/configs/editor-views.js +2 -0
- package/dist/es/versions.js +1 -1
- package/dist/es/views/author_notes.js +2 -74
- package/dist/es/views/corresp.js +25 -0
- package/dist/types/configs/editor-views.d.ts +1 -0
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/author_notes.d.ts +3 -13
- package/dist/types/views/corresp.d.ts +25 -0
- package/package.json +3 -3
- package/styles/AdvancedEditor.css +4 -9
|
@@ -24,6 +24,7 @@ const bibliography_element_editable_1 = __importDefault(require("../views/biblio
|
|
|
24
24
|
const blockquote_element_editable_1 = __importDefault(require("../views/blockquote_element_editable"));
|
|
25
25
|
const citation_editable_1 = __importDefault(require("../views/citation_editable"));
|
|
26
26
|
const contributors_1 = __importDefault(require("../views/contributors"));
|
|
27
|
+
const corresp_1 = __importDefault(require("../views/corresp"));
|
|
27
28
|
const cross_reference_editable_1 = __importDefault(require("../views/cross_reference_editable"));
|
|
28
29
|
const empty_1 = __importDefault(require("../views/empty"));
|
|
29
30
|
const equation_editable_1 = __importDefault(require("../views/equation_editable"));
|
|
@@ -88,5 +89,6 @@ exports.default = (props, dispatch) => {
|
|
|
88
89
|
comments: (0, empty_1.default)('comments'),
|
|
89
90
|
supplements: (0, empty_1.default)('supplements'),
|
|
90
91
|
author_notes: (0, author_notes_1.default)(props, dispatch),
|
|
92
|
+
corresp: (0, corresp_1.default)(props),
|
|
91
93
|
};
|
|
92
94
|
};
|
package/dist/cjs/versions.js
CHANGED
|
@@ -14,90 +14,15 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
18
|
exports.AuthorNotesView = void 0;
|
|
22
|
-
const
|
|
23
|
-
const block_view_1 = __importDefault(require("./block_view"));
|
|
19
|
+
const base_node_view_1 = require("./base_node_view");
|
|
24
20
|
const creators_1 = require("./creators");
|
|
25
|
-
class AuthorNotesView extends
|
|
21
|
+
class AuthorNotesView extends base_node_view_1.BaseNodeView {
|
|
26
22
|
constructor() {
|
|
27
23
|
super(...arguments);
|
|
28
|
-
this.allowedTypes = ['corresp', 'footnote', 'paragraph'];
|
|
29
|
-
this.headersStrings = {
|
|
30
|
-
corresp: 'Correspondence',
|
|
31
|
-
footnote: 'Author notes',
|
|
32
|
-
paragraph: 'Author notes',
|
|
33
|
-
};
|
|
34
24
|
this.ignoreMutation = () => true;
|
|
35
25
|
this.stopEvent = () => true;
|
|
36
|
-
this.createElement = () => {
|
|
37
|
-
this.container = document.createElement('div');
|
|
38
|
-
this.container.classList.add('block', 'author-notes-container');
|
|
39
|
-
this.dom.appendChild(this.container);
|
|
40
|
-
};
|
|
41
|
-
this.updateContents = () => {
|
|
42
|
-
this.dom.setAttribute('contenteditable', 'false');
|
|
43
|
-
this.container.innerHTML = '';
|
|
44
|
-
const items = {};
|
|
45
|
-
this.allowedTypes.forEach((type) => (items[type] = []));
|
|
46
|
-
this.view.state.doc.descendants((node) => {
|
|
47
|
-
if (node.type === transform_1.schema.nodes.author_notes) {
|
|
48
|
-
node.descendants((anNode) => {
|
|
49
|
-
if (this.allowedTypes.includes(anNode.type.name)) {
|
|
50
|
-
items[anNode.type.name].push(anNode);
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
this.allowedTypes.forEach((type) => {
|
|
58
|
-
var _a, _b, _c, _d;
|
|
59
|
-
if (items[type] && items[type].length) {
|
|
60
|
-
const showHeader = type === this.allowedTypes[0] ||
|
|
61
|
-
(type === this.allowedTypes[1] &&
|
|
62
|
-
(!!((_a = items[this.allowedTypes[1]]) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
63
|
-
!!((_b = items[this.allowedTypes[2]]) === null || _b === void 0 ? void 0 : _b.length))) ||
|
|
64
|
-
(type === this.allowedTypes[2] &&
|
|
65
|
-
!((_c = items[this.allowedTypes[1]]) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
66
|
-
!!((_d = items[this.allowedTypes[2]]) === null || _d === void 0 ? void 0 : _d.length));
|
|
67
|
-
const content = this.createContent(type, items[type], showHeader);
|
|
68
|
-
if (content) {
|
|
69
|
-
this.container.appendChild(content);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
this.createHeader = (type) => {
|
|
75
|
-
const header = document.createElement('h1');
|
|
76
|
-
header.classList.add(`${type}-title`, 'block');
|
|
77
|
-
header.textContent = this.headersStrings[type];
|
|
78
|
-
return header;
|
|
79
|
-
};
|
|
80
|
-
this.createContent = (type, nodes, showHeader) => {
|
|
81
|
-
let isNotEmpty = false;
|
|
82
|
-
if (nodes.length) {
|
|
83
|
-
const container = document.createElement('div');
|
|
84
|
-
container.classList.add(`${type}s-container`);
|
|
85
|
-
if (showHeader) {
|
|
86
|
-
container.append(this.createHeader(type));
|
|
87
|
-
}
|
|
88
|
-
nodes.forEach((node) => {
|
|
89
|
-
if (node.textContent) {
|
|
90
|
-
isNotEmpty = true;
|
|
91
|
-
const div = document.createElement('div');
|
|
92
|
-
div.classList.add(type);
|
|
93
|
-
div.textContent = node.textContent;
|
|
94
|
-
container.append(div);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
return isNotEmpty ? container : null;
|
|
98
|
-
}
|
|
99
|
-
return null;
|
|
100
|
-
};
|
|
101
26
|
}
|
|
102
27
|
}
|
|
103
28
|
exports.AuthorNotesView = AuthorNotesView;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2023 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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.CorrespView = void 0;
|
|
22
|
+
const block_view_1 = __importDefault(require("./block_view"));
|
|
23
|
+
const creators_1 = require("./creators");
|
|
24
|
+
class CorrespView extends block_view_1.default {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.ignoreMutation = () => true;
|
|
28
|
+
this.stopEvent = () => true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.CorrespView = CorrespView;
|
|
32
|
+
exports.default = (0, creators_1.createNodeView)(CorrespView);
|
|
@@ -19,6 +19,7 @@ import bibliographyElement from '../views/bibliography_element_editable';
|
|
|
19
19
|
import blockquoteElement from '../views/blockquote_element_editable';
|
|
20
20
|
import citation from '../views/citation_editable';
|
|
21
21
|
import contributors from '../views/contributors';
|
|
22
|
+
import corresp from '../views/corresp';
|
|
22
23
|
import crossReference from '../views/cross_reference_editable';
|
|
23
24
|
import empty from '../views/empty';
|
|
24
25
|
import equation from '../views/equation_editable';
|
|
@@ -83,5 +84,6 @@ export default (props, dispatch) => {
|
|
|
83
84
|
comments: empty('comments'),
|
|
84
85
|
supplements: empty('supplements'),
|
|
85
86
|
author_notes: authorNotes(props, dispatch),
|
|
87
|
+
corresp: corresp(props),
|
|
86
88
|
};
|
|
87
89
|
};
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.0.34
|
|
1
|
+
export const VERSION = '2.0.34';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -13,85 +13,13 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
import BlockView from './block_view';
|
|
16
|
+
import { BaseNodeView } from './base_node_view';
|
|
18
17
|
import { createNodeView } from './creators';
|
|
19
|
-
export class AuthorNotesView extends
|
|
18
|
+
export class AuthorNotesView extends BaseNodeView {
|
|
20
19
|
constructor() {
|
|
21
20
|
super(...arguments);
|
|
22
|
-
this.allowedTypes = ['corresp', 'footnote', 'paragraph'];
|
|
23
|
-
this.headersStrings = {
|
|
24
|
-
corresp: 'Correspondence',
|
|
25
|
-
footnote: 'Author notes',
|
|
26
|
-
paragraph: 'Author notes',
|
|
27
|
-
};
|
|
28
21
|
this.ignoreMutation = () => true;
|
|
29
22
|
this.stopEvent = () => true;
|
|
30
|
-
this.createElement = () => {
|
|
31
|
-
this.container = document.createElement('div');
|
|
32
|
-
this.container.classList.add('block', 'author-notes-container');
|
|
33
|
-
this.dom.appendChild(this.container);
|
|
34
|
-
};
|
|
35
|
-
this.updateContents = () => {
|
|
36
|
-
this.dom.setAttribute('contenteditable', 'false');
|
|
37
|
-
this.container.innerHTML = '';
|
|
38
|
-
const items = {};
|
|
39
|
-
this.allowedTypes.forEach((type) => (items[type] = []));
|
|
40
|
-
this.view.state.doc.descendants((node) => {
|
|
41
|
-
if (node.type === schema.nodes.author_notes) {
|
|
42
|
-
node.descendants((anNode) => {
|
|
43
|
-
if (this.allowedTypes.includes(anNode.type.name)) {
|
|
44
|
-
items[anNode.type.name].push(anNode);
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
this.allowedTypes.forEach((type) => {
|
|
52
|
-
var _a, _b, _c, _d;
|
|
53
|
-
if (items[type] && items[type].length) {
|
|
54
|
-
const showHeader = type === this.allowedTypes[0] ||
|
|
55
|
-
(type === this.allowedTypes[1] &&
|
|
56
|
-
(!!((_a = items[this.allowedTypes[1]]) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
57
|
-
!!((_b = items[this.allowedTypes[2]]) === null || _b === void 0 ? void 0 : _b.length))) ||
|
|
58
|
-
(type === this.allowedTypes[2] &&
|
|
59
|
-
!((_c = items[this.allowedTypes[1]]) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
60
|
-
!!((_d = items[this.allowedTypes[2]]) === null || _d === void 0 ? void 0 : _d.length));
|
|
61
|
-
const content = this.createContent(type, items[type], showHeader);
|
|
62
|
-
if (content) {
|
|
63
|
-
this.container.appendChild(content);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
this.createHeader = (type) => {
|
|
69
|
-
const header = document.createElement('h1');
|
|
70
|
-
header.classList.add(`${type}-title`, 'block');
|
|
71
|
-
header.textContent = this.headersStrings[type];
|
|
72
|
-
return header;
|
|
73
|
-
};
|
|
74
|
-
this.createContent = (type, nodes, showHeader) => {
|
|
75
|
-
let isNotEmpty = false;
|
|
76
|
-
if (nodes.length) {
|
|
77
|
-
const container = document.createElement('div');
|
|
78
|
-
container.classList.add(`${type}s-container`);
|
|
79
|
-
if (showHeader) {
|
|
80
|
-
container.append(this.createHeader(type));
|
|
81
|
-
}
|
|
82
|
-
nodes.forEach((node) => {
|
|
83
|
-
if (node.textContent) {
|
|
84
|
-
isNotEmpty = true;
|
|
85
|
-
const div = document.createElement('div');
|
|
86
|
-
div.classList.add(type);
|
|
87
|
-
div.textContent = node.textContent;
|
|
88
|
-
container.append(div);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
return isNotEmpty ? container : null;
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
};
|
|
95
23
|
}
|
|
96
24
|
}
|
|
97
25
|
export default createNodeView(AuthorNotesView);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2023 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 BlockView from './block_view';
|
|
17
|
+
import { createNodeView } from './creators';
|
|
18
|
+
export class CorrespView extends BlockView {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.ignoreMutation = () => true;
|
|
22
|
+
this.stopEvent = () => true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export default createNodeView(CorrespView);
|
|
@@ -468,5 +468,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
468
468
|
dom: HTMLDivElement;
|
|
469
469
|
};
|
|
470
470
|
author_notes: import("../types").NodeViewCreator<import("../views/author_notes").AuthorNotesView>;
|
|
471
|
+
corresp: import("../types").NodeViewCreator<import("../views/corresp").CorrespView>;
|
|
471
472
|
};
|
|
472
473
|
export default _default;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.34
|
|
1
|
+
export declare const VERSION = "2.0.34";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -13,21 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
import { EditableBlockProps } from './editable_block';
|
|
19
|
-
export declare class AuthorNotesView extends BlockView<EditableBlockProps> {
|
|
16
|
+
import { BaseNodeProps, BaseNodeView } from './base_node_view';
|
|
17
|
+
export declare class AuthorNotesView extends BaseNodeView<BaseNodeProps> {
|
|
20
18
|
container: HTMLElement;
|
|
21
|
-
allowedTypes: string[];
|
|
22
|
-
headersStrings: {
|
|
23
|
-
[key: string]: string;
|
|
24
|
-
};
|
|
25
19
|
ignoreMutation: () => boolean;
|
|
26
20
|
stopEvent: () => boolean;
|
|
27
|
-
createElement: () => void;
|
|
28
|
-
updateContents: () => void;
|
|
29
|
-
createHeader: (type: string) => HTMLHeadingElement;
|
|
30
|
-
createContent: (type: string, nodes: ManuscriptNode[], showHeader: boolean) => HTMLDivElement | null;
|
|
31
21
|
}
|
|
32
|
-
declare const _default: (props:
|
|
22
|
+
declare const _default: (props: BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<AuthorNotesView>;
|
|
33
23
|
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2023 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 BlockView from './block_view';
|
|
17
|
+
import { EditableBlockProps } from './editable_block';
|
|
18
|
+
export declare class CorrespView extends BlockView<EditableBlockProps> {
|
|
19
|
+
version: string;
|
|
20
|
+
container: HTMLElement;
|
|
21
|
+
ignoreMutation: () => boolean;
|
|
22
|
+
stopEvent: () => boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const _default: (props: import("./base_node_view").BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<CorrespView>;
|
|
25
|
+
export default _default;
|
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.34
|
|
4
|
+
"version": "2.0.34",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"@iarna/word-count": "^1.1.2",
|
|
33
33
|
"@manuscripts/json-schema": "2.2.11",
|
|
34
34
|
"@manuscripts/library": "1.3.11",
|
|
35
|
-
"@manuscripts/style-guide": "2.0.10
|
|
35
|
+
"@manuscripts/style-guide": "2.0.10",
|
|
36
36
|
"@manuscripts/track-changes-plugin": "1.7.17",
|
|
37
|
-
"@manuscripts/transform": "2.3.28
|
|
37
|
+
"@manuscripts/transform": "2.3.28",
|
|
38
38
|
"@popperjs/core": "^2.11.8",
|
|
39
39
|
"astrocite-eutils": "^0.16.4",
|
|
40
40
|
"codemirror": "^5.58.1",
|
|
@@ -281,8 +281,10 @@ span.comment-marker {
|
|
|
281
281
|
line-height: 16px !important;
|
|
282
282
|
margin-top: 4px !important;
|
|
283
283
|
}
|
|
284
|
-
|
|
285
|
-
|
|
284
|
+
.ProseMirror > .author-notes {
|
|
285
|
+
margin: 1rem 0;
|
|
286
|
+
}
|
|
287
|
+
.ProseMirror > .author-notes > .block-section_title > h1 {
|
|
286
288
|
color: #353535 !important;
|
|
287
289
|
font-size: 16px !important;
|
|
288
290
|
font-weight: 700 !important;
|
|
@@ -290,13 +292,6 @@ span.comment-marker {
|
|
|
290
292
|
margin: 0 !important
|
|
291
293
|
}
|
|
292
294
|
|
|
293
|
-
.ProseMirror .author-notes-container > div {
|
|
294
|
-
margin-bottom: 16px;
|
|
295
|
-
}
|
|
296
|
-
.ProseMirror .author-notes-container > div:last-child {
|
|
297
|
-
margin-bottom: 0;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
295
|
.keywords .keyword {
|
|
301
296
|
display: inline-block;
|
|
302
297
|
color: #353535;
|