@manuscripts/body-editor 2.6.9-LEAN-4149.0 → 2.6.9
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.
|
@@ -48,6 +48,16 @@ const getSelectedCellsCount = (state) => {
|
|
|
48
48
|
columns: columns > 1 ? `${columns} columns` : `column`,
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
+
const isHeaderCellSelected = (state) => {
|
|
52
|
+
var _a;
|
|
53
|
+
if (state.selection instanceof prosemirror_tables_1.CellSelection) {
|
|
54
|
+
const anchorNode = state.selection.$anchorCell.node(state.selection.$anchorCell.depth).firstChild;
|
|
55
|
+
const headNode = state.selection.$headCell.node(state.selection.$headCell.depth).firstChild;
|
|
56
|
+
return ((anchorNode === null || anchorNode === void 0 ? void 0 : anchorNode.type) === transform_1.schema.nodes.table_header ||
|
|
57
|
+
(headNode === null || headNode === void 0 ? void 0 : headNode.type) === transform_1.schema.nodes.table_header);
|
|
58
|
+
}
|
|
59
|
+
return (((_a = state.doc.nodeAt(state.selection.from)) === null || _a === void 0 ? void 0 : _a.type) === transform_1.schema.nodes.table_header);
|
|
60
|
+
};
|
|
51
61
|
const ColumnChangeWarningDialog = ({ isOpen, primaryAction, secondaryAction }) => (react_1.default.createElement(style_guide_1.Dialog, { isOpen: isOpen, category: style_guide_1.Category.confirmation, header: "This change can't be tracked", message: "This column action won't be marked as chnage. Do you want to continue?", actions: {
|
|
52
62
|
primary: {
|
|
53
63
|
action: primaryAction,
|
|
@@ -59,19 +69,16 @@ const ColumnChangeWarningDialog = ({ isOpen, primaryAction, secondaryAction }) =
|
|
|
59
69
|
},
|
|
60
70
|
} }));
|
|
61
71
|
const ContextMenu = ({ view, close, onCancelColumnDialog }) => {
|
|
62
|
-
var _a;
|
|
63
72
|
const runCommand = (command, noTracking) => {
|
|
64
73
|
command(view.state, (tr) => view.dispatch((noTracking && (0, track_changes_plugin_1.skipTracking)(tr)) || tr));
|
|
65
74
|
close();
|
|
66
75
|
};
|
|
67
76
|
const [columnAction, setColumnAction] = (0, react_1.useState)();
|
|
68
|
-
const isHeaderCellSelected = ((_a = view.state.doc.nodeAt(view.state.selection.from)) === null || _a === void 0 ? void 0 : _a.type) ===
|
|
69
|
-
transform_1.schema.nodes.table_header;
|
|
70
77
|
const isCellSelectionMerged = (0, prosemirror_tables_1.mergeCells)(view.state);
|
|
71
78
|
const isCellSelectionSplittable = (0, prosemirror_tables_1.splitCell)(view.state);
|
|
72
79
|
const { rows, columns } = getSelectedCellsCount(view.state);
|
|
73
80
|
return (react_1.default.createElement(MenuDropdownList, { className: 'table-ctx' },
|
|
74
|
-
react_1.default.createElement(ActionButton, { disabled: isHeaderCellSelected, onClick: () => runCommand((0, commands_1.addRows)('top')) },
|
|
81
|
+
react_1.default.createElement(ActionButton, { disabled: isHeaderCellSelected(view.state), onClick: () => runCommand((0, commands_1.addRows)('top')) },
|
|
75
82
|
react_1.default.createElement(style_guide_1.PlusIcon, null),
|
|
76
83
|
" Insert ",
|
|
77
84
|
rows,
|
package/dist/cjs/versions.js
CHANGED
|
@@ -19,6 +19,16 @@ const getSelectedCellsCount = (state) => {
|
|
|
19
19
|
columns: columns > 1 ? `${columns} columns` : `column`,
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
+
const isHeaderCellSelected = (state) => {
|
|
23
|
+
var _a;
|
|
24
|
+
if (state.selection instanceof CellSelection) {
|
|
25
|
+
const anchorNode = state.selection.$anchorCell.node(state.selection.$anchorCell.depth).firstChild;
|
|
26
|
+
const headNode = state.selection.$headCell.node(state.selection.$headCell.depth).firstChild;
|
|
27
|
+
return ((anchorNode === null || anchorNode === void 0 ? void 0 : anchorNode.type) === schema.nodes.table_header ||
|
|
28
|
+
(headNode === null || headNode === void 0 ? void 0 : headNode.type) === schema.nodes.table_header);
|
|
29
|
+
}
|
|
30
|
+
return (((_a = state.doc.nodeAt(state.selection.from)) === null || _a === void 0 ? void 0 : _a.type) === schema.nodes.table_header);
|
|
31
|
+
};
|
|
22
32
|
const ColumnChangeWarningDialog = ({ isOpen, primaryAction, secondaryAction }) => (React.createElement(Dialog, { isOpen: isOpen, category: Category.confirmation, header: "This change can't be tracked", message: "This column action won't be marked as chnage. Do you want to continue?", actions: {
|
|
23
33
|
primary: {
|
|
24
34
|
action: primaryAction,
|
|
@@ -30,19 +40,16 @@ const ColumnChangeWarningDialog = ({ isOpen, primaryAction, secondaryAction }) =
|
|
|
30
40
|
},
|
|
31
41
|
} }));
|
|
32
42
|
export const ContextMenu = ({ view, close, onCancelColumnDialog }) => {
|
|
33
|
-
var _a;
|
|
34
43
|
const runCommand = (command, noTracking) => {
|
|
35
44
|
command(view.state, (tr) => view.dispatch((noTracking && skipTracking(tr)) || tr));
|
|
36
45
|
close();
|
|
37
46
|
};
|
|
38
47
|
const [columnAction, setColumnAction] = useState();
|
|
39
|
-
const isHeaderCellSelected = ((_a = view.state.doc.nodeAt(view.state.selection.from)) === null || _a === void 0 ? void 0 : _a.type) ===
|
|
40
|
-
schema.nodes.table_header;
|
|
41
48
|
const isCellSelectionMerged = mergeCells(view.state);
|
|
42
49
|
const isCellSelectionSplittable = splitCell(view.state);
|
|
43
50
|
const { rows, columns } = getSelectedCellsCount(view.state);
|
|
44
51
|
return (React.createElement(MenuDropdownList, { className: 'table-ctx' },
|
|
45
|
-
React.createElement(ActionButton, { disabled: isHeaderCellSelected, onClick: () => runCommand(addRows('top')) },
|
|
52
|
+
React.createElement(ActionButton, { disabled: isHeaderCellSelected(view.state), onClick: () => runCommand(addRows('top')) },
|
|
46
53
|
React.createElement(PlusIcon, null),
|
|
47
54
|
" Insert ",
|
|
48
55
|
rows,
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.6.9
|
|
1
|
+
export const VERSION = '2.6.9';
|
|
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 = "2.6.9
|
|
1
|
+
export declare const VERSION = "2.6.9";
|
|
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.6.9
|
|
4
|
+
"version": "2.6.9",
|
|
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.23",
|
|
36
36
|
"@manuscripts/track-changes-plugin": "1.8.1",
|
|
37
|
-
"@manuscripts/transform": "3.0.
|
|
37
|
+
"@manuscripts/transform": "3.0.14",
|
|
38
38
|
"@popperjs/core": "^2.11.8",
|
|
39
39
|
"astrocite-eutils": "^0.16.4",
|
|
40
40
|
"codemirror": "^5.58.1",
|