@manuscripts/body-editor 3.12.35 → 3.12.38
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/commands.js +1 -1
- package/dist/cjs/plugins/paragraphs.js +17 -2
- package/dist/cjs/plugins/placeholder.js +3 -2
- package/dist/cjs/versions.js +1 -1
- package/dist/es/commands.js +1 -1
- package/dist/es/plugins/paragraphs.js +17 -2
- package/dist/es/plugins/placeholder.js +3 -2
- package/dist/es/versions.js +1 -1
- package/dist/types/versions.d.ts +1 -1
- package/package.json +3 -3
- package/styles/Editor.css +4 -0
package/dist/cjs/commands.js
CHANGED
|
@@ -198,7 +198,7 @@ const createBlock = (nodeType, position, state, dispatch, attrs) => {
|
|
|
198
198
|
break;
|
|
199
199
|
case state.schema.nodes.pullquote_element:
|
|
200
200
|
node = state.schema.nodes.pullquote_element.create(attrs, [
|
|
201
|
-
state.schema.nodes.
|
|
201
|
+
state.schema.nodes.text_block.create({}),
|
|
202
202
|
state.schema.nodes.attribution.create({}),
|
|
203
203
|
]);
|
|
204
204
|
break;
|
|
@@ -17,6 +17,17 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const transform_1 = require("@manuscripts/transform");
|
|
19
19
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
20
|
+
const isTextBlock = (node) => {
|
|
21
|
+
return node.type === node.type.schema.nodes.text_block;
|
|
22
|
+
};
|
|
23
|
+
const isTextBlockOrParagraph = (node) => {
|
|
24
|
+
return (0, transform_1.isParagraphNode)(node) || isTextBlock(node);
|
|
25
|
+
};
|
|
26
|
+
const isTableCell = (node) => {
|
|
27
|
+
const { schema } = node.type;
|
|
28
|
+
return (node.type === schema.nodes.table_cell ||
|
|
29
|
+
node.type === schema.nodes.table_header);
|
|
30
|
+
};
|
|
20
31
|
exports.default = () => {
|
|
21
32
|
return new prosemirror_state_1.Plugin({
|
|
22
33
|
appendTransaction: (transactions, oldState, newState) => {
|
|
@@ -27,11 +38,15 @@ exports.default = () => {
|
|
|
27
38
|
}
|
|
28
39
|
const joinAdjacentParagraphs = (parent, pos) => (node, offset, index) => {
|
|
29
40
|
const nodePos = pos + offset;
|
|
30
|
-
if ((
|
|
41
|
+
if (isTableCell(parent)) {
|
|
42
|
+
node.forEach(joinAdjacentParagraphs(node, nodePos + 1));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (isTextBlockOrParagraph(node) &&
|
|
31
46
|
node.childCount === 0 &&
|
|
32
47
|
index < parent.childCount - 1) {
|
|
33
48
|
const nextNode = parent.child(index + 1);
|
|
34
|
-
if ((
|
|
49
|
+
if (isTextBlockOrParagraph(nextNode) && nextNode.childCount === 0) {
|
|
35
50
|
positionsToJoin.push(nodePos + node.nodeSize);
|
|
36
51
|
}
|
|
37
52
|
}
|
|
@@ -50,7 +50,7 @@ const getParagraphPlaceholderText = (parent, node) => {
|
|
|
50
50
|
if ((0, transform_1.isPullquoteElement)(parent) && !node.textContent.length) {
|
|
51
51
|
let otherParagraphHasContent = false;
|
|
52
52
|
parent.descendants((child) => {
|
|
53
|
-
if (child !== node && child.type === child.type.schema.nodes.
|
|
53
|
+
if (child !== node && child.type === child.type.schema.nodes.text_block) {
|
|
54
54
|
otherParagraphHasContent = true;
|
|
55
55
|
}
|
|
56
56
|
});
|
|
@@ -81,7 +81,8 @@ exports.default = () => new prosemirror_state_1.Plugin({
|
|
|
81
81
|
if (node.type === node.type.schema.nodes.attribution) {
|
|
82
82
|
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, placeholderWidget('Insert reference here')));
|
|
83
83
|
}
|
|
84
|
-
if (node.type === node.type.schema.nodes.paragraph
|
|
84
|
+
if (node.type === node.type.schema.nodes.paragraph ||
|
|
85
|
+
node.type === node.type.schema.nodes.text_block) {
|
|
85
86
|
const text = getParagraphPlaceholderText(parent, node);
|
|
86
87
|
if (text) {
|
|
87
88
|
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, placeholderWidget(text)));
|
package/dist/cjs/versions.js
CHANGED
package/dist/es/commands.js
CHANGED
|
@@ -188,7 +188,7 @@ export const createBlock = (nodeType, position, state, dispatch, attrs) => {
|
|
|
188
188
|
break;
|
|
189
189
|
case state.schema.nodes.pullquote_element:
|
|
190
190
|
node = state.schema.nodes.pullquote_element.create(attrs, [
|
|
191
|
-
state.schema.nodes.
|
|
191
|
+
state.schema.nodes.text_block.create({}),
|
|
192
192
|
state.schema.nodes.attribution.create({}),
|
|
193
193
|
]);
|
|
194
194
|
break;
|
|
@@ -15,6 +15,17 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { isParagraphNode } from '@manuscripts/transform';
|
|
17
17
|
import { Plugin } from 'prosemirror-state';
|
|
18
|
+
const isTextBlock = (node) => {
|
|
19
|
+
return node.type === node.type.schema.nodes.text_block;
|
|
20
|
+
};
|
|
21
|
+
const isTextBlockOrParagraph = (node) => {
|
|
22
|
+
return isParagraphNode(node) || isTextBlock(node);
|
|
23
|
+
};
|
|
24
|
+
const isTableCell = (node) => {
|
|
25
|
+
const { schema } = node.type;
|
|
26
|
+
return (node.type === schema.nodes.table_cell ||
|
|
27
|
+
node.type === schema.nodes.table_header);
|
|
28
|
+
};
|
|
18
29
|
export default () => {
|
|
19
30
|
return new Plugin({
|
|
20
31
|
appendTransaction: (transactions, oldState, newState) => {
|
|
@@ -25,11 +36,15 @@ export default () => {
|
|
|
25
36
|
}
|
|
26
37
|
const joinAdjacentParagraphs = (parent, pos) => (node, offset, index) => {
|
|
27
38
|
const nodePos = pos + offset;
|
|
28
|
-
if (
|
|
39
|
+
if (isTableCell(parent)) {
|
|
40
|
+
node.forEach(joinAdjacentParagraphs(node, nodePos + 1));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (isTextBlockOrParagraph(node) &&
|
|
29
44
|
node.childCount === 0 &&
|
|
30
45
|
index < parent.childCount - 1) {
|
|
31
46
|
const nextNode = parent.child(index + 1);
|
|
32
|
-
if (
|
|
47
|
+
if (isTextBlockOrParagraph(nextNode) && nextNode.childCount === 0) {
|
|
33
48
|
positionsToJoin.push(nodePos + node.nodeSize);
|
|
34
49
|
}
|
|
35
50
|
}
|
|
@@ -48,7 +48,7 @@ const getParagraphPlaceholderText = (parent, node) => {
|
|
|
48
48
|
if (isPullquoteElement(parent) && !node.textContent.length) {
|
|
49
49
|
let otherParagraphHasContent = false;
|
|
50
50
|
parent.descendants((child) => {
|
|
51
|
-
if (child !== node && child.type === child.type.schema.nodes.
|
|
51
|
+
if (child !== node && child.type === child.type.schema.nodes.text_block) {
|
|
52
52
|
otherParagraphHasContent = true;
|
|
53
53
|
}
|
|
54
54
|
});
|
|
@@ -79,7 +79,8 @@ export default () => new Plugin({
|
|
|
79
79
|
if (node.type === node.type.schema.nodes.attribution) {
|
|
80
80
|
decorations.push(Decoration.widget(pos + 1, placeholderWidget('Insert reference here')));
|
|
81
81
|
}
|
|
82
|
-
if (node.type === node.type.schema.nodes.paragraph
|
|
82
|
+
if (node.type === node.type.schema.nodes.paragraph ||
|
|
83
|
+
node.type === node.type.schema.nodes.text_block) {
|
|
83
84
|
const text = getParagraphPlaceholderText(parent, node);
|
|
84
85
|
if (text) {
|
|
85
86
|
decorations.push(Decoration.widget(pos + 1, placeholderWidget(text)));
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.12.
|
|
1
|
+
export const VERSION = '3.12.38';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.12.
|
|
1
|
+
export declare const VERSION = "3.12.38";
|
|
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": "3.12.
|
|
4
|
+
"version": "3.12.38",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"@citation-js/plugin-pubmed": "0.3.0",
|
|
38
38
|
"@citation-js/plugin-ris": "0.7.18",
|
|
39
39
|
"@iarna/word-count": "1.1.2",
|
|
40
|
-
"@manuscripts/style-guide": "3.5.
|
|
40
|
+
"@manuscripts/style-guide": "3.5.13",
|
|
41
41
|
"@manuscripts/track-changes-plugin": "2.3.10",
|
|
42
|
-
"@manuscripts/transform": "4.3.
|
|
42
|
+
"@manuscripts/transform": "4.3.41",
|
|
43
43
|
"@popperjs/core": "2.11.8",
|
|
44
44
|
"citeproc": "2.4.63",
|
|
45
45
|
"codemirror": "5.65.19",
|
package/styles/Editor.css
CHANGED
|
@@ -92,6 +92,9 @@
|
|
|
92
92
|
line-height: 2;
|
|
93
93
|
font-size: 16px;
|
|
94
94
|
}
|
|
95
|
+
.ProseMirror .pullquote p {
|
|
96
|
+
display: flow-root;
|
|
97
|
+
}
|
|
95
98
|
.ProseMirror .pullquote p i {
|
|
96
99
|
font-style: normal;
|
|
97
100
|
}
|
|
@@ -128,6 +131,7 @@
|
|
|
128
131
|
}
|
|
129
132
|
|
|
130
133
|
.ProseMirror .pullquote footer {
|
|
134
|
+
display: flow-root;
|
|
131
135
|
padding-left: 1em;
|
|
132
136
|
color: #777;
|
|
133
137
|
position: relative;
|