@atlaskit/editor-common 119.16.4 → 120.0.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 +46 -0
  2. package/codemods/117.0.0-upgrade-react-peer-dependencies.ts +6 -0
  3. package/dist/cjs/media-insert/rank.js +11 -0
  4. package/dist/cjs/monitoring/error.js +1 -1
  5. package/dist/cjs/node-anchor/limited-mode-document-thresholds.js +41 -3
  6. package/dist/cjs/node-anchor/node-anchor-provider.js +5 -46
  7. package/dist/cjs/node-anchor/should-enable-limited-mode.js +52 -0
  8. package/dist/cjs/quick-insert/ElementBrowserQuickInsertMenuItem.js +128 -0
  9. package/dist/cjs/quick-insert/QuickInsertMenuItem.js +24 -45
  10. package/dist/cjs/quick-insert/TypeAheadQuickInsertMenuItem.js +56 -0
  11. package/dist/cjs/quick-insert/quickInsertMenuItemUtils.js +22 -0
  12. package/dist/cjs/ui/DropList/index.js +1 -1
  13. package/dist/es2019/media-insert/rank.js +7 -0
  14. package/dist/es2019/monitoring/error.js +1 -1
  15. package/dist/es2019/node-anchor/limited-mode-document-thresholds.js +39 -2
  16. package/dist/es2019/node-anchor/node-anchor-provider.js +5 -48
  17. package/dist/es2019/node-anchor/should-enable-limited-mode.js +47 -0
  18. package/dist/es2019/quick-insert/ElementBrowserQuickInsertMenuItem.js +123 -0
  19. package/dist/es2019/quick-insert/QuickInsertMenuItem.js +24 -38
  20. package/dist/es2019/quick-insert/TypeAheadQuickInsertMenuItem.js +51 -0
  21. package/dist/es2019/quick-insert/quickInsertMenuItemUtils.js +13 -0
  22. package/dist/es2019/ui/DropList/index.js +1 -1
  23. package/dist/esm/media-insert/rank.js +4 -0
  24. package/dist/esm/monitoring/error.js +1 -1
  25. package/dist/esm/node-anchor/limited-mode-document-thresholds.js +41 -2
  26. package/dist/esm/node-anchor/node-anchor-provider.js +5 -46
  27. package/dist/esm/node-anchor/should-enable-limited-mode.js +46 -0
  28. package/dist/esm/quick-insert/ElementBrowserQuickInsertMenuItem.js +121 -0
  29. package/dist/esm/quick-insert/QuickInsertMenuItem.js +24 -43
  30. package/dist/esm/quick-insert/TypeAheadQuickInsertMenuItem.js +49 -0
  31. package/dist/esm/quick-insert/quickInsertMenuItemUtils.js +16 -0
  32. package/dist/esm/ui/DropList/index.js +1 -1
  33. package/dist/types/media-insert/rank.d.ts +3 -0
  34. package/dist/types/node-anchor/limited-mode-document-thresholds.d.ts +29 -2
  35. package/dist/types/node-anchor/should-enable-limited-mode.d.ts +21 -0
  36. package/dist/types/quick-insert/ElementBrowserQuickInsertMenuItem.d.ts +3 -0
  37. package/dist/types/quick-insert/QuickInsertContext.d.ts +1 -0
  38. package/dist/types/quick-insert/QuickInsertMenuItem.d.ts +8 -8
  39. package/dist/types/quick-insert/TypeAheadQuickInsertMenuItem.d.ts +3 -0
  40. package/dist/types/quick-insert/quickInsertMenuItemUtils.d.ts +2 -0
  41. package/media-insert/rank/package.json +10 -0
  42. package/package.json +2 -2
  43. package/should-enable-limited-mode/package.json +10 -0
  44. /package/dist/cjs/quick-insert/{QuickInsertMenuItem.compiled.css → TypeAheadQuickInsertMenuItem.compiled.css} +0 -0
  45. /package/dist/es2019/quick-insert/{QuickInsertMenuItem.compiled.css → TypeAheadQuickInsertMenuItem.compiled.css} +0 -0
  46. /package/dist/esm/quick-insert/{QuickInsertMenuItem.compiled.css → TypeAheadQuickInsertMenuItem.compiled.css} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 120.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`82fd62dcd2841`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/82fd62dcd2841) -
8
+ Add the experiment-gated registry-native Element Browser treatment for
9
+ `platform_editor_slash_command`.
10
+
11
+ `QuickInsertProvider` values must now provide a `surface` of either `typeahead` or
12
+ `element-browser`.
13
+
14
+ Prepare surface-specific Quick Insert item renderers for the `platform_editor_slash_command`
15
+ experiment.
16
+
17
+ Fix the registry Element Browser opening from View more and localize its accessibility labels.
18
+
19
+ ### Minor Changes
20
+
21
+ - [`ab79746656fb4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ab79746656fb4) -
22
+ [ux] Add shared media insert tab ranks, allow registered tabs to define a numeric rank, and move
23
+ the AI image generation Create tab to the third position when the
24
+ `platform_editor_ai_image_generation_improvement_ex` experiment is enabled.
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies
29
+
30
+ ## 119.17.0
31
+
32
+ ### Minor Changes
33
+
34
+ - [`df8065dfa9d59`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/df8065dfa9d59) -
35
+ [EDITOR-8302] Behind the `platform_editor_limited_threshold_tweaks` experiment, limited mode
36
+ retunes its document thresholds: the node-count threshold drops from 5,000 to 2,438 — the
37
+ production p99 — so the guard lands on the largest ~1% of documents, and the `doc.nodeSize`
38
+ threshold is raised from 30,000 to 750,000 so it acts as a backstop for pathologically huge
39
+ documents rather than tripping on ordinary long-text pages. Control behaviour is unchanged.
40
+
41
+ The decision now lives in a single shared `@atlaskit/editor-common/should-enable-limited-mode`
42
+ module, used by both the limited-mode plugin and the node-anchor provider, instead of two
43
+ hand-synced copies.
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies
48
+
3
49
  ## 119.16.4
4
50
 
5
51
  ### Patch Changes
@@ -15,7 +15,13 @@ const EXCLUDED_PACKAGE_JSON_PATHS = [
15
15
  'packages/editor/editor-core/package.json',
16
16
  'packages/editor/editor-plugin-ai-tests/package.json',
17
17
  'packages/editor/editor-plugin-extension-tests/package.json',
18
+ 'packages/editor/editor-plugin-synced-block-tests/package.json',
19
+ 'packages/editor/generative-ai-modal/package.json',
20
+ 'packages/editor/editor-plugin-show-diff-tests/package.json',
18
21
  'packages/editor/editor-plugin-table-tests/package.json',
22
+ 'packages/editor/editor-plugin-quick-insert-tests/package.json',
23
+ 'packages/editor/editor-referentiality/package.json',
24
+ 'packages/editor/editor-synced-block-renderer-tests/package.json',
19
25
  ];
20
26
 
21
27
  type DependencyName = 'react' | 'react-dom' | '@types/react' | '@types/react-dom';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.MEDIA_INSERT_TAB_RANK = exports.DEFAULT_MEDIA_INSERT_TAB_RANK = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _enums = require("../analytics/types/enums");
10
+ var DEFAULT_MEDIA_INSERT_TAB_RANK = exports.DEFAULT_MEDIA_INSERT_TAB_RANK = 0;
11
+ var MEDIA_INSERT_TAB_RANK = exports.MEDIA_INSERT_TAB_RANK = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _enums.MEDIA_INSERT_TAB.UPLOAD, 100), _enums.MEDIA_INSERT_TAB.LINK, 200), _enums.MEDIA_INSERT_TAB.CREATE, 300);
@@ -28,7 +28,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
28
28
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
29
29
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
30
30
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
31
- var packageVersion = "119.16.3";
31
+ var packageVersion = "119.17.0";
32
32
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
33
33
  // Remove URL as it has UGC
34
34
  // Ignored via go/ees007
@@ -3,13 +3,51 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.LIMITED_MODE_INCLUDE_LEGACY_CONTENT_IN_THRESHOLD = exports.LIMITED_MODE_DEFAULT_NODE_COUNT_THRESHOLD = exports.LIMITED_MODE_DEFAULT_DOC_SIZE_THRESHOLD = void 0;
6
+ exports.getLimitedModeThresholds = exports.LIMITED_MODE_TWEAKED_NODE_COUNT_THRESHOLD = exports.LIMITED_MODE_TWEAKED_DOC_SIZE_THRESHOLD = exports.LIMITED_MODE_DEFAULT_NODE_COUNT_THRESHOLD = exports.LIMITED_MODE_DEFAULT_DOC_SIZE_THRESHOLD = void 0;
7
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
7
8
  /** Fixed document thresholds for limited (performance) mode (previously Statsig-driven). */
8
9
  var LIMITED_MODE_DEFAULT_NODE_COUNT_THRESHOLD = exports.LIMITED_MODE_DEFAULT_NODE_COUNT_THRESHOLD = 5000;
9
10
 
10
11
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
11
12
  var LIMITED_MODE_DEFAULT_DOC_SIZE_THRESHOLD = exports.LIMITED_MODE_DEFAULT_DOC_SIZE_THRESHOLD = 30000;
12
13
 
13
- /** When true, any legacy-content macro triggers limited mode regardless of size/count. */
14
+ /**
15
+ * Treatment node-count threshold. Production node-count percentiles across all documents are
16
+ * p90 ≈ 206, p95 ≈ 576, p99 ≈ 2,438 — today's 5,000 sits beyond p99 and fires on only ~0.36% of
17
+ * documents. 2,500 is p99 rounded, i.e. limited mode becomes a guard on the largest ~1% of pages.
18
+ *
19
+ * Deliberately NOT lower: the worst-5%-by-INP cohort has a median document of ~25 nodes, so its
20
+ * slowness is device/extension/collab-bound and structurally invisible. No node-count value catches
21
+ * it without enabling limited mode for nearly everyone (300 nodes ⇒ 8% of all sessions for 34%
22
+ * recall). Chasing that cohort needs a runtime input-latency trigger, not a bigger document guard.
23
+ */
14
24
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
15
- var LIMITED_MODE_INCLUDE_LEGACY_CONTENT_IN_THRESHOLD = exports.LIMITED_MODE_INCLUDE_LEGACY_CONTENT_IN_THRESHOLD = true;
25
+ var LIMITED_MODE_TWEAKED_NODE_COUNT_THRESHOLD = exports.LIMITED_MODE_TWEAKED_NODE_COUNT_THRESHOLD = 2438;
26
+
27
+ /**
28
+ * Treatment `nodeSize` threshold — a backstop for pathologically huge documents, not a routine
29
+ * trigger. Input latency really does degrade at extreme document sizes: the 100k+ `nodeSize` bucket
30
+ * sits at p90 113.5ms / p99 899ms, against p90 25.6ms in the 6k–11k bucket. But that curve is smooth
31
+ * and only becomes severe far past the body of the distribution (production `nodeSize` p99 is
32
+ * ~91.8k), so this is set well beyond p99 rather than at the control's 30,000 — which fires around
33
+ * p95 and so degrades a large population of plain long-text pages that type perfectly well.
34
+ */
35
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
36
+ var LIMITED_MODE_TWEAKED_DOC_SIZE_THRESHOLD = exports.LIMITED_MODE_TWEAKED_DOC_SIZE_THRESHOLD = 750000;
37
+
38
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
39
+
40
+ /**
41
+ * The document thresholds currently in force. This is the only place the cohort is resolved — the
42
+ * limited-mode decision itself is identical either way, only these two numbers change.
43
+ */
44
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
45
+ var getLimitedModeThresholds = exports.getLimitedModeThresholds = function getLimitedModeThresholds() {
46
+ return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_limited_threshold_tweaks') ? {
47
+ docSizeThreshold: LIMITED_MODE_TWEAKED_DOC_SIZE_THRESHOLD,
48
+ nodeCountThreshold: LIMITED_MODE_TWEAKED_NODE_COUNT_THRESHOLD
49
+ } : {
50
+ docSizeThreshold: LIMITED_MODE_DEFAULT_DOC_SIZE_THRESHOLD,
51
+ nodeCountThreshold: LIMITED_MODE_DEFAULT_NODE_COUNT_THRESHOLD
52
+ };
53
+ };
@@ -10,7 +10,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _utils = require("../utils");
12
12
  var _dynamicBitArray = require("./dynamic-bit-array");
13
- var _limitedModeDocumentThresholds = require("./limited-mode-document-thresholds");
13
+ var _shouldEnableLimitedMode = require("./should-enable-limited-mode");
14
14
  var NodeAnchorProvider = exports.NodeAnchorProvider = /*#__PURE__*/function () {
15
15
  function NodeAnchorProvider() {
16
16
  var limitedMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
@@ -94,53 +94,12 @@ var NodeAnchorProvider = exports.NodeAnchorProvider = /*#__PURE__*/function () {
94
94
  var nodeIdProviderMap = new WeakMap();
95
95
 
96
96
  /**
97
- * Determines whether limited mode should be enabled.
98
- * This logic mirrors the limited mode plugin implementation, but lives here to avoid a circular dependency.
99
- * If it changes, update the matching logic in `editor-plugin-limited-mode/src/pm-plugins/main.ts`.
100
- *
101
- * Limited mode is activated when ANY of the following conditions are met:
102
- * 1. Document size exceeds `LIMITED_MODE_DEFAULT_DOC_SIZE_THRESHOLD` — checked first as O(1)
103
- * 2. Node count exceeds `LIMITED_MODE_DEFAULT_NODE_COUNT_THRESHOLD`
104
- * 3. Document contains a legacy-content macro (LCM)
105
- *
106
- * Performance optimisations:
107
- * - Doc size is checked first (O(1)) - if it exceeds threshold, we skip traversal entirely.
108
- * - If we find an LCM during traversal, we exit early since limited mode will be enabled.
97
+ * Determines whether limited mode should be enabled for the given editor view.
98
+ * Delegates to the shared decision in `should-enable-limited-mode.ts` so the provider and the
99
+ * limited-mode plugin can never drift.
109
100
  */
110
101
  var isLimitedModeEnabled = function isLimitedModeEnabled(editorView) {
111
- var doc = editorView.state.doc;
112
- var nodeCountThreshold = _limitedModeDocumentThresholds.LIMITED_MODE_DEFAULT_NODE_COUNT_THRESHOLD;
113
- var docSizeThreshold = _limitedModeDocumentThresholds.LIMITED_MODE_DEFAULT_DOC_SIZE_THRESHOLD;
114
-
115
- // Early exit: doc size exceeds threshold - O(1), no traversal needed
116
- if (doc.nodeSize > docSizeThreshold) {
117
- return true;
118
- }
119
-
120
- // Single traversal for node count and LCM detection
121
- var nodeCount = 0;
122
- var hasLcm = false;
123
- doc.descendants(function (node) {
124
- var _node$attrs;
125
- nodeCount += 1;
126
- if (((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionKey) === 'legacy-content') {
127
- hasLcm = true;
128
-
129
- // Early exit: LCM found — limited mode will be enabled
130
- return false;
131
- }
132
- });
133
-
134
- // LCM condition takes precedence (if we early exited traversal, this is why)
135
- if (hasLcm) {
136
- return true;
137
- }
138
-
139
- // Check node count threshold
140
- if (nodeCount > nodeCountThreshold) {
141
- return true;
142
- }
143
- return false;
102
+ return (0, _shouldEnableLimitedMode.shouldEnableLimitedModeForDocument)(editorView.state.doc);
144
103
  };
145
104
 
146
105
  // Get the NodeIdProvider for a specific EditorView instance.
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.shouldEnableLimitedModeForDocument = void 0;
7
+ var _limitedModeDocumentThresholds = require("./limited-mode-document-thresholds");
8
+ var LEGACY_CONTENT_EXTENSION_KEY = 'legacy-content';
9
+
10
+ /**
11
+ * Single source of truth for the limited (performance) mode decision.
12
+ *
13
+ * Shared by the limited-mode plugin (`editor-plugin-limited-mode/src/pm-plugins/main.ts`) and the
14
+ * node-anchor provider (`node-anchor-provider.ts`) so the logic can no longer drift between two
15
+ * hand-synced copies. It lives in `editor-common` to avoid a circular dependency (the plugin already
16
+ * depends on `editor-common`; `editor-common` must not depend on the plugin).
17
+ *
18
+ * Limited mode is enabled when ANY of the following is true:
19
+ * 1. `doc.nodeSize` exceeds the doc-size threshold (checked first, O(1))
20
+ * 2. the document contains a legacy-content macro (LCM)
21
+ * 3. node count exceeds the node-count threshold
22
+ *
23
+ * The thresholds come from `getLimitedModeThresholds()`, which is where the
24
+ * `platform_editor_limited_threshold_tweaks` cohort is resolved — see
25
+ * `limited-mode-document-thresholds.ts` for the values and the data behind them.
26
+ *
27
+ * Performance: doc size is checked first so an oversized document skips the traversal entirely.
28
+ */
29
+ var shouldEnableLimitedModeForDocument = exports.shouldEnableLimitedModeForDocument = function shouldEnableLimitedModeForDocument(doc) {
30
+ var _getLimitedModeThresh = (0, _limitedModeDocumentThresholds.getLimitedModeThresholds)(),
31
+ docSizeThreshold = _getLimitedModeThresh.docSizeThreshold,
32
+ nodeCountThreshold = _getLimitedModeThresh.nodeCountThreshold;
33
+ if (doc.nodeSize > docSizeThreshold) {
34
+ return true;
35
+ }
36
+
37
+ // Single traversal for node count and LCM detection.
38
+ var nodeCount = 0;
39
+ var hasLcm = false;
40
+ doc.descendants(function (node) {
41
+ var _node$attrs;
42
+ nodeCount += 1;
43
+ if (((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionKey) === LEGACY_CONTENT_EXTENSION_KEY) {
44
+ hasLcm = true;
45
+
46
+ // Early exit: LCM found — limited mode will be enabled
47
+ return false;
48
+ }
49
+ return true;
50
+ });
51
+ return hasLcm || nodeCount > nodeCountThreshold;
52
+ };
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ElementBrowserQuickInsertMenuItem = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _primitives = require("@atlaskit/primitives");
10
+ var _quickInsertMenuItemUtils = require("./quickInsertMenuItemUtils");
11
+ var _useQuickInsertContext = require("./useQuickInsertContext");
12
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- Compiled primitives do not provide Pressable.
13
+
14
+ var itemStyles = (0, _primitives.xcss)({
15
+ alignItems: 'start',
16
+ backgroundColor: 'color.background.neutral.subtle',
17
+ borderColor: 'color.border',
18
+ borderRadius: 'radius.medium',
19
+ borderStyle: 'solid',
20
+ borderWidth: 'border.width',
21
+ color: 'color.text',
22
+ cursor: 'pointer',
23
+ display: 'flex',
24
+ gap: 'space.150',
25
+ padding: 'space.150',
26
+ textAlign: 'start',
27
+ width: '100%'
28
+ });
29
+ var selectedItemStyles = (0, _primitives.xcss)({
30
+ alignItems: 'start',
31
+ backgroundColor: 'color.background.selected',
32
+ borderColor: 'color.border.selected',
33
+ borderRadius: 'radius.medium',
34
+ borderStyle: 'solid',
35
+ borderWidth: 'border.width',
36
+ color: 'color.text',
37
+ cursor: 'pointer',
38
+ display: 'flex',
39
+ gap: 'space.150',
40
+ padding: 'space.150',
41
+ textAlign: 'start',
42
+ width: '100%'
43
+ });
44
+ var disabledItemStyles = (0, _primitives.xcss)({
45
+ alignItems: 'start',
46
+ backgroundColor: 'color.background.neutral.subtle',
47
+ borderColor: 'color.border',
48
+ borderRadius: 'radius.medium',
49
+ borderStyle: 'solid',
50
+ borderWidth: 'border.width',
51
+ color: 'color.text.disabled',
52
+ cursor: 'not-allowed',
53
+ display: 'flex',
54
+ gap: 'space.150',
55
+ padding: 'space.150',
56
+ textAlign: 'start',
57
+ width: '100%'
58
+ });
59
+ var iconStyles = (0, _primitives.xcss)({
60
+ alignItems: 'center',
61
+ backgroundColor: 'elevation.surface.overlay',
62
+ borderColor: 'color.border',
63
+ borderRadius: 'radius.medium',
64
+ borderStyle: 'solid',
65
+ borderWidth: 'border.width',
66
+ display: 'flex',
67
+ flexShrink: 0,
68
+ height: '40px',
69
+ justifyContent: 'center',
70
+ overflow: 'hidden',
71
+ width: '40px'
72
+ });
73
+ var descriptionStyles = (0, _primitives.xcss)({
74
+ color: 'color.text.subtle'
75
+ });
76
+ var shortcutStyles = (0, _primitives.xcss)({
77
+ backgroundColor: 'color.background.neutral',
78
+ borderRadius: 'radius.small',
79
+ color: 'color.text.subtle',
80
+ font: 'font.body.small',
81
+ paddingBlock: 'space.025',
82
+ paddingInline: 'space.050'
83
+ });
84
+ var ElementBrowserQuickInsertMenuItem = exports.ElementBrowserQuickInsertMenuItem = function ElementBrowserQuickInsertMenuItem(_ref) {
85
+ var ariaLabel = _ref.ariaLabel,
86
+ description = _ref.description,
87
+ iconBefore = _ref.iconBefore,
88
+ isDisabled = _ref.isDisabled,
89
+ onSelect = _ref.onSelect,
90
+ shortcut = _ref.shortcut,
91
+ _ref$shouldWrapIcon = _ref.shouldWrapIcon,
92
+ shouldWrapIcon = _ref$shouldWrapIcon === void 0 ? true : _ref$shouldWrapIcon,
93
+ title = _ref.title;
94
+ var _useQuickInsertContex = (0, _useQuickInsertContext.useQuickInsertContext)(),
95
+ item = _useQuickInsertContex.item;
96
+ var _ref2 = item !== null && item !== void 0 ? item : {
97
+ id: undefined,
98
+ isSelected: false
99
+ },
100
+ id = _ref2.id,
101
+ isSelected = _ref2.isSelected;
102
+ var handleClick = (0, _quickInsertMenuItemUtils.useQuickInsertMenuItemSelection)(onSelect);
103
+ return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
104
+ "aria-label": ariaLabel,
105
+ "aria-selected": isSelected,
106
+ id: id,
107
+ isDisabled: isDisabled,
108
+ onClick: handleClick,
109
+ role: "option",
110
+ xcss: isDisabled ? disabledItemStyles : isSelected ? selectedItemStyles : itemStyles
111
+ }, iconBefore && shouldWrapIcon ? /*#__PURE__*/_react.default.createElement(_primitives.Box, {
112
+ xcss: iconStyles
113
+ }, iconBefore) : iconBefore, /*#__PURE__*/_react.default.createElement(_primitives.Stack, {
114
+ space: "space.050",
115
+ grow: "fill"
116
+ }, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
117
+ alignBlock: "center",
118
+ spread: "space-between",
119
+ space: "space.100"
120
+ }, /*#__PURE__*/_react.default.createElement(_primitives.Text, {
121
+ weight: "medium"
122
+ }, title), shortcut && /*#__PURE__*/_react.default.createElement(_primitives.Box, {
123
+ as: "span",
124
+ xcss: shortcutStyles
125
+ }, shortcut)), description && /*#__PURE__*/_react.default.createElement(_primitives.Box, {
126
+ xcss: descriptionStyles
127
+ }, /*#__PURE__*/_react.default.createElement(_primitives.Text, null, description))));
128
+ };
@@ -1,63 +1,42 @@
1
- /* QuickInsertMenuItem.tsx generated by @compiled/babel-plugin v2.0.0 */
2
1
  "use strict";
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
4
  Object.defineProperty(exports, "__esModule", {
7
5
  value: true
8
6
  });
9
7
  exports.QuickInsertMenuItem = void 0;
10
- require("./QuickInsertMenuItem.compiled.css");
11
- var _runtime = require("@compiled/react/runtime");
12
- var _react = _interopRequireWildcard(require("react"));
13
- var _buttonItem = _interopRequireDefault(require("@atlaskit/menu/button-item"));
14
- var _compiled = require("@atlaskit/primitives/compiled");
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _ElementBrowserQuickInsertMenuItem = require("./ElementBrowserQuickInsertMenuItem");
10
+ var _TypeAheadQuickInsertMenuItem = require("./TypeAheadQuickInsertMenuItem");
15
11
  var _useQuickInsertContext = require("./useQuickInsertContext");
16
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
17
- var styles = {
18
- icon: "_2rko1qi0 _1reo15vq _18m915vq _1h6d1l7x _1dqonqa1 _189ee4h9 _4cvr1h6o _bfhk1bhr _1e0c1txw _4t3izwfg _1bah1h6o _1bsbzwfg",
19
- shortcut: "_2rko12b0 _11c8wadc _1rjcv77o _18zr1b66 _bfhki8nm _syazazsu"
20
- };
21
12
  var QuickInsertMenuItem = exports.QuickInsertMenuItem = function QuickInsertMenuItem(_ref) {
22
- var _item$isSelected;
23
13
  var ariaLabel = _ref.ariaLabel,
14
+ description = _ref.description,
24
15
  iconBefore = _ref.iconBefore,
25
16
  isDisabled = _ref.isDisabled,
26
17
  onSelect = _ref.onSelect,
27
18
  shortcut = _ref.shortcut,
28
- _ref$shouldWrapIcon = _ref.shouldWrapIcon,
29
- shouldWrapIcon = _ref$shouldWrapIcon === void 0 ? true : _ref$shouldWrapIcon,
19
+ shouldWrapIcon = _ref.shouldWrapIcon,
30
20
  title = _ref.title;
31
21
  var _useQuickInsertContex = (0, _useQuickInsertContext.useQuickInsertContext)(),
32
- editorView = _useQuickInsertContex.editorView,
33
- item = _useQuickInsertContex.item,
34
- select = _useQuickInsertContex.select;
35
- var isSelected = (_item$isSelected = item === null || item === void 0 ? void 0 : item.isSelected) !== null && _item$isSelected !== void 0 ? _item$isSelected : false;
36
- var handleClick = (0, _react.useCallback)(function () {
37
- return select(function (selectionContext) {
38
- return onSelect({
39
- editorView: editorView,
40
- insert: selectionContext.insert,
41
- source: selectionContext.source
42
- });
43
- });
44
- }, [editorView, onSelect, select]);
45
- return /*#__PURE__*/_react.default.createElement(_buttonItem.default, {
46
- "aria-label": ariaLabel,
47
- "aria-selected": isSelected,
48
- iconBefore: iconBefore && shouldWrapIcon ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
49
- xcss: styles.icon
50
- }, iconBefore) : iconBefore,
51
- id: item === null || item === void 0 ? void 0 : item.id,
22
+ surface = _useQuickInsertContex.surface;
23
+ return surface === 'element-browser' ? /*#__PURE__*/_react.default.createElement(_ElementBrowserQuickInsertMenuItem.ElementBrowserQuickInsertMenuItem, {
24
+ ariaLabel: ariaLabel,
25
+ description: description,
26
+ iconBefore: iconBefore,
52
27
  isDisabled: isDisabled,
53
- isSelected: isSelected,
54
- onClick: handleClick,
55
- role: "option"
56
- }, /*#__PURE__*/_react.default.createElement(_compiled.Inline, {
57
- alignBlock: "center",
58
- spread: "space-between"
59
- }, /*#__PURE__*/_react.default.createElement(_compiled.Text, null, title), shortcut && /*#__PURE__*/_react.default.createElement(_compiled.Box, {
60
- as: "span",
61
- xcss: styles.shortcut
62
- }, shortcut)));
28
+ onSelect: onSelect,
29
+ shortcut: shortcut,
30
+ shouldWrapIcon: shouldWrapIcon,
31
+ title: title
32
+ }) : /*#__PURE__*/_react.default.createElement(_TypeAheadQuickInsertMenuItem.TypeAheadQuickInsertMenuItem, {
33
+ ariaLabel: ariaLabel,
34
+ description: description,
35
+ iconBefore: iconBefore,
36
+ isDisabled: isDisabled,
37
+ onSelect: onSelect,
38
+ shortcut: shortcut,
39
+ shouldWrapIcon: shouldWrapIcon,
40
+ title: title
41
+ });
63
42
  };
@@ -0,0 +1,56 @@
1
+ /* TypeAheadQuickInsertMenuItem.tsx generated by @compiled/babel-plugin v2.0.0 */
2
+ "use strict";
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.TypeAheadQuickInsertMenuItem = void 0;
9
+ require("./TypeAheadQuickInsertMenuItem.compiled.css");
10
+ var _runtime = require("@compiled/react/runtime");
11
+ var _react = _interopRequireDefault(require("react"));
12
+ var _buttonItem = _interopRequireDefault(require("@atlaskit/menu/button-item"));
13
+ var _compiled = require("@atlaskit/primitives/compiled");
14
+ var _quickInsertMenuItemUtils = require("./quickInsertMenuItemUtils");
15
+ var _useQuickInsertContext = require("./useQuickInsertContext");
16
+ var styles = {
17
+ icon: "_2rko1qi0 _1reo15vq _18m915vq _1h6d1l7x _1dqonqa1 _189ee4h9 _4cvr1h6o _bfhk1bhr _1e0c1txw _4t3izwfg _1bah1h6o _1bsbzwfg",
18
+ shortcut: "_2rko12b0 _11c8wadc _1rjcv77o _18zr1b66 _bfhki8nm _syazazsu"
19
+ };
20
+ var TypeAheadQuickInsertMenuItem = exports.TypeAheadQuickInsertMenuItem = function TypeAheadQuickInsertMenuItem(_ref) {
21
+ var ariaLabel = _ref.ariaLabel,
22
+ iconBefore = _ref.iconBefore,
23
+ isDisabled = _ref.isDisabled,
24
+ onSelect = _ref.onSelect,
25
+ shortcut = _ref.shortcut,
26
+ _ref$shouldWrapIcon = _ref.shouldWrapIcon,
27
+ shouldWrapIcon = _ref$shouldWrapIcon === void 0 ? true : _ref$shouldWrapIcon,
28
+ title = _ref.title;
29
+ var _useQuickInsertContex = (0, _useQuickInsertContext.useQuickInsertContext)(),
30
+ item = _useQuickInsertContex.item;
31
+ var _ref2 = item !== null && item !== void 0 ? item : {
32
+ id: undefined,
33
+ isSelected: false
34
+ },
35
+ id = _ref2.id,
36
+ isSelected = _ref2.isSelected;
37
+ var handleClick = (0, _quickInsertMenuItemUtils.useQuickInsertMenuItemSelection)(onSelect);
38
+ return /*#__PURE__*/_react.default.createElement(_buttonItem.default, {
39
+ "aria-label": ariaLabel,
40
+ "aria-selected": isSelected,
41
+ iconBefore: iconBefore && shouldWrapIcon ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
42
+ xcss: styles.icon
43
+ }, iconBefore) : iconBefore,
44
+ id: id,
45
+ isDisabled: isDisabled,
46
+ isSelected: isSelected,
47
+ onClick: handleClick,
48
+ role: "option"
49
+ }, /*#__PURE__*/_react.default.createElement(_compiled.Inline, {
50
+ alignBlock: "center",
51
+ spread: "space-between"
52
+ }, /*#__PURE__*/_react.default.createElement(_compiled.Text, null, title), shortcut && /*#__PURE__*/_react.default.createElement(_compiled.Box, {
53
+ as: "span",
54
+ xcss: styles.shortcut
55
+ }, shortcut)));
56
+ };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useQuickInsertMenuItemSelection = void 0;
7
+ var _react = require("react");
8
+ var _useQuickInsertContext = require("./useQuickInsertContext");
9
+ var useQuickInsertMenuItemSelection = exports.useQuickInsertMenuItemSelection = function useQuickInsertMenuItemSelection(onSelect) {
10
+ var _useQuickInsertContex = (0, _useQuickInsertContext.useQuickInsertContext)(),
11
+ editorView = _useQuickInsertContex.editorView,
12
+ select = _useQuickInsertContex.select;
13
+ return (0, _react.useCallback)(function () {
14
+ return select(function (selectionContext) {
15
+ return onSelect({
16
+ editorView: editorView,
17
+ insert: selectionContext.insert,
18
+ source: selectionContext.source
19
+ });
20
+ });
21
+ }, [editorView, onSelect, select]);
22
+ };
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "119.16.3";
27
+ var packageVersion = "119.17.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -0,0 +1,7 @@
1
+ import { MEDIA_INSERT_TAB } from '../analytics/types/enums';
2
+ export const DEFAULT_MEDIA_INSERT_TAB_RANK = 0;
3
+ export const MEDIA_INSERT_TAB_RANK = {
4
+ [MEDIA_INSERT_TAB.UPLOAD]: 100,
5
+ [MEDIA_INSERT_TAB.LINK]: 200,
6
+ [MEDIA_INSERT_TAB.CREATE]: 300
7
+ };
@@ -14,7 +14,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
14
14
  const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
15
15
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
16
16
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
17
- const packageVersion = "119.16.3";
17
+ const packageVersion = "119.17.0";
18
18
  const sanitiseSentryEvents = (data, _hint) => {
19
19
  // Remove URL as it has UGC
20
20
  // Ignored via go/ees007
@@ -1,9 +1,46 @@
1
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
2
+
1
3
  /** Fixed document thresholds for limited (performance) mode (previously Statsig-driven). */
2
4
  export const LIMITED_MODE_DEFAULT_NODE_COUNT_THRESHOLD = 5000;
3
5
 
4
6
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
5
7
  export const LIMITED_MODE_DEFAULT_DOC_SIZE_THRESHOLD = 30000;
6
8
 
7
- /** When true, any legacy-content macro triggers limited mode regardless of size/count. */
9
+ /**
10
+ * Treatment node-count threshold. Production node-count percentiles across all documents are
11
+ * p90 ≈ 206, p95 ≈ 576, p99 ≈ 2,438 — today's 5,000 sits beyond p99 and fires on only ~0.36% of
12
+ * documents. 2,500 is p99 rounded, i.e. limited mode becomes a guard on the largest ~1% of pages.
13
+ *
14
+ * Deliberately NOT lower: the worst-5%-by-INP cohort has a median document of ~25 nodes, so its
15
+ * slowness is device/extension/collab-bound and structurally invisible. No node-count value catches
16
+ * it without enabling limited mode for nearly everyone (300 nodes ⇒ 8% of all sessions for 34%
17
+ * recall). Chasing that cohort needs a runtime input-latency trigger, not a bigger document guard.
18
+ */
19
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
20
+ export const LIMITED_MODE_TWEAKED_NODE_COUNT_THRESHOLD = 2438;
21
+
22
+ /**
23
+ * Treatment `nodeSize` threshold — a backstop for pathologically huge documents, not a routine
24
+ * trigger. Input latency really does degrade at extreme document sizes: the 100k+ `nodeSize` bucket
25
+ * sits at p90 113.5ms / p99 899ms, against p90 25.6ms in the 6k–11k bucket. But that curve is smooth
26
+ * and only becomes severe far past the body of the distribution (production `nodeSize` p99 is
27
+ * ~91.8k), so this is set well beyond p99 rather than at the control's 30,000 — which fires around
28
+ * p95 and so degrades a large population of plain long-text pages that type perfectly well.
29
+ */
30
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
31
+ export const LIMITED_MODE_TWEAKED_DOC_SIZE_THRESHOLD = 750000;
32
+
33
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
34
+
35
+ /**
36
+ * The document thresholds currently in force. This is the only place the cohort is resolved — the
37
+ * limited-mode decision itself is identical either way, only these two numbers change.
38
+ */
8
39
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
9
- export const LIMITED_MODE_INCLUDE_LEGACY_CONTENT_IN_THRESHOLD = true;
40
+ export const getLimitedModeThresholds = () => isExperimentEnabled('platform_editor_limited_threshold_tweaks') ? {
41
+ docSizeThreshold: LIMITED_MODE_TWEAKED_DOC_SIZE_THRESHOLD,
42
+ nodeCountThreshold: LIMITED_MODE_TWEAKED_NODE_COUNT_THRESHOLD
43
+ } : {
44
+ docSizeThreshold: LIMITED_MODE_DEFAULT_DOC_SIZE_THRESHOLD,
45
+ nodeCountThreshold: LIMITED_MODE_DEFAULT_NODE_COUNT_THRESHOLD
46
+ };