@atlaskit/editor-plugin-table 15.3.12 → 15.3.14
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 +16 -0
- package/dist/cjs/nodeviews/TableComponentLegacy.js +3 -5
- package/dist/cjs/nodeviews/TableComponentNext.js +3 -5
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +0 -4
- package/dist/cjs/pm-plugins/utils/analytics.js +48 -1
- package/dist/cjs/tablePlugin.js +12 -4
- package/dist/es2019/nodeviews/TableComponentLegacy.js +3 -5
- package/dist/es2019/nodeviews/TableComponentNext.js +3 -5
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +0 -4
- package/dist/es2019/pm-plugins/utils/analytics.js +45 -0
- package/dist/es2019/tablePlugin.js +13 -5
- package/dist/esm/nodeviews/TableComponentLegacy.js +3 -5
- package/dist/esm/nodeviews/TableComponentNext.js +3 -5
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +0 -4
- package/dist/esm/pm-plugins/utils/analytics.js +47 -0
- package/dist/esm/tablePlugin.js +13 -5
- package/dist/types/pm-plugins/utils/analytics.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/utils/analytics.d.ts +1 -0
- package/package.json +13 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 15.3.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`21ffffe31e25a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/21ffffe31e25a) -
|
|
8
|
+
Cleaned platform_editor_fix_table_resizing_undo FG.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 15.3.13
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`ca454ed251e1e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ca454ed251e1e) -
|
|
16
|
+
Add table height analytics
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 15.3.12
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -257,11 +257,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
257
257
|
)(state.tr);
|
|
258
258
|
if (!isUserTriggered) {
|
|
259
259
|
(0, _collab.tintDirtyTransaction)(tr);
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
tr.setMeta('addToHistory', false);
|
|
264
|
-
}
|
|
260
|
+
// Avoid adding this transaction separately to the history as these are automatic updates
|
|
261
|
+
// as a consequence of another action
|
|
262
|
+
tr.setMeta('addToHistory', false);
|
|
265
263
|
}
|
|
266
264
|
dispatch(tr);
|
|
267
265
|
});
|
|
@@ -223,11 +223,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
223
223
|
)(state.tr);
|
|
224
224
|
if (!isUserTriggered) {
|
|
225
225
|
(0, _collab.tintDirtyTransaction)(tr);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
tr.setMeta('addToHistory', false);
|
|
230
|
-
}
|
|
226
|
+
// Avoid adding this transaction separately to the history as these are automatic updates
|
|
227
|
+
// as a consequence of another action
|
|
228
|
+
tr.setMeta('addToHistory', false);
|
|
231
229
|
}
|
|
232
230
|
dispatch(tr);
|
|
233
231
|
});
|
|
@@ -10,7 +10,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
11
11
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _columnWidth = require("../../transforms/column-width");
|
|
15
14
|
var _nodes = require("../../utils/nodes");
|
|
16
15
|
var _misc = require("../utils/misc");
|
|
@@ -178,9 +177,6 @@ var scaleTable = exports.scaleTable = function scaleTable(tableRef, options, dom
|
|
|
178
177
|
}
|
|
179
178
|
if (resizeState) {
|
|
180
179
|
tr = (0, _columnWidth.updateColumnWidths)(resizeState, node, start, api)(tr);
|
|
181
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_fix_table_resizing_undo')) {
|
|
182
|
-
tr.setMeta('addToHistory', false);
|
|
183
|
-
}
|
|
184
180
|
if (tr.docChanged) {
|
|
185
181
|
tr.setMeta('scrollIntoView', false);
|
|
186
182
|
// TODO: ED-8995 - We need to do this check to reduce the number of race conditions when working with tables.
|
|
@@ -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.generateResizedPayload = exports.generateResizeFrameRatePayloads = void 0;
|
|
7
|
+
exports.getHeightInfoPayload = exports.generateResizedPayload = exports.generateResizeFrameRatePayloads = void 0;
|
|
8
8
|
exports.getSelectedCellInfo = getSelectedCellInfo;
|
|
9
9
|
exports.getSelectedTableInfo = getSelectedTableInfo;
|
|
10
10
|
exports.withEditorAnalyticsAPI = exports.useMeasureFramerate = exports.reduceResizeFrameRateSamples = exports.getWidthInfoPayload = void 0;
|
|
@@ -256,4 +256,51 @@ var getWidthInfoPayload = exports.getWidthInfoPayload = function getWidthInfoPay
|
|
|
256
256
|
},
|
|
257
257
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
258
258
|
};
|
|
259
|
+
};
|
|
260
|
+
var getHeightInfoPayload = exports.getHeightInfoPayload = function getHeightInfoPayload(editorView) {
|
|
261
|
+
var tablesInfo = [];
|
|
262
|
+
var editorPopupScrollParent = editorView.dom.closest('.fabric-editor-popup-scroll-parent');
|
|
263
|
+
|
|
264
|
+
// don't send the event if the editor scroll parent is not available
|
|
265
|
+
if (!editorPopupScrollParent) {
|
|
266
|
+
return undefined;
|
|
267
|
+
}
|
|
268
|
+
var editorScrollParentClientHeight = editorPopupScrollParent.clientHeight;
|
|
269
|
+
var isEditorScrollable = editorPopupScrollParent.scrollHeight > editorScrollParentClientHeight;
|
|
270
|
+
editorView.state.doc.nodesBetween(0, editorView.state.doc.content.size, function (node, pos, parent) {
|
|
271
|
+
if (!tableContainerNodes.has(node.type.name)) {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
if (node.type.name === 'table') {
|
|
275
|
+
var _domAtPos$node2;
|
|
276
|
+
var domAtPos = editorView.domAtPos(pos + 1);
|
|
277
|
+
var table = (_domAtPos$node2 = domAtPos.node) === null || _domAtPos$node2 === void 0 ? void 0 : _domAtPos$node2.parentElement;
|
|
278
|
+
var isNestedTable = (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'tableCell' || (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'tableHeader';
|
|
279
|
+
if (table instanceof HTMLTableElement) {
|
|
280
|
+
tablesInfo.push({
|
|
281
|
+
isNestedTable: isNestedTable,
|
|
282
|
+
tableHeight: table.scrollHeight
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
// only send the event if there are tables on the page
|
|
289
|
+
if (tablesInfo.length === 0) {
|
|
290
|
+
return undefined;
|
|
291
|
+
}
|
|
292
|
+
var maxTableHeight = Math.max.apply(Math, (0, _toConsumableArray2.default)(tablesInfo.map(function (table) {
|
|
293
|
+
return table.tableHeight;
|
|
294
|
+
})));
|
|
295
|
+
return {
|
|
296
|
+
action: _analytics.TABLE_ACTION.TABLE_EDITOR_HEIGHT_INFO,
|
|
297
|
+
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
298
|
+
attributes: {
|
|
299
|
+
editorScrollParentClientHeight: editorScrollParentClientHeight,
|
|
300
|
+
isEditorScrollable: isEditorScrollable,
|
|
301
|
+
maxTableToEditorHeightRatio: maxTableHeight / editorScrollParentClientHeight,
|
|
302
|
+
tableHeightInfo: tablesInfo
|
|
303
|
+
},
|
|
304
|
+
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
305
|
+
};
|
|
259
306
|
};
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -430,10 +430,18 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
430
430
|
var requestIdleCallbackFn = function requestIdleCallbackFn() {
|
|
431
431
|
var _api$width$sharedStat2;
|
|
432
432
|
var editorWidth = api === null || api === void 0 || (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
|
|
433
|
-
if (
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
433
|
+
if (editorViewRef.current) {
|
|
434
|
+
if (editorWidth) {
|
|
435
|
+
var payload = (0, _analytics2.getWidthInfoPayload)(editorViewRef.current, editorWidth);
|
|
436
|
+
if (payload) {
|
|
437
|
+
dispatchAnalyticsEvent(payload);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_table_height_analytics_event')) {
|
|
441
|
+
var payloadHeight = (0, _analytics2.getHeightInfoPayload)(editorViewRef.current);
|
|
442
|
+
if (payloadHeight) {
|
|
443
|
+
dispatchAnalyticsEvent(payloadHeight);
|
|
444
|
+
}
|
|
437
445
|
}
|
|
438
446
|
}
|
|
439
447
|
};
|
|
@@ -252,11 +252,9 @@ class TableComponent extends React.Component {
|
|
|
252
252
|
)(state.tr);
|
|
253
253
|
if (!isUserTriggered) {
|
|
254
254
|
tintDirtyTransaction(tr);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
tr.setMeta('addToHistory', false);
|
|
259
|
-
}
|
|
255
|
+
// Avoid adding this transaction separately to the history as these are automatic updates
|
|
256
|
+
// as a consequence of another action
|
|
257
|
+
tr.setMeta('addToHistory', false);
|
|
260
258
|
}
|
|
261
259
|
dispatch(tr);
|
|
262
260
|
});
|
|
@@ -209,11 +209,9 @@ class TableComponent extends React.Component {
|
|
|
209
209
|
)(state.tr);
|
|
210
210
|
if (!isUserTriggered) {
|
|
211
211
|
tintDirtyTransaction(tr);
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
tr.setMeta('addToHistory', false);
|
|
216
|
-
}
|
|
212
|
+
// Avoid adding this transaction separately to the history as these are automatic updates
|
|
213
|
+
// as a consequence of another action
|
|
214
|
+
tr.setMeta('addToHistory', false);
|
|
217
215
|
}
|
|
218
216
|
dispatch(tr);
|
|
219
217
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
2
2
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { updateColumnWidths } from '../../transforms/column-width';
|
|
6
5
|
import { getTableWidth } from '../../utils/nodes';
|
|
7
6
|
import { getLayoutSize } from '../utils/misc';
|
|
@@ -164,9 +163,6 @@ export const scaleTable = (tableRef, options, domAtPos, api, isTableScalingEnabl
|
|
|
164
163
|
}
|
|
165
164
|
if (resizeState) {
|
|
166
165
|
tr = updateColumnWidths(resizeState, node, start, api)(tr);
|
|
167
|
-
if (!fg('platform_editor_fix_table_resizing_undo')) {
|
|
168
|
-
tr.setMeta('addToHistory', false);
|
|
169
|
-
}
|
|
170
166
|
if (tr.docChanged) {
|
|
171
167
|
tr.setMeta('scrollIntoView', false);
|
|
172
168
|
// TODO: ED-8995 - We need to do this check to reduce the number of race conditions when working with tables.
|
|
@@ -227,4 +227,49 @@ export const getWidthInfoPayload = (editorView, editorWidth) => {
|
|
|
227
227
|
},
|
|
228
228
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
229
229
|
};
|
|
230
|
+
};
|
|
231
|
+
export const getHeightInfoPayload = editorView => {
|
|
232
|
+
const tablesInfo = [];
|
|
233
|
+
const editorPopupScrollParent = editorView.dom.closest('.fabric-editor-popup-scroll-parent');
|
|
234
|
+
|
|
235
|
+
// don't send the event if the editor scroll parent is not available
|
|
236
|
+
if (!editorPopupScrollParent) {
|
|
237
|
+
return undefined;
|
|
238
|
+
}
|
|
239
|
+
const editorScrollParentClientHeight = editorPopupScrollParent.clientHeight;
|
|
240
|
+
const isEditorScrollable = editorPopupScrollParent.scrollHeight > editorScrollParentClientHeight;
|
|
241
|
+
editorView.state.doc.nodesBetween(0, editorView.state.doc.content.size, (node, pos, parent) => {
|
|
242
|
+
if (!tableContainerNodes.has(node.type.name)) {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
if (node.type.name === 'table') {
|
|
246
|
+
var _domAtPos$node2;
|
|
247
|
+
const domAtPos = editorView.domAtPos(pos + 1);
|
|
248
|
+
const table = (_domAtPos$node2 = domAtPos.node) === null || _domAtPos$node2 === void 0 ? void 0 : _domAtPos$node2.parentElement;
|
|
249
|
+
const isNestedTable = (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'tableCell' || (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'tableHeader';
|
|
250
|
+
if (table instanceof HTMLTableElement) {
|
|
251
|
+
tablesInfo.push({
|
|
252
|
+
isNestedTable: isNestedTable,
|
|
253
|
+
tableHeight: table.scrollHeight
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// only send the event if there are tables on the page
|
|
260
|
+
if (tablesInfo.length === 0) {
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
const maxTableHeight = Math.max(...tablesInfo.map(table => table.tableHeight));
|
|
264
|
+
return {
|
|
265
|
+
action: TABLE_ACTION.TABLE_EDITOR_HEIGHT_INFO,
|
|
266
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
267
|
+
attributes: {
|
|
268
|
+
editorScrollParentClientHeight,
|
|
269
|
+
isEditorScrollable,
|
|
270
|
+
maxTableToEditorHeightRatio: maxTableHeight / editorScrollParentClientHeight,
|
|
271
|
+
tableHeightInfo: tablesInfo
|
|
272
|
+
},
|
|
273
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
274
|
+
};
|
|
230
275
|
};
|
|
@@ -36,7 +36,7 @@ import { tableSelectionKeymapPlugin } from './pm-plugins/table-selection-keymap'
|
|
|
36
36
|
import { createPlugin as createSizeSelectorPlugin, pluginKey as sizeSelectorPluginKey } from './pm-plugins/table-size-selector';
|
|
37
37
|
import { createPlugin as createTableWidthPlugin, pluginKey as tableWidthPluginKey } from './pm-plugins/table-width';
|
|
38
38
|
import { createPlugin as createTableWidthInCommentFixPlugin } from './pm-plugins/table-width-in-comment-fix';
|
|
39
|
-
import { getWidthInfoPayload } from './pm-plugins/utils/analytics';
|
|
39
|
+
import { getHeightInfoPayload, getWidthInfoPayload } from './pm-plugins/utils/analytics';
|
|
40
40
|
import { createTableWithWidth } from './pm-plugins/utils/create';
|
|
41
41
|
import { createPlugin as createViewModeSortPlugin } from './pm-plugins/view-mode-sort';
|
|
42
42
|
import { ContentComponent } from './ui/ContentComponent';
|
|
@@ -419,10 +419,18 @@ const tablePlugin = ({
|
|
|
419
419
|
const requestIdleCallbackFn = () => {
|
|
420
420
|
var _api$width$sharedStat2;
|
|
421
421
|
const editorWidth = api === null || api === void 0 ? void 0 : (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
|
|
422
|
-
if (
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
422
|
+
if (editorViewRef.current) {
|
|
423
|
+
if (editorWidth) {
|
|
424
|
+
const payload = getWidthInfoPayload(editorViewRef.current, editorWidth);
|
|
425
|
+
if (payload) {
|
|
426
|
+
dispatchAnalyticsEvent(payload);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (fg('platform_editor_table_height_analytics_event')) {
|
|
430
|
+
const payloadHeight = getHeightInfoPayload(editorViewRef.current);
|
|
431
|
+
if (payloadHeight) {
|
|
432
|
+
dispatchAnalyticsEvent(payloadHeight);
|
|
433
|
+
}
|
|
426
434
|
}
|
|
427
435
|
}
|
|
428
436
|
};
|
|
@@ -251,11 +251,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
251
251
|
)(state.tr);
|
|
252
252
|
if (!isUserTriggered) {
|
|
253
253
|
tintDirtyTransaction(tr);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
tr.setMeta('addToHistory', false);
|
|
258
|
-
}
|
|
254
|
+
// Avoid adding this transaction separately to the history as these are automatic updates
|
|
255
|
+
// as a consequence of another action
|
|
256
|
+
tr.setMeta('addToHistory', false);
|
|
259
257
|
}
|
|
260
258
|
dispatch(tr);
|
|
261
259
|
});
|
|
@@ -217,11 +217,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
217
217
|
)(state.tr);
|
|
218
218
|
if (!isUserTriggered) {
|
|
219
219
|
tintDirtyTransaction(tr);
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
tr.setMeta('addToHistory', false);
|
|
224
|
-
}
|
|
220
|
+
// Avoid adding this transaction separately to the history as these are automatic updates
|
|
221
|
+
// as a consequence of another action
|
|
222
|
+
tr.setMeta('addToHistory', false);
|
|
225
223
|
}
|
|
226
224
|
dispatch(tr);
|
|
227
225
|
});
|
|
@@ -4,7 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
5
5
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
6
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { updateColumnWidths } from '../../transforms/column-width';
|
|
9
8
|
import { getTableWidth } from '../../utils/nodes';
|
|
10
9
|
import { getLayoutSize } from '../utils/misc';
|
|
@@ -170,9 +169,6 @@ export var scaleTable = function scaleTable(tableRef, options, domAtPos, api) {
|
|
|
170
169
|
}
|
|
171
170
|
if (resizeState) {
|
|
172
171
|
tr = updateColumnWidths(resizeState, node, start, api)(tr);
|
|
173
|
-
if (!fg('platform_editor_fix_table_resizing_undo')) {
|
|
174
|
-
tr.setMeta('addToHistory', false);
|
|
175
|
-
}
|
|
176
172
|
if (tr.docChanged) {
|
|
177
173
|
tr.setMeta('scrollIntoView', false);
|
|
178
174
|
// TODO: ED-8995 - We need to do this check to reduce the number of race conditions when working with tables.
|
|
@@ -246,4 +246,51 @@ export var getWidthInfoPayload = function getWidthInfoPayload(editorView, editor
|
|
|
246
246
|
},
|
|
247
247
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
248
248
|
};
|
|
249
|
+
};
|
|
250
|
+
export var getHeightInfoPayload = function getHeightInfoPayload(editorView) {
|
|
251
|
+
var tablesInfo = [];
|
|
252
|
+
var editorPopupScrollParent = editorView.dom.closest('.fabric-editor-popup-scroll-parent');
|
|
253
|
+
|
|
254
|
+
// don't send the event if the editor scroll parent is not available
|
|
255
|
+
if (!editorPopupScrollParent) {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
var editorScrollParentClientHeight = editorPopupScrollParent.clientHeight;
|
|
259
|
+
var isEditorScrollable = editorPopupScrollParent.scrollHeight > editorScrollParentClientHeight;
|
|
260
|
+
editorView.state.doc.nodesBetween(0, editorView.state.doc.content.size, function (node, pos, parent) {
|
|
261
|
+
if (!tableContainerNodes.has(node.type.name)) {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
if (node.type.name === 'table') {
|
|
265
|
+
var _domAtPos$node2;
|
|
266
|
+
var domAtPos = editorView.domAtPos(pos + 1);
|
|
267
|
+
var table = (_domAtPos$node2 = domAtPos.node) === null || _domAtPos$node2 === void 0 ? void 0 : _domAtPos$node2.parentElement;
|
|
268
|
+
var isNestedTable = (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'tableCell' || (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'tableHeader';
|
|
269
|
+
if (table instanceof HTMLTableElement) {
|
|
270
|
+
tablesInfo.push({
|
|
271
|
+
isNestedTable: isNestedTable,
|
|
272
|
+
tableHeight: table.scrollHeight
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// only send the event if there are tables on the page
|
|
279
|
+
if (tablesInfo.length === 0) {
|
|
280
|
+
return undefined;
|
|
281
|
+
}
|
|
282
|
+
var maxTableHeight = Math.max.apply(Math, _toConsumableArray(tablesInfo.map(function (table) {
|
|
283
|
+
return table.tableHeight;
|
|
284
|
+
})));
|
|
285
|
+
return {
|
|
286
|
+
action: TABLE_ACTION.TABLE_EDITOR_HEIGHT_INFO,
|
|
287
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
288
|
+
attributes: {
|
|
289
|
+
editorScrollParentClientHeight: editorScrollParentClientHeight,
|
|
290
|
+
isEditorScrollable: isEditorScrollable,
|
|
291
|
+
maxTableToEditorHeightRatio: maxTableHeight / editorScrollParentClientHeight,
|
|
292
|
+
tableHeightInfo: tablesInfo
|
|
293
|
+
},
|
|
294
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
295
|
+
};
|
|
249
296
|
};
|
package/dist/esm/tablePlugin.js
CHANGED
|
@@ -39,7 +39,7 @@ import { tableSelectionKeymapPlugin } from './pm-plugins/table-selection-keymap'
|
|
|
39
39
|
import { createPlugin as createSizeSelectorPlugin, pluginKey as sizeSelectorPluginKey } from './pm-plugins/table-size-selector';
|
|
40
40
|
import { createPlugin as createTableWidthPlugin, pluginKey as tableWidthPluginKey } from './pm-plugins/table-width';
|
|
41
41
|
import { createPlugin as createTableWidthInCommentFixPlugin } from './pm-plugins/table-width-in-comment-fix';
|
|
42
|
-
import { getWidthInfoPayload } from './pm-plugins/utils/analytics';
|
|
42
|
+
import { getHeightInfoPayload, getWidthInfoPayload } from './pm-plugins/utils/analytics';
|
|
43
43
|
import { createTableWithWidth } from './pm-plugins/utils/create';
|
|
44
44
|
import { createPlugin as createViewModeSortPlugin } from './pm-plugins/view-mode-sort';
|
|
45
45
|
import { ContentComponent } from './ui/ContentComponent';
|
|
@@ -421,10 +421,18 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
421
421
|
var requestIdleCallbackFn = function requestIdleCallbackFn() {
|
|
422
422
|
var _api$width$sharedStat2;
|
|
423
423
|
var editorWidth = api === null || api === void 0 || (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
|
|
424
|
-
if (
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
424
|
+
if (editorViewRef.current) {
|
|
425
|
+
if (editorWidth) {
|
|
426
|
+
var payload = getWidthInfoPayload(editorViewRef.current, editorWidth);
|
|
427
|
+
if (payload) {
|
|
428
|
+
dispatchAnalyticsEvent(payload);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (fg('platform_editor_table_height_analytics_event')) {
|
|
432
|
+
var payloadHeight = getHeightInfoPayload(editorViewRef.current);
|
|
433
|
+
if (payloadHeight) {
|
|
434
|
+
dispatchAnalyticsEvent(payloadHeight);
|
|
435
|
+
}
|
|
428
436
|
}
|
|
429
437
|
}
|
|
430
438
|
};
|
|
@@ -45,4 +45,5 @@ export declare const useMeasureFramerate: (config?: UseMeasureFramerateConfig) =
|
|
|
45
45
|
countFrames: () => void;
|
|
46
46
|
};
|
|
47
47
|
export declare const getWidthInfoPayload: (editorView: EditorView, editorWidth: number) => TableEventPayload | undefined;
|
|
48
|
+
export declare const getHeightInfoPayload: (editorView: EditorView) => TableEventPayload | undefined;
|
|
48
49
|
export {};
|
|
@@ -45,4 +45,5 @@ export declare const useMeasureFramerate: (config?: UseMeasureFramerateConfig) =
|
|
|
45
45
|
countFrames: () => void;
|
|
46
46
|
};
|
|
47
47
|
export declare const getWidthInfoPayload: (editorView: EditorView, editorWidth: number) => TableEventPayload | undefined;
|
|
48
|
+
export declare const getHeightInfoPayload: (editorView: EditorView) => TableEventPayload | undefined;
|
|
48
49
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "15.3.
|
|
3
|
+
"version": "15.3.14",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^51.3.2",
|
|
32
|
-
"@atlaskit/button": "^23.
|
|
32
|
+
"@atlaskit/button": "^23.6.0",
|
|
33
33
|
"@atlaskit/custom-steps": "^0.16.0",
|
|
34
34
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^6.0.0",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-batch-attribute-updates": "^6.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-content-insertion": "^6.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
|
|
40
|
-
"@atlaskit/editor-plugin-extension": "9.2.
|
|
40
|
+
"@atlaskit/editor-plugin-extension": "9.2.1",
|
|
41
41
|
"@atlaskit/editor-plugin-guideline": "^6.0.0",
|
|
42
|
-
"@atlaskit/editor-plugin-interaction": "^
|
|
42
|
+
"@atlaskit/editor-plugin-interaction": "^10.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-limited-mode": "^3.1.0",
|
|
44
44
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
45
45
|
"@atlaskit/editor-plugin-toolbar": "^3.4.0",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"@atlaskit/primitives": "^16.1.0",
|
|
60
60
|
"@atlaskit/react-ufo": "^4.14.0",
|
|
61
61
|
"@atlaskit/theme": "^21.0.0",
|
|
62
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
62
|
+
"@atlaskit/tmp-editor-statsig": "^13.32.0",
|
|
63
63
|
"@atlaskit/toggle": "^15.1.0",
|
|
64
|
-
"@atlaskit/tokens": "^
|
|
65
|
-
"@atlaskit/tooltip": "^20.
|
|
64
|
+
"@atlaskit/tokens": "^8.0.0",
|
|
65
|
+
"@atlaskit/tooltip": "^20.8.0",
|
|
66
66
|
"@babel/runtime": "^7.0.0",
|
|
67
67
|
"@emotion/react": "^11.7.1",
|
|
68
68
|
"classnames": "^2.2.5",
|
|
@@ -127,9 +127,6 @@
|
|
|
127
127
|
"platform_editor_tables_table_selector": {
|
|
128
128
|
"type": "boolean"
|
|
129
129
|
},
|
|
130
|
-
"platform_editor_fix_table_resizing_undo": {
|
|
131
|
-
"type": "boolean"
|
|
132
|
-
},
|
|
133
130
|
"platform_editor_table_fw_numcol_overflow_fix": {
|
|
134
131
|
"type": "boolean"
|
|
135
132
|
},
|
|
@@ -147,6 +144,12 @@
|
|
|
147
144
|
},
|
|
148
145
|
"platform_editor_table_width_refactor": {
|
|
149
146
|
"type": "boolean"
|
|
147
|
+
},
|
|
148
|
+
"platform_editor_table_height_analytics": {
|
|
149
|
+
"type": "boolean"
|
|
150
|
+
},
|
|
151
|
+
"platform_editor_table_height_analytics_event": {
|
|
152
|
+
"type": "boolean"
|
|
150
153
|
}
|
|
151
154
|
}
|
|
152
155
|
}
|