@manuscripts/body-editor 3.18.1 → 3.18.3

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.
@@ -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 onClick={() => runCommand(addRows('bottom'))}>
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 onClick={() => runCommand(mergeCells, true)}>
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 onClick={() => runCommand(splitCell, true)}>
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(IconTextButton)`
217
- padding: 8px 16px;
218
- justify-content: flex-start;
219
-
220
- &:hover {
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/toolbar.tsx CHANGED
@@ -49,6 +49,7 @@ import {
49
49
  blockActive,
50
50
  canInsert,
51
51
  canInsertCrossReference,
52
+ canInsertInlineComment,
52
53
  Dispatch,
53
54
  insertBlock,
54
55
  insertBoxElement,
@@ -179,7 +180,9 @@ export const toolbar: ToolbarConfig = {
179
180
  comment: {
180
181
  title: 'Insert comment',
181
182
  content: <AddCommentIcon />,
182
- isEnabled: isEnabled(canInsert(schema.nodes.highlight_marker)), // TODO: check both ends of selection
183
+ isEnabled: isEnabled((state) =>
184
+ canInsertInlineComment(state.selection.$from)
185
+ ),
183
186
  run: addInlineComment,
184
187
  },
185
188
  cross_reference: {
package/src/versions.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  //THIS FILE WAS GENERATED BY versions.mjs
2
- export const VERSION = '3.18.1';
2
+ export const VERSION = '3.18.3';
3
3
  export const MATHJAX_VERSION = '3.2.2';
@@ -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
- <ThemeProvider theme={props.theme}>
96
- <Component
97
- nodeAttrs={node.attrs}
98
- setNodeAttrs={setNodeAttrs}
99
- viewProps={{ node, view, getPos }}
100
- container={container}
101
- {...props}
102
- {...componentProps}
103
- />
104
- </ThemeProvider>
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 || ''