@manuscripts/body-editor 2.2.20 → 2.2.21
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 +3 -1
- package/dist/cjs/lib/context-menu.js +3 -1
- package/dist/cjs/lib/section-categories.js +5 -1
- package/dist/cjs/plugins/section-category/section-category-utils.js +2 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/es/commands.js +3 -1
- package/dist/es/lib/context-menu.js +3 -1
- package/dist/es/lib/section-categories.js +3 -0
- package/dist/es/plugins/section-category/section-category-utils.js +3 -2
- package/dist/es/versions.js +1 -1
- package/dist/types/lib/section-categories.d.ts +1 -0
- package/dist/types/versions.d.ts +1 -1
- package/package.json +3 -3
package/dist/cjs/commands.js
CHANGED
|
@@ -525,7 +525,9 @@ const insertSection = (subsection = false) => (state, dispatch, view) => {
|
|
|
525
525
|
if (!pos) {
|
|
526
526
|
return false;
|
|
527
527
|
}
|
|
528
|
-
const section = transform_1.schema.nodes.section.createAndFill(
|
|
528
|
+
const section = transform_1.schema.nodes.section.createAndFill({
|
|
529
|
+
category: subsection ? 'MPSectionCategory:subsection' : '',
|
|
530
|
+
});
|
|
529
531
|
const diff = subsection ? -1 : 0;
|
|
530
532
|
const tr = state.tr.insert(pos + diff, section);
|
|
531
533
|
if (dispatch) {
|
|
@@ -88,7 +88,9 @@ class ContextMenu {
|
|
|
88
88
|
const level = (0, exports.sectionLevel)($pos.depth);
|
|
89
89
|
const label = `New ${level} to ${itemTitle}`;
|
|
90
90
|
section.appendChild(this.createMenuItem(label, () => {
|
|
91
|
-
insertNode(transform_1.schema.nodes.section, insPos
|
|
91
|
+
insertNode(transform_1.schema.nodes.section, insPos, {
|
|
92
|
+
category: 'MPSectionCategory:subsection',
|
|
93
|
+
});
|
|
92
94
|
popper.destroy();
|
|
93
95
|
}));
|
|
94
96
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.getCategoryName = exports.isBackMatterSection = exports.isUnique = exports.isEditableSectionCategoryID = exports.uniqueSectionCategories = exports.uneditableSectionCategories = void 0;
|
|
18
|
+
exports.getCategoryName = exports.isSubSection = exports.isBackMatterSection = exports.isUnique = exports.isEditableSectionCategoryID = exports.uniqueSectionCategories = exports.uneditableSectionCategories = void 0;
|
|
19
19
|
exports.uneditableSectionCategories = [
|
|
20
20
|
'MPSectionCategory:bibliography',
|
|
21
21
|
'MPSectionCategory:keywords',
|
|
@@ -37,6 +37,10 @@ const isBackMatterSection = (groupId) => {
|
|
|
37
37
|
return groupId === 'MPSectionCategory:backmatter';
|
|
38
38
|
};
|
|
39
39
|
exports.isBackMatterSection = isBackMatterSection;
|
|
40
|
+
const isSubSection = (categoryId) => {
|
|
41
|
+
return categoryId === 'MPSectionCategory:subsection';
|
|
42
|
+
};
|
|
43
|
+
exports.isSubSection = isSubSection;
|
|
40
44
|
const getCategoryName = (categories, id) => {
|
|
41
45
|
const category = categories.find((item) => item._id === id);
|
|
42
46
|
return category ? category.name : '';
|
|
@@ -83,7 +83,8 @@ function buildPluginState(state, props) {
|
|
|
83
83
|
if ((0, transform_1.isSectionNode)(node)) {
|
|
84
84
|
const attrs = node.attrs;
|
|
85
85
|
if ((0, section_categories_1.isEditableSectionCategoryID)(attrs.category) &&
|
|
86
|
-
!(0, section_categories_1.isUnique)(attrs.category)
|
|
86
|
+
!(0, section_categories_1.isUnique)(attrs.category) &&
|
|
87
|
+
!(0, section_categories_1.isSubSection)(attrs.category)) {
|
|
87
88
|
decorations.push(prosemirror_view_1.Decoration.widget(pos + 1, (view) => createButton(view, props, node, pos, attrs.category, can === null || can === void 0 ? void 0 : can.editArticle)));
|
|
88
89
|
}
|
|
89
90
|
}
|
package/dist/cjs/versions.js
CHANGED
package/dist/es/commands.js
CHANGED
|
@@ -497,7 +497,9 @@ export const insertSection = (subsection = false) => (state, dispatch, view) =>
|
|
|
497
497
|
if (!pos) {
|
|
498
498
|
return false;
|
|
499
499
|
}
|
|
500
|
-
const section = schema.nodes.section.createAndFill(
|
|
500
|
+
const section = schema.nodes.section.createAndFill({
|
|
501
|
+
category: subsection ? 'MPSectionCategory:subsection' : '',
|
|
502
|
+
});
|
|
501
503
|
const diff = subsection ? -1 : 0;
|
|
502
504
|
const tr = state.tr.insert(pos + diff, section);
|
|
503
505
|
if (dispatch) {
|
|
@@ -81,7 +81,9 @@ export class ContextMenu {
|
|
|
81
81
|
const level = sectionLevel($pos.depth);
|
|
82
82
|
const label = `New ${level} to ${itemTitle}`;
|
|
83
83
|
section.appendChild(this.createMenuItem(label, () => {
|
|
84
|
-
insertNode(schema.nodes.section, insPos
|
|
84
|
+
insertNode(schema.nodes.section, insPos, {
|
|
85
|
+
category: 'MPSectionCategory:subsection',
|
|
86
|
+
});
|
|
85
87
|
popper.destroy();
|
|
86
88
|
}));
|
|
87
89
|
}
|
|
@@ -31,6 +31,9 @@ export const isUnique = (categoryId) => {
|
|
|
31
31
|
export const isBackMatterSection = (groupId) => {
|
|
32
32
|
return groupId === 'MPSectionCategory:backmatter';
|
|
33
33
|
};
|
|
34
|
+
export const isSubSection = (categoryId) => {
|
|
35
|
+
return categoryId === 'MPSectionCategory:subsection';
|
|
36
|
+
};
|
|
34
37
|
export const getCategoryName = (categories, id) => {
|
|
35
38
|
const category = categories.find((item) => item._id === id);
|
|
36
39
|
return category ? category.name : '';
|
|
@@ -5,7 +5,7 @@ import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
|
5
5
|
import { createElement } from 'react';
|
|
6
6
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
7
7
|
import { PopperManager } from '../../lib/popper';
|
|
8
|
-
import { getCategoryName, isBackMatterSection, isEditableSectionCategoryID, isUnique, } from '../../lib/section-categories';
|
|
8
|
+
import { getCategoryName, isBackMatterSection, isEditableSectionCategoryID, isSubSection, isUnique, } from '../../lib/section-categories';
|
|
9
9
|
import { isChildOfNodeTypes } from '../../lib/utils';
|
|
10
10
|
export const sectionCategoryKey = new PluginKey('section-category');
|
|
11
11
|
const popper = new PopperManager();
|
|
@@ -80,7 +80,8 @@ export function buildPluginState(state, props) {
|
|
|
80
80
|
if (isSectionNode(node)) {
|
|
81
81
|
const attrs = node.attrs;
|
|
82
82
|
if (isEditableSectionCategoryID(attrs.category) &&
|
|
83
|
-
!isUnique(attrs.category)
|
|
83
|
+
!isUnique(attrs.category) &&
|
|
84
|
+
!isSubSection(attrs.category)) {
|
|
84
85
|
decorations.push(Decoration.widget(pos + 1, (view) => createButton(view, props, node, pos, attrs.category, can === null || can === void 0 ? void 0 : can.editArticle)));
|
|
85
86
|
}
|
|
86
87
|
}
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.2.
|
|
1
|
+
export const VERSION = '2.2.21';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -19,4 +19,5 @@ export declare const uniqueSectionCategories: string[];
|
|
|
19
19
|
export declare const isEditableSectionCategoryID: (id: string) => boolean;
|
|
20
20
|
export declare const isUnique: (categoryId: string) => boolean;
|
|
21
21
|
export declare const isBackMatterSection: (groupId: string) => boolean;
|
|
22
|
+
export declare const isSubSection: (categoryId: string) => boolean;
|
|
22
23
|
export declare const getCategoryName: (categories: SectionCategory[], id: string) => string;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.2.
|
|
1
|
+
export declare const VERSION = "2.2.21";
|
|
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": "2.2.
|
|
4
|
+
"version": "2.2.21",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@manuscripts/library": "1.3.11",
|
|
35
35
|
"@manuscripts/style-guide": "2.0.21",
|
|
36
36
|
"@manuscripts/track-changes-plugin": "1.7.23",
|
|
37
|
-
"@manuscripts/transform": "3.0.
|
|
37
|
+
"@manuscripts/transform": "3.0.6",
|
|
38
38
|
"@popperjs/core": "^2.11.8",
|
|
39
39
|
"astrocite-eutils": "^0.16.4",
|
|
40
40
|
"codemirror": "^5.58.1",
|
|
@@ -116,4 +116,4 @@
|
|
|
116
116
|
"engines": {
|
|
117
117
|
"node": ">=20.16.0"
|
|
118
118
|
}
|
|
119
|
-
}
|
|
119
|
+
}
|