@atlaskit/editor-plugin-table 15.3.12 → 15.3.13
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 +8 -0
- package/dist/cjs/pm-plugins/utils/analytics.js +48 -1
- package/dist/cjs/tablePlugin.js +12 -4
- package/dist/es2019/pm-plugins/utils/analytics.js +45 -0
- package/dist/es2019/tablePlugin.js +13 -5
- 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 +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 15.3.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ca454ed251e1e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ca454ed251e1e) -
|
|
8
|
+
Add table height analytics
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 15.3.12
|
|
4
12
|
|
|
5
13
|
### Patch 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.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
|
};
|
|
@@ -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
|
};
|
|
@@ -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.13",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -147,6 +147,12 @@
|
|
|
147
147
|
},
|
|
148
148
|
"platform_editor_table_width_refactor": {
|
|
149
149
|
"type": "boolean"
|
|
150
|
+
},
|
|
151
|
+
"platform_editor_table_height_analytics": {
|
|
152
|
+
"type": "boolean"
|
|
153
|
+
},
|
|
154
|
+
"platform_editor_table_height_analytics_event": {
|
|
155
|
+
"type": "boolean"
|
|
150
156
|
}
|
|
151
157
|
}
|
|
152
158
|
}
|