@atlaskit/editor-plugin-table 7.6.11 → 7.6.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.6.11",
3
+ "version": "7.6.12",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,11 +30,12 @@
30
30
  "dependencies": {
31
31
  "@atlaskit/adf-schema": "^35.8.0",
32
32
  "@atlaskit/custom-steps": "^0.0.17",
33
- "@atlaskit/editor-common": "^78.23.0",
33
+ "@atlaskit/editor-common": "^78.24.0",
34
34
  "@atlaskit/editor-palette": "1.5.3",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.0.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
37
37
  "@atlaskit/editor-plugin-content-insertion": "^1.0.0",
38
+ "@atlaskit/editor-plugin-editor-viewmode": "^1.0.0",
38
39
  "@atlaskit/editor-plugin-guideline": "^1.0.0",
39
40
  "@atlaskit/editor-plugin-selection": "^1.1.0",
40
41
  "@atlaskit/editor-plugin-width": "^1.0.0",
@@ -5,6 +5,7 @@ import classNames from 'classnames';
5
5
 
6
6
  import type { TableEventPayload } from '@atlaskit/editor-common/analytics';
7
7
  import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
8
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
8
9
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
9
10
  import { calcTableWidth } from '@atlaskit/editor-common/styles';
10
11
  import type { EditorContainerWidth } from '@atlaskit/editor-common/types';
@@ -180,6 +181,9 @@ export const ResizableTableContainer = React.memo(
180
181
  );
181
182
 
182
183
  const tableWidth = getTableContainerWidth(node);
184
+ const { editorViewModeState } = useSharedPluginState(pluginInjectionApi, [
185
+ 'editorViewMode',
186
+ ]);
183
187
 
184
188
  // 76 is currently an accepted padding value considering the spacing for resizer handle
185
189
  const responsiveContainerWidth = isTableScalingEnabled
@@ -239,11 +243,17 @@ export const ResizableTableContainer = React.memo(
239
243
  className={ClassName.TABLE_RESIZER_CONTAINER}
240
244
  ref={containerRef}
241
245
  >
242
- <TableResizer {...tableResizerProps}>
246
+ {editorViewModeState?.mode === 'view' ? (
243
247
  <InnerContainer className={className} node={node}>
244
248
  {children}
245
249
  </InnerContainer>
246
- </TableResizer>
250
+ ) : (
251
+ <TableResizer {...tableResizerProps}>
252
+ <InnerContainer className={className} node={node}>
253
+ {children}
254
+ </InnerContainer>
255
+ </TableResizer>
256
+ )}
247
257
  </div>
248
258
  </div>
249
259
  );
package/src/plugin.tsx CHANGED
@@ -35,6 +35,7 @@ import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
35
35
  import type { AccessibilityUtilsPlugin } from '@atlaskit/editor-plugin-accessibility-utils';
36
36
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
37
37
  import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
38
+ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
38
39
  import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
39
40
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
40
41
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
@@ -141,6 +142,7 @@ export type TablePlugin = NextEditorPlugin<
141
142
  GuidelinePlugin,
142
143
  SelectionPlugin,
143
144
  OptionalPlugin<MediaPlugin>,
145
+ OptionalPlugin<EditorViewModePlugin>,
144
146
  ];
145
147
  }
146
148
  >;
@@ -352,7 +352,10 @@ export const createPlugin = (
352
352
 
353
353
  if (
354
354
  targetClassList.contains(ClassName.CONTROLS_BUTTON) ||
355
- targetClassList.contains(ClassName.CONTEXTUAL_MENU_BUTTON)
355
+ targetClassList.contains(ClassName.CONTEXTUAL_MENU_BUTTON) ||
356
+ targetClassList.contains(
357
+ ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE,
358
+ )
356
359
  ) {
357
360
  return true;
358
361
  }
@@ -227,6 +227,15 @@ const DragHandleComponent = ({
227
227
  alignSelf: isColumn ? 'none' : 'center',
228
228
  zIndex: isColumn ? '-1' : 'auto',
229
229
  }}
230
+ onMouseUp={(e) => {
231
+ // should toggle menu if current drag menu open.
232
+ // return focus to editor so copying table selections whilst still works, i cannot call e.preventDefault in a mousemove event as this stops dragstart events from firing
233
+ // -> this is bad for a11y but is the current standard new copy/paste keyboard shortcuts should be introduced instead
234
+ editorView.focus();
235
+ if (isDragMenuOpen) {
236
+ toggleDragMenu && toggleDragMenu('mouse', e);
237
+ }
238
+ }}
230
239
  onClick={onClick}
231
240
  />
232
241
  <button
package/tsconfig.app.json CHANGED
@@ -51,6 +51,9 @@
51
51
  {
52
52
  "path": "../editor-plugin-content-insertion/tsconfig.app.json"
53
53
  },
54
+ {
55
+ "path": "../editor-plugin-editor-viewmode/tsconfig.app.json"
56
+ },
54
57
  {
55
58
  "path": "../editor-plugin-guideline/tsconfig.app.json"
56
59
  },