@atlaskit/editor-plugin-block-controls 30.1.0 → 30.1.1

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 30.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c02fec2c86f55`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c02fec2c86f55) -
8
+ Clean up experiment `platform_editor_remove_legacy_perf_events`
9
+ - Updated dependencies
10
+
3
11
  ## 30.1.0
4
12
 
5
13
  ### Minor Changes
@@ -12,7 +12,6 @@ var _browserApis = require("@atlaskit/browser-apis");
12
12
  var _enums = require("@atlaskit/editor-common/analytics/types/enums");
13
13
  var _browser = require("@atlaskit/editor-common/browser");
14
14
  var _nodeAnchorProvider = require("@atlaskit/editor-common/node-anchor-provider");
15
- var _performanceMeasures = require("@atlaskit/editor-common/performance-measures");
16
15
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
17
16
  var _dragHandle = require("@atlaskit/editor-common/styles/drag-handle");
18
17
  var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
@@ -51,17 +50,10 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
51
50
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
52
51
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
53
52
  var key = exports.key = new _state.PluginKey('blockControls');
54
- var EDITOR_BLOCKS_DRAG_INIT = 'Editor Blocks Drag Initialization Time';
55
- var EDITOR_BLOCKS_DROP_INIT = 'Editor Blocks Drop Initialization Time';
56
- var scheduleCallback = function scheduleCallback(cb, options) {
57
- return 'requestIdleCallback' in window ? requestIdleCallback(cb, _objectSpread({
58
- timeout: 5000
59
- }, options)) : requestAnimationFrame(cb);
60
- };
61
53
  var isHTMLElement = function isHTMLElement(element) {
62
54
  return element instanceof HTMLElement;
63
55
  };
64
- var destroyFn = function destroyFn(api, editorView) {
56
+ var destroyFn = function destroyFn(api) {
65
57
  var _getDocument$querySel, _getDocument;
66
58
  var scrollable = (_getDocument$querySel = (_getDocument = (0, _browserApis.getDocument)()) === null || _getDocument === void 0 ? void 0 : _getDocument.querySelector('.fabric-editor-popup-scroll-parent')) !== null && _getDocument$querySel !== void 0 ? _getDocument$querySel : null;
67
59
  var cleanupFn = [];
@@ -70,37 +62,11 @@ var destroyFn = function destroyFn(api, editorView) {
70
62
  element: scrollable
71
63
  }));
72
64
  }
73
- var dragInitializationDuration = 0;
74
65
  cleanupFn.push((0, _elementAdapter.monitorForElements)({
75
66
  canMonitor: function canMonitor(_ref) {
76
67
  var source = _ref.source;
77
68
  return source.data.type === 'element';
78
69
  },
79
- onDrag: function onDrag() {
80
- if ((0, _fg.fg)('platform_editor_drag_and_drop_perf_analytics')) {
81
- if ((0, _performanceMeasures.isMeasuring)(EDITOR_BLOCKS_DRAG_INIT)) {
82
- (0, _performanceMeasures.stopMeasure)(EDITOR_BLOCKS_DRAG_INIT, function (duration) {
83
- dragInitializationDuration = duration;
84
- });
85
- }
86
- } else {
87
- if ((0, _performanceMeasures.isMeasuring)(EDITOR_BLOCKS_DRAG_INIT)) {
88
- (0, _performanceMeasures.stopMeasure)(EDITOR_BLOCKS_DRAG_INIT, function (duration, startTime) {
89
- var _api$analytics;
90
- api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
91
- action: _enums.ACTION.BLOCKS_DRAG_INIT,
92
- actionSubject: _enums.ACTION_SUBJECT.EDITOR,
93
- eventType: _enums.EVENT_TYPE.OPERATIONAL,
94
- attributes: {
95
- duration: duration,
96
- startTime: startTime,
97
- nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
98
- }
99
- });
100
- });
101
- }
102
- }
103
- },
104
70
  onDragStart: function onDragStart() {
105
71
  if (isHTMLElement(scrollable)) {
106
72
  scrollable.style.setProperty('scroll-behavior', 'unset');
@@ -113,10 +79,6 @@ var destroyFn = function destroyFn(api, editorView) {
113
79
  if (isHTMLElement(scrollable)) {
114
80
  scrollable.style.setProperty('scroll-behavior', null);
115
81
  }
116
- var shouldMeasureDrop = (0, _fg.fg)('platform_editor_drag_and_drop_perf_analytics') && !(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_remove_legacy_perf_events');
117
- if (shouldMeasureDrop) {
118
- (0, _performanceMeasures.startMeasure)(EDITOR_BLOCKS_DROP_INIT);
119
- }
120
82
  if (!api) {
121
83
  return;
122
84
  }
@@ -148,13 +110,13 @@ var destroyFn = function destroyFn(api, editorView) {
148
110
  // if no drop targets are rendered, assume that drop is invalid
149
111
  var lastDragCancelled = location.current.dropTargets.length === 0;
150
112
  if (lastDragCancelled) {
151
- var _api$analytics2;
113
+ var _api$analytics;
152
114
  var position = (0, _selection.getSelectedSlicePosition)(start, tr, api);
153
115
  var attributes = (0, _analytics.getMultiSelectAnalyticsAttributes)(tr, position.from, position.to);
154
116
  var nodeTypes = attributes.nodeTypes,
155
117
  hasSelectedMultipleNodes = attributes.hasSelectedMultipleNodes;
156
118
  var resolvedMovingNode = tr.doc.resolve(start);
157
- (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
119
+ (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
158
120
  eventType: _enums.EVENT_TYPE.UI,
159
121
  action: _enums.ACTION.CANCELLED,
160
122
  actionSubject: _enums.ACTION_SUBJECT.DRAG,
@@ -181,29 +143,6 @@ var destroyFn = function destroyFn(api, editorView) {
181
143
  lastDragCancelled: lastDragCancelled
182
144
  }));
183
145
  });
184
- if (shouldMeasureDrop) {
185
- // wait for the idle callback to ensure that the drag operation has completed
186
- scheduleCallback(function () {
187
- if ((0, _performanceMeasures.isMeasuring)(EDITOR_BLOCKS_DROP_INIT)) {
188
- (0, _performanceMeasures.stopMeasure)(EDITOR_BLOCKS_DROP_INIT, function (duration) {
189
- var _api$analytics3;
190
- var isCancelled = location.current.dropTargets.length === 0;
191
- api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || _api$analytics3.actions.fireAnalyticsEvent({
192
- action: _enums.ACTION.ENDED,
193
- eventType: _enums.EVENT_TYPE.TRACK,
194
- actionSubject: _enums.ACTION_SUBJECT.DRAG,
195
- actionSubjectId: _enums.ACTION_SUBJECT_ID.ELEMENT_DRAG_HANDLE,
196
- attributes: {
197
- dragInitializationDuration: dragInitializationDuration,
198
- dropProcessingDuration: duration,
199
- isCancelled: isCancelled,
200
- nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
201
- }
202
- });
203
- });
204
- }
205
- });
206
- }
207
146
  }
208
147
  }));
209
148
  return _combine.combine.apply(void 0, cleanupFn);
@@ -1161,9 +1100,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
1161
1100
  if (api !== null && api !== void 0 && (_api$limitedMode6 = api.limitedMode) !== null && _api$limitedMode6 !== void 0 && (_api$limitedMode6 = _api$limitedMode6.sharedState.currentState()) !== null && _api$limitedMode6 !== void 0 && _api$limitedMode6.enabled) {
1162
1101
  return;
1163
1102
  }
1164
- if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_remove_legacy_perf_events')) {
1165
- (0, _performanceMeasures.startMeasure)(EDITOR_BLOCKS_DRAG_INIT);
1166
- }
1167
1103
  if (isAdvancedLayoutEnabled) {
1168
1104
  _activeAnchorTracker.defaultActiveAnchorTracker.reset();
1169
1105
  }
@@ -1305,7 +1241,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
1305
1241
  }
1306
1242
 
1307
1243
  // Start pragmatic monitors
1308
- pragmaticCleanup = destroyFn(api, editorView);
1244
+ pragmaticCleanup = destroyFn(api);
1309
1245
  var unbindMouseMove;
1310
1246
 
1311
1247
  // When ignoreRestingPointerHover is false, pointerHasMoved is always true, so we never
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useBlockControlsSurfaceDragSource = void 0;
7
7
  var _react = require("react");
8
8
  var _enums = require("@atlaskit/editor-common/analytics/types/enums");
9
- var _performanceMeasures = require("@atlaskit/editor-common/performance-measures");
10
9
  var _utils = require("@atlaskit/editor-prosemirror/utils");
11
10
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
12
11
  var _elementAdapter = require("@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter");
@@ -17,7 +16,6 @@ var _collapsedHeading = require("../pm-plugins/utils/collapsed-heading");
17
16
  var _getSelection = require("../pm-plugins/utils/getSelection");
18
17
  var _blockControlsSurfaceDragHandleUtils = require("./block-controls-surface-drag-handle-utils");
19
18
  var _dragPreview = require("./drag-preview");
20
- var EDITOR_BLOCKS_DRAG_INIT = 'Editor Blocks Drag Initialization Time';
21
19
  /**
22
20
  * Registry surface drag source. This intentionally duplicates the stable widget handle's drag
23
21
  * contract so the legacy implementation remains byte-for-byte unchanged during migration.
@@ -148,9 +146,6 @@ var useBlockControlsSurfaceDragSource = exports.useBlockControlsSurfaceDragSourc
148
146
  }
149
147
 
150
148
  // This handle is outside ProseMirror, so it owns the side effects normally started by PM.
151
- if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_remove_legacy_perf_events')) {
152
- (0, _performanceMeasures.startMeasure)(EDITOR_BLOCKS_DRAG_INIT);
153
- }
154
149
  _activeAnchorTracker.defaultActiveAnchorTracker.reset();
155
150
  api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref5) {
156
151
  var _api$blockControls$sh2, _resolvedMovingNode$n, _api$blockControls2, _api$analytics;
@@ -4,7 +4,6 @@ import { getDocument } from '@atlaskit/browser-apis';
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
5
5
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
6
6
  import { getNodeIdProvider } from '@atlaskit/editor-common/node-anchor-provider';
7
- import { isMeasuring, startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
8
7
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
9
8
  import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles/drag-handle';
10
9
  import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
@@ -38,18 +37,10 @@ import { selectNode } from './utils/getSelection';
38
37
  import { getSelectedSlicePosition } from './utils/selection';
39
38
  import { getTrMetadata } from './utils/transactions';
40
39
  export const key = new PluginKey('blockControls');
41
- const EDITOR_BLOCKS_DRAG_INIT = 'Editor Blocks Drag Initialization Time';
42
- const EDITOR_BLOCKS_DROP_INIT = 'Editor Blocks Drop Initialization Time';
43
- const scheduleCallback = (cb, options) => {
44
- return 'requestIdleCallback' in window ? requestIdleCallback(cb, {
45
- timeout: 5000,
46
- ...options
47
- }) : requestAnimationFrame(cb);
48
- };
49
40
  const isHTMLElement = element => {
50
41
  return element instanceof HTMLElement;
51
42
  };
52
- const destroyFn = (api, editorView) => {
43
+ const destroyFn = api => {
53
44
  var _getDocument$querySel, _getDocument;
54
45
  const scrollable = (_getDocument$querySel = (_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.querySelector('.fabric-editor-popup-scroll-parent')) !== null && _getDocument$querySel !== void 0 ? _getDocument$querySel : null;
55
46
  const cleanupFn = [];
@@ -58,36 +49,10 @@ const destroyFn = (api, editorView) => {
58
49
  element: scrollable
59
50
  }));
60
51
  }
61
- let dragInitializationDuration = 0;
62
52
  cleanupFn.push(monitorForElements({
63
53
  canMonitor: ({
64
54
  source
65
55
  }) => source.data.type === 'element',
66
- onDrag: () => {
67
- if (fg('platform_editor_drag_and_drop_perf_analytics')) {
68
- if (isMeasuring(EDITOR_BLOCKS_DRAG_INIT)) {
69
- stopMeasure(EDITOR_BLOCKS_DRAG_INIT, duration => {
70
- dragInitializationDuration = duration;
71
- });
72
- }
73
- } else {
74
- if (isMeasuring(EDITOR_BLOCKS_DRAG_INIT)) {
75
- stopMeasure(EDITOR_BLOCKS_DRAG_INIT, (duration, startTime) => {
76
- var _api$analytics;
77
- api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent({
78
- action: ACTION.BLOCKS_DRAG_INIT,
79
- actionSubject: ACTION_SUBJECT.EDITOR,
80
- eventType: EVENT_TYPE.OPERATIONAL,
81
- attributes: {
82
- duration,
83
- startTime,
84
- nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
85
- }
86
- });
87
- });
88
- }
89
- }
90
- },
91
56
  onDragStart: () => {
92
57
  if (isHTMLElement(scrollable)) {
93
58
  scrollable.style.setProperty('scroll-behavior', 'unset');
@@ -101,10 +66,6 @@ const destroyFn = (api, editorView) => {
101
66
  if (isHTMLElement(scrollable)) {
102
67
  scrollable.style.setProperty('scroll-behavior', null);
103
68
  }
104
- const shouldMeasureDrop = fg('platform_editor_drag_and_drop_perf_analytics') && !isExperimentEnabled('platform_editor_remove_legacy_perf_events');
105
- if (shouldMeasureDrop) {
106
- startMeasure(EDITOR_BLOCKS_DROP_INIT);
107
- }
108
69
  if (!api) {
109
70
  return;
110
71
  }
@@ -139,7 +100,7 @@ const destroyFn = (api, editorView) => {
139
100
  // if no drop targets are rendered, assume that drop is invalid
140
101
  const lastDragCancelled = location.current.dropTargets.length === 0;
141
102
  if (lastDragCancelled) {
142
- var _api$analytics2;
103
+ var _api$analytics;
143
104
  const position = getSelectedSlicePosition(start, tr, api);
144
105
  const attributes = getMultiSelectAnalyticsAttributes(tr, position.from, position.to);
145
106
  const {
@@ -147,7 +108,7 @@ const destroyFn = (api, editorView) => {
147
108
  hasSelectedMultipleNodes
148
109
  } = attributes;
149
110
  const resolvedMovingNode = tr.doc.resolve(start);
150
- (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
111
+ (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
151
112
  eventType: EVENT_TYPE.UI,
152
113
  action: ACTION.CANCELLED,
153
114
  actionSubject: ACTION_SUBJECT.DRAG,
@@ -175,29 +136,6 @@ const destroyFn = (api, editorView) => {
175
136
  lastDragCancelled
176
137
  });
177
138
  });
178
- if (shouldMeasureDrop) {
179
- // wait for the idle callback to ensure that the drag operation has completed
180
- scheduleCallback(() => {
181
- if (isMeasuring(EDITOR_BLOCKS_DROP_INIT)) {
182
- stopMeasure(EDITOR_BLOCKS_DROP_INIT, duration => {
183
- var _api$analytics3;
184
- const isCancelled = location.current.dropTargets.length === 0;
185
- api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent({
186
- action: ACTION.ENDED,
187
- eventType: EVENT_TYPE.TRACK,
188
- actionSubject: ACTION_SUBJECT.DRAG,
189
- actionSubjectId: ACTION_SUBJECT_ID.ELEMENT_DRAG_HANDLE,
190
- attributes: {
191
- dragInitializationDuration,
192
- dropProcessingDuration: duration,
193
- isCancelled,
194
- nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
195
- }
196
- });
197
- });
198
- }
199
- });
200
- }
201
139
  }
202
140
  }));
203
141
  return combine(...cleanupFn);
@@ -1065,9 +1003,6 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
1065
1003
  if (api !== null && api !== void 0 && (_api$limitedMode6 = api.limitedMode) !== null && _api$limitedMode6 !== void 0 && (_api$limitedMode6$sha = _api$limitedMode6.sharedState.currentState()) !== null && _api$limitedMode6$sha !== void 0 && _api$limitedMode6$sha.enabled) {
1066
1004
  return;
1067
1005
  }
1068
- if (!isExperimentEnabled('platform_editor_remove_legacy_perf_events')) {
1069
- startMeasure(EDITOR_BLOCKS_DRAG_INIT);
1070
- }
1071
1006
  if (isAdvancedLayoutEnabled) {
1072
1007
  defaultActiveAnchorTracker.reset();
1073
1008
  }
@@ -1216,7 +1151,7 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
1216
1151
  }
1217
1152
 
1218
1153
  // Start pragmatic monitors
1219
- pragmaticCleanup = destroyFn(api, editorView);
1154
+ pragmaticCleanup = destroyFn(api);
1220
1155
  let unbindMouseMove;
1221
1156
 
1222
1157
  // When ignoreRestingPointerHover is false, pointerHasMoved is always true, so we never
@@ -1,6 +1,5 @@
1
1
  import { useEffect } from 'react';
2
2
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
3
- import { startMeasure } from '@atlaskit/editor-common/performance-measures';
4
3
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
5
4
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
6
5
  import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter';
@@ -11,7 +10,6 @@ import { isCollapsedHeading, prepareCollapsedHeadingSelection } from '../pm-plug
11
10
  import { isHandleCorrelatedToSelection, selectNode } from '../pm-plugins/utils/getSelection';
12
11
  import { getNodeMarginsForDragPreview, getNodeSpacingForDragPreview } from './block-controls-surface-drag-handle-utils';
13
12
  import { dragPreview } from './drag-preview';
14
- const EDITOR_BLOCKS_DRAG_INIT = 'Editor Blocks Drag Initialization Time';
15
13
  /**
16
14
  * Registry surface drag source. This intentionally duplicates the stable widget handle's drag
17
15
  * contract so the legacy implementation remains byte-for-byte unchanged during migration.
@@ -145,9 +143,6 @@ export const useBlockControlsSurfaceDragSource = ({
145
143
  }
146
144
 
147
145
  // This handle is outside ProseMirror, so it owns the side effects normally started by PM.
148
- if (!isExperimentEnabled('platform_editor_remove_legacy_perf_events')) {
149
- startMeasure(EDITOR_BLOCKS_DRAG_INIT);
150
- }
151
146
  defaultActiveAnchorTracker.reset();
152
147
  api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(({
153
148
  tr
@@ -10,7 +10,6 @@ import { getDocument } from '@atlaskit/browser-apis';
10
10
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
11
11
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
12
12
  import { getNodeIdProvider } from '@atlaskit/editor-common/node-anchor-provider';
13
- import { isMeasuring, startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
14
13
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
15
14
  import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles/drag-handle';
16
15
  import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
@@ -44,17 +43,10 @@ import { selectNode } from './utils/getSelection';
44
43
  import { getSelectedSlicePosition } from './utils/selection';
45
44
  import { getTrMetadata } from './utils/transactions';
46
45
  export var key = new PluginKey('blockControls');
47
- var EDITOR_BLOCKS_DRAG_INIT = 'Editor Blocks Drag Initialization Time';
48
- var EDITOR_BLOCKS_DROP_INIT = 'Editor Blocks Drop Initialization Time';
49
- var scheduleCallback = function scheduleCallback(cb, options) {
50
- return 'requestIdleCallback' in window ? requestIdleCallback(cb, _objectSpread({
51
- timeout: 5000
52
- }, options)) : requestAnimationFrame(cb);
53
- };
54
46
  var isHTMLElement = function isHTMLElement(element) {
55
47
  return element instanceof HTMLElement;
56
48
  };
57
- var destroyFn = function destroyFn(api, editorView) {
49
+ var destroyFn = function destroyFn(api) {
58
50
  var _getDocument$querySel, _getDocument;
59
51
  var scrollable = (_getDocument$querySel = (_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.querySelector('.fabric-editor-popup-scroll-parent')) !== null && _getDocument$querySel !== void 0 ? _getDocument$querySel : null;
60
52
  var cleanupFn = [];
@@ -63,37 +55,11 @@ var destroyFn = function destroyFn(api, editorView) {
63
55
  element: scrollable
64
56
  }));
65
57
  }
66
- var dragInitializationDuration = 0;
67
58
  cleanupFn.push(monitorForElements({
68
59
  canMonitor: function canMonitor(_ref) {
69
60
  var source = _ref.source;
70
61
  return source.data.type === 'element';
71
62
  },
72
- onDrag: function onDrag() {
73
- if (fg('platform_editor_drag_and_drop_perf_analytics')) {
74
- if (isMeasuring(EDITOR_BLOCKS_DRAG_INIT)) {
75
- stopMeasure(EDITOR_BLOCKS_DRAG_INIT, function (duration) {
76
- dragInitializationDuration = duration;
77
- });
78
- }
79
- } else {
80
- if (isMeasuring(EDITOR_BLOCKS_DRAG_INIT)) {
81
- stopMeasure(EDITOR_BLOCKS_DRAG_INIT, function (duration, startTime) {
82
- var _api$analytics;
83
- api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
84
- action: ACTION.BLOCKS_DRAG_INIT,
85
- actionSubject: ACTION_SUBJECT.EDITOR,
86
- eventType: EVENT_TYPE.OPERATIONAL,
87
- attributes: {
88
- duration: duration,
89
- startTime: startTime,
90
- nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
91
- }
92
- });
93
- });
94
- }
95
- }
96
- },
97
63
  onDragStart: function onDragStart() {
98
64
  if (isHTMLElement(scrollable)) {
99
65
  scrollable.style.setProperty('scroll-behavior', 'unset');
@@ -106,10 +72,6 @@ var destroyFn = function destroyFn(api, editorView) {
106
72
  if (isHTMLElement(scrollable)) {
107
73
  scrollable.style.setProperty('scroll-behavior', null);
108
74
  }
109
- var shouldMeasureDrop = fg('platform_editor_drag_and_drop_perf_analytics') && !isExperimentEnabled('platform_editor_remove_legacy_perf_events');
110
- if (shouldMeasureDrop) {
111
- startMeasure(EDITOR_BLOCKS_DROP_INIT);
112
- }
113
75
  if (!api) {
114
76
  return;
115
77
  }
@@ -141,13 +103,13 @@ var destroyFn = function destroyFn(api, editorView) {
141
103
  // if no drop targets are rendered, assume that drop is invalid
142
104
  var lastDragCancelled = location.current.dropTargets.length === 0;
143
105
  if (lastDragCancelled) {
144
- var _api$analytics2;
106
+ var _api$analytics;
145
107
  var position = getSelectedSlicePosition(start, tr, api);
146
108
  var attributes = getMultiSelectAnalyticsAttributes(tr, position.from, position.to);
147
109
  var nodeTypes = attributes.nodeTypes,
148
110
  hasSelectedMultipleNodes = attributes.hasSelectedMultipleNodes;
149
111
  var resolvedMovingNode = tr.doc.resolve(start);
150
- (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
112
+ (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
151
113
  eventType: EVENT_TYPE.UI,
152
114
  action: ACTION.CANCELLED,
153
115
  actionSubject: ACTION_SUBJECT.DRAG,
@@ -174,29 +136,6 @@ var destroyFn = function destroyFn(api, editorView) {
174
136
  lastDragCancelled: lastDragCancelled
175
137
  }));
176
138
  });
177
- if (shouldMeasureDrop) {
178
- // wait for the idle callback to ensure that the drag operation has completed
179
- scheduleCallback(function () {
180
- if (isMeasuring(EDITOR_BLOCKS_DROP_INIT)) {
181
- stopMeasure(EDITOR_BLOCKS_DROP_INIT, function (duration) {
182
- var _api$analytics3;
183
- var isCancelled = location.current.dropTargets.length === 0;
184
- api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || _api$analytics3.actions.fireAnalyticsEvent({
185
- action: ACTION.ENDED,
186
- eventType: EVENT_TYPE.TRACK,
187
- actionSubject: ACTION_SUBJECT.DRAG,
188
- actionSubjectId: ACTION_SUBJECT_ID.ELEMENT_DRAG_HANDLE,
189
- attributes: {
190
- dragInitializationDuration: dragInitializationDuration,
191
- dropProcessingDuration: duration,
192
- isCancelled: isCancelled,
193
- nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
194
- }
195
- });
196
- });
197
- }
198
- });
199
- }
200
139
  }
201
140
  }));
202
141
  return combine.apply(void 0, cleanupFn);
@@ -1155,9 +1094,6 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
1155
1094
  if (api !== null && api !== void 0 && (_api$limitedMode6 = api.limitedMode) !== null && _api$limitedMode6 !== void 0 && (_api$limitedMode6 = _api$limitedMode6.sharedState.currentState()) !== null && _api$limitedMode6 !== void 0 && _api$limitedMode6.enabled) {
1156
1095
  return;
1157
1096
  }
1158
- if (!isExperimentEnabled('platform_editor_remove_legacy_perf_events')) {
1159
- startMeasure(EDITOR_BLOCKS_DRAG_INIT);
1160
- }
1161
1097
  if (isAdvancedLayoutEnabled) {
1162
1098
  defaultActiveAnchorTracker.reset();
1163
1099
  }
@@ -1299,7 +1235,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
1299
1235
  }
1300
1236
 
1301
1237
  // Start pragmatic monitors
1302
- pragmaticCleanup = destroyFn(api, editorView);
1238
+ pragmaticCleanup = destroyFn(api);
1303
1239
  var unbindMouseMove;
1304
1240
 
1305
1241
  // When ignoreRestingPointerHover is false, pointerHasMoved is always true, so we never
@@ -1,6 +1,5 @@
1
1
  import { useEffect } from 'react';
2
2
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
3
- import { startMeasure } from '@atlaskit/editor-common/performance-measures';
4
3
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
5
4
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
6
5
  import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter';
@@ -11,7 +10,6 @@ import { isCollapsedHeading, prepareCollapsedHeadingSelection } from '../pm-plug
11
10
  import { isHandleCorrelatedToSelection, selectNode } from '../pm-plugins/utils/getSelection';
12
11
  import { getNodeMarginsForDragPreview, getNodeSpacingForDragPreview } from './block-controls-surface-drag-handle-utils';
13
12
  import { dragPreview } from './drag-preview';
14
- var EDITOR_BLOCKS_DRAG_INIT = 'Editor Blocks Drag Initialization Time';
15
13
  /**
16
14
  * Registry surface drag source. This intentionally duplicates the stable widget handle's drag
17
15
  * contract so the legacy implementation remains byte-for-byte unchanged during migration.
@@ -142,9 +140,6 @@ export var useBlockControlsSurfaceDragSource = function useBlockControlsSurfaceD
142
140
  }
143
141
 
144
142
  // This handle is outside ProseMirror, so it owns the side effects normally started by PM.
145
- if (!isExperimentEnabled('platform_editor_remove_legacy_perf_events')) {
146
- startMeasure(EDITOR_BLOCKS_DRAG_INIT);
147
- }
148
143
  defaultActiveAnchorTracker.reset();
149
144
  api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref5) {
150
145
  var _api$blockControls$sh2, _resolvedMovingNode$n, _api$blockControls2, _api$analytics;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "30.1.0",
3
+ "version": "30.1.1",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -26,7 +26,7 @@
26
26
  "atlaskit:src": "src/index.ts",
27
27
  "dependencies": {
28
28
  "@atlaskit/browser-apis": "^1.2.0",
29
- "@atlaskit/button": "^25.5.0",
29
+ "@atlaskit/button": "^25.6.0",
30
30
  "@atlaskit/css": "^1.1.0",
31
31
  "@atlaskit/docs": "^12.3.0",
32
32
  "@atlaskit/editor-plugin-accessibility-utils": "^29.0.0",
@@ -40,14 +40,14 @@
40
40
  "@atlaskit/editor-plugin-metrics": "^30.0.0",
41
41
  "@atlaskit/editor-plugin-quick-insert": "^29.0.0",
42
42
  "@atlaskit/editor-plugin-selection": "^29.0.0",
43
- "@atlaskit/editor-plugin-show-diff": "^27.0.0",
43
+ "@atlaskit/editor-plugin-show-diff": "^27.1.0",
44
44
  "@atlaskit/editor-plugin-toolbar": "^26.0.0",
45
45
  "@atlaskit/editor-plugin-type-ahead": "^30.0.0",
46
46
  "@atlaskit/editor-plugin-ui-control-registry": "^23.0.0",
47
47
  "@atlaskit/editor-plugin-user-intent": "^27.0.0",
48
48
  "@atlaskit/editor-plugin-width": "^30.0.0",
49
49
  "@atlaskit/editor-prosemirror": "^9.0.0",
50
- "@atlaskit/editor-shared-styles": "^4.5.0",
50
+ "@atlaskit/editor-shared-styles": "^4.6.0",
51
51
  "@atlaskit/editor-tables": "^3.2.0",
52
52
  "@atlaskit/editor-ui-control-model": "^2.10.0",
53
53
  "@atlaskit/icon": "^38.0.0",
@@ -61,8 +61,8 @@
61
61
  "@atlaskit/primitives": "^22.6.0",
62
62
  "@atlaskit/section-message": "^10.2.0",
63
63
  "@atlaskit/theme": "^28.2.0",
64
- "@atlaskit/tmp-editor-statsig": "^244.0.0",
65
- "@atlaskit/tokens": "^20.6.0",
64
+ "@atlaskit/tmp-editor-statsig": "^245.0.0",
65
+ "@atlaskit/tokens": "^20.7.0",
66
66
  "@atlaskit/tooltip": "^24.4.0",
67
67
  "@babel/runtime": "^7.0.0",
68
68
  "@compiled/react": "^1.0.2",
@@ -73,7 +73,7 @@
73
73
  "uuid": "^11.1.1"
74
74
  },
75
75
  "peerDependencies": {
76
- "@atlaskit/editor-common": "^133.1.0",
76
+ "@atlaskit/editor-common": "^133.5.0",
77
77
  "react": "^18.2.0 || ^19.2.0",
78
78
  "react-dom": "^18.2.0 || ^19.2.0",
79
79
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -82,9 +82,6 @@
82
82
  "platform_editor_ease_of_use_metrics": {
83
83
  "type": "boolean"
84
84
  },
85
- "platform_editor_drag_and_drop_perf_analytics": {
86
- "type": "boolean"
87
- },
88
85
  "platform_editor_content_mode_button_mvp": {
89
86
  "type": "boolean"
90
87
  },