@atlaskit/editor-common 131.0.0 → 131.1.0

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/cjs/extensibility/Extension/Extension/index.js +23 -2
  3. package/dist/cjs/monitoring/error.js +1 -1
  4. package/dist/cjs/portal/PortalBucket.js +51 -11
  5. package/dist/cjs/portal/PortalManager.js +6 -3
  6. package/dist/cjs/preset/core-plugin/index.js +4 -20
  7. package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +6 -6
  8. package/dist/cjs/quick-insert/QuickInsertSearchResultsSection.js +19 -0
  9. package/dist/cjs/quick-insert/get-quick-insert-menu-model.js +20 -31
  10. package/dist/cjs/quick-insert/getQuickInsertMenuRows.js +2 -2
  11. package/dist/cjs/quick-insert/keys.js +10 -1
  12. package/dist/cjs/quick-insert/messages.js +5 -0
  13. package/dist/cjs/ui/DropList/index.js +1 -1
  14. package/dist/cjs/ui/OverflowShadow/index.js +14 -2
  15. package/dist/es2019/extensibility/Extension/Extension/index.js +21 -2
  16. package/dist/es2019/monitoring/error.js +1 -1
  17. package/dist/es2019/portal/PortalBucket.js +48 -12
  18. package/dist/es2019/portal/PortalManager.js +6 -3
  19. package/dist/es2019/preset/core-plugin/index.js +4 -20
  20. package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +6 -6
  21. package/dist/es2019/quick-insert/QuickInsertSearchResultsSection.js +14 -0
  22. package/dist/es2019/quick-insert/get-quick-insert-menu-model.js +15 -17
  23. package/dist/es2019/quick-insert/getQuickInsertMenuRows.js +2 -2
  24. package/dist/es2019/quick-insert/keys.js +9 -0
  25. package/dist/es2019/quick-insert/messages.js +5 -0
  26. package/dist/es2019/ui/DropList/index.js +1 -1
  27. package/dist/es2019/ui/OverflowShadow/index.js +12 -2
  28. package/dist/esm/extensibility/Extension/Extension/index.js +23 -2
  29. package/dist/esm/monitoring/error.js +1 -1
  30. package/dist/esm/portal/PortalBucket.js +52 -12
  31. package/dist/esm/portal/PortalManager.js +6 -3
  32. package/dist/esm/preset/core-plugin/index.js +4 -20
  33. package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +6 -6
  34. package/dist/esm/quick-insert/QuickInsertSearchResultsSection.js +12 -0
  35. package/dist/esm/quick-insert/get-quick-insert-menu-model.js +21 -32
  36. package/dist/esm/quick-insert/getQuickInsertMenuRows.js +2 -2
  37. package/dist/esm/quick-insert/keys.js +9 -0
  38. package/dist/esm/quick-insert/messages.js +5 -0
  39. package/dist/esm/ui/DropList/index.js +1 -1
  40. package/dist/esm/ui/OverflowShadow/index.js +14 -2
  41. package/dist/types/quick-insert/QuickInsertSearchResultsSection.d.ts +2 -0
  42. package/dist/types/quick-insert/get-quick-insert-menu-model.d.ts +4 -1
  43. package/dist/types/quick-insert/keys.d.ts +8 -0
  44. package/dist/types/quick-insert/messages.d.ts +1 -1
  45. package/dist/types/ui/OverflowShadow/index.d.ts +5 -0
  46. package/package.json +2 -5
@@ -1,15 +1,6 @@
1
- import React, { useLayoutEffect, useMemo, useState } from 'react';
2
- /**
3
- * A component for rendering portals managed by a `PortalManager`.
4
- * It subscribes to a `PortalManager` instance to listen for changes in the portal content
5
- * and renders the content of its assigned portal bucket.
6
- *
7
- * @param {PortalBucketProps} props The component props.
8
- * @param {number} props.id The ID for the portal bucket. This ID is used by the `PortalManager` to manage the content of this bucket.
9
- * @param {PortalManager} props.portalManager An instance of `PortalManager` which manages the registration and unregistration of portal buckets and their content.
10
- * @returns {React.ReactElement} The React element(s) that are currently registered to this portal bucket.
11
- */
12
- export function PortalBucket({
1
+ import React, { useCallback, useLayoutEffect, useMemo, useReducer, useState } from 'react';
2
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
3
+ function LegacyPortalBucket({
13
4
  id,
14
5
  portalManager
15
6
  }) {
@@ -27,4 +18,49 @@ export function PortalBucket({
27
18
  // Render the current portal elements
28
19
  // @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
29
20
  return /*#__PURE__*/React.createElement(React.Fragment, null, portalElements);
21
+ }
22
+
23
+ /**
24
+ * Portals stay in the manager; state is only a render tick. React keeps
25
+ * hook state on both the current and alternate fiber, so storing portals
26
+ * in state would retain removed portals until the next render.
27
+ */
28
+ function TickPortalBucket({
29
+ id,
30
+ portalManager
31
+ }) {
32
+ var _portalManager$getBuc, _portalManager$getBuc2;
33
+ const [, forceRender] = useReducer(tick => tick + 1, 0);
34
+ const updater = useCallback(() => forceRender(), []);
35
+ useLayoutEffect(() => {
36
+ portalManager.registerBucket(id, updater);
37
+ return () => {
38
+ portalManager.unregisterBucket(id);
39
+ };
40
+ }, [id, portalManager, updater]);
41
+ // @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
42
+ return /*#__PURE__*/React.createElement(React.Fragment, null, Object.values((_portalManager$getBuc = (_portalManager$getBuc2 = portalManager.getBuckets()[id]) === null || _portalManager$getBuc2 === void 0 ? void 0 : _portalManager$getBuc2.portals) !== null && _portalManager$getBuc !== void 0 ? _portalManager$getBuc : {}));
43
+ }
44
+
45
+ /**
46
+ * A component for rendering portals managed by a `PortalManager`.
47
+ * It subscribes to a `PortalManager` instance to listen for changes in the portal content
48
+ * and renders the content of its assigned portal bucket.
49
+ *
50
+ * @param {PortalBucketProps} props The component props.
51
+ * @param {number} props.id The ID for the portal bucket. This ID is used by the `PortalManager` to manage the content of this bucket.
52
+ * @param {PortalManager} props.portalManager An instance of `PortalManager` which manages the registration and unregistration of portal buckets and their content.
53
+ * @returns {React.ReactElement} The React element(s) that are currently registered to this portal bucket.
54
+ */
55
+ export function PortalBucket({
56
+ id,
57
+ portalManager
58
+ }) {
59
+ return isExperimentEnabled('platform_editor_reduce_memory_leaks') ? /*#__PURE__*/React.createElement(TickPortalBucket, {
60
+ id: id,
61
+ portalManager: portalManager
62
+ }) : /*#__PURE__*/React.createElement(LegacyPortalBucket, {
63
+ id: id,
64
+ portalManager: portalManager
65
+ });
30
66
  }
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import throttle from 'lodash/throttle';
3
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
3
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  const DEFAULT_INITIAL_BUCKETS = 50;
5
6
  const DEFAULT_MAX_BUCKET_CAPACITY = 50;
@@ -162,9 +163,11 @@ export class PortalManager {
162
163
  }
163
164
  registerPortal(key, portal, immediate = false) {
164
165
  var _this$portalToBucketM;
165
- this.createBucket();
166
- // @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
167
- this.buckets[this.getCurrentBucket()].capacity -= 1;
166
+ if (!isExperimentEnabled('platform_editor_reduce_memory_leaks') || !this.portalToBucketMap.has(key)) {
167
+ this.createBucket();
168
+ // @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
169
+ this.buckets[this.getCurrentBucket()].capacity -= 1;
170
+ }
168
171
  const id = (_this$portalToBucketM = this.portalToBucketMap.get(key)) !== null && _this$portalToBucketM !== void 0 ? _this$portalToBucketM : this.getCurrentBucket();
169
172
  // @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
170
173
  this.portalToBucketMap.set(key, id);
@@ -1,5 +1,4 @@
1
1
  import { Node } from '@atlaskit/editor-prosemirror/model';
2
- import { fg } from '@atlaskit/platform-feature-flags/fg';
3
2
  import { getNodeIdProvider } from '../../node-anchor/node-anchor-provider';
4
3
  import { processRawFragmentValue } from '../../utils/processRawFragmentValue';
5
4
  import { processRawValue, processRawValueWithoutValidation } from '../../utils/processRawValue';
@@ -70,6 +69,7 @@ export const corePlugin = ({
70
69
  return true;
71
70
  },
72
71
  scrollToPos(pos, scrollOptions) {
72
+ var _ref, _editorView$domAtPos;
73
73
  const editorView = config === null || config === void 0 ? void 0 : config.getEditorView();
74
74
  if (!editorView) {
75
75
  return false;
@@ -79,27 +79,11 @@ export const corePlugin = ({
79
79
  if (!isValidPos) {
80
80
  return false;
81
81
  }
82
- if (fg('platform_editor_fix_scroll_to_pos')) {
83
- var _ref, _editorView$domAtPos;
84
- // nodeDOM can return a Text node for inline positions
85
- const nodeDom = editorView.nodeDOM(pos);
86
- const dom = (_ref = nodeDom instanceof Element ? nodeDom : null) !== null && _ref !== void 0 ? _ref : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
87
- if (!(dom instanceof Element)) {
88
- return false;
89
- }
90
- dom.scrollIntoView(scrollOptions);
91
- return true;
92
- }
93
82
 
94
- // Legacy path — domAtPos interprets block boundaries as the parent container
95
- const dom = editorView.domAtPos(pos).node;
83
+ // nodeDOM can return a Text node for inline positions
84
+ const nodeDom = editorView.nodeDOM(pos);
85
+ const dom = (_ref = nodeDom instanceof Element ? nodeDom : null) !== null && _ref !== void 0 ? _ref : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
96
86
  if (!(dom instanceof Element)) {
97
- // If it's not an element (e.g. #text node), we'll try the parent.
98
- // This is expected to cover most of the scenarios, if not, window.scrollTo is an alternative
99
- if (dom.parentNode instanceof Element) {
100
- dom.parentNode.scrollIntoView(scrollOptions);
101
- return true;
102
- }
103
87
  return false;
104
88
  }
105
89
  dom.scrollIntoView(scrollOptions);
@@ -35,8 +35,8 @@ const itemStyles = xcss({
35
35
  color: 'color.text',
36
36
  display: 'flex',
37
37
  gap: 'space.150',
38
- minHeight: '40px',
39
- paddingBlock: 'space.100',
38
+ minHeight: '44px',
39
+ paddingBlock: 'space.075',
40
40
  paddingInline: 'space.200',
41
41
  textAlign: 'start',
42
42
  width: '100%',
@@ -50,8 +50,8 @@ const selectedItemStyles = xcss({
50
50
  color: 'color.text',
51
51
  display: 'flex',
52
52
  gap: 'space.150',
53
- minHeight: '40px',
54
- paddingBlock: 'space.100',
53
+ minHeight: '44px',
54
+ paddingBlock: 'space.075',
55
55
  paddingInline: 'space.200',
56
56
  position: 'relative',
57
57
  textAlign: 'start',
@@ -76,8 +76,8 @@ const disabledItemStyles = xcss({
76
76
  color: 'color.text.disabled',
77
77
  display: 'flex',
78
78
  gap: 'space.150',
79
- minHeight: '40px',
80
- paddingBlock: 'space.100',
79
+ minHeight: '44px',
80
+ paddingBlock: 'space.075',
81
81
  paddingInline: 'space.200',
82
82
  textAlign: 'start',
83
83
  width: '100%'
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { messages } from './messages';
4
+ import { QuickInsertMenuSection } from './QuickInsertMenuSection';
5
+ export const QuickInsertSearchResultsSection = ({
6
+ children
7
+ }) => {
8
+ const {
9
+ formatMessage
10
+ } = useIntl();
11
+ return /*#__PURE__*/React.createElement(QuickInsertMenuSection, {
12
+ title: formatMessage(messages.searchResults)
13
+ }, children);
14
+ };
@@ -2,8 +2,19 @@ import { getComponentIdentity, resolveSurface, willComponentRender } from '@atla
2
2
  import { isMenuFooterSectionKey } from '../type-ahead/isMenuFooterSectionKey';
3
3
  import { isSectionOverflowItemKey } from '../type-ahead/isSectionOverflowItemKey';
4
4
  import { applyRegisteredItemRanks } from '../type-ahead/item-rank';
5
- import { ASK_ROVO_MENU_ITEM } from './keys';
5
+ import { ASK_ROVO_MENU_ITEM, MENU, SEARCH_RESULTS_SECTION } from './keys';
6
+ import { QuickInsertSearchResultsSection } from './QuickInsertSearchResultsSection';
6
7
  const SEARCH_TOP_MATCH_LIMIT = 5;
8
+ const SEARCH_RESULTS_HEADING = {
9
+ key: SEARCH_RESULTS_SECTION.key,
10
+ type: SEARCH_RESULTS_SECTION.type,
11
+ component: QuickInsertSearchResultsSection,
12
+ parents: [{
13
+ key: MENU.key,
14
+ type: MENU.type,
15
+ rank: 0
16
+ }]
17
+ };
7
18
  const getParentRank = (component, parentKey) => {
8
19
  var _component$parents$fi, _component$parents, _component$parents$fi2;
9
20
  return (_component$parents$fi = (_component$parents = component.parents) === null || _component$parents === void 0 ? void 0 : (_component$parents$fi2 = _component$parents.find(parent => parent.key === parentKey)) === null || _component$parents$fi2 === void 0 ? void 0 : _component$parents$fi2.rank) !== null && _component$parents$fi !== void 0 ? _component$parents$fi : Number.MAX_SAFE_INTEGER;
@@ -82,7 +93,6 @@ const buildSearchSections = ({
82
93
  itemRank: getParentRank(item, section.key),
83
94
  score: Math.min(1, Math.max(0, (_match$score = match === null || match === void 0 ? void 0 : match.score) !== null && _match$score !== void 0 ? _match$score : 0)),
84
95
  sourceIndex: (_sourceIndexByCompone = sourceIndexByComponent.get(item)) !== null && _sourceIndexByCompone !== void 0 ? _sourceIndexByCompone : Number.MAX_SAFE_INTEGER,
85
- section,
86
96
  sectionRank: getParentRank(section, root.key)
87
97
  };
88
98
  const existing = matches.get(candidate.identity);
@@ -93,20 +103,9 @@ const buildSearchSections = ({
93
103
  }
94
104
  const uniqueMatches = Array.from(matches.values()).sort(compareMatchedItems);
95
105
  const searchResults = getSearchResults(uniqueMatches);
96
- const sectionsByKey = new Map();
97
- for (const match of uniqueMatches) {
98
- const existing = sectionsByKey.get(match.section.key);
99
- if (existing) {
100
- existing.push(match.item);
101
- } else {
102
- sectionsByKey.set(match.section.key, [match.section, match.item]);
103
- }
104
- }
105
- const sections = Array.from(sectionsByKey.values());
106
- if (sections.length > 0) {
106
+ if (searchResults.length > 0) {
107
107
  return {
108
- searchResults,
109
- sections
108
+ sections: [[SEARCH_RESULTS_HEADING, ...searchResults]]
110
109
  };
111
110
  }
112
111
  const fallbackItem = contentSections.flatMap(section => {
@@ -115,8 +114,7 @@ const buildSearchSections = ({
115
114
  }).find(component => component.type === ASK_ROVO_MENU_ITEM.type && component.key === ASK_ROVO_MENU_ITEM.key && willComponentRender(component, childrenMap, surfaceContext));
116
115
  return {
117
116
  fallbackItems: fallbackItem ? [fallbackItem] : [],
118
- searchResults,
119
- sections
117
+ sections: []
120
118
  };
121
119
  };
122
120
 
@@ -1,4 +1,4 @@
1
1
  export const getQuickInsertMenuRows = model => {
2
- var _model$searchResults, _model$fallbackItems;
3
- return [...((_model$searchResults = model.searchResults) !== null && _model$searchResults !== void 0 ? _model$searchResults : model.sections.flat()), ...((_model$fallbackItems = model.fallbackItems) !== null && _model$fallbackItems !== void 0 ? _model$fallbackItems : [])];
2
+ var _model$fallbackItems;
3
+ return [...model.sections.flat(), ...((_model$fallbackItems = model.fallbackItems) !== null && _model$fallbackItems !== void 0 ? _model$fallbackItems : [])];
4
4
  };
@@ -44,6 +44,15 @@ export const OTHER_SECTION = {
44
44
  key: 'quick-insert-other-section',
45
45
  type: 'menu-section'
46
46
  };
47
+
48
+ /**
49
+ * Heading shown above the matching items when the menu has a search query. It is not registered,
50
+ * so it never appears in browse mode.
51
+ */
52
+ export const SEARCH_RESULTS_SECTION = {
53
+ key: 'quick-insert-search-results-section',
54
+ type: 'menu-section'
55
+ };
47
56
  export const VIEW_ALL_ELEMENTS_MENU_ITEM = {
48
57
  key: 'quick-insert-view-all-elements-menu-item',
49
58
  type: 'menu-item'
@@ -135,6 +135,11 @@ export const messages = defineMessages({
135
135
  defaultMessage: 'Other elements',
136
136
  description: 'Other items in the Quick Insert menu.'
137
137
  },
138
+ searchResults: {
139
+ id: 'editor-common.quick-insert.searchResults',
140
+ defaultMessage: 'Search results',
141
+ description: 'Heading shown above the matching items when searching in the Quick Insert menu.'
142
+ },
138
143
  previewAttributionBy: {
139
144
  id: 'editor-common.quick-insert.previewAttributionBy',
140
145
  defaultMessage: 'By {name}',
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags/fg';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "131.0.0";
17
+ const packageVersion = "131.0.1";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -24,7 +24,7 @@ export default function overflowShadow(Component, options) {
24
24
  this.updateShadows();
25
25
  });
26
26
  _defineProperty(this, "updateShadows", () => {
27
- if (options.useShadowObserver) {
27
+ if (this.isDisabled || options.useShadowObserver) {
28
28
  return;
29
29
  }
30
30
  this.setState(prevState => {
@@ -78,6 +78,9 @@ export default function overflowShadow(Component, options) {
78
78
  if (!this.overflowContainer) {
79
79
  this.overflowContainer = container;
80
80
  }
81
+ if (this.isDisabled) {
82
+ return;
83
+ }
81
84
  if (options.useShadowObserver) {
82
85
  this.initShadowObserver();
83
86
  return;
@@ -88,6 +91,13 @@ export default function overflowShadow(Component, options) {
88
91
  this.overflowContainer.addEventListener('scroll', this.handleScroll);
89
92
  });
90
93
  }
94
+ get isDisabled() {
95
+ if (this.disabled === undefined) {
96
+ var _options$isDisabled, _options$isDisabled2;
97
+ this.disabled = (_options$isDisabled = (_options$isDisabled2 = options.isDisabled) === null || _options$isDisabled2 === void 0 ? void 0 : _options$isDisabled2.call(options)) !== null && _options$isDisabled !== void 0 ? _options$isDisabled : false;
98
+ }
99
+ return this.disabled;
100
+ }
91
101
  componentWillUnmount() {
92
102
  if (options.useShadowObserver) {
93
103
  return this.shadowObserver && this.shadowObserver.dispose();
@@ -133,7 +143,7 @@ export default function overflowShadow(Component, options) {
133
143
  showLeftShadow,
134
144
  showRightShadow
135
145
  } = this.state;
136
- const classNames = [!((_this$props = this.props) !== null && _this$props !== void 0 && _this$props.disableTableOverflowShadow) && showRightShadow && shadowClassNames.RIGHT_SHADOW, !((_this$props2 = this.props) !== null && _this$props2 !== void 0 && _this$props2.disableTableOverflowShadow) && showLeftShadow && shadowClassNames.LEFT_SHADOW, options.useShadowObserver && shadowObserverClassNames.SHADOW_CONTAINER].filter(Boolean).join(' ');
146
+ const classNames = this.isDisabled ? '' : [!((_this$props = this.props) !== null && _this$props !== void 0 && _this$props.disableTableOverflowShadow) && showRightShadow && shadowClassNames.RIGHT_SHADOW, !((_this$props2 = this.props) !== null && _this$props2 !== void 0 && _this$props2.disableTableOverflowShadow) && showLeftShadow && shadowClassNames.LEFT_SHADOW, options.useShadowObserver && shadowObserverClassNames.SHADOW_CONTAINER].filter(Boolean).join(' ');
137
147
 
138
148
  /**
139
149
  * The widths have already been calculated to determine
@@ -15,6 +15,7 @@ import React, { Fragment, useCallback, useState } from 'react';
15
15
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
16
16
  import { css, jsx } from '@emotion/react';
17
17
  import classnames from 'classnames';
18
+ import memoizeOne from 'memoize-one';
18
19
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
19
20
  import { fg } from '@atlaskit/platform-feature-flags/fg';
20
21
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -36,6 +37,12 @@ var hoverStyles = css({
36
37
  var containerStyle = css({
37
38
  containerType: 'inline-size'
38
39
  });
40
+ var isCssScrollTimelineSupported = memoizeOne(function (css) {
41
+ if (!css || typeof css.supports !== 'function') {
42
+ return false;
43
+ }
44
+ return css.supports('animation-timeline', '--test-timeline') && css.supports('scroll-timeline-name', '--test-timeline') && css.supports('timeline-scope', '--test-timeline') && css.supports('animation-range', '0% 101%');
45
+ });
39
46
  function ExtensionWithPluginState(props) {
40
47
  var _node$attrs;
41
48
  var node = props.node,
@@ -106,6 +113,7 @@ function ExtensionWithPluginState(props) {
106
113
  'without-frame': removeBorder
107
114
  }, widerLayoutClassName, shouldBreakout));
108
115
  var overflowClassNames = classnames('extension-overflow-wrapper', {
116
+ 'extension-scroll-inline-shadow': isExperimentEnabled('platform_editor_reduce_forced_layout_2'),
109
117
  'with-body': hasBody,
110
118
  'with-margin-styles': showMacroInteractionDesignUpdates && !isNodeNested && !showBodiedExtensionRendererView,
111
119
  // Adding extra padding for renderer view so users can have a touch target to click on the extension
@@ -225,7 +233,17 @@ function ExtensionWithPluginState(props) {
225
233
  className: contentClassNames
226
234
  }, jsx(NodeViewContentHole, {
227
235
  ref: handleContentDOMRef
228
- })))), fg('cc_maui_annotations_on_extensions') && node.type.name === 'extension' && container && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.annotation) && jsx(ExtensionCommentBadge, {
236
+ })))), isExperimentEnabled('platform_editor_reduce_forced_layout_2') && jsx(Fragment, null, jsx("div", {
237
+ contentEditable: false,
238
+ "aria-hidden": "true",
239
+ "data-vc-nvs": "true",
240
+ "data-extension-overflow-shadow": "start"
241
+ }), jsx("div", {
242
+ contentEditable: false,
243
+ "aria-hidden": "true",
244
+ "data-vc-nvs": "true",
245
+ "data-extension-overflow-shadow": "end"
246
+ })), fg('cc_maui_annotations_on_extensions') && node.type.name === 'extension' && container && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.annotation) && jsx(ExtensionCommentBadge, {
229
247
  api: pluginInjectionApi,
230
248
  node: node,
231
249
  getPos: getPos,
@@ -262,6 +280,9 @@ var Extension = function Extension(props) {
262
280
  }, props));
263
281
  };
264
282
  var _default_1 = overflowShadow(Extension, {
265
- overflowSelector: '.extension-overflow-wrapper'
283
+ overflowSelector: '.extension-overflow-wrapper',
284
+ isDisabled: function isDisabled() {
285
+ return isExperimentEnabled('platform_editor_reduce_forced_layout_2') && isCssScrollTimelineSupported(globalThis.CSS);
286
+ }
266
287
  });
267
288
  export default _default_1;
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
19
19
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "131.0.0";
22
+ var packageVersion = "131.0.1";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -1,16 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import React, { useLayoutEffect, useMemo, useState } from 'react';
3
- /**
4
- * A component for rendering portals managed by a `PortalManager`.
5
- * It subscribes to a `PortalManager` instance to listen for changes in the portal content
6
- * and renders the content of its assigned portal bucket.
7
- *
8
- * @param {PortalBucketProps} props The component props.
9
- * @param {number} props.id The ID for the portal bucket. This ID is used by the `PortalManager` to manage the content of this bucket.
10
- * @param {PortalManager} props.portalManager An instance of `PortalManager` which manages the registration and unregistration of portal buckets and their content.
11
- * @returns {React.ReactElement} The React element(s) that are currently registered to this portal bucket.
12
- */
13
- export function PortalBucket(_ref) {
2
+ import React, { useCallback, useLayoutEffect, useMemo, useReducer, useState } from 'react';
3
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
+ function LegacyPortalBucket(_ref) {
14
5
  var id = _ref.id,
15
6
  portalManager = _ref.portalManager;
16
7
  // State to hold the current portals for this bucket
@@ -32,4 +23,53 @@ export function PortalBucket(_ref) {
32
23
  // Render the current portal elements
33
24
  // @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
34
25
  return /*#__PURE__*/React.createElement(React.Fragment, null, portalElements);
26
+ }
27
+
28
+ /**
29
+ * Portals stay in the manager; state is only a render tick. React keeps
30
+ * hook state on both the current and alternate fiber, so storing portals
31
+ * in state would retain removed portals until the next render.
32
+ */
33
+ function TickPortalBucket(_ref2) {
34
+ var _portalManager$getBuc, _portalManager$getBuc2;
35
+ var id = _ref2.id,
36
+ portalManager = _ref2.portalManager;
37
+ var _useReducer = useReducer(function (tick) {
38
+ return tick + 1;
39
+ }, 0),
40
+ _useReducer2 = _slicedToArray(_useReducer, 2),
41
+ forceRender = _useReducer2[1];
42
+ var updater = useCallback(function () {
43
+ return forceRender();
44
+ }, []);
45
+ useLayoutEffect(function () {
46
+ portalManager.registerBucket(id, updater);
47
+ return function () {
48
+ portalManager.unregisterBucket(id);
49
+ };
50
+ }, [id, portalManager, updater]);
51
+ // @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
52
+ return /*#__PURE__*/React.createElement(React.Fragment, null, Object.values((_portalManager$getBuc = (_portalManager$getBuc2 = portalManager.getBuckets()[id]) === null || _portalManager$getBuc2 === void 0 ? void 0 : _portalManager$getBuc2.portals) !== null && _portalManager$getBuc !== void 0 ? _portalManager$getBuc : {}));
53
+ }
54
+
55
+ /**
56
+ * A component for rendering portals managed by a `PortalManager`.
57
+ * It subscribes to a `PortalManager` instance to listen for changes in the portal content
58
+ * and renders the content of its assigned portal bucket.
59
+ *
60
+ * @param {PortalBucketProps} props The component props.
61
+ * @param {number} props.id The ID for the portal bucket. This ID is used by the `PortalManager` to manage the content of this bucket.
62
+ * @param {PortalManager} props.portalManager An instance of `PortalManager` which manages the registration and unregistration of portal buckets and their content.
63
+ * @returns {React.ReactElement} The React element(s) that are currently registered to this portal bucket.
64
+ */
65
+ export function PortalBucket(_ref3) {
66
+ var id = _ref3.id,
67
+ portalManager = _ref3.portalManager;
68
+ return isExperimentEnabled('platform_editor_reduce_memory_leaks') ? /*#__PURE__*/React.createElement(TickPortalBucket, {
69
+ id: id,
70
+ portalManager: portalManager
71
+ }) : /*#__PURE__*/React.createElement(LegacyPortalBucket, {
72
+ id: id,
73
+ portalManager: portalManager
74
+ });
35
75
  }
@@ -5,6 +5,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  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; }
6
6
  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) { _defineProperty(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; }
7
7
  import throttle from 'lodash/throttle';
8
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
8
9
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
10
  var DEFAULT_INITIAL_BUCKETS = 50;
10
11
  var DEFAULT_MAX_BUCKET_CAPACITY = 50;
@@ -199,9 +200,11 @@ export var PortalManager = /*#__PURE__*/function () {
199
200
  var _this$portalToBucketM,
200
201
  _this4 = this;
201
202
  var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
202
- this.createBucket();
203
- // @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
204
- this.buckets[this.getCurrentBucket()].capacity -= 1;
203
+ if (!isExperimentEnabled('platform_editor_reduce_memory_leaks') || !this.portalToBucketMap.has(key)) {
204
+ this.createBucket();
205
+ // @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
206
+ this.buckets[this.getCurrentBucket()].capacity -= 1;
207
+ }
205
208
  var id = (_this$portalToBucketM = this.portalToBucketMap.get(key)) !== null && _this$portalToBucketM !== void 0 ? _this$portalToBucketM : this.getCurrentBucket();
206
209
  // @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
207
210
  this.portalToBucketMap.set(key, id);
@@ -1,5 +1,4 @@
1
1
  import { Node } from '@atlaskit/editor-prosemirror/model';
2
- import { fg } from '@atlaskit/platform-feature-flags/fg';
3
2
  import { getNodeIdProvider } from '../../node-anchor/node-anchor-provider';
4
3
  import { processRawFragmentValue } from '../../utils/processRawFragmentValue';
5
4
  import { processRawValue, processRawValueWithoutValidation } from '../../utils/processRawValue';
@@ -69,6 +68,7 @@ export var corePlugin = function corePlugin(_ref) {
69
68
  return true;
70
69
  },
71
70
  scrollToPos: function scrollToPos(pos, scrollOptions) {
71
+ var _ref2, _editorView$domAtPos;
72
72
  var editorView = config === null || config === void 0 ? void 0 : config.getEditorView();
73
73
  if (!editorView) {
74
74
  return false;
@@ -78,27 +78,11 @@ export var corePlugin = function corePlugin(_ref) {
78
78
  if (!isValidPos) {
79
79
  return false;
80
80
  }
81
- if (fg('platform_editor_fix_scroll_to_pos')) {
82
- var _ref2, _editorView$domAtPos;
83
- // nodeDOM can return a Text node for inline positions
84
- var nodeDom = editorView.nodeDOM(pos);
85
- var _dom = (_ref2 = nodeDom instanceof Element ? nodeDom : null) !== null && _ref2 !== void 0 ? _ref2 : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
86
- if (!(_dom instanceof Element)) {
87
- return false;
88
- }
89
- _dom.scrollIntoView(scrollOptions);
90
- return true;
91
- }
92
81
 
93
- // Legacy path — domAtPos interprets block boundaries as the parent container
94
- var dom = editorView.domAtPos(pos).node;
82
+ // nodeDOM can return a Text node for inline positions
83
+ var nodeDom = editorView.nodeDOM(pos);
84
+ var dom = (_ref2 = nodeDom instanceof Element ? nodeDom : null) !== null && _ref2 !== void 0 ? _ref2 : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
95
85
  if (!(dom instanceof Element)) {
96
- // If it's not an element (e.g. #text node), we'll try the parent.
97
- // This is expected to cover most of the scenarios, if not, window.scrollTo is an alternative
98
- if (dom.parentNode instanceof Element) {
99
- dom.parentNode.scrollIntoView(scrollOptions);
100
- return true;
101
- }
102
86
  return false;
103
87
  }
104
88
  dom.scrollIntoView(scrollOptions);
@@ -36,8 +36,8 @@ var itemStyles = xcss({
36
36
  color: 'color.text',
37
37
  display: 'flex',
38
38
  gap: 'space.150',
39
- minHeight: '40px',
40
- paddingBlock: 'space.100',
39
+ minHeight: '44px',
40
+ paddingBlock: 'space.075',
41
41
  paddingInline: 'space.200',
42
42
  textAlign: 'start',
43
43
  width: '100%',
@@ -51,8 +51,8 @@ var selectedItemStyles = xcss({
51
51
  color: 'color.text',
52
52
  display: 'flex',
53
53
  gap: 'space.150',
54
- minHeight: '40px',
55
- paddingBlock: 'space.100',
54
+ minHeight: '44px',
55
+ paddingBlock: 'space.075',
56
56
  paddingInline: 'space.200',
57
57
  position: 'relative',
58
58
  textAlign: 'start',
@@ -77,8 +77,8 @@ var disabledItemStyles = xcss({
77
77
  color: 'color.text.disabled',
78
78
  display: 'flex',
79
79
  gap: 'space.150',
80
- minHeight: '40px',
81
- paddingBlock: 'space.100',
80
+ minHeight: '44px',
81
+ paddingBlock: 'space.075',
82
82
  paddingInline: 'space.200',
83
83
  textAlign: 'start',
84
84
  width: '100%'
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { messages } from './messages';
4
+ import { QuickInsertMenuSection } from './QuickInsertMenuSection';
5
+ export var QuickInsertSearchResultsSection = function QuickInsertSearchResultsSection(_ref) {
6
+ var children = _ref.children;
7
+ var _useIntl = useIntl(),
8
+ formatMessage = _useIntl.formatMessage;
9
+ return /*#__PURE__*/React.createElement(QuickInsertMenuSection, {
10
+ title: formatMessage(messages.searchResults)
11
+ }, children);
12
+ };