@manuscripts/body-editor 2.2.14 → 2.2.15
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.
|
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.ContextMenu = void 0;
|
|
30
30
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
31
31
|
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
32
|
+
const transform_1 = require("@manuscripts/transform");
|
|
32
33
|
const prosemirror_tables_1 = require("prosemirror-tables");
|
|
33
34
|
const react_1 = __importStar(require("react"));
|
|
34
35
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
@@ -58,16 +59,19 @@ const ColumnChangeWarningDialog = ({ isOpen, primaryAction, secondaryAction }) =
|
|
|
58
59
|
},
|
|
59
60
|
} }));
|
|
60
61
|
const ContextMenu = ({ view, close, onCancelColumnDialog }) => {
|
|
62
|
+
var _a;
|
|
61
63
|
const runCommand = (command, noTracking) => {
|
|
62
64
|
command(view.state, (tr) => view.dispatch((noTracking && (0, track_changes_plugin_1.skipTracking)(tr)) || tr));
|
|
63
65
|
close();
|
|
64
66
|
};
|
|
65
67
|
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;
|
|
66
70
|
const isCellSelectionMerged = (0, prosemirror_tables_1.mergeCells)(view.state);
|
|
67
71
|
const isCellSelectionSplittable = (0, prosemirror_tables_1.splitCell)(view.state);
|
|
68
72
|
const { rows, columns } = getSelectedCellsCount(view.state);
|
|
69
73
|
return (react_1.default.createElement(MenuDropdownList, { className: 'table-ctx' },
|
|
70
|
-
react_1.default.createElement(ActionButton, { onClick: () => runCommand((0, commands_1.addRows)('top')) },
|
|
74
|
+
react_1.default.createElement(ActionButton, { disabled: isHeaderCellSelected, onClick: () => runCommand((0, commands_1.addRows)('top')) },
|
|
71
75
|
react_1.default.createElement(style_guide_1.PlusIcon, null),
|
|
72
76
|
" Insert ",
|
|
73
77
|
rows,
|
package/dist/cjs/versions.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Category, DeleteIcon, Dialog, IconTextButton, PlusIcon, } from '@manuscripts/style-guide';
|
|
2
2
|
import { skipTracking } from '@manuscripts/track-changes-plugin';
|
|
3
|
+
import { schema } from '@manuscripts/transform';
|
|
3
4
|
import { CellSelection, deleteColumn, deleteRow, mergeCells, selectedRect, splitCell, } from 'prosemirror-tables';
|
|
4
5
|
import React, { useState } from 'react';
|
|
5
6
|
import styled from 'styled-components';
|
|
@@ -29,16 +30,19 @@ const ColumnChangeWarningDialog = ({ isOpen, primaryAction, secondaryAction }) =
|
|
|
29
30
|
},
|
|
30
31
|
} }));
|
|
31
32
|
export const ContextMenu = ({ view, close, onCancelColumnDialog }) => {
|
|
33
|
+
var _a;
|
|
32
34
|
const runCommand = (command, noTracking) => {
|
|
33
35
|
command(view.state, (tr) => view.dispatch((noTracking && skipTracking(tr)) || tr));
|
|
34
36
|
close();
|
|
35
37
|
};
|
|
36
38
|
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;
|
|
37
41
|
const isCellSelectionMerged = mergeCells(view.state);
|
|
38
42
|
const isCellSelectionSplittable = splitCell(view.state);
|
|
39
43
|
const { rows, columns } = getSelectedCellsCount(view.state);
|
|
40
44
|
return (React.createElement(MenuDropdownList, { className: 'table-ctx' },
|
|
41
|
-
React.createElement(ActionButton, { onClick: () => runCommand(addRows('top')) },
|
|
45
|
+
React.createElement(ActionButton, { disabled: isHeaderCellSelected, onClick: () => runCommand(addRows('top')) },
|
|
42
46
|
React.createElement(PlusIcon, null),
|
|
43
47
|
" Insert ",
|
|
44
48
|
rows,
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.2.
|
|
1
|
+
export const VERSION = '2.2.15';
|
|
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.2.
|
|
1
|
+
export declare const VERSION = "2.2.15";
|
|
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.15",
|
|
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.3",
|
|
38
38
|
"@popperjs/core": "^2.11.8",
|
|
39
39
|
"astrocite-eutils": "^0.16.4",
|
|
40
40
|
"codemirror": "^5.58.1",
|