@manuscripts/body-editor 1.9.3 → 1.9.4-LEAN-2746.0
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
CHANGED
|
@@ -59,7 +59,10 @@ const blockActive = (type) => (state) => {
|
|
|
59
59
|
};
|
|
60
60
|
exports.blockActive = blockActive;
|
|
61
61
|
const canInsert = (type) => (state) => {
|
|
62
|
-
const { $from } = state.selection;
|
|
62
|
+
const { $from, $to } = state.selection;
|
|
63
|
+
if ($from.node().type === transform_1.schema.nodes.title && $from.pos === $to.pos) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
63
66
|
for (let d = $from.depth; d >= 0; d--) {
|
|
64
67
|
const index = $from.index(d);
|
|
65
68
|
if ($from.node(d).canReplaceWith(index, index, type)) {
|
|
@@ -698,10 +701,13 @@ const addBlockComment = (node, state, dispatch) => {
|
|
|
698
701
|
[highlight_1.SET_COMMENT]: comment,
|
|
699
702
|
});
|
|
700
703
|
tr.setMeta('addToHistory', false);
|
|
701
|
-
if (
|
|
702
|
-
dispatch(tr);
|
|
704
|
+
if (isAllowedType(type)) {
|
|
705
|
+
dispatch && dispatch(tr);
|
|
706
|
+
return true;
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
return false;
|
|
703
710
|
}
|
|
704
|
-
return true;
|
|
705
711
|
};
|
|
706
712
|
const addHighlightComment = (node, state, dispatch) => {
|
|
707
713
|
const { attrs: { id }, type, } = node;
|
|
@@ -53,11 +53,17 @@ exports.default = (props) => {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
const hasCommentChange = !!tr.steps.find((s) => {
|
|
56
|
-
var _a, _b;
|
|
56
|
+
var _a, _b, _c, _d;
|
|
57
57
|
if (s instanceof prosemirror_transform_1.ReplaceStep) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
if (s.slice.size > 0) {
|
|
59
|
+
return (((_a = newState.doc.nodeAt(s.from + 1)) === null || _a === void 0 ? void 0 : _a.type) ===
|
|
60
|
+
transform_1.schema.nodes.comment ||
|
|
61
|
+
((_b = newState.doc.nodeAt(s.from)) === null || _b === void 0 ? void 0 : _b.type) ===
|
|
62
|
+
transform_1.schema.nodes.highlight_marker);
|
|
63
|
+
}
|
|
64
|
+
return (((_c = oldState.doc.nodeAt(s.from)) === null || _c === void 0 ? void 0 : _c.type) === transform_1.schema.nodes.comment ||
|
|
65
|
+
((_d = oldState.doc.nodeAt(s.from)) === null || _d === void 0 ? void 0 : _d.type) ===
|
|
66
|
+
transform_1.schema.nodes.highlight_marker);
|
|
61
67
|
}
|
|
62
68
|
});
|
|
63
69
|
if (hasCommentChange) {
|
package/dist/es/commands.js
CHANGED
|
@@ -53,7 +53,10 @@ export const blockActive = (type) => (state) => {
|
|
|
53
53
|
return false;
|
|
54
54
|
};
|
|
55
55
|
export const canInsert = (type) => (state) => {
|
|
56
|
-
const { $from } = state.selection;
|
|
56
|
+
const { $from, $to } = state.selection;
|
|
57
|
+
if ($from.node().type === schema.nodes.title && $from.pos === $to.pos) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
57
60
|
for (let d = $from.depth; d >= 0; d--) {
|
|
58
61
|
const index = $from.index(d);
|
|
59
62
|
if ($from.node(d).canReplaceWith(index, index, type)) {
|
|
@@ -662,10 +665,13 @@ const addBlockComment = (node, state, dispatch) => {
|
|
|
662
665
|
[SET_COMMENT]: comment,
|
|
663
666
|
});
|
|
664
667
|
tr.setMeta('addToHistory', false);
|
|
665
|
-
if (
|
|
666
|
-
dispatch(tr);
|
|
668
|
+
if (isAllowedType(type)) {
|
|
669
|
+
dispatch && dispatch(tr);
|
|
670
|
+
return true;
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
return false;
|
|
667
674
|
}
|
|
668
|
-
return true;
|
|
669
675
|
};
|
|
670
676
|
const addHighlightComment = (node, state, dispatch) => {
|
|
671
677
|
const { attrs: { id }, type, } = node;
|
|
@@ -47,11 +47,17 @@ export default (props) => {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
const hasCommentChange = !!tr.steps.find((s) => {
|
|
50
|
-
var _a, _b;
|
|
50
|
+
var _a, _b, _c, _d;
|
|
51
51
|
if (s instanceof ReplaceStep) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
if (s.slice.size > 0) {
|
|
53
|
+
return (((_a = newState.doc.nodeAt(s.from + 1)) === null || _a === void 0 ? void 0 : _a.type) ===
|
|
54
|
+
schema.nodes.comment ||
|
|
55
|
+
((_b = newState.doc.nodeAt(s.from)) === null || _b === void 0 ? void 0 : _b.type) ===
|
|
56
|
+
schema.nodes.highlight_marker);
|
|
57
|
+
}
|
|
58
|
+
return (((_c = oldState.doc.nodeAt(s.from)) === null || _c === void 0 ? void 0 : _c.type) === schema.nodes.comment ||
|
|
59
|
+
((_d = oldState.doc.nodeAt(s.from)) === null || _d === void 0 ? void 0 : _d.type) ===
|
|
60
|
+
schema.nodes.highlight_marker);
|
|
55
61
|
}
|
|
56
62
|
});
|
|
57
63
|
if (hasCommentChange) {
|
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": "1.9.
|
|
4
|
+
"version": "1.9.4-LEAN-2746.0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"@manuscripts/assets": "^0.6.4",
|
|
32
32
|
"@manuscripts/json-schema": "^2.2.7",
|
|
33
33
|
"@manuscripts/library": "^1.3.6",
|
|
34
|
-
"@manuscripts/style-guide": "1.12.
|
|
34
|
+
"@manuscripts/style-guide": "1.12.3-LEAN-2746.0",
|
|
35
35
|
"@manuscripts/track-changes-plugin": "1.7.10",
|
|
36
|
-
"@manuscripts/transform": "2.3.
|
|
36
|
+
"@manuscripts/transform": "2.3.3-LEAN-2746.0",
|
|
37
37
|
"astrocite-eutils": "^0.16.4",
|
|
38
38
|
"mathjax-full": "^3.2.2",
|
|
39
39
|
"codemirror": "^5.58.1",
|