@atlaskit/editor-plugin-table 2.10.0 → 2.10.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +9 -3
  3. package/dist/cjs/plugins/table/nodeviews/TableContainer.js +9 -2
  4. package/dist/cjs/plugins/table/nodeviews/TableResizer.js +5 -1
  5. package/dist/cjs/plugins/table/nodeviews/table.js +4 -2
  6. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +9 -3
  7. package/dist/es2019/plugins/table/nodeviews/TableContainer.js +10 -3
  8. package/dist/es2019/plugins/table/nodeviews/TableResizer.js +6 -1
  9. package/dist/es2019/plugins/table/nodeviews/table.js +3 -1
  10. package/dist/esm/plugins/table/nodeviews/TableComponent.js +9 -3
  11. package/dist/esm/plugins/table/nodeviews/TableContainer.js +10 -3
  12. package/dist/esm/plugins/table/nodeviews/TableResizer.js +5 -1
  13. package/dist/esm/plugins/table/nodeviews/table.js +4 -2
  14. package/dist/types/plugins/table/nodeviews/TableContainer.d.ts +4 -2
  15. package/dist/types/plugins/table/nodeviews/table.d.ts +4 -4
  16. package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +4 -2
  17. package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +4 -4
  18. package/package.json +3 -3
  19. package/src/__tests__/unit/commands/go-to-next-cell.ts +5 -5
  20. package/src/__tests__/unit/commands/insert.ts +5 -5
  21. package/src/__tests__/unit/commands/misc.ts +6 -8
  22. package/src/__tests__/unit/copy-paste.ts +10 -13
  23. package/src/__tests__/unit/event-handlers/index.ts +6 -6
  24. package/src/__tests__/unit/handlers.ts +6 -5
  25. package/src/__tests__/unit/hover-selection.ts +7 -6
  26. package/src/__tests__/unit/layout.ts +6 -6
  27. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +23 -23
  28. package/src/__tests__/unit/sort-column.ts +5 -5
  29. package/src/__tests__/unit/transforms/delete-columns.ts +6 -6
  30. package/src/__tests__/unit/transforms/delete-rows.ts +6 -6
  31. package/src/__tests__/unit/transforms/merging.ts +5 -5
  32. package/src/__tests__/unit/ui/TableFloatingControls.tsx +5 -5
  33. package/src/__tests__/unit/utils.ts +5 -5
  34. package/src/plugins/table/nodeviews/TableComponent.tsx +20 -3
  35. package/src/plugins/table/nodeviews/TableContainer.tsx +19 -3
  36. package/src/plugins/table/nodeviews/TableResizer.tsx +3 -0
  37. package/src/plugins/table/nodeviews/table.tsx +14 -7
@@ -17,6 +17,7 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
17
17
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
18
18
  import { findTable } from '@atlaskit/editor-tables/utils';
19
19
 
20
+ import { getPluginState } from '../pm-plugins/plugin-factory';
20
21
  import {
21
22
  COLUMN_MIN_WIDTH,
22
23
  getColgroupChildrenLength,
@@ -126,6 +127,7 @@ export const TableResizer = ({
126
127
 
127
128
  const resizerMinWidth = getResizerMinWidth(node);
128
129
  const handleHeightSize = getResizerHandleHeight(tableRef);
130
+ const { isInDanger } = getPluginState(editorView.state);
129
131
 
130
132
  const { startMeasure, endMeasure, countFrames } = useMeasureFramerate();
131
133
 
@@ -331,6 +333,7 @@ export const TableResizer = ({
331
333
  innerPadding={tableHandlePosition}
332
334
  isHandleVisible={findTable(editorView.state?.selection)?.pos === getPos()}
333
335
  handleComponent={handleComponent}
336
+ appearance={isInDanger ? 'danger' : undefined}
334
337
  >
335
338
  {children}
336
339
  </ResizerNext>
@@ -12,13 +12,16 @@ import type {
12
12
  getPosHandlerNode,
13
13
  } from '@atlaskit/editor-common/types';
14
14
  import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
15
- import {
15
+ import type {
16
16
  DOMOutputSpec,
17
- DOMSerializer,
18
17
  Node as PmNode,
19
18
  } from '@atlaskit/editor-prosemirror/model';
20
- import { EditorState, PluginKey } from '@atlaskit/editor-prosemirror/state';
21
- import { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
19
+ import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
20
+ import type {
21
+ EditorState,
22
+ PluginKey,
23
+ } from '@atlaskit/editor-prosemirror/state';
24
+ import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
22
25
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
23
26
  import { TableMap } from '@atlaskit/editor-tables/table-map';
24
27
 
@@ -28,11 +31,11 @@ import { pluginKey } from '../pm-plugins/plugin-key';
28
31
  import { pluginKey as tableResizingPluginKey } from '../pm-plugins/table-resizing';
29
32
  import { generateColgroup } from '../pm-plugins/table-resizing/utils';
30
33
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
31
- import { PluginInjectionAPI } from '../types';
34
+ import type { PluginInjectionAPI } from '../types';
32
35
  import { isTableNested } from '../utils';
33
36
 
34
37
  import TableComponent from './TableComponent';
35
- import { Props, TableOptions } from './types';
38
+ import type { Props, TableOptions } from './types';
36
39
 
37
40
  type ForwardRef = (node: HTMLElement | null) => void;
38
41
 
@@ -160,7 +163,11 @@ export default class TableView extends ReactNodeView<Props> {
160
163
  this.getPos(),
161
164
  );
162
165
 
163
- if (tableInlineWidth) {
166
+ const isTableResizing = tableWidthPluginKey.getState(
167
+ this.view.state,
168
+ )?.resizing;
169
+
170
+ if (!isTableResizing && tableInlineWidth) {
164
171
  handleInlineTableWidth(this.table, tableInlineWidth);
165
172
  }
166
173
  }