@atlaskit/editor-plugin-table 10.10.4 → 10.10.6
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/CHANGELOG.md +20 -0
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +2 -0
- package/dist/cjs/pm-plugins/table-width.js +2 -18
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +2 -0
- package/dist/es2019/pm-plugins/table-width.js +2 -18
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +2 -0
- package/dist/esm/pm-plugins/table-width.js +2 -18
- package/package.json +2 -2
- package/src/nodeviews/TableComponentWithSharedState.tsx +2 -0
- package/src/pm-plugins/table-width.ts +2 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.10.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#160340](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/160340)
|
|
8
|
+
[`4abcfffdd3620`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4abcfffdd3620) -
|
|
9
|
+
Re-render TableComponentWithSharedState when `targetCellPosition` changes so that table controls
|
|
10
|
+
re-renders
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 10.10.5
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#158239](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/158239)
|
|
18
|
+
[`c2caa0af876e0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c2caa0af876e0) -
|
|
19
|
+
[ux] ED-28028 add breakout mark to expands, codeblocks and layouts for new resizing experience
|
|
20
|
+
behind the platform_editor_breakout_resizing experiment
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 10.10.4
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -27,6 +27,8 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
|
|
|
27
27
|
var hoveredRows = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredRows');
|
|
28
28
|
var isTableHovered = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isTableHovered');
|
|
29
29
|
var isWholeTableInDanger = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isWholeTableInDanger');
|
|
30
|
+
// Required so that table controls re-renders
|
|
31
|
+
(0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'targetCellPosition');
|
|
30
32
|
|
|
31
33
|
// mediaState
|
|
32
34
|
var isFullscreen = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'media.isFullscreen');
|
|
@@ -9,8 +9,8 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _steps = require("@atlaskit/adf-schema/steps");
|
|
11
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
12
|
+
var _document = require("@atlaskit/editor-common/utils/document");
|
|
12
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
|
-
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
14
14
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
15
|
var _consts = require("./table-resizing/utils/consts");
|
|
16
16
|
var _alignment = require("./utils/alignment");
|
|
@@ -54,23 +54,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
54
54
|
// and Collab service triggers a transaction to replace the empty document with the real document that should be rendered.
|
|
55
55
|
// what we need to do is to add width attr to all tables in the real document
|
|
56
56
|
// isReplaceDocumentOperation is checking if the transaction is the one that replace the empty document with the real document
|
|
57
|
-
var isReplaceDocumentOperation =
|
|
58
|
-
if (tr.getMeta('replaceDocument')) {
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
var hasStepReplacingEntireDocument = tr.steps.some(function (step) {
|
|
62
|
-
if (!(step instanceof _transform.ReplaceStep)) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
var isStepReplacingFromDocStart = step.from === 0;
|
|
66
|
-
var isStepReplacingUntilTheEndOfDocument = step.to === oldState.doc.content.size;
|
|
67
|
-
if (!isStepReplacingFromDocStart || !isStepReplacingUntilTheEndOfDocument) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
return true;
|
|
71
|
-
});
|
|
72
|
-
return hasStepReplacingEntireDocument;
|
|
73
|
-
});
|
|
57
|
+
var isReplaceDocumentOperation = (0, _document.isReplaceDocOperation)(transactions, oldState);
|
|
74
58
|
var referentialityTr = transactions.find(function (tr) {
|
|
75
59
|
return tr.getMeta('referentialityTableInserted');
|
|
76
60
|
});
|
|
@@ -21,6 +21,8 @@ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
|
21
21
|
const hoveredRows = useInternalTablePluginStateSelector(api, 'hoveredRows');
|
|
22
22
|
const isTableHovered = useInternalTablePluginStateSelector(api, 'isTableHovered');
|
|
23
23
|
const isWholeTableInDanger = useInternalTablePluginStateSelector(api, 'isWholeTableInDanger');
|
|
24
|
+
// Required so that table controls re-renders
|
|
25
|
+
useInternalTablePluginStateSelector(api, 'targetCellPosition');
|
|
24
26
|
|
|
25
27
|
// mediaState
|
|
26
28
|
const isFullscreen = useSharedPluginStateSelector(api, 'media.isFullscreen');
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
8
8
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
9
|
+
import { isReplaceDocOperation } from '@atlaskit/editor-common/utils/document';
|
|
9
10
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
10
|
-
import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
11
11
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
12
12
|
import { TABLE_MAX_WIDTH } from './table-resizing/utils/consts';
|
|
13
13
|
import { ALIGN_START } from './utils/alignment';
|
|
@@ -47,23 +47,7 @@ const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTabl
|
|
|
47
47
|
// and Collab service triggers a transaction to replace the empty document with the real document that should be rendered.
|
|
48
48
|
// what we need to do is to add width attr to all tables in the real document
|
|
49
49
|
// isReplaceDocumentOperation is checking if the transaction is the one that replace the empty document with the real document
|
|
50
|
-
const isReplaceDocumentOperation = transactions
|
|
51
|
-
if (tr.getMeta('replaceDocument')) {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
const hasStepReplacingEntireDocument = tr.steps.some(step => {
|
|
55
|
-
if (!(step instanceof ReplaceStep)) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
const isStepReplacingFromDocStart = step.from === 0;
|
|
59
|
-
const isStepReplacingUntilTheEndOfDocument = step.to === oldState.doc.content.size;
|
|
60
|
-
if (!isStepReplacingFromDocStart || !isStepReplacingUntilTheEndOfDocument) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
return true;
|
|
64
|
-
});
|
|
65
|
-
return hasStepReplacingEntireDocument;
|
|
66
|
-
});
|
|
50
|
+
const isReplaceDocumentOperation = isReplaceDocOperation(transactions, oldState);
|
|
67
51
|
const referentialityTr = transactions.find(tr => tr.getMeta('referentialityTableInserted'));
|
|
68
52
|
const shouldPatchTableWidth = fullWidthEnabled && isTableScalingEnabled;
|
|
69
53
|
const shouldPatchTableAlignment = fullWidthEnabled && isTableAlignmentEnabled;
|
|
@@ -21,6 +21,8 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
|
21
21
|
var hoveredRows = useInternalTablePluginStateSelector(api, 'hoveredRows');
|
|
22
22
|
var isTableHovered = useInternalTablePluginStateSelector(api, 'isTableHovered');
|
|
23
23
|
var isWholeTableInDanger = useInternalTablePluginStateSelector(api, 'isWholeTableInDanger');
|
|
24
|
+
// Required so that table controls re-renders
|
|
25
|
+
useInternalTablePluginStateSelector(api, 'targetCellPosition');
|
|
24
26
|
|
|
25
27
|
// mediaState
|
|
26
28
|
var isFullscreen = useSharedPluginStateSelector(api, 'media.isFullscreen');
|
|
@@ -11,8 +11,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
11
11
|
|
|
12
12
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
13
13
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
14
|
+
import { isReplaceDocOperation } from '@atlaskit/editor-common/utils/document';
|
|
14
15
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
15
|
-
import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
16
16
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
17
17
|
import { TABLE_MAX_WIDTH } from './table-resizing/utils/consts';
|
|
18
18
|
import { ALIGN_START } from './utils/alignment';
|
|
@@ -49,23 +49,7 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
49
49
|
// and Collab service triggers a transaction to replace the empty document with the real document that should be rendered.
|
|
50
50
|
// what we need to do is to add width attr to all tables in the real document
|
|
51
51
|
// isReplaceDocumentOperation is checking if the transaction is the one that replace the empty document with the real document
|
|
52
|
-
var isReplaceDocumentOperation = transactions
|
|
53
|
-
if (tr.getMeta('replaceDocument')) {
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
var hasStepReplacingEntireDocument = tr.steps.some(function (step) {
|
|
57
|
-
if (!(step instanceof ReplaceStep)) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
var isStepReplacingFromDocStart = step.from === 0;
|
|
61
|
-
var isStepReplacingUntilTheEndOfDocument = step.to === oldState.doc.content.size;
|
|
62
|
-
if (!isStepReplacingFromDocStart || !isStepReplacingUntilTheEndOfDocument) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
return true;
|
|
66
|
-
});
|
|
67
|
-
return hasStepReplacingEntireDocument;
|
|
68
|
-
});
|
|
52
|
+
var isReplaceDocumentOperation = isReplaceDocOperation(transactions, oldState);
|
|
69
53
|
var referentialityTr = transactions.find(function (tr) {
|
|
70
54
|
return tr.getMeta('referentialityTableInserted');
|
|
71
55
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "10.10.
|
|
3
|
+
"version": "10.10.6",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
55
55
|
"@atlaskit/primitives": "^14.8.0",
|
|
56
56
|
"@atlaskit/theme": "^18.0.0",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
57
|
+
"@atlaskit/tmp-editor-statsig": "^4.25.0",
|
|
58
58
|
"@atlaskit/toggle": "^15.0.0",
|
|
59
59
|
"@atlaskit/tokens": "^4.9.0",
|
|
60
60
|
"@atlaskit/tooltip": "^20.0.0",
|
|
@@ -52,6 +52,8 @@ const useSharedState = sharedPluginStateHookMigratorFactory(
|
|
|
52
52
|
const hoveredRows = useInternalTablePluginStateSelector(api, 'hoveredRows');
|
|
53
53
|
const isTableHovered = useInternalTablePluginStateSelector(api, 'isTableHovered');
|
|
54
54
|
const isWholeTableInDanger = useInternalTablePluginStateSelector(api, 'isWholeTableInDanger');
|
|
55
|
+
// Required so that table controls re-renders
|
|
56
|
+
useInternalTablePluginStateSelector(api, 'targetCellPosition');
|
|
55
57
|
|
|
56
58
|
// mediaState
|
|
57
59
|
const isFullscreen = useSharedPluginStateSelector(api, 'media.isFullscreen');
|
|
@@ -8,8 +8,8 @@ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
|
8
8
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
10
10
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
11
|
+
import { isReplaceDocOperation } from '@atlaskit/editor-common/utils/document';
|
|
11
12
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
12
|
-
import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
13
13
|
import {
|
|
14
14
|
akEditorDefaultLayoutWidth,
|
|
15
15
|
akEditorFullWidthLayoutWidth,
|
|
@@ -19,12 +19,6 @@ import {
|
|
|
19
19
|
import { TABLE_MAX_WIDTH } from './table-resizing/utils/consts';
|
|
20
20
|
import { ALIGN_START } from './utils/alignment';
|
|
21
21
|
|
|
22
|
-
type __ReplaceStep = ReplaceStep & {
|
|
23
|
-
// Properties `to` and `from` are private attributes of ReplaceStep.
|
|
24
|
-
to: number;
|
|
25
|
-
from: number;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
22
|
type TableWidthPluginState = {
|
|
29
23
|
resizing: boolean;
|
|
30
24
|
tableLocalId: string;
|
|
@@ -75,28 +69,7 @@ const createPlugin = (
|
|
|
75
69
|
// and Collab service triggers a transaction to replace the empty document with the real document that should be rendered.
|
|
76
70
|
// what we need to do is to add width attr to all tables in the real document
|
|
77
71
|
// isReplaceDocumentOperation is checking if the transaction is the one that replace the empty document with the real document
|
|
78
|
-
const isReplaceDocumentOperation = transactions
|
|
79
|
-
if (tr.getMeta('replaceDocument')) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const hasStepReplacingEntireDocument = tr.steps.some((step) => {
|
|
84
|
-
if (!(step instanceof ReplaceStep)) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const isStepReplacingFromDocStart = (step as __ReplaceStep).from === 0;
|
|
89
|
-
const isStepReplacingUntilTheEndOfDocument =
|
|
90
|
-
(step as __ReplaceStep).to === oldState.doc.content.size;
|
|
91
|
-
|
|
92
|
-
if (!isStepReplacingFromDocStart || !isStepReplacingUntilTheEndOfDocument) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
return true;
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
return hasStepReplacingEntireDocument;
|
|
99
|
-
});
|
|
72
|
+
const isReplaceDocumentOperation = isReplaceDocOperation(transactions, oldState);
|
|
100
73
|
|
|
101
74
|
const referentialityTr = transactions.find((tr) => tr.getMeta('referentialityTableInserted'));
|
|
102
75
|
|