@manuscripts/body-editor 3.2.19 → 3.2.22
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 +13 -7
- package/dist/cjs/menus.js +2 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/es/commands.js +13 -7
- package/dist/es/menus.js +2 -1
- package/dist/es/versions.js +1 -1
- package/dist/types/versions.d.ts +1 -1
- package/package.json +2 -2
package/dist/cjs/commands.js
CHANGED
|
@@ -112,6 +112,11 @@ const canInsert = (type) => (state) => {
|
|
|
112
112
|
return false;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
+
if (type === transform_1.schema.nodes.box_element &&
|
|
116
|
+
(!(0, prosemirror_utils_1.hasParentNodeOfType)(transform_1.schema.nodes.body)(state.selection) ||
|
|
117
|
+
(0, prosemirror_utils_1.hasParentNodeOfType)(transform_1.schema.nodes.box_element)(state.selection))) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
115
120
|
const initDepth = (0, prosemirror_utils_1.findParentNodeOfType)(transform_1.schema.nodes.box_element)(state.selection)?.depth ||
|
|
116
121
|
0;
|
|
117
122
|
for (let d = $from.depth; d >= initDepth; d--) {
|
|
@@ -540,19 +545,20 @@ const reinstateNode = (tr, node, pos) => {
|
|
|
540
545
|
};
|
|
541
546
|
const insertBoxElement = (state, dispatch) => {
|
|
542
547
|
const selection = state.selection;
|
|
543
|
-
const
|
|
544
|
-
const
|
|
548
|
+
const { nodes } = transform_1.schema;
|
|
549
|
+
const isBody = (0, prosemirror_utils_1.hasParentNodeOfType)(nodes.body)(selection);
|
|
550
|
+
const isBoxText = (0, prosemirror_utils_1.hasParentNodeOfType)(nodes.box_element)(selection);
|
|
545
551
|
if (!isBody || isBoxText) {
|
|
546
552
|
return false;
|
|
547
553
|
}
|
|
548
554
|
const position = findBlockInsertPosition(state);
|
|
549
|
-
const paragraph =
|
|
550
|
-
const section =
|
|
551
|
-
|
|
555
|
+
const paragraph = nodes.paragraph.create({});
|
|
556
|
+
const section = nodes.section.createAndFill({}, [
|
|
557
|
+
nodes.section_title.create(),
|
|
552
558
|
paragraph,
|
|
553
559
|
]);
|
|
554
|
-
const node =
|
|
555
|
-
|
|
560
|
+
const node = nodes.box_element.createAndFill({}, [
|
|
561
|
+
nodes.figcaption.create({}, [nodes.caption_title.create()]),
|
|
556
562
|
section,
|
|
557
563
|
]);
|
|
558
564
|
if (position && dispatch) {
|
package/dist/cjs/menus.js
CHANGED
|
@@ -216,7 +216,8 @@ const getEditorMenus = (editor) => {
|
|
|
216
216
|
mac: 'Option+CommandOrControl+B',
|
|
217
217
|
pc: 'CommandOrControl+Option+B',
|
|
218
218
|
},
|
|
219
|
-
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
219
|
+
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
220
|
+
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.box_element)),
|
|
220
221
|
run: doCommand(commands_1.insertBoxElement),
|
|
221
222
|
},
|
|
222
223
|
{
|
package/dist/cjs/versions.js
CHANGED
package/dist/es/commands.js
CHANGED
|
@@ -104,6 +104,11 @@ export const canInsert = (type) => (state) => {
|
|
|
104
104
|
return false;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
if (type === schema.nodes.box_element &&
|
|
108
|
+
(!hasParentNodeOfType(schema.nodes.body)(state.selection) ||
|
|
109
|
+
hasParentNodeOfType(schema.nodes.box_element)(state.selection))) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
107
112
|
const initDepth = findParentNodeOfType(schema.nodes.box_element)(state.selection)?.depth ||
|
|
108
113
|
0;
|
|
109
114
|
for (let d = $from.depth; d >= initDepth; d--) {
|
|
@@ -510,19 +515,20 @@ const reinstateNode = (tr, node, pos) => {
|
|
|
510
515
|
};
|
|
511
516
|
export const insertBoxElement = (state, dispatch) => {
|
|
512
517
|
const selection = state.selection;
|
|
513
|
-
const
|
|
514
|
-
const
|
|
518
|
+
const { nodes } = schema;
|
|
519
|
+
const isBody = hasParentNodeOfType(nodes.body)(selection);
|
|
520
|
+
const isBoxText = hasParentNodeOfType(nodes.box_element)(selection);
|
|
515
521
|
if (!isBody || isBoxText) {
|
|
516
522
|
return false;
|
|
517
523
|
}
|
|
518
524
|
const position = findBlockInsertPosition(state);
|
|
519
|
-
const paragraph =
|
|
520
|
-
const section =
|
|
521
|
-
|
|
525
|
+
const paragraph = nodes.paragraph.create({});
|
|
526
|
+
const section = nodes.section.createAndFill({}, [
|
|
527
|
+
nodes.section_title.create(),
|
|
522
528
|
paragraph,
|
|
523
529
|
]);
|
|
524
|
-
const node =
|
|
525
|
-
|
|
530
|
+
const node = nodes.box_element.createAndFill({}, [
|
|
531
|
+
nodes.figcaption.create({}, [nodes.caption_title.create()]),
|
|
526
532
|
section,
|
|
527
533
|
]);
|
|
528
534
|
if (position && dispatch) {
|
package/dist/es/menus.js
CHANGED
|
@@ -213,7 +213,8 @@ export const getEditorMenus = (editor) => {
|
|
|
213
213
|
mac: 'Option+CommandOrControl+B',
|
|
214
214
|
pc: 'CommandOrControl+Option+B',
|
|
215
215
|
},
|
|
216
|
-
isEnabled: isEditAllowed(state) &&
|
|
216
|
+
isEnabled: isEditAllowed(state) &&
|
|
217
|
+
isCommandValid(canInsert(schema.nodes.box_element)),
|
|
217
218
|
run: doCommand(insertBoxElement),
|
|
218
219
|
},
|
|
219
220
|
{
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.2.
|
|
1
|
+
export const VERSION = '3.2.22';
|
|
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.2.
|
|
1
|
+
export declare const VERSION = "3.2.22";
|
|
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.2.
|
|
4
|
+
"version": "3.2.22",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@manuscripts/json-schema": "2.2.12",
|
|
41
41
|
"@manuscripts/style-guide": "3.1.5",
|
|
42
42
|
"@manuscripts/track-changes-plugin": "2.0.3",
|
|
43
|
-
"@manuscripts/transform": "4.2.
|
|
43
|
+
"@manuscripts/transform": "4.2.6",
|
|
44
44
|
"@popperjs/core": "2.11.8",
|
|
45
45
|
"citeproc": "2.4.63",
|
|
46
46
|
"codemirror": "5.65.19",
|