@manuscripts/body-editor 3.12.63 → 3.12.65
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/plugins/objects.js +29 -20
- package/dist/cjs/plugins/placeholder.js +15 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/es/plugins/objects.js +29 -20
- package/dist/es/plugins/placeholder.js +15 -1
- package/dist/es/versions.js +1 -1
- package/dist/types/versions.d.ts +1 -1
- package/package.json +2 -2
- package/styles/AdvancedEditor.css +0 -4
- package/styles/Editor.css +46 -37
|
@@ -43,18 +43,34 @@ exports.default = () => {
|
|
|
43
43
|
if (id) {
|
|
44
44
|
const target = targets.get(id);
|
|
45
45
|
if (target) {
|
|
46
|
-
const labelNode = document.createElement('span');
|
|
47
|
-
labelNode.className = 'element-label';
|
|
48
46
|
const caption = (0, prosemirror_utils_1.findChildren)(node, (node) => node.type === transform_1.schema.nodes.caption ||
|
|
49
47
|
node.type === transform_1.schema.nodes.caption_title, false)[0];
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
if (caption) {
|
|
49
|
+
let from;
|
|
50
|
+
let to;
|
|
51
|
+
if (caption.node.type === transform_1.schema.nodes.caption_title) {
|
|
52
|
+
from = pos + 1 + caption.pos;
|
|
53
|
+
to = from + caption.node.nodeSize;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const firstChild = caption.node.firstChild;
|
|
57
|
+
from = pos + 1 + caption.pos + 1;
|
|
58
|
+
to = from + (firstChild?.nodeSize || caption.node.nodeSize);
|
|
59
|
+
}
|
|
60
|
+
decorations.push(prosemirror_view_1.Decoration.node(from, to, {
|
|
61
|
+
'element-label': target.label,
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const labelPos = getDecorationPos(target, state.doc, pos);
|
|
66
|
+
const labelNode = document.createElement('span');
|
|
67
|
+
labelNode.className = 'element-label';
|
|
68
|
+
labelNode.textContent = target.label;
|
|
69
|
+
decorations.push(prosemirror_view_1.Decoration.widget(labelPos, labelNode, {
|
|
70
|
+
side: -1,
|
|
71
|
+
key: `element-label-${id}-${target.label}`,
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
58
74
|
}
|
|
59
75
|
}
|
|
60
76
|
});
|
|
@@ -64,14 +80,7 @@ exports.default = () => {
|
|
|
64
80
|
},
|
|
65
81
|
});
|
|
66
82
|
};
|
|
67
|
-
const getDecorationPos = (target, doc, pos
|
|
68
|
-
const $pos = doc.resolve(pos +
|
|
69
|
-
|
|
70
|
-
if (!caption) {
|
|
71
|
-
targetPos = $pos.end();
|
|
72
|
-
}
|
|
73
|
-
else if (!$pos.nodeBefore) {
|
|
74
|
-
targetPos -= 1;
|
|
75
|
-
}
|
|
76
|
-
return targetPos;
|
|
83
|
+
const getDecorationPos = (target, doc, pos) => {
|
|
84
|
+
const $pos = doc.resolve(pos + 1);
|
|
85
|
+
return $pos.end();
|
|
77
86
|
};
|
|
@@ -72,6 +72,10 @@ const getParagraphPlaceholderText = (parent, node) => {
|
|
|
72
72
|
return 'Type here';
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
+
const isTextBlockOfQuoteElement = (node, parent) => node.type === transform_1.schema.nodes.text_block &&
|
|
76
|
+
!!parent &&
|
|
77
|
+
(parent.type === transform_1.schema.nodes.pullquote_element ||
|
|
78
|
+
parent.type === transform_1.schema.nodes.blockquote_element);
|
|
75
79
|
exports.default = () => new prosemirror_state_1.Plugin({
|
|
76
80
|
props: {
|
|
77
81
|
decorations: (state) => {
|
|
@@ -82,7 +86,7 @@ exports.default = () => new prosemirror_state_1.Plugin({
|
|
|
82
86
|
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, placeholderWidget('Insert reference here')));
|
|
83
87
|
}
|
|
84
88
|
if (node.type === node.type.schema.nodes.paragraph ||
|
|
85
|
-
node
|
|
89
|
+
isTextBlockOfQuoteElement(node, parent)) {
|
|
86
90
|
const text = getParagraphPlaceholderText(parent, node);
|
|
87
91
|
if (text) {
|
|
88
92
|
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, placeholderWidget(text)));
|
|
@@ -106,6 +110,16 @@ exports.default = () => new prosemirror_state_1.Plugin({
|
|
|
106
110
|
else if (node.type === node.type.schema.nodes.trans_abstract) {
|
|
107
111
|
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, placeholderWidget('Type new abstract title here')));
|
|
108
112
|
}
|
|
113
|
+
else if (node.type === transform_1.schema.nodes.caption_title) {
|
|
114
|
+
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, placeholderWidget('Caption title...'), {
|
|
115
|
+
key: node.attrs.id,
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
else if (node.type === transform_1.schema.nodes.text_block &&
|
|
119
|
+
parent &&
|
|
120
|
+
parent.type === transform_1.schema.nodes.caption) {
|
|
121
|
+
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, placeholderWidget('Caption...')));
|
|
122
|
+
}
|
|
109
123
|
else {
|
|
110
124
|
const placeholder = placeholderMap[node.type.name];
|
|
111
125
|
decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
|
package/dist/cjs/versions.js
CHANGED
|
@@ -40,18 +40,34 @@ export default () => {
|
|
|
40
40
|
if (id) {
|
|
41
41
|
const target = targets.get(id);
|
|
42
42
|
if (target) {
|
|
43
|
-
const labelNode = document.createElement('span');
|
|
44
|
-
labelNode.className = 'element-label';
|
|
45
43
|
const caption = findChildren(node, (node) => node.type === schema.nodes.caption ||
|
|
46
44
|
node.type === schema.nodes.caption_title, false)[0];
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
if (caption) {
|
|
46
|
+
let from;
|
|
47
|
+
let to;
|
|
48
|
+
if (caption.node.type === schema.nodes.caption_title) {
|
|
49
|
+
from = pos + 1 + caption.pos;
|
|
50
|
+
to = from + caption.node.nodeSize;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const firstChild = caption.node.firstChild;
|
|
54
|
+
from = pos + 1 + caption.pos + 1;
|
|
55
|
+
to = from + (firstChild?.nodeSize || caption.node.nodeSize);
|
|
56
|
+
}
|
|
57
|
+
decorations.push(Decoration.node(from, to, {
|
|
58
|
+
'element-label': target.label,
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const labelPos = getDecorationPos(target, state.doc, pos);
|
|
63
|
+
const labelNode = document.createElement('span');
|
|
64
|
+
labelNode.className = 'element-label';
|
|
65
|
+
labelNode.textContent = target.label;
|
|
66
|
+
decorations.push(Decoration.widget(labelPos, labelNode, {
|
|
67
|
+
side: -1,
|
|
68
|
+
key: `element-label-${id}-${target.label}`,
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
55
71
|
}
|
|
56
72
|
}
|
|
57
73
|
});
|
|
@@ -61,14 +77,7 @@ export default () => {
|
|
|
61
77
|
},
|
|
62
78
|
});
|
|
63
79
|
};
|
|
64
|
-
const getDecorationPos = (target, doc, pos
|
|
65
|
-
const $pos = doc.resolve(pos +
|
|
66
|
-
|
|
67
|
-
if (!caption) {
|
|
68
|
-
targetPos = $pos.end();
|
|
69
|
-
}
|
|
70
|
-
else if (!$pos.nodeBefore) {
|
|
71
|
-
targetPos -= 1;
|
|
72
|
-
}
|
|
73
|
-
return targetPos;
|
|
80
|
+
const getDecorationPos = (target, doc, pos) => {
|
|
81
|
+
const $pos = doc.resolve(pos + 1);
|
|
82
|
+
return $pos.end();
|
|
74
83
|
};
|
|
@@ -70,6 +70,10 @@ const getParagraphPlaceholderText = (parent, node) => {
|
|
|
70
70
|
return 'Type here';
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
+
const isTextBlockOfQuoteElement = (node, parent) => node.type === schema.nodes.text_block &&
|
|
74
|
+
!!parent &&
|
|
75
|
+
(parent.type === schema.nodes.pullquote_element ||
|
|
76
|
+
parent.type === schema.nodes.blockquote_element);
|
|
73
77
|
export default () => new Plugin({
|
|
74
78
|
props: {
|
|
75
79
|
decorations: (state) => {
|
|
@@ -80,7 +84,7 @@ export default () => new Plugin({
|
|
|
80
84
|
decorations.push(Decoration.widget(pos + 1, placeholderWidget('Insert reference here')));
|
|
81
85
|
}
|
|
82
86
|
if (node.type === node.type.schema.nodes.paragraph ||
|
|
83
|
-
node
|
|
87
|
+
isTextBlockOfQuoteElement(node, parent)) {
|
|
84
88
|
const text = getParagraphPlaceholderText(parent, node);
|
|
85
89
|
if (text) {
|
|
86
90
|
decorations.push(Decoration.widget(pos + 1, placeholderWidget(text)));
|
|
@@ -104,6 +108,16 @@ export default () => new Plugin({
|
|
|
104
108
|
else if (node.type === node.type.schema.nodes.trans_abstract) {
|
|
105
109
|
decorations.push(Decoration.widget(pos + 1, placeholderWidget('Type new abstract title here')));
|
|
106
110
|
}
|
|
111
|
+
else if (node.type === schema.nodes.caption_title) {
|
|
112
|
+
decorations.push(Decoration.widget(pos + 1, placeholderWidget('Caption title...'), {
|
|
113
|
+
key: node.attrs.id,
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
else if (node.type === schema.nodes.text_block &&
|
|
117
|
+
parent &&
|
|
118
|
+
parent.type === schema.nodes.caption) {
|
|
119
|
+
decorations.push(Decoration.widget(pos + 1, placeholderWidget('Caption...')));
|
|
120
|
+
}
|
|
107
121
|
else {
|
|
108
122
|
const placeholder = placeholderMap[node.type.name];
|
|
109
123
|
decorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.12.
|
|
1
|
+
export const VERSION = '3.12.65';
|
|
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.65";
|
|
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.65",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@iarna/word-count": "1.1.2",
|
|
43
43
|
"@manuscripts/style-guide": "3.5.31",
|
|
44
44
|
"@manuscripts/track-changes-plugin": "2.3.16",
|
|
45
|
-
"@manuscripts/transform": "4.3.
|
|
45
|
+
"@manuscripts/transform": "4.3.52",
|
|
46
46
|
"@popperjs/core": "2.11.8",
|
|
47
47
|
"citeproc": "2.4.63",
|
|
48
48
|
"codemirror": "5.65.19",
|
package/styles/Editor.css
CHANGED
|
@@ -314,27 +314,42 @@
|
|
|
314
314
|
|
|
315
315
|
/* Caption and Element Label */
|
|
316
316
|
|
|
317
|
-
|
|
317
|
+
/* Shared typography for all label variants */
|
|
318
|
+
.ProseMirror .element-label,
|
|
319
|
+
.ProseMirror .caption-title[element-label]::before,
|
|
320
|
+
.ProseMirror .caption-description > [element-label]::before {
|
|
321
|
+
color: #353535;
|
|
322
|
+
font-style: normal;
|
|
323
|
+
font-weight: 700;
|
|
324
|
+
line-height: 16px;
|
|
325
|
+
margin-right: 5px;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.ProseMirror .caption-title[element-label]::before,
|
|
329
|
+
.ProseMirror .caption-description > [element-label]::before {
|
|
330
|
+
content: attr(element-label)":";
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.ProseMirror .caption-title:not(:has(.placeholder-text)) {
|
|
318
334
|
font-weight: bold;
|
|
319
335
|
}
|
|
320
336
|
|
|
321
|
-
.ProseMirror .
|
|
322
|
-
|
|
323
|
-
outline: none;
|
|
324
|
-
margin: 0;
|
|
325
|
-
display: inline;
|
|
337
|
+
.ProseMirror .caption-title {
|
|
338
|
+
display: block;
|
|
326
339
|
}
|
|
327
340
|
|
|
328
|
-
.ProseMirror .
|
|
341
|
+
.ProseMirror .caption-description, .ProseMirror .caption-description[element-label] > p:first-child {
|
|
329
342
|
display: inline;
|
|
330
343
|
}
|
|
331
344
|
|
|
332
|
-
.ProseMirror .caption-description
|
|
345
|
+
.ProseMirror .caption-description, .ProseMirror .caption-title, .ProseMirror .element-label {
|
|
346
|
+
font-size: 14px;
|
|
347
|
+
outline: none;
|
|
333
348
|
margin: 0;
|
|
334
349
|
}
|
|
335
350
|
|
|
336
|
-
.ProseMirror .
|
|
337
|
-
margin
|
|
351
|
+
.ProseMirror .caption-description > p {
|
|
352
|
+
margin: 0;
|
|
338
353
|
}
|
|
339
354
|
|
|
340
355
|
.ProseMirror .block-equation_element .element-label {
|
|
@@ -342,23 +357,33 @@
|
|
|
342
357
|
text-align: center;
|
|
343
358
|
}
|
|
344
359
|
|
|
345
|
-
.ProseMirror .caption-title.
|
|
346
|
-
content: '
|
|
347
|
-
color: #000;
|
|
348
|
-
cursor: text;
|
|
360
|
+
.ProseMirror .block-table_element .caption-title .placeholder-text::before {
|
|
361
|
+
content: 'Table title';
|
|
349
362
|
}
|
|
350
363
|
|
|
351
|
-
.ProseMirror .caption-
|
|
352
|
-
|
|
353
|
-
color: #
|
|
354
|
-
|
|
364
|
+
.ProseMirror .supplement-item .caption-title .placeholder-text::before,
|
|
365
|
+
.ProseMirror .supplement-item .caption-description .placeholder-text::before {
|
|
366
|
+
color: #c9c9c9;
|
|
367
|
+
font-style: italic;
|
|
355
368
|
}
|
|
356
369
|
|
|
357
|
-
.ProseMirror .
|
|
358
|
-
content: '
|
|
370
|
+
.ProseMirror .supplement-item .caption-title .placeholder-text::before {
|
|
371
|
+
content: 'Insert caption title...';
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.ProseMirror .supplement-item .caption-description .placeholder-text::before {
|
|
375
|
+
content: 'Insert caption...';
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.ProseMirror .supplement-item .caption-description > p {
|
|
379
|
+
text-align: start;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.ProseMirror .box-element > .caption-title {
|
|
383
|
+
margin: 0 52px;
|
|
359
384
|
}
|
|
360
385
|
|
|
361
|
-
.ProseMirror .box-element > .caption-title.
|
|
386
|
+
.ProseMirror .box-element > .caption-title .placeholder-text::before {
|
|
362
387
|
color: #999;
|
|
363
388
|
font-style: italic;
|
|
364
389
|
}
|
|
@@ -1205,22 +1230,6 @@
|
|
|
1205
1230
|
border-bottom: none;
|
|
1206
1231
|
}
|
|
1207
1232
|
|
|
1208
|
-
.ProseMirror .supplement-item .caption-title.empty-node::before {
|
|
1209
|
-
content: 'Insert caption title...';
|
|
1210
|
-
color: #c9c9c9;
|
|
1211
|
-
font-style: italic;
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
.ProseMirror .supplement-item .caption-description > p.empty-node::before {
|
|
1215
|
-
content: 'Insert caption...';
|
|
1216
|
-
color: #c9c9c9;
|
|
1217
|
-
font-style: italic;
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
.ProseMirror .supplement-item .caption-description > p {
|
|
1221
|
-
text-align: start;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
1233
|
.ProseMirror .supplement-file-info {
|
|
1225
1234
|
display: flex;
|
|
1226
1235
|
align-items: center;
|