@manuscripts/body-editor 3.18.1 → 3.18.2
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/components/references/CitationEditor.js +8 -34
- package/dist/cjs/components/views/FigureDropdown.js +30 -39
- package/dist/cjs/components/views/FootnotesSelector.js +4 -5
- package/dist/cjs/components/views/LinkForm.js +5 -4
- package/dist/cjs/components/views/TableCellContextMenu.js +15 -15
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/ReactSubView.js +4 -2
- package/dist/es/components/references/CitationEditor.js +9 -35
- package/dist/es/components/views/FigureDropdown.js +31 -40
- package/dist/es/components/views/FootnotesSelector.js +5 -6
- package/dist/es/components/views/LinkForm.js +6 -5
- package/dist/es/components/views/TableCellContextMenu.js +16 -16
- package/dist/es/versions.js +1 -1
- package/dist/es/views/ReactSubView.js +4 -2
- package/dist/types/versions.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/references/CitationEditor.tsx +14 -42
- package/src/components/views/FigureDropdown.tsx +48 -38
- package/src/components/views/FootnotesSelector.tsx +8 -9
- package/src/components/views/LinkForm.tsx +10 -7
- package/src/components/views/TableCellContextMenu.tsx +24 -10
- package/src/versions.ts +1 -1
- package/src/views/ReactSubView.tsx +13 -10
- package/src/views/cross_reference.ts +1 -1
|
@@ -38,6 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.CitationEditor = void 0;
|
|
40
40
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
41
|
+
const mui_1 = require("@manuscripts/style-guide/mui");
|
|
41
42
|
const transform_1 = require("@manuscripts/transform");
|
|
42
43
|
const react_1 = __importStar(require("react"));
|
|
43
44
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
@@ -52,33 +53,6 @@ const CitedItemActions = styled_components_1.default.div `
|
|
|
52
53
|
display: flex;
|
|
53
54
|
align-items: center;
|
|
54
55
|
margin-left: 12px;
|
|
55
|
-
|
|
56
|
-
svg.remove-icon {
|
|
57
|
-
color: #6e6e6e;
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
const ActionButton = (0, styled_components_1.default)(style_guide_1.IconButton).attrs({
|
|
61
|
-
$size: 24,
|
|
62
|
-
}) `
|
|
63
|
-
&:disabled {
|
|
64
|
-
background-color: transparent !important;
|
|
65
|
-
border-color: transparent !important;
|
|
66
|
-
color: rgb(255, 255, 255);
|
|
67
|
-
path,
|
|
68
|
-
g {
|
|
69
|
-
fill: ${(props) => props.theme.colors.background.tertiary} !important;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
&:not(:disabled):focus,
|
|
73
|
-
&:not(:disabled):hover {
|
|
74
|
-
path,
|
|
75
|
-
g {
|
|
76
|
-
fill: ${(props) => props.theme.colors.brand.medium} !important;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
`;
|
|
80
|
-
const EditReferenceButton = (0, styled_components_1.default)(ActionButton) `
|
|
81
|
-
margin-right: ${(props) => props.theme.grid.unit * 3}px;
|
|
82
56
|
`;
|
|
83
57
|
const Actions = (0, styled_components_1.default)(style_guide_1.ButtonGroup) `
|
|
84
58
|
margin: ${(props) => props.theme.grid.unit * 4}px;
|
|
@@ -182,15 +156,15 @@ const CitationEditor = ({ query, rids: $rids, items: $items, citationCounts, sou
|
|
|
182
156
|
title: 'Cancel',
|
|
183
157
|
},
|
|
184
158
|
} }),
|
|
185
|
-
react_1.default.createElement(CitationViewer_1.CitedItems, null, cited.map((item) => (react_1.default.createElement(CitationViewer_1.CitedItem, { key: item.id },
|
|
159
|
+
react_1.default.createElement(CitationViewer_1.CitedItems, null, cited.map((item) => (react_1.default.createElement(CitationViewer_1.CitedItem, { key: item.id, "data-cy": "cited-item" },
|
|
186
160
|
react_1.default.createElement(ReferenceLine_1.ReferenceLine, { item: item }),
|
|
187
161
|
react_1.default.createElement(CitedItemActions, null,
|
|
188
|
-
react_1.default.createElement(
|
|
189
|
-
react_1.default.createElement(style_guide_1.EditIcon,
|
|
190
|
-
react_1.default.createElement(
|
|
191
|
-
react_1.default.createElement(style_guide_1.DeleteSolidIcon, {
|
|
162
|
+
react_1.default.createElement(mui_1.IconButton, { value: item.id, disabled: !canEdit, onClick: () => setEditingForm({ show: true, item: item }) },
|
|
163
|
+
react_1.default.createElement(style_guide_1.EditIcon, { fill: 'currentColor' })),
|
|
164
|
+
react_1.default.createElement(mui_1.IconButton, { "data-cy": "remove-citation", disabled: !canEdit, onClick: () => setDeleteDialog({ show: true, id: item.id }) },
|
|
165
|
+
react_1.default.createElement(style_guide_1.DeleteSolidIcon, { fill: 'currentColor' }))))))),
|
|
192
166
|
react_1.default.createElement(Actions, null,
|
|
193
|
-
react_1.default.createElement(
|
|
194
|
-
react_1.default.createElement(
|
|
167
|
+
react_1.default.createElement(mui_1.Button, { variant: "secondary", onClick: onCancel }, "Done"),
|
|
168
|
+
react_1.default.createElement(mui_1.Button, { disabled: !canEdit, onClick: () => setSearching(true) }, "Add Citation"))));
|
|
195
169
|
};
|
|
196
170
|
exports.CitationEditor = CitationEditor;
|
|
@@ -38,6 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.FigureOptions = void 0;
|
|
40
40
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
41
|
+
const mui_1 = require("@manuscripts/style-guide/mui");
|
|
41
42
|
const react_1 = __importStar(require("react"));
|
|
42
43
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
43
44
|
const files_1 = require("../../lib/files");
|
|
@@ -138,20 +139,20 @@ const FigureOptions = ({ can, getDoc, getFiles, onDownload, onUpload, onDetach,
|
|
|
138
139
|
} },
|
|
139
140
|
react_1.default.createElement(style_guide_1.DotsIcon, null)),
|
|
140
141
|
isOpen && (react_1.default.createElement(OptionsDropdownList, { "$direction": 'right', "$width": 128, "$top": 5, ref: dropdownRef },
|
|
141
|
-
showReplace && isEmbedMode && (react_1.default.createElement(ListItemButton, { onClick: () => onReplaceEmbed && onReplaceEmbed() }, "Edit Link")),
|
|
142
|
+
showReplace && isEmbedMode && (react_1.default.createElement(ListItemButton, { variant: "tertiary", onClick: () => onReplaceEmbed && onReplaceEmbed() }, "Edit Link")),
|
|
142
143
|
showReplace && !isEmbedMode && (react_1.default.createElement(NestedDropdown, { disabled: !showReplace, parentToggleOpen: toggleOpen, buttonText: replaceBtnText, moveLeft: true, list: react_1.default.createElement(react_1.default.Fragment, null,
|
|
143
|
-
getSupplements(getFiles, getDoc, groupFiles, isEmbed).map((file, index) => (react_1.default.createElement(ListItemButton, { key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file, true) },
|
|
144
|
+
getSupplements(getFiles, getDoc, groupFiles, isEmbed).map((file, index) => (react_1.default.createElement(ListItemButton, { variant: "tertiary", key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file, true) },
|
|
144
145
|
(0, style_guide_1.getFileIcon)(file.name),
|
|
145
146
|
react_1.default.createElement(ListItemText, null, file.name)))),
|
|
146
|
-
getOtherFiles(getFiles, getDoc, groupFiles, isEmbed).map((file, index) => (react_1.default.createElement(ListItemButton, { key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file) },
|
|
147
|
+
getOtherFiles(getFiles, getDoc, groupFiles, isEmbed).map((file, index) => (react_1.default.createElement(ListItemButton, { variant: "tertiary", key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file) },
|
|
147
148
|
(0, style_guide_1.getFileIcon)(file.name),
|
|
148
149
|
react_1.default.createElement(ListItemText, null, file.name)))),
|
|
149
|
-
showUpload && (react_1.default.createElement(UploadButton, { onClick: onUpload, disabled: !showUpload },
|
|
150
|
+
showUpload && (react_1.default.createElement(UploadButton, { variant: "tertiary", onClick: onUpload, disabled: !showUpload },
|
|
150
151
|
react_1.default.createElement(style_guide_1.UploadIcon, null),
|
|
151
152
|
" Upload new..."))) })),
|
|
152
|
-
showDownload && (react_1.default.createElement(ListItemButton, { onClick: onDownload, disabled: !showDownload }, "Download")),
|
|
153
|
-
showDetach && (react_1.default.createElement(ListItemButton, { onClick: onDetach, disabled: !showDetach }, "Detach")),
|
|
154
|
-
showDelete() && (react_1.default.createElement(ListItemButton, { onClick: onDelete }, "Delete"))))));
|
|
153
|
+
showDownload && (react_1.default.createElement(ListItemButton, { variant: "tertiary", onClick: onDownload, disabled: !showDownload }, "Download")),
|
|
154
|
+
showDetach && (react_1.default.createElement(ListItemButton, { variant: "tertiary", onClick: onDetach, disabled: !showDetach }, "Detach")),
|
|
155
|
+
showDelete() && (react_1.default.createElement(ListItemButton, { variant: "tertiary", onClick: onDelete }, "Delete"))))));
|
|
155
156
|
};
|
|
156
157
|
exports.FigureOptions = FigureOptions;
|
|
157
158
|
const NestedDropdown = ({ parentToggleOpen, buttonText, disabled, list, moveLeft }) => {
|
|
@@ -164,7 +165,7 @@ const NestedDropdown = ({ parentToggleOpen, buttonText, disabled, list, moveLeft
|
|
|
164
165
|
}, [toggleOpen, wrapperRef]);
|
|
165
166
|
useDropdownKeyboardNav(isOpen, nestedListRef, handleArrowLeft, handleArrowLeft);
|
|
166
167
|
return (react_1.default.createElement(DropdownWrapper, { ref: wrapperRef },
|
|
167
|
-
react_1.default.createElement(NestedListButton, { className: "nested-list-button", onClick: toggleOpen, disabled: disabled, onKeyDown: (e) => {
|
|
168
|
+
react_1.default.createElement(NestedListButton, { variant: "tertiary", className: "nested-list-button", onClick: toggleOpen, disabled: disabled, onKeyDown: (e) => {
|
|
168
169
|
if (e.key === 'ArrowRight') {
|
|
169
170
|
e.preventDefault();
|
|
170
171
|
toggleOpen();
|
|
@@ -181,26 +182,18 @@ const DropdownWrapper = styled_components_1.default.div ``;
|
|
|
181
182
|
const OptionsDropdownList = (0, styled_components_1.default)(style_guide_1.DropdownList) `
|
|
182
183
|
right: 4%;
|
|
183
184
|
`;
|
|
184
|
-
const OptionsButton = (0, styled_components_1.default)(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
background: #ffffff;
|
|
193
|
-
|
|
194
|
-
&:hover {
|
|
195
|
-
background: #f2fbfc !important;
|
|
196
|
-
border: 1px solid #e2e2e2 !important;
|
|
185
|
+
const OptionsButton = (0, styled_components_1.default)(mui_1.IconButton).attrs({
|
|
186
|
+
size: 'small',
|
|
187
|
+
bordered: true,
|
|
188
|
+
}) `
|
|
189
|
+
&& {
|
|
190
|
+
margin: ${(props) => props.theme.grid.unit}px;
|
|
191
|
+
visibility: hidden;
|
|
192
|
+
background: #ffffff;
|
|
197
193
|
}
|
|
198
194
|
|
|
199
195
|
&:active,
|
|
200
196
|
&:focus {
|
|
201
|
-
background: #f2fbfc !important;
|
|
202
|
-
border: 1px solid #e2e2e2 !important;
|
|
203
|
-
|
|
204
197
|
circle {
|
|
205
198
|
fill: #1a9bc7;
|
|
206
199
|
}
|
|
@@ -210,14 +203,12 @@ const OptionsButton = (0, styled_components_1.default)(style_guide_1.IconButton)
|
|
|
210
203
|
fill: #6e6e6e;
|
|
211
204
|
}
|
|
212
205
|
`;
|
|
213
|
-
const ListItemButton = (0, styled_components_1.default)(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
&:focus-visible {
|
|
220
|
-
background: #f2fbfc;
|
|
206
|
+
const ListItemButton = (0, styled_components_1.default)(mui_1.Button) `
|
|
207
|
+
&& {
|
|
208
|
+
padding: 16px 14px;
|
|
209
|
+
justify-content: space-between;
|
|
210
|
+
align-items: center;
|
|
211
|
+
width: 100%;
|
|
221
212
|
}
|
|
222
213
|
|
|
223
214
|
&:is([disabled]) {
|
|
@@ -247,12 +238,12 @@ const NestedListDropdownList = (0, styled_components_1.default)(style_guide_1.Dr
|
|
|
247
238
|
top: 0;
|
|
248
239
|
${(props) => (props.$moveLeft && 'right: 30%;') || 'left: 100%;'}
|
|
249
240
|
`;
|
|
250
|
-
const UploadButton = (0, styled_components_1.default)(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
241
|
+
const UploadButton = (0, styled_components_1.default)(mui_1.Button) `
|
|
242
|
+
&& {
|
|
243
|
+
border-top: 1px solid #f2f2f2;
|
|
244
|
+
padding: ${(props) => props.theme.grid.unit * 4}px;
|
|
245
|
+
justify-content: flex-start;
|
|
246
|
+
width: 100%;
|
|
247
|
+
border-radius: 0;
|
|
257
248
|
}
|
|
258
249
|
`;
|
|
@@ -53,6 +53,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
54
|
exports.FootnotesSelector = void 0;
|
|
55
55
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
56
|
+
const mui_1 = require("@manuscripts/style-guide/mui");
|
|
56
57
|
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
57
58
|
const react_1 = __importStar(require("react"));
|
|
58
59
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
@@ -117,12 +118,10 @@ const FootnotesSelector = ({ footnotes, inlineFootnote, labels, onAdd, onInsert,
|
|
|
117
118
|
react_1.default.createElement(FootnotesList, { footnotes: footnotes, inlineFootnote: inlineFootnote, labels: labels, isSelected: isSelected, onSelect: toggleSelection })),
|
|
118
119
|
react_1.default.createElement(Actions, null,
|
|
119
120
|
react_1.default.createElement(AddNewFootnote, null,
|
|
120
|
-
react_1.default.createElement(
|
|
121
|
-
react_1.default.createElement(style_guide_1.AddNewIcon, null),
|
|
122
|
-
"Add new")),
|
|
121
|
+
react_1.default.createElement(mui_1.Button, { variant: "tertiary", onClick: onAdd, startIcon: react_1.default.createElement(style_guide_1.AddNewIcon, null) }, "Add new")),
|
|
123
122
|
react_1.default.createElement(style_guide_1.ButtonGroup, null,
|
|
124
|
-
react_1.default.createElement(
|
|
125
|
-
react_1.default.createElement(
|
|
123
|
+
react_1.default.createElement(mui_1.Button, { variant: "secondary", onClick: onCancel }, "Cancel"),
|
|
124
|
+
react_1.default.createElement(mui_1.Button, { onClick: handleClick, disabled: selections.size === 0 && !inlineFootnote }, inlineFootnote ? 'Update' : 'Insert')))));
|
|
126
125
|
};
|
|
127
126
|
exports.FootnotesSelector = FootnotesSelector;
|
|
128
127
|
const FootnotesList = ({ footnotes, inlineFootnote, labels, isSelected, onSelect }) => {
|
|
@@ -53,6 +53,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
54
|
exports.LinkForm = exports.Open = void 0;
|
|
55
55
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
56
|
+
const mui_1 = require("@manuscripts/style-guide/mui");
|
|
56
57
|
const react_1 = __importStar(require("react"));
|
|
57
58
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
58
59
|
const url_1 = require("../../lib/url");
|
|
@@ -70,7 +71,7 @@ const ActionGroup = styled_components_1.default.span `
|
|
|
70
71
|
margin-right: 4px;
|
|
71
72
|
}
|
|
72
73
|
`;
|
|
73
|
-
const RemoveButton = (0, styled_components_1.default)(
|
|
74
|
+
const RemoveButton = (0, styled_components_1.default)(mui_1.Button) `
|
|
74
75
|
display: flex;
|
|
75
76
|
justify-content: space-between;
|
|
76
77
|
align-items: center;
|
|
@@ -156,11 +157,11 @@ const LinkForm = ({ onCancel, onRemove, onSave, value, }) => {
|
|
|
156
157
|
react_1.default.createElement(style_guide_1.TextField, { type: 'text', name: 'title', value: title, autoComplete: 'off', required: false, onChange: (e) => setTitle(e.target.value) })),
|
|
157
158
|
react_1.default.createElement(Actions, null,
|
|
158
159
|
react_1.default.createElement(ActionGroup, null,
|
|
159
|
-
react_1.default.createElement(RemoveButton, { type: 'button', onClick: onRemove },
|
|
160
|
+
react_1.default.createElement(RemoveButton, { variant: "secondary", type: 'button', onClick: onRemove },
|
|
160
161
|
react_1.default.createElement(style_guide_1.DeleteIcon, null),
|
|
161
162
|
react_1.default.createElement("span", null, "Remove Link"))),
|
|
162
163
|
react_1.default.createElement(ActionGroup, null,
|
|
163
|
-
react_1.default.createElement(
|
|
164
|
-
react_1.default.createElement(
|
|
164
|
+
react_1.default.createElement(mui_1.Button, { variant: "secondary", type: 'button', onClick: onCancel }, "Cancel"),
|
|
165
|
+
react_1.default.createElement(mui_1.Button, { type: 'submit' }, "Save"))))));
|
|
165
166
|
};
|
|
166
167
|
exports.LinkForm = LinkForm;
|
|
@@ -38,6 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.ContextMenu = void 0;
|
|
40
40
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
41
|
+
const mui_1 = require("@manuscripts/style-guide/mui");
|
|
41
42
|
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
42
43
|
const transform_1 = require("@manuscripts/transform");
|
|
43
44
|
const prosemirror_tables_1 = require("prosemirror-tables");
|
|
@@ -91,45 +92,45 @@ const ContextMenu = ({ view, close, onCancelColumnDialog }) => {
|
|
|
91
92
|
}
|
|
92
93
|
};
|
|
93
94
|
return (react_1.default.createElement(MenuDropdownList, { className: 'table-ctx' },
|
|
94
|
-
react_1.default.createElement(ActionButton, { disabled: isHeaderCellSelected(view.state), onClick: () => runCommand((0, commands_1.addRows)('top')) },
|
|
95
|
+
react_1.default.createElement(ActionButton, { variant: "tertiary", disabled: isHeaderCellSelected(view.state), onClick: () => runCommand((0, commands_1.addRows)('top')) },
|
|
95
96
|
react_1.default.createElement(style_guide_1.PlusIcon, null),
|
|
96
97
|
" Insert ",
|
|
97
98
|
rows,
|
|
98
99
|
" above"),
|
|
99
|
-
react_1.default.createElement(ActionButton, { onClick: () => runCommand((0, commands_1.addRows)('bottom')) },
|
|
100
|
+
react_1.default.createElement(ActionButton, { variant: "tertiary", onClick: () => runCommand((0, commands_1.addRows)('bottom')) },
|
|
100
101
|
react_1.default.createElement(style_guide_1.PlusIcon, null),
|
|
101
102
|
" Insert ",
|
|
102
103
|
rows,
|
|
103
104
|
" below"),
|
|
104
|
-
react_1.default.createElement(ActionButton, { onClick: () => showWarningForTCPlugin(setColumnAction, () => (0, commands_1.addColumns)('left')) },
|
|
105
|
+
react_1.default.createElement(ActionButton, { variant: "tertiary", onClick: () => showWarningForTCPlugin(setColumnAction, () => (0, commands_1.addColumns)('left')) },
|
|
105
106
|
react_1.default.createElement(style_guide_1.PlusIcon, null),
|
|
106
107
|
" Insert ",
|
|
107
108
|
columns,
|
|
108
109
|
" to the left"),
|
|
109
|
-
react_1.default.createElement(ActionButton, { onClick: () => showWarningForTCPlugin(setColumnAction, () => (0, commands_1.addColumns)('right')) },
|
|
110
|
+
react_1.default.createElement(ActionButton, { variant: "tertiary", onClick: () => showWarningForTCPlugin(setColumnAction, () => (0, commands_1.addColumns)('right')) },
|
|
110
111
|
react_1.default.createElement(style_guide_1.PlusIcon, null),
|
|
111
112
|
" Insert ",
|
|
112
113
|
columns,
|
|
113
114
|
" to the right"),
|
|
114
115
|
react_1.default.createElement(Separator, null),
|
|
115
|
-
react_1.default.createElement(ActionButton, { disabled: count.rows !== 1, onClick: () => runCommand((0, commands_1.addHeaderRow)(headerPosition)) },
|
|
116
|
+
react_1.default.createElement(ActionButton, { variant: "tertiary", disabled: count.rows !== 1, onClick: () => runCommand((0, commands_1.addHeaderRow)(headerPosition)) },
|
|
116
117
|
react_1.default.createElement(style_guide_1.PlusIcon, null),
|
|
117
118
|
" Insert header row ",
|
|
118
119
|
headerPosition),
|
|
119
120
|
react_1.default.createElement(Separator, null),
|
|
120
|
-
react_1.default.createElement(ActionButton, { onClick: () => showWarningForTCPlugin(setRowDeleteAction, () => prosemirror_tables_1.deleteRow) },
|
|
121
|
+
react_1.default.createElement(ActionButton, { variant: "tertiary", onClick: () => showWarningForTCPlugin(setRowDeleteAction, () => prosemirror_tables_1.deleteRow) },
|
|
121
122
|
react_1.default.createElement(GrayDeleteIcon, null),
|
|
122
123
|
" Delete",
|
|
123
124
|
isHeaderCellSelected(view.state) ? ' header ' : '',
|
|
124
125
|
" ",
|
|
125
126
|
rows),
|
|
126
|
-
react_1.default.createElement(ActionButton, { onClick: () => showWarningForTCPlugin(setColumnAction, () => prosemirror_tables_1.deleteColumn) },
|
|
127
|
+
react_1.default.createElement(ActionButton, { variant: "tertiary", onClick: () => showWarningForTCPlugin(setColumnAction, () => prosemirror_tables_1.deleteColumn) },
|
|
127
128
|
react_1.default.createElement(GrayDeleteIcon, null),
|
|
128
129
|
" Delete ",
|
|
129
130
|
columns),
|
|
130
131
|
(isCellSelectionMerged || isCellSelectionSplittable) && react_1.default.createElement(Separator, null),
|
|
131
|
-
isCellSelectionMerged && (react_1.default.createElement(ActionButton, { onClick: () => runCommand(prosemirror_tables_1.mergeCells, true) }, "Merge cells")),
|
|
132
|
-
isCellSelectionSplittable && (react_1.default.createElement(ActionButton, { onClick: () => runCommand(prosemirror_tables_1.splitCell, true) }, "Split cells")),
|
|
132
|
+
isCellSelectionMerged && (react_1.default.createElement(ActionButton, { variant: "tertiary", onClick: () => runCommand(prosemirror_tables_1.mergeCells, true) }, "Merge cells")),
|
|
133
|
+
isCellSelectionSplittable && (react_1.default.createElement(ActionButton, { variant: "tertiary", onClick: () => runCommand(prosemirror_tables_1.splitCell, true) }, "Split cells")),
|
|
133
134
|
react_1.default.createElement(TableChangeWarningDialog, { isOpen: !!rowDeleteAction, primaryAction: () => {
|
|
134
135
|
if (rowDeleteAction) {
|
|
135
136
|
runCommand(rowDeleteAction, true);
|
|
@@ -151,12 +152,11 @@ const MenuDropdownList = styled_components_1.default.div `
|
|
|
151
152
|
display: flex;
|
|
152
153
|
flex-direction: column;
|
|
153
154
|
`;
|
|
154
|
-
const ActionButton = (0, styled_components_1.default)(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
background: #f2fbfc;
|
|
155
|
+
const ActionButton = (0, styled_components_1.default)(mui_1.Button) `
|
|
156
|
+
&& {
|
|
157
|
+
padding: 8px 16px;
|
|
158
|
+
justify-content: flex-start;
|
|
159
|
+
width: 100%;
|
|
160
160
|
}
|
|
161
161
|
&:disabled {
|
|
162
162
|
color: #353535;
|
package/dist/cjs/versions.js
CHANGED
|
@@ -19,6 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.createSubViewAsync = createSubViewAsync;
|
|
22
|
+
const mui_1 = require("@manuscripts/style-guide/mui");
|
|
22
23
|
const react_1 = __importDefault(require("react"));
|
|
23
24
|
const react_dom_1 = require("react-dom");
|
|
24
25
|
const client_1 = require("react-dom/client");
|
|
@@ -46,8 +47,9 @@ function createView(props, Component, componentProps, node, getPos, view, classN
|
|
|
46
47
|
}).setSelection(selection.map(tr.doc, tr.mapping));
|
|
47
48
|
view.dispatch(tr);
|
|
48
49
|
};
|
|
49
|
-
return (react_1.default.createElement(
|
|
50
|
-
react_1.default.createElement(
|
|
50
|
+
return (react_1.default.createElement(mui_1.MuiThemeProvider, { theme: mui_1.muiTheme },
|
|
51
|
+
react_1.default.createElement(styled_components_1.ThemeProvider, { theme: props.theme },
|
|
52
|
+
react_1.default.createElement(Component, { nodeAttrs: node.attrs, setNodeAttrs: setNodeAttrs, viewProps: { node, view, getPos }, container: container, ...props, ...componentProps }))));
|
|
51
53
|
};
|
|
52
54
|
return Wrapped;
|
|
53
55
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ButtonGroup, Category, DeleteSolidIcon, Dialog, EditIcon,
|
|
1
|
+
import { ButtonGroup, Category, DeleteSolidIcon, Dialog, EditIcon, withFocusTrap, } from '@manuscripts/style-guide';
|
|
2
|
+
import { Button, IconButton } from '@manuscripts/style-guide/mui';
|
|
2
3
|
import { generateNodeID, schema, } from '@manuscripts/transform';
|
|
3
4
|
import React, { useMemo, useReducer, useState } from 'react';
|
|
4
5
|
import styled from 'styled-components';
|
|
@@ -13,33 +14,6 @@ const CitedItemActions = styled.div `
|
|
|
13
14
|
display: flex;
|
|
14
15
|
align-items: center;
|
|
15
16
|
margin-left: 12px;
|
|
16
|
-
|
|
17
|
-
svg.remove-icon {
|
|
18
|
-
color: #6e6e6e;
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
const ActionButton = styled(IconButton).attrs({
|
|
22
|
-
$size: 24,
|
|
23
|
-
}) `
|
|
24
|
-
&:disabled {
|
|
25
|
-
background-color: transparent !important;
|
|
26
|
-
border-color: transparent !important;
|
|
27
|
-
color: rgb(255, 255, 255);
|
|
28
|
-
path,
|
|
29
|
-
g {
|
|
30
|
-
fill: ${(props) => props.theme.colors.background.tertiary} !important;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
&:not(:disabled):focus,
|
|
34
|
-
&:not(:disabled):hover {
|
|
35
|
-
path,
|
|
36
|
-
g {
|
|
37
|
-
fill: ${(props) => props.theme.colors.brand.medium} !important;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
|
-
const EditReferenceButton = styled(ActionButton) `
|
|
42
|
-
margin-right: ${(props) => props.theme.grid.unit * 3}px;
|
|
43
17
|
`;
|
|
44
18
|
const Actions = styled(ButtonGroup) `
|
|
45
19
|
margin: ${(props) => props.theme.grid.unit * 4}px;
|
|
@@ -143,14 +117,14 @@ export const CitationEditor = ({ query, rids: $rids, items: $items, citationCoun
|
|
|
143
117
|
title: 'Cancel',
|
|
144
118
|
},
|
|
145
119
|
} }),
|
|
146
|
-
React.createElement(CitedItems, null, cited.map((item) => (React.createElement(CitedItem, { key: item.id },
|
|
120
|
+
React.createElement(CitedItems, null, cited.map((item) => (React.createElement(CitedItem, { key: item.id, "data-cy": "cited-item" },
|
|
147
121
|
React.createElement(ReferenceLine, { item: item }),
|
|
148
122
|
React.createElement(CitedItemActions, null,
|
|
149
|
-
React.createElement(
|
|
150
|
-
React.createElement(EditIcon,
|
|
151
|
-
React.createElement(
|
|
152
|
-
React.createElement(DeleteSolidIcon, {
|
|
123
|
+
React.createElement(IconButton, { value: item.id, disabled: !canEdit, onClick: () => setEditingForm({ show: true, item: item }) },
|
|
124
|
+
React.createElement(EditIcon, { fill: 'currentColor' })),
|
|
125
|
+
React.createElement(IconButton, { "data-cy": "remove-citation", disabled: !canEdit, onClick: () => setDeleteDialog({ show: true, id: item.id }) },
|
|
126
|
+
React.createElement(DeleteSolidIcon, { fill: 'currentColor' }))))))),
|
|
153
127
|
React.createElement(Actions, null,
|
|
154
|
-
React.createElement(
|
|
155
|
-
React.createElement(
|
|
128
|
+
React.createElement(Button, { variant: "secondary", onClick: onCancel }, "Done"),
|
|
129
|
+
React.createElement(Button, { disabled: !canEdit, onClick: () => setSearching(true) }, "Add Citation"))));
|
|
156
130
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DotsIcon, DropdownList, getFileIcon,
|
|
1
|
+
import { DotsIcon, DropdownList, getFileIcon, TriangleCollapsedIcon, UploadIcon, useDropdown, } from '@manuscripts/style-guide';
|
|
2
|
+
import { Button, IconButton } from '@manuscripts/style-guide/mui';
|
|
2
3
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
3
4
|
import styled from 'styled-components';
|
|
4
5
|
import { memoGroupFiles, } from '../../lib/files';
|
|
@@ -99,20 +100,20 @@ export const FigureOptions = ({ can, getDoc, getFiles, onDownload, onUpload, onD
|
|
|
99
100
|
} },
|
|
100
101
|
React.createElement(DotsIcon, null)),
|
|
101
102
|
isOpen && (React.createElement(OptionsDropdownList, { "$direction": 'right', "$width": 128, "$top": 5, ref: dropdownRef },
|
|
102
|
-
showReplace && isEmbedMode && (React.createElement(ListItemButton, { onClick: () => onReplaceEmbed && onReplaceEmbed() }, "Edit Link")),
|
|
103
|
+
showReplace && isEmbedMode && (React.createElement(ListItemButton, { variant: "tertiary", onClick: () => onReplaceEmbed && onReplaceEmbed() }, "Edit Link")),
|
|
103
104
|
showReplace && !isEmbedMode && (React.createElement(NestedDropdown, { disabled: !showReplace, parentToggleOpen: toggleOpen, buttonText: replaceBtnText, moveLeft: true, list: React.createElement(React.Fragment, null,
|
|
104
|
-
getSupplements(getFiles, getDoc, groupFiles, isEmbed).map((file, index) => (React.createElement(ListItemButton, { key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file, true) },
|
|
105
|
+
getSupplements(getFiles, getDoc, groupFiles, isEmbed).map((file, index) => (React.createElement(ListItemButton, { variant: "tertiary", key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file, true) },
|
|
105
106
|
getFileIcon(file.name),
|
|
106
107
|
React.createElement(ListItemText, null, file.name)))),
|
|
107
|
-
getOtherFiles(getFiles, getDoc, groupFiles, isEmbed).map((file, index) => (React.createElement(ListItemButton, { key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file) },
|
|
108
|
+
getOtherFiles(getFiles, getDoc, groupFiles, isEmbed).map((file, index) => (React.createElement(ListItemButton, { variant: "tertiary", key: file.id, id: index.toString(), onClick: () => onReplace && onReplace(file) },
|
|
108
109
|
getFileIcon(file.name),
|
|
109
110
|
React.createElement(ListItemText, null, file.name)))),
|
|
110
|
-
showUpload && (React.createElement(UploadButton, { onClick: onUpload, disabled: !showUpload },
|
|
111
|
+
showUpload && (React.createElement(UploadButton, { variant: "tertiary", onClick: onUpload, disabled: !showUpload },
|
|
111
112
|
React.createElement(UploadIcon, null),
|
|
112
113
|
" Upload new..."))) })),
|
|
113
|
-
showDownload && (React.createElement(ListItemButton, { onClick: onDownload, disabled: !showDownload }, "Download")),
|
|
114
|
-
showDetach && (React.createElement(ListItemButton, { onClick: onDetach, disabled: !showDetach }, "Detach")),
|
|
115
|
-
showDelete() && (React.createElement(ListItemButton, { onClick: onDelete }, "Delete"))))));
|
|
114
|
+
showDownload && (React.createElement(ListItemButton, { variant: "tertiary", onClick: onDownload, disabled: !showDownload }, "Download")),
|
|
115
|
+
showDetach && (React.createElement(ListItemButton, { variant: "tertiary", onClick: onDetach, disabled: !showDetach }, "Detach")),
|
|
116
|
+
showDelete() && (React.createElement(ListItemButton, { variant: "tertiary", onClick: onDelete }, "Delete"))))));
|
|
116
117
|
};
|
|
117
118
|
const NestedDropdown = ({ parentToggleOpen, buttonText, disabled, list, moveLeft }) => {
|
|
118
119
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
|
@@ -124,7 +125,7 @@ const NestedDropdown = ({ parentToggleOpen, buttonText, disabled, list, moveLeft
|
|
|
124
125
|
}, [toggleOpen, wrapperRef]);
|
|
125
126
|
useDropdownKeyboardNav(isOpen, nestedListRef, handleArrowLeft, handleArrowLeft);
|
|
126
127
|
return (React.createElement(DropdownWrapper, { ref: wrapperRef },
|
|
127
|
-
React.createElement(NestedListButton, { className: "nested-list-button", onClick: toggleOpen, disabled: disabled, onKeyDown: (e) => {
|
|
128
|
+
React.createElement(NestedListButton, { variant: "tertiary", className: "nested-list-button", onClick: toggleOpen, disabled: disabled, onKeyDown: (e) => {
|
|
128
129
|
if (e.key === 'ArrowRight') {
|
|
129
130
|
e.preventDefault();
|
|
130
131
|
toggleOpen();
|
|
@@ -141,26 +142,18 @@ const DropdownWrapper = styled.div ``;
|
|
|
141
142
|
const OptionsDropdownList = styled(DropdownList) `
|
|
142
143
|
right: 4%;
|
|
143
144
|
`;
|
|
144
|
-
const OptionsButton = styled(IconButton)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
background: #ffffff;
|
|
153
|
-
|
|
154
|
-
&:hover {
|
|
155
|
-
background: #f2fbfc !important;
|
|
156
|
-
border: 1px solid #e2e2e2 !important;
|
|
145
|
+
const OptionsButton = styled(IconButton).attrs({
|
|
146
|
+
size: 'small',
|
|
147
|
+
bordered: true,
|
|
148
|
+
}) `
|
|
149
|
+
&& {
|
|
150
|
+
margin: ${(props) => props.theme.grid.unit}px;
|
|
151
|
+
visibility: hidden;
|
|
152
|
+
background: #ffffff;
|
|
157
153
|
}
|
|
158
154
|
|
|
159
155
|
&:active,
|
|
160
156
|
&:focus {
|
|
161
|
-
background: #f2fbfc !important;
|
|
162
|
-
border: 1px solid #e2e2e2 !important;
|
|
163
|
-
|
|
164
157
|
circle {
|
|
165
158
|
fill: #1a9bc7;
|
|
166
159
|
}
|
|
@@ -170,14 +163,12 @@ const OptionsButton = styled(IconButton) `
|
|
|
170
163
|
fill: #6e6e6e;
|
|
171
164
|
}
|
|
172
165
|
`;
|
|
173
|
-
const ListItemButton = styled(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
&:focus-visible {
|
|
180
|
-
background: #f2fbfc;
|
|
166
|
+
const ListItemButton = styled(Button) `
|
|
167
|
+
&& {
|
|
168
|
+
padding: 16px 14px;
|
|
169
|
+
justify-content: space-between;
|
|
170
|
+
align-items: center;
|
|
171
|
+
width: 100%;
|
|
181
172
|
}
|
|
182
173
|
|
|
183
174
|
&:is([disabled]) {
|
|
@@ -207,12 +198,12 @@ const NestedListDropdownList = styled(DropdownList) `
|
|
|
207
198
|
top: 0;
|
|
208
199
|
${(props) => (props.$moveLeft && 'right: 30%;') || 'left: 100%;'}
|
|
209
200
|
`;
|
|
210
|
-
const UploadButton = styled(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
201
|
+
const UploadButton = styled(Button) `
|
|
202
|
+
&& {
|
|
203
|
+
border-top: 1px solid #f2f2f2;
|
|
204
|
+
padding: ${(props) => props.theme.grid.unit * 4}px;
|
|
205
|
+
justify-content: flex-start;
|
|
206
|
+
width: 100%;
|
|
207
|
+
border-radius: 0;
|
|
217
208
|
}
|
|
218
209
|
`;
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { AddedIcon, AddIcon, AddNewIcon, ButtonGroup,
|
|
16
|
+
import { AddedIcon, AddIcon, AddNewIcon, ButtonGroup, withFocusTrap, withListNavigation, withNavigableListItem, } from '@manuscripts/style-guide';
|
|
17
|
+
import { Button } from '@manuscripts/style-guide/mui';
|
|
17
18
|
import { isDeleted } from '@manuscripts/track-changes-plugin';
|
|
18
19
|
import React, { useState } from 'react';
|
|
19
20
|
import styled from 'styled-components';
|
|
@@ -78,12 +79,10 @@ export const FootnotesSelector = ({ footnotes, inlineFootnote, labels, onAdd, on
|
|
|
78
79
|
React.createElement(FootnotesList, { footnotes: footnotes, inlineFootnote: inlineFootnote, labels: labels, isSelected: isSelected, onSelect: toggleSelection })),
|
|
79
80
|
React.createElement(Actions, null,
|
|
80
81
|
React.createElement(AddNewFootnote, null,
|
|
81
|
-
React.createElement(
|
|
82
|
-
React.createElement(AddNewIcon, null),
|
|
83
|
-
"Add new")),
|
|
82
|
+
React.createElement(Button, { variant: "tertiary", onClick: onAdd, startIcon: React.createElement(AddNewIcon, null) }, "Add new")),
|
|
84
83
|
React.createElement(ButtonGroup, null,
|
|
85
|
-
React.createElement(
|
|
86
|
-
React.createElement(
|
|
84
|
+
React.createElement(Button, { variant: "secondary", onClick: onCancel }, "Cancel"),
|
|
85
|
+
React.createElement(Button, { onClick: handleClick, disabled: selections.size === 0 && !inlineFootnote }, inlineFootnote ? 'Update' : 'Insert')))));
|
|
87
86
|
};
|
|
88
87
|
const FootnotesList = ({ footnotes, inlineFootnote, labels, isSelected, onSelect }) => {
|
|
89
88
|
const rids = inlineFootnote?.attrs.rids;
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { DeleteIcon, FormContainer, FormRow, Label,
|
|
16
|
+
import { DeleteIcon, FormContainer, FormRow, Label, TextField, InputErrorText, withFocusTrap, } from '@manuscripts/style-guide';
|
|
17
|
+
import { Button } from '@manuscripts/style-guide/mui';
|
|
17
18
|
import React, { useCallback, useState } from 'react';
|
|
18
19
|
import styled from 'styled-components';
|
|
19
20
|
import { allowedHref } from '../../lib/url';
|
|
@@ -31,7 +32,7 @@ const ActionGroup = styled.span `
|
|
|
31
32
|
margin-right: 4px;
|
|
32
33
|
}
|
|
33
34
|
`;
|
|
34
|
-
const RemoveButton = styled(
|
|
35
|
+
const RemoveButton = styled(Button) `
|
|
35
36
|
display: flex;
|
|
36
37
|
justify-content: space-between;
|
|
37
38
|
align-items: center;
|
|
@@ -117,10 +118,10 @@ export const LinkForm = ({ onCancel, onRemove, onSave, value, }) => {
|
|
|
117
118
|
React.createElement(TextField, { type: 'text', name: 'title', value: title, autoComplete: 'off', required: false, onChange: (e) => setTitle(e.target.value) })),
|
|
118
119
|
React.createElement(Actions, null,
|
|
119
120
|
React.createElement(ActionGroup, null,
|
|
120
|
-
React.createElement(RemoveButton, { type: 'button', onClick: onRemove },
|
|
121
|
+
React.createElement(RemoveButton, { variant: "secondary", type: 'button', onClick: onRemove },
|
|
121
122
|
React.createElement(DeleteIcon, null),
|
|
122
123
|
React.createElement("span", null, "Remove Link"))),
|
|
123
124
|
React.createElement(ActionGroup, null,
|
|
124
|
-
React.createElement(
|
|
125
|
-
React.createElement(
|
|
125
|
+
React.createElement(Button, { variant: "secondary", type: 'button', onClick: onCancel }, "Cancel"),
|
|
126
|
+
React.createElement(Button, { type: 'submit' }, "Save"))))));
|
|
126
127
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Category, DeleteIcon, Dialog,
|
|
1
|
+
import { Category, DeleteIcon, Dialog, PlusIcon, } from '@manuscripts/style-guide';
|
|
2
|
+
import { Button } from '@manuscripts/style-guide/mui';
|
|
2
3
|
import { skipTracking } from '@manuscripts/track-changes-plugin';
|
|
3
4
|
import { schema } from '@manuscripts/transform';
|
|
4
5
|
import { CellSelection, deleteColumn, deleteRow, mergeCells, selectedRect, splitCell, } from 'prosemirror-tables';
|
|
@@ -52,45 +53,45 @@ export const ContextMenu = ({ view, close, onCancelColumnDialog }) => {
|
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
55
|
return (React.createElement(MenuDropdownList, { className: 'table-ctx' },
|
|
55
|
-
React.createElement(ActionButton, { disabled: isHeaderCellSelected(view.state), onClick: () => runCommand(addRows('top')) },
|
|
56
|
+
React.createElement(ActionButton, { variant: "tertiary", disabled: isHeaderCellSelected(view.state), onClick: () => runCommand(addRows('top')) },
|
|
56
57
|
React.createElement(PlusIcon, null),
|
|
57
58
|
" Insert ",
|
|
58
59
|
rows,
|
|
59
60
|
" above"),
|
|
60
|
-
React.createElement(ActionButton, { onClick: () => runCommand(addRows('bottom')) },
|
|
61
|
+
React.createElement(ActionButton, { variant: "tertiary", onClick: () => runCommand(addRows('bottom')) },
|
|
61
62
|
React.createElement(PlusIcon, null),
|
|
62
63
|
" Insert ",
|
|
63
64
|
rows,
|
|
64
65
|
" below"),
|
|
65
|
-
React.createElement(ActionButton, { onClick: () => showWarningForTCPlugin(setColumnAction, () => addColumns('left')) },
|
|
66
|
+
React.createElement(ActionButton, { variant: "tertiary", onClick: () => showWarningForTCPlugin(setColumnAction, () => addColumns('left')) },
|
|
66
67
|
React.createElement(PlusIcon, null),
|
|
67
68
|
" Insert ",
|
|
68
69
|
columns,
|
|
69
70
|
" to the left"),
|
|
70
|
-
React.createElement(ActionButton, { onClick: () => showWarningForTCPlugin(setColumnAction, () => addColumns('right')) },
|
|
71
|
+
React.createElement(ActionButton, { variant: "tertiary", onClick: () => showWarningForTCPlugin(setColumnAction, () => addColumns('right')) },
|
|
71
72
|
React.createElement(PlusIcon, null),
|
|
72
73
|
" Insert ",
|
|
73
74
|
columns,
|
|
74
75
|
" to the right"),
|
|
75
76
|
React.createElement(Separator, null),
|
|
76
|
-
React.createElement(ActionButton, { disabled: count.rows !== 1, onClick: () => runCommand(addHeaderRow(headerPosition)) },
|
|
77
|
+
React.createElement(ActionButton, { variant: "tertiary", disabled: count.rows !== 1, onClick: () => runCommand(addHeaderRow(headerPosition)) },
|
|
77
78
|
React.createElement(PlusIcon, null),
|
|
78
79
|
" Insert header row ",
|
|
79
80
|
headerPosition),
|
|
80
81
|
React.createElement(Separator, null),
|
|
81
|
-
React.createElement(ActionButton, { onClick: () => showWarningForTCPlugin(setRowDeleteAction, () => deleteRow) },
|
|
82
|
+
React.createElement(ActionButton, { variant: "tertiary", onClick: () => showWarningForTCPlugin(setRowDeleteAction, () => deleteRow) },
|
|
82
83
|
React.createElement(GrayDeleteIcon, null),
|
|
83
84
|
" Delete",
|
|
84
85
|
isHeaderCellSelected(view.state) ? ' header ' : '',
|
|
85
86
|
" ",
|
|
86
87
|
rows),
|
|
87
|
-
React.createElement(ActionButton, { onClick: () => showWarningForTCPlugin(setColumnAction, () => deleteColumn) },
|
|
88
|
+
React.createElement(ActionButton, { variant: "tertiary", onClick: () => showWarningForTCPlugin(setColumnAction, () => deleteColumn) },
|
|
88
89
|
React.createElement(GrayDeleteIcon, null),
|
|
89
90
|
" Delete ",
|
|
90
91
|
columns),
|
|
91
92
|
(isCellSelectionMerged || isCellSelectionSplittable) && React.createElement(Separator, null),
|
|
92
|
-
isCellSelectionMerged && (React.createElement(ActionButton, { onClick: () => runCommand(mergeCells, true) }, "Merge cells")),
|
|
93
|
-
isCellSelectionSplittable && (React.createElement(ActionButton, { onClick: () => runCommand(splitCell, true) }, "Split cells")),
|
|
93
|
+
isCellSelectionMerged && (React.createElement(ActionButton, { variant: "tertiary", onClick: () => runCommand(mergeCells, true) }, "Merge cells")),
|
|
94
|
+
isCellSelectionSplittable && (React.createElement(ActionButton, { variant: "tertiary", onClick: () => runCommand(splitCell, true) }, "Split cells")),
|
|
94
95
|
React.createElement(TableChangeWarningDialog, { isOpen: !!rowDeleteAction, primaryAction: () => {
|
|
95
96
|
if (rowDeleteAction) {
|
|
96
97
|
runCommand(rowDeleteAction, true);
|
|
@@ -111,12 +112,11 @@ const MenuDropdownList = styled.div `
|
|
|
111
112
|
display: flex;
|
|
112
113
|
flex-direction: column;
|
|
113
114
|
`;
|
|
114
|
-
const ActionButton = styled(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
background: #f2fbfc;
|
|
115
|
+
const ActionButton = styled(Button) `
|
|
116
|
+
&& {
|
|
117
|
+
padding: 8px 16px;
|
|
118
|
+
justify-content: flex-start;
|
|
119
|
+
width: 100%;
|
|
120
120
|
}
|
|
121
121
|
&:disabled {
|
|
122
122
|
color: #353535;
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.18.
|
|
1
|
+
export const VERSION = '3.18.2';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { MuiThemeProvider, muiTheme } from '@manuscripts/style-guide/mui';
|
|
16
17
|
import React from 'react';
|
|
17
18
|
import { flushSync } from 'react-dom';
|
|
18
19
|
import { createRoot } from 'react-dom/client';
|
|
@@ -40,8 +41,9 @@ function createView(props, Component, componentProps, node, getPos, view, classN
|
|
|
40
41
|
}).setSelection(selection.map(tr.doc, tr.mapping));
|
|
41
42
|
view.dispatch(tr);
|
|
42
43
|
};
|
|
43
|
-
return (React.createElement(
|
|
44
|
-
React.createElement(
|
|
44
|
+
return (React.createElement(MuiThemeProvider, { theme: muiTheme },
|
|
45
|
+
React.createElement(ThemeProvider, { theme: props.theme },
|
|
46
|
+
React.createElement(Component, { nodeAttrs: node.attrs, setNodeAttrs: setNodeAttrs, viewProps: { node, view, getPos }, container: container, ...props, ...componentProps }))));
|
|
45
47
|
};
|
|
46
48
|
return Wrapped;
|
|
47
49
|
}
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.18.
|
|
1
|
+
export declare const VERSION = "3.18.2";
|
|
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.18.
|
|
4
|
+
"version": "3.18.2",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@citation-js/plugin-pubmed": "0.3.0",
|
|
42
42
|
"@citation-js/plugin-ris": "0.7.18",
|
|
43
43
|
"@iarna/word-count": "1.1.2",
|
|
44
|
-
"@manuscripts/style-guide": "3.7.
|
|
44
|
+
"@manuscripts/style-guide": "3.7.3",
|
|
45
45
|
"@manuscripts/track-changes-plugin": "2.4.0",
|
|
46
46
|
"@manuscripts/transform": "4.5.6",
|
|
47
47
|
"@popperjs/core": "2.11.8",
|
|
@@ -19,11 +19,9 @@ import {
|
|
|
19
19
|
DeleteSolidIcon,
|
|
20
20
|
Dialog,
|
|
21
21
|
EditIcon,
|
|
22
|
-
IconButton,
|
|
23
|
-
PrimaryButton,
|
|
24
|
-
SecondaryButton,
|
|
25
22
|
withFocusTrap,
|
|
26
23
|
} from '@manuscripts/style-guide'
|
|
24
|
+
import { Button, IconButton } from '@manuscripts/style-guide/mui'
|
|
27
25
|
import {
|
|
28
26
|
BibliographyItemAttrs,
|
|
29
27
|
generateNodeID,
|
|
@@ -46,35 +44,6 @@ const CitedItemActions = styled.div`
|
|
|
46
44
|
display: flex;
|
|
47
45
|
align-items: center;
|
|
48
46
|
margin-left: 12px;
|
|
49
|
-
|
|
50
|
-
svg.remove-icon {
|
|
51
|
-
color: #6e6e6e;
|
|
52
|
-
}
|
|
53
|
-
`
|
|
54
|
-
|
|
55
|
-
const ActionButton = styled(IconButton).attrs({
|
|
56
|
-
$size: 24,
|
|
57
|
-
})`
|
|
58
|
-
&:disabled {
|
|
59
|
-
background-color: transparent !important;
|
|
60
|
-
border-color: transparent !important;
|
|
61
|
-
color: rgb(255, 255, 255);
|
|
62
|
-
path,
|
|
63
|
-
g {
|
|
64
|
-
fill: ${(props) => props.theme.colors.background.tertiary} !important;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
&:not(:disabled):focus,
|
|
68
|
-
&:not(:disabled):hover {
|
|
69
|
-
path,
|
|
70
|
-
g {
|
|
71
|
-
fill: ${(props) => props.theme.colors.brand.medium} !important;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
`
|
|
75
|
-
|
|
76
|
-
const EditReferenceButton = styled(ActionButton)`
|
|
77
|
-
margin-right: ${(props) => props.theme.grid.unit * 3}px;
|
|
78
47
|
`
|
|
79
48
|
|
|
80
49
|
const Actions = styled(ButtonGroup)`
|
|
@@ -261,31 +230,34 @@ export const CitationEditor: React.FC<CitationEditorProps> = ({
|
|
|
261
230
|
/>
|
|
262
231
|
<CitedItems>
|
|
263
232
|
{cited.map((item) => (
|
|
264
|
-
<CitedItem key={item.id}>
|
|
233
|
+
<CitedItem key={item.id} data-cy="cited-item">
|
|
265
234
|
<ReferenceLine item={item} />
|
|
266
235
|
<CitedItemActions>
|
|
267
|
-
<
|
|
236
|
+
<IconButton
|
|
268
237
|
value={item.id}
|
|
269
238
|
disabled={!canEdit}
|
|
270
239
|
onClick={() => setEditingForm({ show: true, item: item })}
|
|
271
240
|
>
|
|
272
|
-
<EditIcon />
|
|
273
|
-
</
|
|
274
|
-
<
|
|
241
|
+
<EditIcon fill={'currentColor'} />
|
|
242
|
+
</IconButton>
|
|
243
|
+
<IconButton
|
|
244
|
+
data-cy="remove-citation"
|
|
275
245
|
disabled={!canEdit}
|
|
276
246
|
onClick={() => setDeleteDialog({ show: true, id: item.id })}
|
|
277
247
|
>
|
|
278
|
-
<DeleteSolidIcon
|
|
279
|
-
</
|
|
248
|
+
<DeleteSolidIcon fill={'currentColor'} />
|
|
249
|
+
</IconButton>
|
|
280
250
|
</CitedItemActions>
|
|
281
251
|
</CitedItem>
|
|
282
252
|
))}
|
|
283
253
|
</CitedItems>
|
|
284
254
|
<Actions>
|
|
285
|
-
<
|
|
286
|
-
|
|
255
|
+
<Button variant="secondary" onClick={onCancel}>
|
|
256
|
+
Done
|
|
257
|
+
</Button>
|
|
258
|
+
<Button disabled={!canEdit} onClick={() => setSearching(true)}>
|
|
287
259
|
Add Citation
|
|
288
|
-
</
|
|
260
|
+
</Button>
|
|
289
261
|
</Actions>
|
|
290
262
|
</Container>
|
|
291
263
|
)
|
|
@@ -17,12 +17,11 @@ import {
|
|
|
17
17
|
DotsIcon,
|
|
18
18
|
DropdownList,
|
|
19
19
|
getFileIcon,
|
|
20
|
-
IconButton,
|
|
21
|
-
IconTextButton,
|
|
22
20
|
TriangleCollapsedIcon,
|
|
23
21
|
UploadIcon,
|
|
24
22
|
useDropdown,
|
|
25
23
|
} from '@manuscripts/style-guide'
|
|
24
|
+
import { Button, IconButton } from '@manuscripts/style-guide/mui'
|
|
26
25
|
import { FigureNode } from '@manuscripts/transform'
|
|
27
26
|
import { Node as ManuscriptNode } from 'prosemirror-model'
|
|
28
27
|
import React, { SyntheticEvent, useCallback, useEffect, useRef } from 'react'
|
|
@@ -140,6 +139,7 @@ function getOtherFiles(
|
|
|
140
139
|
|
|
141
140
|
type WrappedProps = FigureOptionsProps & ReactViewComponentProps<FigureNode>
|
|
142
141
|
|
|
142
|
+
// TODO: To be refactored with the new dropdown component
|
|
143
143
|
export const FigureOptions: React.FC<WrappedProps> = ({
|
|
144
144
|
can,
|
|
145
145
|
getDoc,
|
|
@@ -221,7 +221,10 @@ export const FigureOptions: React.FC<WrappedProps> = ({
|
|
|
221
221
|
ref={dropdownRef}
|
|
222
222
|
>
|
|
223
223
|
{showReplace && isEmbedMode && (
|
|
224
|
-
<ListItemButton
|
|
224
|
+
<ListItemButton
|
|
225
|
+
variant="tertiary"
|
|
226
|
+
onClick={() => onReplaceEmbed && onReplaceEmbed()}
|
|
227
|
+
>
|
|
225
228
|
Edit Link
|
|
226
229
|
</ListItemButton>
|
|
227
230
|
)}
|
|
@@ -236,6 +239,7 @@ export const FigureOptions: React.FC<WrappedProps> = ({
|
|
|
236
239
|
{getSupplements(getFiles, getDoc, groupFiles, isEmbed).map(
|
|
237
240
|
(file, index) => (
|
|
238
241
|
<ListItemButton
|
|
242
|
+
variant="tertiary"
|
|
239
243
|
key={file.id}
|
|
240
244
|
id={index.toString()}
|
|
241
245
|
onClick={() => onReplace && onReplace(file, true)}
|
|
@@ -248,6 +252,7 @@ export const FigureOptions: React.FC<WrappedProps> = ({
|
|
|
248
252
|
{getOtherFiles(getFiles, getDoc, groupFiles, isEmbed).map(
|
|
249
253
|
(file, index) => (
|
|
250
254
|
<ListItemButton
|
|
255
|
+
variant="tertiary"
|
|
251
256
|
key={file.id}
|
|
252
257
|
id={index.toString()}
|
|
253
258
|
onClick={() => onReplace && onReplace(file)}
|
|
@@ -258,7 +263,11 @@ export const FigureOptions: React.FC<WrappedProps> = ({
|
|
|
258
263
|
)
|
|
259
264
|
)}
|
|
260
265
|
{showUpload && (
|
|
261
|
-
<UploadButton
|
|
266
|
+
<UploadButton
|
|
267
|
+
variant="tertiary"
|
|
268
|
+
onClick={onUpload}
|
|
269
|
+
disabled={!showUpload}
|
|
270
|
+
>
|
|
262
271
|
<UploadIcon /> Upload new...
|
|
263
272
|
</UploadButton>
|
|
264
273
|
)}
|
|
@@ -267,17 +276,27 @@ export const FigureOptions: React.FC<WrappedProps> = ({
|
|
|
267
276
|
/>
|
|
268
277
|
)}
|
|
269
278
|
{showDownload && (
|
|
270
|
-
<ListItemButton
|
|
279
|
+
<ListItemButton
|
|
280
|
+
variant="tertiary"
|
|
281
|
+
onClick={onDownload}
|
|
282
|
+
disabled={!showDownload}
|
|
283
|
+
>
|
|
271
284
|
Download
|
|
272
285
|
</ListItemButton>
|
|
273
286
|
)}
|
|
274
287
|
{showDetach && (
|
|
275
|
-
<ListItemButton
|
|
288
|
+
<ListItemButton
|
|
289
|
+
variant="tertiary"
|
|
290
|
+
onClick={onDetach}
|
|
291
|
+
disabled={!showDetach}
|
|
292
|
+
>
|
|
276
293
|
Detach
|
|
277
294
|
</ListItemButton>
|
|
278
295
|
)}
|
|
279
296
|
{showDelete() && (
|
|
280
|
-
<ListItemButton onClick={onDelete}>
|
|
297
|
+
<ListItemButton variant="tertiary" onClick={onDelete}>
|
|
298
|
+
Delete
|
|
299
|
+
</ListItemButton>
|
|
281
300
|
)}
|
|
282
301
|
</OptionsDropdownList>
|
|
283
302
|
)}
|
|
@@ -315,6 +334,7 @@ const NestedDropdown: React.FC<{
|
|
|
315
334
|
return (
|
|
316
335
|
<DropdownWrapper ref={wrapperRef}>
|
|
317
336
|
<NestedListButton
|
|
337
|
+
variant="tertiary"
|
|
318
338
|
className="nested-list-button"
|
|
319
339
|
onClick={toggleOpen}
|
|
320
340
|
disabled={disabled}
|
|
@@ -352,26 +372,18 @@ const OptionsDropdownList = styled(DropdownList)`
|
|
|
352
372
|
right: 4%;
|
|
353
373
|
`
|
|
354
374
|
|
|
355
|
-
const OptionsButton = styled(IconButton)
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
background: #ffffff;
|
|
364
|
-
|
|
365
|
-
&:hover {
|
|
366
|
-
background: #f2fbfc !important;
|
|
367
|
-
border: 1px solid #e2e2e2 !important;
|
|
375
|
+
const OptionsButton = styled(IconButton).attrs({
|
|
376
|
+
size: 'small',
|
|
377
|
+
bordered: true,
|
|
378
|
+
})`
|
|
379
|
+
&& {
|
|
380
|
+
margin: ${(props) => props.theme.grid.unit}px;
|
|
381
|
+
visibility: hidden;
|
|
382
|
+
background: #ffffff;
|
|
368
383
|
}
|
|
369
384
|
|
|
370
385
|
&:active,
|
|
371
386
|
&:focus {
|
|
372
|
-
background: #f2fbfc !important;
|
|
373
|
-
border: 1px solid #e2e2e2 !important;
|
|
374
|
-
|
|
375
387
|
circle {
|
|
376
388
|
fill: #1a9bc7;
|
|
377
389
|
}
|
|
@@ -382,14 +394,12 @@ const OptionsButton = styled(IconButton)`
|
|
|
382
394
|
}
|
|
383
395
|
`
|
|
384
396
|
|
|
385
|
-
const ListItemButton = styled(
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
&:focus-visible {
|
|
392
|
-
background: #f2fbfc;
|
|
397
|
+
const ListItemButton = styled(Button)`
|
|
398
|
+
&& {
|
|
399
|
+
padding: 16px 14px;
|
|
400
|
+
justify-content: space-between;
|
|
401
|
+
align-items: center;
|
|
402
|
+
width: 100%;
|
|
393
403
|
}
|
|
394
404
|
|
|
395
405
|
&:is([disabled]) {
|
|
@@ -423,12 +433,12 @@ const NestedListDropdownList = styled(DropdownList)<{ $moveLeft?: boolean }>`
|
|
|
423
433
|
${(props) => (props.$moveLeft && 'right: 30%;') || 'left: 100%;'}
|
|
424
434
|
`
|
|
425
435
|
|
|
426
|
-
const UploadButton = styled(
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
436
|
+
const UploadButton = styled(Button)`
|
|
437
|
+
&& {
|
|
438
|
+
border-top: 1px solid #f2f2f2;
|
|
439
|
+
padding: ${(props) => props.theme.grid.unit * 4}px;
|
|
440
|
+
justify-content: flex-start;
|
|
441
|
+
width: 100%;
|
|
442
|
+
border-radius: 0;
|
|
433
443
|
}
|
|
434
444
|
`
|
|
@@ -19,13 +19,11 @@ import {
|
|
|
19
19
|
AddIcon,
|
|
20
20
|
AddNewIcon,
|
|
21
21
|
ButtonGroup,
|
|
22
|
-
IconTextButton,
|
|
23
|
-
PrimaryButton,
|
|
24
|
-
SecondaryButton,
|
|
25
22
|
withFocusTrap,
|
|
26
23
|
withListNavigation,
|
|
27
24
|
withNavigableListItem,
|
|
28
25
|
} from '@manuscripts/style-guide'
|
|
26
|
+
import { Button } from '@manuscripts/style-guide/mui'
|
|
29
27
|
import { isDeleted } from '@manuscripts/track-changes-plugin'
|
|
30
28
|
import { FootnoteNode, InlineFootnoteNode } from '@manuscripts/transform'
|
|
31
29
|
import React, { useState } from 'react'
|
|
@@ -131,19 +129,20 @@ export const FootnotesSelector: React.FC<FootnotesSelectorProps> = ({
|
|
|
131
129
|
</NotesContainer>
|
|
132
130
|
<Actions>
|
|
133
131
|
<AddNewFootnote>
|
|
134
|
-
<
|
|
135
|
-
<AddNewIcon />
|
|
132
|
+
<Button variant="tertiary" onClick={onAdd} startIcon={<AddNewIcon />}>
|
|
136
133
|
Add new
|
|
137
|
-
</
|
|
134
|
+
</Button>
|
|
138
135
|
</AddNewFootnote>
|
|
139
136
|
<ButtonGroup>
|
|
140
|
-
<
|
|
141
|
-
|
|
137
|
+
<Button variant="secondary" onClick={onCancel}>
|
|
138
|
+
Cancel
|
|
139
|
+
</Button>
|
|
140
|
+
<Button
|
|
142
141
|
onClick={handleClick}
|
|
143
142
|
disabled={selections.size === 0 && !inlineFootnote}
|
|
144
143
|
>
|
|
145
144
|
{inlineFootnote ? 'Update' : 'Insert'}
|
|
146
|
-
</
|
|
145
|
+
</Button>
|
|
147
146
|
</ButtonGroup>
|
|
148
147
|
</Actions>
|
|
149
148
|
</Container>
|
|
@@ -19,12 +19,11 @@ import {
|
|
|
19
19
|
FormContainer,
|
|
20
20
|
FormRow,
|
|
21
21
|
Label,
|
|
22
|
-
PrimaryButton,
|
|
23
|
-
SecondaryButton,
|
|
24
22
|
TextField,
|
|
25
23
|
InputErrorText,
|
|
26
24
|
withFocusTrap,
|
|
27
25
|
} from '@manuscripts/style-guide'
|
|
26
|
+
import { Button } from '@manuscripts/style-guide/mui'
|
|
28
27
|
import React, { useCallback, useState } from 'react'
|
|
29
28
|
import styled from 'styled-components'
|
|
30
29
|
|
|
@@ -46,7 +45,7 @@ const ActionGroup = styled.span`
|
|
|
46
45
|
}
|
|
47
46
|
`
|
|
48
47
|
|
|
49
|
-
const RemoveButton = styled(
|
|
48
|
+
const RemoveButton = styled(Button)`
|
|
50
49
|
display: flex;
|
|
51
50
|
justify-content: space-between;
|
|
52
51
|
align-items: center;
|
|
@@ -201,17 +200,21 @@ export const LinkForm: React.FC<LinkFormProps> = ({
|
|
|
201
200
|
|
|
202
201
|
<Actions>
|
|
203
202
|
<ActionGroup>
|
|
204
|
-
<RemoveButton
|
|
203
|
+
<RemoveButton
|
|
204
|
+
variant="secondary"
|
|
205
|
+
type={'button'}
|
|
206
|
+
onClick={onRemove}
|
|
207
|
+
>
|
|
205
208
|
<DeleteIcon />
|
|
206
209
|
<span>Remove Link</span>
|
|
207
210
|
</RemoveButton>
|
|
208
211
|
</ActionGroup>
|
|
209
212
|
|
|
210
213
|
<ActionGroup>
|
|
211
|
-
<
|
|
214
|
+
<Button variant="secondary" type={'button'} onClick={onCancel}>
|
|
212
215
|
Cancel
|
|
213
|
-
</
|
|
214
|
-
<
|
|
216
|
+
</Button>
|
|
217
|
+
<Button type={'submit'}>Save</Button>
|
|
215
218
|
</ActionGroup>
|
|
216
219
|
</Actions>
|
|
217
220
|
</FormContainer>
|
|
@@ -17,9 +17,9 @@ import {
|
|
|
17
17
|
Category,
|
|
18
18
|
DeleteIcon,
|
|
19
19
|
Dialog,
|
|
20
|
-
IconTextButton,
|
|
21
20
|
PlusIcon,
|
|
22
21
|
} from '@manuscripts/style-guide'
|
|
22
|
+
import { Button } from '@manuscripts/style-guide/mui'
|
|
23
23
|
import { skipTracking } from '@manuscripts/track-changes-plugin'
|
|
24
24
|
import { schema } from '@manuscripts/transform'
|
|
25
25
|
import { Command, EditorState } from 'prosemirror-state'
|
|
@@ -125,15 +125,20 @@ export const ContextMenu: React.FC<{
|
|
|
125
125
|
return (
|
|
126
126
|
<MenuDropdownList className={'table-ctx'}>
|
|
127
127
|
<ActionButton
|
|
128
|
+
variant="tertiary"
|
|
128
129
|
disabled={isHeaderCellSelected(view.state)}
|
|
129
130
|
onClick={() => runCommand(addRows('top'))}
|
|
130
131
|
>
|
|
131
132
|
<PlusIcon /> Insert {rows} above
|
|
132
133
|
</ActionButton>
|
|
133
|
-
<ActionButton
|
|
134
|
+
<ActionButton
|
|
135
|
+
variant="tertiary"
|
|
136
|
+
onClick={() => runCommand(addRows('bottom'))}
|
|
137
|
+
>
|
|
134
138
|
<PlusIcon /> Insert {rows} below
|
|
135
139
|
</ActionButton>
|
|
136
140
|
<ActionButton
|
|
141
|
+
variant="tertiary"
|
|
137
142
|
onClick={() =>
|
|
138
143
|
showWarningForTCPlugin(setColumnAction, () => addColumns('left'))
|
|
139
144
|
}
|
|
@@ -141,6 +146,7 @@ export const ContextMenu: React.FC<{
|
|
|
141
146
|
<PlusIcon /> Insert {columns} to the left
|
|
142
147
|
</ActionButton>
|
|
143
148
|
<ActionButton
|
|
149
|
+
variant="tertiary"
|
|
144
150
|
onClick={() =>
|
|
145
151
|
showWarningForTCPlugin(setColumnAction, () => addColumns('right'))
|
|
146
152
|
}
|
|
@@ -149,6 +155,7 @@ export const ContextMenu: React.FC<{
|
|
|
149
155
|
</ActionButton>
|
|
150
156
|
<Separator />
|
|
151
157
|
<ActionButton
|
|
158
|
+
variant="tertiary"
|
|
152
159
|
disabled={count.rows !== 1}
|
|
153
160
|
onClick={() => runCommand(addHeaderRow(headerPosition))}
|
|
154
161
|
>
|
|
@@ -156,6 +163,7 @@ export const ContextMenu: React.FC<{
|
|
|
156
163
|
</ActionButton>
|
|
157
164
|
<Separator />
|
|
158
165
|
<ActionButton
|
|
166
|
+
variant="tertiary"
|
|
159
167
|
onClick={() =>
|
|
160
168
|
showWarningForTCPlugin(setRowDeleteAction, () => deleteRow)
|
|
161
169
|
}
|
|
@@ -164,6 +172,7 @@ export const ContextMenu: React.FC<{
|
|
|
164
172
|
{isHeaderCellSelected(view.state) ? ' header ' : ''} {rows}
|
|
165
173
|
</ActionButton>
|
|
166
174
|
<ActionButton
|
|
175
|
+
variant="tertiary"
|
|
167
176
|
onClick={() =>
|
|
168
177
|
showWarningForTCPlugin(setColumnAction, () => deleteColumn)
|
|
169
178
|
}
|
|
@@ -172,12 +181,18 @@ export const ContextMenu: React.FC<{
|
|
|
172
181
|
</ActionButton>
|
|
173
182
|
{(isCellSelectionMerged || isCellSelectionSplittable) && <Separator />}
|
|
174
183
|
{isCellSelectionMerged && (
|
|
175
|
-
<ActionButton
|
|
184
|
+
<ActionButton
|
|
185
|
+
variant="tertiary"
|
|
186
|
+
onClick={() => runCommand(mergeCells, true)}
|
|
187
|
+
>
|
|
176
188
|
Merge cells
|
|
177
189
|
</ActionButton>
|
|
178
190
|
)}
|
|
179
191
|
{isCellSelectionSplittable && (
|
|
180
|
-
<ActionButton
|
|
192
|
+
<ActionButton
|
|
193
|
+
variant="tertiary"
|
|
194
|
+
onClick={() => runCommand(splitCell, true)}
|
|
195
|
+
>
|
|
181
196
|
Split cells
|
|
182
197
|
</ActionButton>
|
|
183
198
|
)}
|
|
@@ -213,12 +228,11 @@ const MenuDropdownList = styled.div`
|
|
|
213
228
|
flex-direction: column;
|
|
214
229
|
`
|
|
215
230
|
|
|
216
|
-
const ActionButton = styled(
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
background: #f2fbfc;
|
|
231
|
+
const ActionButton = styled(Button)`
|
|
232
|
+
&& {
|
|
233
|
+
padding: 8px 16px;
|
|
234
|
+
justify-content: flex-start;
|
|
235
|
+
width: 100%;
|
|
222
236
|
}
|
|
223
237
|
&:disabled {
|
|
224
238
|
color: #353535;
|
package/src/versions.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { MuiThemeProvider, muiTheme } from '@manuscripts/style-guide/mui'
|
|
17
18
|
import { ManuscriptEditorView, ManuscriptNode } from '@manuscripts/transform'
|
|
18
19
|
import React from 'react'
|
|
19
20
|
import { flushSync } from 'react-dom'
|
|
@@ -92,16 +93,18 @@ function createView<T extends Trackable<ManuscriptNode>>(
|
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
return (
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
<MuiThemeProvider theme={muiTheme}>
|
|
97
|
+
<ThemeProvider theme={props.theme}>
|
|
98
|
+
<Component
|
|
99
|
+
nodeAttrs={node.attrs}
|
|
100
|
+
setNodeAttrs={setNodeAttrs}
|
|
101
|
+
viewProps={{ node, view, getPos }}
|
|
102
|
+
container={container}
|
|
103
|
+
{...props}
|
|
104
|
+
{...componentProps}
|
|
105
|
+
/>
|
|
106
|
+
</ThemeProvider>
|
|
107
|
+
</MuiThemeProvider>
|
|
105
108
|
)
|
|
106
109
|
}
|
|
107
110
|
return Wrapped
|
|
@@ -48,7 +48,7 @@ export class CrossReferenceView
|
|
|
48
48
|
const attrs = this.node.attrs
|
|
49
49
|
const target = attrs.rids.length ? targets.get(attrs.rids[0]) : undefined
|
|
50
50
|
|
|
51
|
-
const isSupplement = target?.type === schema.nodes.supplement.name
|
|
51
|
+
const isSupplement = target?.type === schema.nodes.supplement.name
|
|
52
52
|
const derivedLabel = isSupplement
|
|
53
53
|
? target?.caption || target?.label || ''
|
|
54
54
|
: target?.label || ''
|