@manuscripts/body-editor 1.9.6 → 1.9.7
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 +10 -4
- package/dist/es/commands.js +10 -4
- package/package.json +3 -3
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)) {
|
|
@@ -708,10 +711,13 @@ const addBlockComment = (node, state, dispatch) => {
|
|
|
708
711
|
[highlight_1.SET_COMMENT]: comment,
|
|
709
712
|
});
|
|
710
713
|
tr.setMeta('addToHistory', false);
|
|
711
|
-
if (
|
|
712
|
-
dispatch(tr);
|
|
714
|
+
if (isAllowedType(type)) {
|
|
715
|
+
dispatch && dispatch(tr);
|
|
716
|
+
return true;
|
|
717
|
+
}
|
|
718
|
+
else {
|
|
719
|
+
return false;
|
|
713
720
|
}
|
|
714
|
-
return true;
|
|
715
721
|
};
|
|
716
722
|
const addHighlightComment = (node, state, dispatch) => {
|
|
717
723
|
const { attrs: { id }, type, } = node;
|
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)) {
|
|
@@ -671,10 +674,13 @@ const addBlockComment = (node, state, dispatch) => {
|
|
|
671
674
|
[SET_COMMENT]: comment,
|
|
672
675
|
});
|
|
673
676
|
tr.setMeta('addToHistory', false);
|
|
674
|
-
if (
|
|
675
|
-
dispatch(tr);
|
|
677
|
+
if (isAllowedType(type)) {
|
|
678
|
+
dispatch && dispatch(tr);
|
|
679
|
+
return true;
|
|
680
|
+
}
|
|
681
|
+
else {
|
|
682
|
+
return false;
|
|
676
683
|
}
|
|
677
|
-
return true;
|
|
678
684
|
};
|
|
679
685
|
const addHighlightComment = (node, state, dispatch) => {
|
|
680
686
|
const { attrs: { id }, type, } = node;
|
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.7",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
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.4",
|
|
35
35
|
"@manuscripts/track-changes-plugin": "1.7.10",
|
|
36
36
|
"@manuscripts/transform": "2.3.3",
|
|
37
37
|
"astrocite-eutils": "^0.16.4",
|
|
@@ -111,4 +111,4 @@
|
|
|
111
111
|
"@types/react": "^17.0.2",
|
|
112
112
|
"prosemirror-tables": "^1.3.5"
|
|
113
113
|
}
|
|
114
|
-
}
|
|
114
|
+
}
|