@atlaskit/editor-plugin-type-ahead 31.0.16 → 31.0.18
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,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 31.0.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 31.0.17
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`1935babc0509d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1935babc0509d) -
|
|
14
|
+
Improve editor interaction performance behind `platform_editor_block_control_inp`. Quick Insert
|
|
15
|
+
now reuses an unformatted empty paragraph that already immediately follows the target block
|
|
16
|
+
instead of inserting a new one, and the typeahead popup reuses a single memoized layout scheduler.
|
|
17
|
+
Paths that keep the cursor inside the target block, such as cell selections and text selections,
|
|
18
|
+
are unchanged.
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 31.0.16
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -16,6 +16,7 @@ var _utils = require("@atlaskit/editor-common/Popup/utils");
|
|
|
16
16
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
17
17
|
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
18
18
|
var _constants = require("@atlaskit/editor-shared-styles/constants");
|
|
19
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
19
20
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
20
21
|
var _analytics = require("../pm-plugins/analytics");
|
|
21
22
|
var _constants2 = require("../pm-plugins/constants");
|
|
@@ -89,6 +90,7 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
89
90
|
moreElementsInQuickInsertView = _useSharedPluginState.moreElementsInQuickInsertView;
|
|
90
91
|
var moreElementsInQuickInsertViewEnabled = moreElementsInQuickInsertView && triggerHandler.id === _typeAhead.TypeAheadAvailableNodes.QUICK_INSERT;
|
|
91
92
|
var isEditorControlsEnabled = (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1');
|
|
93
|
+
var typeAheadOptimizationsEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_inp');
|
|
92
94
|
var defaultMenuHeight = (0, _react.useMemo)(function () {
|
|
93
95
|
return moreElementsInQuickInsertViewEnabled ? DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW : DEFAULT_TYPEAHEAD_MENU_HEIGHT;
|
|
94
96
|
}, [moreElementsInQuickInsertViewEnabled]);
|
|
@@ -192,7 +194,23 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
192
194
|
var minFitHeight = Math.min(defaultMenuHeight, fitHeightWithSpace);
|
|
193
195
|
return setFitHeight(minFitHeight);
|
|
194
196
|
}, [anchorElement, defaultMenuHeight, popupsBoundariesElement, popupsMountPoint]);
|
|
195
|
-
var
|
|
197
|
+
var stableGetFitHeightDebounced = (0, _react.useMemo)(function () {
|
|
198
|
+
return typeAheadOptimizationsEnabled ? (0, _rafSchd.default)(getFitHeight) : undefined;
|
|
199
|
+
}, [getFitHeight, typeAheadOptimizationsEnabled]);
|
|
200
|
+
// A new rafSchedule instance on every render re-runs the layout effect below (two forced
|
|
201
|
+
// layouts plus listener re-binding) on every popup render; the memoised one keeps it stable.
|
|
202
|
+
var getFitHeightDebounced = stableGetFitHeightDebounced !== null && stableGetFitHeightDebounced !== void 0 ? stableGetFitHeightDebounced : (0, _rafSchd.default)(getFitHeight);
|
|
203
|
+
(0, _react.useEffect)(function () {
|
|
204
|
+
if (stableGetFitHeightDebounced) {
|
|
205
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-chain-state-updates -- rAF-batched measurement keeps popup geometry fresh without re-binding listeners
|
|
206
|
+
stableGetFitHeightDebounced();
|
|
207
|
+
}
|
|
208
|
+
// Cancel our own pending frame so this effect does not rely on the layout effect cleanup
|
|
209
|
+
// below. raf-schd's cancel() is a no-op when nothing is scheduled, so double-cancel is safe.
|
|
210
|
+
return function () {
|
|
211
|
+
return stableGetFitHeightDebounced === null || stableGetFitHeightDebounced === void 0 ? void 0 : stableGetFitHeightDebounced.cancel();
|
|
212
|
+
};
|
|
213
|
+
}, [props.decorationSet, isEmptyQuery, items, stableGetFitHeightDebounced]);
|
|
196
214
|
(0, _react.useLayoutEffect)(function () {
|
|
197
215
|
// Ignored via go/ees005
|
|
198
216
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -215,8 +233,9 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
215
233
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
216
234
|
scrollableElement.removeEventListener('scroll', getFitHeightDebounced);
|
|
217
235
|
}
|
|
236
|
+
stableGetFitHeightDebounced === null || stableGetFitHeightDebounced === void 0 || stableGetFitHeightDebounced.cancel();
|
|
218
237
|
};
|
|
219
|
-
}, [anchorElement, popupsScrollableElement, getFitHeightDebounced, getFitHeight]);
|
|
238
|
+
}, [anchorElement, popupsScrollableElement, getFitHeightDebounced, getFitHeight, stableGetFitHeightDebounced]);
|
|
220
239
|
(0, _react.useLayoutEffect)(function () {
|
|
221
240
|
var _ref2 = (0, _utils2.getPluginState)(editorView.state) || {},
|
|
222
241
|
removePrefixTriggerOnCancel = _ref2.removePrefixTriggerOnCancel;
|
|
@@ -13,6 +13,7 @@ import { findOverflowScrollParent } from '@atlaskit/editor-common/Popup/utils';
|
|
|
13
13
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
14
14
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
15
15
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles/constants';
|
|
16
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
16
17
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
17
18
|
import { fireTypeAheadClosedAnalyticsEvent } from '../pm-plugins/analytics';
|
|
18
19
|
import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../pm-plugins/constants';
|
|
@@ -81,6 +82,7 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
81
82
|
});
|
|
82
83
|
const moreElementsInQuickInsertViewEnabled = moreElementsInQuickInsertView && triggerHandler.id === TypeAheadAvailableNodes.QUICK_INSERT;
|
|
83
84
|
const isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
|
|
85
|
+
const typeAheadOptimizationsEnabled = isExperimentEnabled('platform_editor_block_control_inp');
|
|
84
86
|
const defaultMenuHeight = useMemo(() => moreElementsInQuickInsertViewEnabled ? DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW : DEFAULT_TYPEAHEAD_MENU_HEIGHT, [moreElementsInQuickInsertViewEnabled]);
|
|
85
87
|
const activityStateRef = useRef({
|
|
86
88
|
inputMethod: null,
|
|
@@ -179,7 +181,19 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
179
181
|
const minFitHeight = Math.min(defaultMenuHeight, fitHeightWithSpace);
|
|
180
182
|
return setFitHeight(minFitHeight);
|
|
181
183
|
}, [anchorElement, defaultMenuHeight, popupsBoundariesElement, popupsMountPoint]);
|
|
182
|
-
const
|
|
184
|
+
const stableGetFitHeightDebounced = useMemo(() => typeAheadOptimizationsEnabled ? rafSchedule(getFitHeight) : undefined, [getFitHeight, typeAheadOptimizationsEnabled]);
|
|
185
|
+
// A new rafSchedule instance on every render re-runs the layout effect below (two forced
|
|
186
|
+
// layouts plus listener re-binding) on every popup render; the memoised one keeps it stable.
|
|
187
|
+
const getFitHeightDebounced = stableGetFitHeightDebounced !== null && stableGetFitHeightDebounced !== void 0 ? stableGetFitHeightDebounced : rafSchedule(getFitHeight);
|
|
188
|
+
useEffect(() => {
|
|
189
|
+
if (stableGetFitHeightDebounced) {
|
|
190
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-chain-state-updates -- rAF-batched measurement keeps popup geometry fresh without re-binding listeners
|
|
191
|
+
stableGetFitHeightDebounced();
|
|
192
|
+
}
|
|
193
|
+
// Cancel our own pending frame so this effect does not rely on the layout effect cleanup
|
|
194
|
+
// below. raf-schd's cancel() is a no-op when nothing is scheduled, so double-cancel is safe.
|
|
195
|
+
return () => stableGetFitHeightDebounced === null || stableGetFitHeightDebounced === void 0 ? void 0 : stableGetFitHeightDebounced.cancel();
|
|
196
|
+
}, [props.decorationSet, isEmptyQuery, items, stableGetFitHeightDebounced]);
|
|
183
197
|
useLayoutEffect(() => {
|
|
184
198
|
// Ignored via go/ees005
|
|
185
199
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -202,8 +216,9 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
202
216
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
203
217
|
scrollableElement.removeEventListener('scroll', getFitHeightDebounced);
|
|
204
218
|
}
|
|
219
|
+
stableGetFitHeightDebounced === null || stableGetFitHeightDebounced === void 0 ? void 0 : stableGetFitHeightDebounced.cancel();
|
|
205
220
|
};
|
|
206
|
-
}, [anchorElement, popupsScrollableElement, getFitHeightDebounced, getFitHeight]);
|
|
221
|
+
}, [anchorElement, popupsScrollableElement, getFitHeightDebounced, getFitHeight, stableGetFitHeightDebounced]);
|
|
207
222
|
useLayoutEffect(() => {
|
|
208
223
|
const {
|
|
209
224
|
removePrefixTriggerOnCancel
|
|
@@ -14,6 +14,7 @@ import { findOverflowScrollParent } from '@atlaskit/editor-common/Popup/utils';
|
|
|
14
14
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
15
15
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
16
16
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles/constants';
|
|
17
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
17
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
18
19
|
import { fireTypeAheadClosedAnalyticsEvent } from '../pm-plugins/analytics';
|
|
19
20
|
import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../pm-plugins/constants';
|
|
@@ -79,6 +80,7 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
79
80
|
moreElementsInQuickInsertView = _useSharedPluginState.moreElementsInQuickInsertView;
|
|
80
81
|
var moreElementsInQuickInsertViewEnabled = moreElementsInQuickInsertView && triggerHandler.id === TypeAheadAvailableNodes.QUICK_INSERT;
|
|
81
82
|
var isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
|
|
83
|
+
var typeAheadOptimizationsEnabled = isExperimentEnabled('platform_editor_block_control_inp');
|
|
82
84
|
var defaultMenuHeight = useMemo(function () {
|
|
83
85
|
return moreElementsInQuickInsertViewEnabled ? DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW : DEFAULT_TYPEAHEAD_MENU_HEIGHT;
|
|
84
86
|
}, [moreElementsInQuickInsertViewEnabled]);
|
|
@@ -182,7 +184,23 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
182
184
|
var minFitHeight = Math.min(defaultMenuHeight, fitHeightWithSpace);
|
|
183
185
|
return setFitHeight(minFitHeight);
|
|
184
186
|
}, [anchorElement, defaultMenuHeight, popupsBoundariesElement, popupsMountPoint]);
|
|
185
|
-
var
|
|
187
|
+
var stableGetFitHeightDebounced = useMemo(function () {
|
|
188
|
+
return typeAheadOptimizationsEnabled ? rafSchedule(getFitHeight) : undefined;
|
|
189
|
+
}, [getFitHeight, typeAheadOptimizationsEnabled]);
|
|
190
|
+
// A new rafSchedule instance on every render re-runs the layout effect below (two forced
|
|
191
|
+
// layouts plus listener re-binding) on every popup render; the memoised one keeps it stable.
|
|
192
|
+
var getFitHeightDebounced = stableGetFitHeightDebounced !== null && stableGetFitHeightDebounced !== void 0 ? stableGetFitHeightDebounced : rafSchedule(getFitHeight);
|
|
193
|
+
useEffect(function () {
|
|
194
|
+
if (stableGetFitHeightDebounced) {
|
|
195
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-chain-state-updates -- rAF-batched measurement keeps popup geometry fresh without re-binding listeners
|
|
196
|
+
stableGetFitHeightDebounced();
|
|
197
|
+
}
|
|
198
|
+
// Cancel our own pending frame so this effect does not rely on the layout effect cleanup
|
|
199
|
+
// below. raf-schd's cancel() is a no-op when nothing is scheduled, so double-cancel is safe.
|
|
200
|
+
return function () {
|
|
201
|
+
return stableGetFitHeightDebounced === null || stableGetFitHeightDebounced === void 0 ? void 0 : stableGetFitHeightDebounced.cancel();
|
|
202
|
+
};
|
|
203
|
+
}, [props.decorationSet, isEmptyQuery, items, stableGetFitHeightDebounced]);
|
|
186
204
|
useLayoutEffect(function () {
|
|
187
205
|
// Ignored via go/ees005
|
|
188
206
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -205,8 +223,9 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
205
223
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
206
224
|
scrollableElement.removeEventListener('scroll', getFitHeightDebounced);
|
|
207
225
|
}
|
|
226
|
+
stableGetFitHeightDebounced === null || stableGetFitHeightDebounced === void 0 || stableGetFitHeightDebounced.cancel();
|
|
208
227
|
};
|
|
209
|
-
}, [anchorElement, popupsScrollableElement, getFitHeightDebounced, getFitHeight]);
|
|
228
|
+
}, [anchorElement, popupsScrollableElement, getFitHeightDebounced, getFitHeight, stableGetFitHeightDebounced]);
|
|
210
229
|
useLayoutEffect(function () {
|
|
211
230
|
var _ref2 = getPluginState(editorView.state) || {},
|
|
212
231
|
removePrefixTriggerOnCancel = _ref2.removePrefixTriggerOnCancel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "31.0.
|
|
3
|
+
"version": "31.0.18",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@atlaskit/editor-plugin-metrics": "^31.0.0",
|
|
30
30
|
"@atlaskit/editor-plugin-ui-control-registry": "^24.0.0",
|
|
31
31
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
32
|
-
"@atlaskit/editor-shared-styles": "^5.
|
|
32
|
+
"@atlaskit/editor-shared-styles": "^5.1.0",
|
|
33
33
|
"@atlaskit/editor-ui-control-model": "^3.0.0",
|
|
34
34
|
"@atlaskit/heading": "^8.0.0",
|
|
35
35
|
"@atlaskit/insm": "^3.0.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@atlaskit/primitives": "^22.6.0",
|
|
41
41
|
"@atlaskit/prosemirror-history": "^1.3.0",
|
|
42
42
|
"@atlaskit/prosemirror-input-rules": "^4.1.0",
|
|
43
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
43
|
+
"@atlaskit/tmp-editor-statsig": "^258.0.0",
|
|
44
44
|
"@atlaskit/tokens": "^20.9.0",
|
|
45
45
|
"@atlaskit/visually-hidden": "^4.4.0",
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|