@atlaskit/editor-plugin-table 11.1.0 → 11.1.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/CHANGELOG.md +15 -0
- package/dist/cjs/nodeviews/TableComponent.js +11 -8
- package/dist/es2019/nodeviews/TableComponent.js +11 -6
- package/dist/esm/nodeviews/TableComponent.js +10 -7
- package/dist/types/nodeviews/TableComponent.d.ts +0 -4
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +0 -4
- package/package.json +6 -6
- package/src/nodeviews/TableComponent.tsx +11 -6
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 11.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 11.1.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#185075](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/185075)
|
|
14
|
+
[`0ffa67091b61f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0ffa67091b61f) -
|
|
15
|
+
Adds resiliency for consumers that end up with multiple table plugins
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 11.1.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default =
|
|
7
|
+
exports.default = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -76,12 +76,15 @@ var isOverflowAnalyticsEnabled = false;
|
|
|
76
76
|
// Prevent unnecessary parentWidth updates when table is nested inside of a node that is nested itself.
|
|
77
77
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
78
78
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
// Generate a unique ID to prevent collisions when multiple plugin versions exist on the same page
|
|
80
|
+
var generateUniqueTableId = function generateUniqueTableId() {
|
|
81
|
+
// Use crypto.randomUUID() if available, fallback to Math.random() based approach
|
|
82
|
+
if (!globalThis.crypto || typeof globalThis.crypto.randomUUID !== 'function') {
|
|
83
|
+
// Fallback: for older environments (IE).
|
|
84
|
+
// Not the best fallback, but the crypto.randomUUID is widely available
|
|
85
|
+
return (Math.random() + 1).toString(36).substring(20);
|
|
86
|
+
}
|
|
87
|
+
return crypto.randomUUID();
|
|
85
88
|
};
|
|
86
89
|
|
|
87
90
|
// Ignored via go/ees005
|
|
@@ -96,7 +99,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
96
99
|
parentWidth: undefined
|
|
97
100
|
}, _types.ShadowEvent.SHOW_BEFORE_SHADOW, false), _types.ShadowEvent.SHOW_AFTER_SHADOW, false), "tableWrapperWidth", undefined), "tableWrapperHeight", undefined));
|
|
98
101
|
(0, _defineProperty3.default)(_this, "holdCompleted", false);
|
|
99
|
-
(0, _defineProperty3.default)(_this, "dispatchEventName", "tableResized-".concat(
|
|
102
|
+
(0, _defineProperty3.default)(_this, "dispatchEventName", "tableResized-".concat(generateUniqueTableId()));
|
|
100
103
|
(0, _defineProperty3.default)(_this, "handleMouseOut", function (event) {
|
|
101
104
|
if (!(0, _eventHandlers.isTableInFocus)(_this.props.view)) {
|
|
102
105
|
return false;
|
|
@@ -56,11 +56,16 @@ const isOverflowAnalyticsEnabled = false;
|
|
|
56
56
|
// Prevent unnecessary parentWidth updates when table is nested inside of a node that is nested itself.
|
|
57
57
|
const NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
58
58
|
const NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
// Generate a unique ID to prevent collisions when multiple plugin versions exist on the same page
|
|
60
|
+
const generateUniqueTableId = () => {
|
|
61
|
+
// Use crypto.randomUUID() if available, fallback to Math.random() based approach
|
|
62
|
+
if (!globalThis.crypto || typeof globalThis.crypto.randomUUID !== 'function') {
|
|
63
|
+
// Fallback: for older environments (IE).
|
|
64
|
+
// Not the best fallback, but the crypto.randomUUID is widely available
|
|
65
|
+
return (Math.random() + 1).toString(36).substring(20);
|
|
66
|
+
}
|
|
67
|
+
return crypto.randomUUID();
|
|
68
|
+
};
|
|
64
69
|
|
|
65
70
|
// Ignored via go/ees005
|
|
66
71
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -76,7 +81,7 @@ class TableComponent extends React.Component {
|
|
|
76
81
|
tableWrapperHeight: undefined
|
|
77
82
|
});
|
|
78
83
|
_defineProperty(this, "holdCompleted", false);
|
|
79
|
-
_defineProperty(this, "dispatchEventName", `tableResized-${
|
|
84
|
+
_defineProperty(this, "dispatchEventName", `tableResized-${generateUniqueTableId()}`);
|
|
80
85
|
_defineProperty(this, "handleMouseOut", event => {
|
|
81
86
|
if (!isTableInFocus(this.props.view)) {
|
|
82
87
|
return false;
|
|
@@ -70,12 +70,15 @@ var isOverflowAnalyticsEnabled = false;
|
|
|
70
70
|
// Prevent unnecessary parentWidth updates when table is nested inside of a node that is nested itself.
|
|
71
71
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
72
72
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
// Generate a unique ID to prevent collisions when multiple plugin versions exist on the same page
|
|
74
|
+
var generateUniqueTableId = function generateUniqueTableId() {
|
|
75
|
+
// Use crypto.randomUUID() if available, fallback to Math.random() based approach
|
|
76
|
+
if (!globalThis.crypto || typeof globalThis.crypto.randomUUID !== 'function') {
|
|
77
|
+
// Fallback: for older environments (IE).
|
|
78
|
+
// Not the best fallback, but the crypto.randomUUID is widely available
|
|
79
|
+
return (Math.random() + 1).toString(36).substring(20);
|
|
80
|
+
}
|
|
81
|
+
return crypto.randomUUID();
|
|
79
82
|
};
|
|
80
83
|
|
|
81
84
|
// Ignored via go/ees005
|
|
@@ -90,7 +93,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
90
93
|
parentWidth: undefined
|
|
91
94
|
}, ShadowEvent.SHOW_BEFORE_SHADOW, false), ShadowEvent.SHOW_AFTER_SHADOW, false), "tableWrapperWidth", undefined), "tableWrapperHeight", undefined));
|
|
92
95
|
_defineProperty(_this, "holdCompleted", false);
|
|
93
|
-
_defineProperty(_this, "dispatchEventName", "tableResized-".concat(
|
|
96
|
+
_defineProperty(_this, "dispatchEventName", "tableResized-".concat(generateUniqueTableId()));
|
|
94
97
|
_defineProperty(_this, "handleMouseOut", function (event) {
|
|
95
98
|
if (!isTableInFocus(_this.props.view)) {
|
|
96
99
|
return false;
|
|
@@ -40,10 +40,6 @@ interface ComponentProps {
|
|
|
40
40
|
isWholeTableInDanger?: boolean;
|
|
41
41
|
selection?: Selection;
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Exported for test purposes only
|
|
45
|
-
*/
|
|
46
|
-
export declare const _reset_tableComponentCount: () => number;
|
|
47
43
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<ComponentProps>> & {
|
|
48
44
|
WrappedComponent: React.ComponentType<ComponentProps>;
|
|
49
45
|
};
|
|
@@ -40,10 +40,6 @@ interface ComponentProps {
|
|
|
40
40
|
isWholeTableInDanger?: boolean;
|
|
41
41
|
selection?: Selection;
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Exported for test purposes only
|
|
45
|
-
*/
|
|
46
|
-
export declare const _reset_tableComponentCount: () => number;
|
|
47
43
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<ComponentProps>> & {
|
|
48
44
|
WrappedComponent: React.ComponentType<ComponentProps>;
|
|
49
45
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.2",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"singleton": true
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@atlaskit/adf-schema": "^49.0.
|
|
31
|
+
"@atlaskit/adf-schema": "^49.0.6",
|
|
32
32
|
"@atlaskit/button": "^23.2.0",
|
|
33
33
|
"@atlaskit/custom-steps": "^0.11.0",
|
|
34
34
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
53
53
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
54
54
|
"@atlaskit/primitives": "^14.10.0",
|
|
55
|
-
"@atlaskit/react-ufo": "^
|
|
55
|
+
"@atlaskit/react-ufo": "^4.0.0",
|
|
56
56
|
"@atlaskit/theme": "^19.0.0",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^9.
|
|
57
|
+
"@atlaskit/tmp-editor-statsig": "^9.6.0",
|
|
58
58
|
"@atlaskit/toggle": "^15.0.0",
|
|
59
|
-
"@atlaskit/tokens": "^5.
|
|
59
|
+
"@atlaskit/tokens": "^5.5.0",
|
|
60
60
|
"@atlaskit/tooltip": "^20.3.0",
|
|
61
61
|
"@babel/runtime": "^7.0.0",
|
|
62
62
|
"@emotion/react": "^11.7.1",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"uuid": "^3.1.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@atlaskit/editor-common": "^107.
|
|
70
|
+
"@atlaskit/editor-common": "^107.8.0",
|
|
71
71
|
"react": "^18.2.0",
|
|
72
72
|
"react-dom": "^18.2.0",
|
|
73
73
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -148,11 +148,16 @@ interface TableState {
|
|
|
148
148
|
tableWrapperHeight?: number;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
// Generate a unique ID to prevent collisions when multiple plugin versions exist on the same page
|
|
152
|
+
const generateUniqueTableId = () => {
|
|
153
|
+
// Use crypto.randomUUID() if available, fallback to Math.random() based approach
|
|
154
|
+
if (!globalThis.crypto || typeof globalThis.crypto.randomUUID !== 'function') {
|
|
155
|
+
// Fallback: for older environments (IE).
|
|
156
|
+
// Not the best fallback, but the crypto.randomUUID is widely available
|
|
157
|
+
return (Math.random() + 1).toString(36).substring(20);
|
|
158
|
+
}
|
|
159
|
+
return crypto.randomUUID();
|
|
160
|
+
};
|
|
156
161
|
|
|
157
162
|
// Ignored via go/ees005
|
|
158
163
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -191,7 +196,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
191
196
|
private dragAndDropCleanupFn?: CleanupFn;
|
|
192
197
|
private nodeVisibilityObserverCleanupFn?: CleanupFn;
|
|
193
198
|
private holdCompleted = false;
|
|
194
|
-
private dispatchEventName = `tableResized-${
|
|
199
|
+
private dispatchEventName = `tableResized-${generateUniqueTableId()}`;
|
|
195
200
|
|
|
196
201
|
constructor(props: ComponentProps) {
|
|
197
202
|
super(props);
|
|
@@ -116,7 +116,7 @@ export const ColumnControls = ({
|
|
|
116
116
|
const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
117
117
|
|
|
118
118
|
const rowControlStickyTop = 45;
|
|
119
|
-
const marginTop = hasHeaderRow && stickyTop !== undefined ?
|
|
119
|
+
const marginTop = hasHeaderRow && stickyTop !== undefined ? rowControlStickyTop ?? 0 : 0;
|
|
120
120
|
|
|
121
121
|
const handleClick = useCallback(
|
|
122
122
|
(event: MouseEvent) => {
|