@atlaskit/editor-common 128.3.2 → 129.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 (92) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/block-node-badges/package.json +10 -0
  3. package/dist/cjs/analytics/types/enums.js +0 -12
  4. package/dist/cjs/block-node-badges.js +98 -0
  5. package/dist/cjs/extensibility/Extension/Extension/index.js +20 -2
  6. package/dist/cjs/extensibility/Extension/ExtensionCommentBadge.js +110 -0
  7. package/dist/cjs/media-single/MediaBadges.js +12 -85
  8. package/dist/cjs/messages/insert-block.js +0 -5
  9. package/dist/cjs/monitoring/error.js +1 -1
  10. package/dist/cjs/quick-insert/snippetMenuRank.js +35 -0
  11. package/dist/cjs/quick-insert/utils.js +9 -14
  12. package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +0 -13
  13. package/dist/cjs/react-node-view/index.js +0 -14
  14. package/dist/cjs/type-ahead/messages.js +0 -10
  15. package/dist/cjs/ui/DropList/index.js +1 -1
  16. package/dist/cjs/utils/index.js +0 -47
  17. package/dist/es2019/analytics/types/enums.js +0 -12
  18. package/dist/es2019/block-node-badges.js +84 -0
  19. package/dist/es2019/extensibility/Extension/Extension/index.js +17 -3
  20. package/dist/es2019/extensibility/Extension/ExtensionCommentBadge.js +60 -0
  21. package/dist/es2019/media-single/MediaBadges.js +12 -79
  22. package/dist/es2019/messages/insert-block.js +0 -5
  23. package/dist/es2019/monitoring/error.js +1 -1
  24. package/dist/es2019/quick-insert/snippetMenuRank.js +30 -0
  25. package/dist/es2019/quick-insert/utils.js +7 -12
  26. package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +1 -15
  27. package/dist/es2019/react-node-view/index.js +0 -15
  28. package/dist/es2019/type-ahead/messages.js +0 -10
  29. package/dist/es2019/ui/DropList/index.js +1 -1
  30. package/dist/es2019/utils/index.js +0 -5
  31. package/dist/esm/analytics/types/enums.js +0 -12
  32. package/dist/esm/block-node-badges.js +88 -0
  33. package/dist/esm/extensibility/Extension/Extension/index.js +21 -3
  34. package/dist/esm/extensibility/Extension/ExtensionCommentBadge.js +101 -0
  35. package/dist/esm/media-single/MediaBadges.js +12 -82
  36. package/dist/esm/messages/insert-block.js +0 -5
  37. package/dist/esm/monitoring/error.js +1 -1
  38. package/dist/esm/quick-insert/snippetMenuRank.js +29 -0
  39. package/dist/esm/quick-insert/utils.js +9 -14
  40. package/dist/esm/react-node-view/getInlineNodeViewProducer.js +1 -14
  41. package/dist/esm/react-node-view/index.js +0 -14
  42. package/dist/esm/type-ahead/messages.js +0 -10
  43. package/dist/esm/ui/DropList/index.js +1 -1
  44. package/dist/esm/utils/index.js +0 -5
  45. package/dist/types/analytics/index.d.ts +1 -2
  46. package/dist/types/analytics/types/enums.d.ts +0 -12
  47. package/dist/types/analytics/types/events.d.ts +1 -3
  48. package/dist/types/analytics/types/general-events.d.ts +2 -15
  49. package/dist/types/block-node-badges.d.ts +14 -0
  50. package/dist/types/extensibility/Extension/ExtensionCommentBadge.d.ts +8 -0
  51. package/dist/types/extensibility/types.d.ts +29 -2
  52. package/dist/types/media-single/MediaBadges.d.ts +4 -8
  53. package/dist/types/messages/insert-block.d.ts +0 -5
  54. package/dist/types/quick-insert/snippetMenuRank.d.ts +16 -0
  55. package/dist/types/type-ahead/messages.d.ts +0 -10
  56. package/dist/types/types/index.d.ts +1 -1
  57. package/dist/types/types/performance-tracking.d.ts +0 -22
  58. package/dist/types/types/type-ahead.d.ts +0 -7
  59. package/dist/types/utils/index.d.ts +0 -5
  60. package/package.json +7 -3
  61. package/quick-insert/snippet-menu-rank/package.json +10 -0
  62. package/analytics/types/performance-report/package.json +0 -10
  63. package/dist/cjs/analytics/types/performance-report.js +0 -1
  64. package/dist/cjs/quick-insert/boost-native-results-above-skills.js +0 -61
  65. package/dist/cjs/utils/get-performance-options.js +0 -65
  66. package/dist/cjs/utils/performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.js +0 -10
  67. package/dist/cjs/utils/performance/TTI_SEVERITY_THRESHOLD_DEFAULTS.js +0 -10
  68. package/dist/cjs/utils/performance/measure-tti.js +0 -112
  69. package/dist/cjs/utils/startMeasureReactNodeViewRendered.js +0 -11
  70. package/dist/es2019/analytics/types/performance-report.js +0 -0
  71. package/dist/es2019/quick-insert/boost-native-results-above-skills.js +0 -49
  72. package/dist/es2019/utils/get-performance-options.js +0 -54
  73. package/dist/es2019/utils/performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.js +0 -4
  74. package/dist/es2019/utils/performance/TTI_SEVERITY_THRESHOLD_DEFAULTS.js +0 -4
  75. package/dist/es2019/utils/performance/measure-tti.js +0 -91
  76. package/dist/es2019/utils/startMeasureReactNodeViewRendered.js +0 -6
  77. package/dist/esm/analytics/types/performance-report.js +0 -0
  78. package/dist/esm/quick-insert/boost-native-results-above-skills.js +0 -54
  79. package/dist/esm/utils/get-performance-options.js +0 -53
  80. package/dist/esm/utils/performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.js +0 -4
  81. package/dist/esm/utils/performance/TTI_SEVERITY_THRESHOLD_DEFAULTS.js +0 -4
  82. package/dist/esm/utils/performance/measure-tti.js +0 -94
  83. package/dist/esm/utils/startMeasureReactNodeViewRendered.js +0 -5
  84. package/dist/types/analytics/types/performance-report.d.ts +0 -24
  85. package/dist/types/quick-insert/boost-native-results-above-skills.d.ts +0 -21
  86. package/dist/types/utils/get-performance-options.d.ts +0 -14
  87. package/dist/types/utils/performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.d.ts +0 -4
  88. package/dist/types/utils/performance/TTI_SEVERITY_THRESHOLD_DEFAULTS.d.ts +0 -4
  89. package/dist/types/utils/performance/measure-tti.d.ts +0 -8
  90. package/dist/types/utils/startMeasureReactNodeViewRendered.d.ts +0 -3
  91. package/performance/measure-tti/package.json +0 -10
  92. package/utils/get-performance-options/package.json +0 -10
@@ -32,7 +32,6 @@ var _analytics = require("../analytics");
32
32
  var _coreUtils = require("../core-utils");
33
33
  var _eventDispatcher = require("../event-dispatcher");
34
34
  var _ErrorBoundary = require("../ui/ErrorBoundary");
35
- var _utils = require("../utils");
36
35
  var _analytics2 = require("../utils/analytics");
37
36
  var _generateUniqueNodeKey = require("./generateUniqueNodeKey");
38
37
  var _getInlineNodeViewProducer = require("./getInlineNodeViewProducer");
@@ -112,13 +111,6 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
112
111
  // nodeView if DOM structure has nested plain "div"s, it doesn't see the
113
112
  // difference between them and it kills the nodeView
114
113
  this.domRef.classList.add("".concat(this.node.type.name, "View-content-wrap"));
115
- var _getPerformanceOption = (0, _utils.getPerformanceOptions)(this.view),
116
- samplingRate = _getPerformanceOption.samplingRate,
117
- slowThreshold = _getPerformanceOption.slowThreshold,
118
- trackingEnabled = _getPerformanceOption.trackingEnabled;
119
- trackingEnabled && (0, _utils.startMeasureReactNodeViewRendered)({
120
- nodeTypeName: this.node.type.name
121
- });
122
114
  if (!shouldSkipInitRender) {
123
115
  this.renderReactComponent(function () {
124
116
  return _this2.render(_this2.reactComponentProps, _this2.handleRef);
@@ -139,12 +131,6 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
139
131
  }
140
132
  }
141
133
  }
142
- trackingEnabled && (0, _utils.stopMeasureReactNodeViewRendered)({
143
- nodeTypeName: this.node.type.name,
144
- dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
145
- samplingRate: samplingRate,
146
- slowThreshold: slowThreshold
147
- });
148
134
  return this;
149
135
  }
150
136
 
@@ -110,15 +110,5 @@ var typeAheadListMessages = exports.typeAheadListMessages = (0, _reactIntl.defin
110
110
  id: 'fabric.editor.emptySearchResultsSuggestion',
111
111
  defaultMessage: 'Select {buttonName} to browse inserts.',
112
112
  description: 'a prompt to suggest user to click a button to browse inserts when there are no search results'
113
- },
114
- emptySearchResultsSuggestionNew: {
115
- id: 'fabric.editor.emptySearchResultsSuggestionNew',
116
- defaultMessage: 'Select {askRovoName} for help, or {buttonName} to browse inserts.',
117
- description: 'a prompt to suggest user to click a button to browse inserts or ask Rovo for help when there are no search results'
118
- },
119
- emptySearchResultsSuggestionAskRovoOnly: {
120
- id: 'fabric.editor.emptySearchResultsSuggestionAskRovoOnly',
121
- defaultMessage: 'Select {askRovoName} for help.',
122
- description: 'a prompt to suggest user to ask Rovo for help when there are no search results and no browse inserts button is available'
123
113
  }
124
114
  });
@@ -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 = "128.3.1";
27
+ var packageVersion = "128.4.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -76,18 +76,6 @@ Object.defineProperty(exports, "SelectedState", {
76
76
  return _SelectedState.SelectedState;
77
77
  }
78
78
  });
79
- Object.defineProperty(exports, "TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS", {
80
- enumerable: true,
81
- get: function get() {
82
- return _TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS;
83
- }
84
- });
85
- Object.defineProperty(exports, "TTI_SEVERITY_THRESHOLD_DEFAULTS", {
86
- enumerable: true,
87
- get: function get() {
88
- return _TTI_SEVERITY_THRESHOLD_DEFAULTS.TTI_SEVERITY_THRESHOLD_DEFAULTS;
89
- }
90
- });
91
79
  Object.defineProperty(exports, "UNSUPPORTED_CONTENT_LEVEL_SEVERITY", {
92
80
  enumerable: true,
93
81
  get: function get() {
@@ -540,12 +528,6 @@ Object.defineProperty(exports, "getPageElementCounts", {
540
528
  return _pageElementCounts.getPageElementCounts;
541
529
  }
542
530
  });
543
- Object.defineProperty(exports, "getPerformanceOptions", {
544
- enumerable: true,
545
- get: function get() {
546
- return _getPerformanceOptions.getPerformanceOptions;
547
- }
548
- });
549
531
  Object.defineProperty(exports, "getPropsDifference", {
550
532
  enumerable: true,
551
533
  get: function get() {
@@ -588,12 +570,6 @@ Object.defineProperty(exports, "getStepRange", {
588
570
  return _getStepRange.getStepRange;
589
571
  }
590
572
  });
591
- Object.defineProperty(exports, "getTTISeverity", {
592
- enumerable: true,
593
- get: function get() {
594
- return _measureTti.getTTISeverity;
595
- }
596
- });
597
573
  Object.defineProperty(exports, "getTimeSince", {
598
574
  enumerable: true,
599
575
  get: function get() {
@@ -918,12 +894,6 @@ Object.defineProperty(exports, "measureRender", {
918
894
  return _measureRender.measureRender;
919
895
  }
920
896
  });
921
- Object.defineProperty(exports, "measureTTI", {
922
- enumerable: true,
923
- get: function get() {
924
- return _measureTti.measureTTI;
925
- }
926
- });
927
897
  Object.defineProperty(exports, "nodeToJSON", {
928
898
  enumerable: true,
929
899
  get: function get() {
@@ -1052,12 +1022,6 @@ Object.defineProperty(exports, "startMeasure", {
1052
1022
  return _measure.startMeasure;
1053
1023
  }
1054
1024
  });
1055
- Object.defineProperty(exports, "startMeasureReactNodeViewRendered", {
1056
- enumerable: true,
1057
- get: function get() {
1058
- return _startMeasureReactNodeViewRendered.startMeasureReactNodeViewRendered;
1059
- }
1060
- });
1061
1025
  Object.defineProperty(exports, "stepAddsOneOf", {
1062
1026
  enumerable: true,
1063
1027
  get: function get() {
@@ -1076,12 +1040,6 @@ Object.defineProperty(exports, "stopMeasure", {
1076
1040
  return _measure.stopMeasure;
1077
1041
  }
1078
1042
  });
1079
- Object.defineProperty(exports, "stopMeasureReactNodeViewRendered", {
1080
- enumerable: true,
1081
- get: function get() {
1082
- return _getPerformanceOptions.stopMeasureReactNodeViewRendered;
1083
- }
1084
- });
1085
1043
  Object.defineProperty(exports, "timestampToIsoFormat", {
1086
1044
  enumerable: true,
1087
1045
  get: function get() {
@@ -1252,9 +1210,6 @@ var _getUnsupportedContentLevelData = require("./unsupportedContent/get-unsuppor
1252
1210
  var _trackUnsupportedContent = require("./track-unsupported-content");
1253
1211
  var _measureRender = require("./performance/measure-render");
1254
1212
  var _measure = require("./performance/measure");
1255
- var _TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS = require("./performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS");
1256
- var _TTI_SEVERITY_THRESHOLD_DEFAULTS = require("./performance/TTI_SEVERITY_THRESHOLD_DEFAULTS");
1257
- var _measureTti = require("./performance/measure-tti");
1258
1213
  var _isPerformanceApiAvailable = require("./performance/is-performance-api-available");
1259
1214
  var _isPerformanceObserverAvailable = require("./performance/isPerformanceObserverAvailable");
1260
1215
  var _getRequestToResponseTime = require("./performance/getRequestToResponseTime");
@@ -1270,8 +1225,6 @@ var _isTextInput = require("./is-text-input");
1270
1225
  var _whitespace = require("../whitespace");
1271
1226
  var _shouldForceTracking = require("./should-force-tracking");
1272
1227
  var _getModeFromTheme = require("./getModeFromTheme");
1273
- var _getPerformanceOptions = require("./get-performance-options");
1274
- var _startMeasureReactNodeViewRendered = require("./startMeasureReactNodeViewRendered");
1275
1228
  var _browserExtensions = require("./browser-extensions");
1276
1229
  var _renderCount = require("./profiler/render-count");
1277
1230
  var _validateUsingSpec = require("./validate-using-spec");
@@ -50,14 +50,12 @@ export let ACTION = /*#__PURE__*/function (ACTION) {
50
50
  ACTION["DISPLAYED"] = "displayed";
51
51
  ACTION["DIVERGED"] = "diverged";
52
52
  ACTION["DISPATCHED_INVALID_TRANSACTION"] = "dispatchedInvalidTransaction";
53
- ACTION["DISPATCHED_VALID_TRANSACTION"] = "dispatchedValidTransaction";
54
53
  ACTION["DOUBLE_CLICKED"] = "doubleClicked";
55
54
  ACTION["DRAGGED"] = "dragged";
56
55
  ACTION["EDITED"] = "edited";
57
56
  ACTION["EDITOR_CRASHED"] = "unhandledErrorCaught";
58
57
  ACTION["EDITOR_CRASHED_ADDITIONAL_INFORMATION"] = "unhandledErrorCaughtAdditionalInfov2";
59
58
  ACTION["EDITOR_MOUNTED"] = "mounted";
60
- ACTION["EDITOR_CONTENT_RETRIEVAL_PERFORMED"] = "contentRetrievalPerformed";
61
59
  ACTION["RE_RENDERED"] = "reRendered";
62
60
  ACTION["ENDED"] = "ended";
63
61
  ACTION["ENTERED"] = "entered";
@@ -116,7 +114,6 @@ export let ACTION = /*#__PURE__*/function (ACTION) {
116
114
  ACTION["PRESSED"] = "pressed";
117
115
  ACTION["QUICK_INSERT_INFORMATION"] = "quickInsertInformation";
118
116
  ACTION["PROSEMIRROR_RENDERED"] = "proseMirrorRendered";
119
- ACTION["REACT_NODEVIEW_RENDERED"] = "reactNodeViewRendered";
120
117
  ACTION["REFERENCE_SYNCED_BLOCK_DELETE"] = "referenceSyncedBlockDelete";
121
118
  ACTION["REFERENCE_SYNCED_BLOCK_UPDATE"] = "referenceSyncedBlockUpdate";
122
119
  ACTION["REFERENCE_SYNCED_BLOCK_UNSYNC"] = "referenceSyncedBlockUnsync";
@@ -172,18 +169,9 @@ export let ACTION = /*#__PURE__*/function (ACTION) {
172
169
  ACTION["UPLOAD_EXTERNAL_FAIL"] = "uploadExternalFailed";
173
170
  ACTION["VIEWED"] = "viewed";
174
171
  ACTION["VISITED"] = "visited";
175
- ACTION["WITH_PLUGIN_STATE_CALLED"] = "withPluginStateCalled";
176
172
  ACTION["RENDERED"] = "rendered";
177
- ACTION["RENDERED_SAMPLED"] = "renderedSampled";
178
173
  ACTION["REASONING_VIEWED"] = "reasoningViewed";
179
174
  ACTION["ON_EDITOR_READY_CALLBACK"] = "onEditorReadyCallback";
180
- /**
181
- * @private
182
- * @deprecated
183
- *
184
- * This is no longer used and can be removed at a later date
185
- */
186
- ACTION["ON_CHANGE_CALLBACK"] = "onChangeCalled";
187
175
  ACTION["NESTED_TABLE_TRANSFORMED"] = "nestedTableTransformed";
188
176
  ACTION["CONTAINER_NODE_TRANSFORMED"] = "containerNodeTransformed";
189
177
  ACTION["NATIVE_EMBEDS_TRANSFORMED"] = "nativeEmbedsTransformed";
@@ -0,0 +1,84 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import debounce from 'lodash/debounce';
3
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
4
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
5
+ import { Box, xcss } from '@atlaskit/primitives';
6
+ const BADGE_VISIBILITY_BREAKPOINT = 200;
7
+ const containerStyles = xcss({
8
+ display: 'flex',
9
+ position: 'absolute',
10
+ top: 'space.0',
11
+ right: 'space.0',
12
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
13
+ lineHeight: "var(--ds-space-200, 16px)",
14
+ gap: 'space.025',
15
+ zIndex: 'card',
16
+ height: 'fit-content',
17
+ width: 'fit-content',
18
+ margin: 'space.075'
19
+ });
20
+
21
+ // The above styles are used for both editor and renderer, and in renderer the
22
+ // document body is the main scroll area. This means it overscrolls the primary
23
+ // toolbar, where the z-index is "2". We have to hack in our own z-index less
24
+ // than that to ensure our badge appears under the toolbar when scrolled.
25
+ const hackedZIndexStyles = xcss({
26
+ zIndex: '1'
27
+ });
28
+ const resizeOffsetStyles = xcss({
29
+ right: 'space.150'
30
+ });
31
+ const getBadgeVisible = (width, height) => {
32
+ return width && width < BADGE_VISIBILITY_BREAKPOINT || height && height < BADGE_VISIBILITY_BREAKPOINT ? false : true;
33
+ };
34
+ export const BlockNodeBadges = ({
35
+ children,
36
+ element,
37
+ width,
38
+ height,
39
+ extendedResizeOffset,
40
+ useMinimumZIndex = false
41
+ }) => {
42
+ const [visible, setVisible] = useState(getBadgeVisible(width, height));
43
+ useEffect(() => {
44
+ const observer = new ResizeObserver(debounce(entries => {
45
+ const [entry] = entries;
46
+ const {
47
+ width,
48
+ height
49
+ } = entry.contentRect;
50
+ setVisible(getBadgeVisible(width, height));
51
+ }));
52
+ if (element) {
53
+ // Ignored via go/ees005
54
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
55
+ observer.observe(element);
56
+ }
57
+ return () => {
58
+ observer.disconnect();
59
+ };
60
+ }, [element]);
61
+ if (typeof children === 'function') {
62
+ children = children({
63
+ visible
64
+ });
65
+ }
66
+
67
+ // delete this block on cleanup of media-perf-uplift-mutation-fix
68
+ if (!fg('media-perf-uplift-mutation-fix')) {
69
+ // becuase it is wrapped in a fragment, React.Children.count(children) will always be 1.
70
+ // That makes this check a source of late mutations that we don't need.
71
+ if (!element || React.Children.count(children) === 0) {
72
+ return null;
73
+ }
74
+ }
75
+ return /*#__PURE__*/React.createElement(Box, {
76
+ as: "div",
77
+ testId: "media-badges",
78
+ "data-media-badges": "true",
79
+ contentEditable: false
80
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
81
+ ,
82
+ xcss: [containerStyles, useMinimumZIndex && hackedZIndexStyles, extendedResizeOffset && resizeOffsetStyles]
83
+ }, children);
84
+ };
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/extends";
4
4
  * @jsx jsx
5
5
  */
6
6
 
7
- import React, { Fragment } from 'react';
7
+ import React, { Fragment, useCallback, useState } from 'react';
8
8
 
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
10
  import { css, jsx } from '@emotion/react';
@@ -17,6 +17,7 @@ import { NodeViewContentHole } from '../../../react-node-view/NodeViewContentHol
17
17
  import { overflowShadow } from '../../../ui';
18
18
  import { calculateBreakoutStyles } from '../../../utils';
19
19
  import { shouldExtensionBreakout } from '../../utils/should-extension-breakout';
20
+ import { ExtensionCommentBadge } from '../ExtensionCommentBadge';
20
21
  import ExtensionLozenge from '../Lozenge';
21
22
  import { overlay } from '../styles';
22
23
  import { isEmptyBodiedMacro } from './extension-utils';
@@ -52,6 +53,13 @@ function ExtensionWithPluginState(props) {
52
53
  isLivePageViewMode,
53
54
  hideConfigureLabel
54
55
  } = props;
56
+ const [container, setContainer] = useState(null);
57
+ const handleContainerRef = useCallback(element => {
58
+ handleRef === null || handleRef === void 0 ? void 0 : handleRef(element);
59
+ if (fg('cc_maui_annotations_on_extensions')) {
60
+ setContainer(element);
61
+ }
62
+ }, [handleRef]);
55
63
  const {
56
64
  showMacroInteractionDesignUpdates
57
65
  } = macroInteractionDesignFeatureFlags || {};
@@ -156,7 +164,7 @@ function ExtensionWithPluginState(props) {
156
164
  hideConfigureLabel: hideConfigureLabel
157
165
  }), jsx("div", {
158
166
  "data-testid": "extension-container",
159
- ref: handleRef,
167
+ ref: handleContainerRef,
160
168
  "data-layout": node.attrs.layout
161
169
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
162
170
  ,
@@ -216,7 +224,13 @@ function ExtensionWithPluginState(props) {
216
224
  className: contentClassNames
217
225
  }, jsx(NodeViewContentHole, {
218
226
  ref: handleContentDOMRef
219
- }))))));
227
+ })))), fg('cc_maui_annotations_on_extensions') && node.type.name === 'extension' && container && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.annotation) && jsx(ExtensionCommentBadge, {
228
+ api: pluginInjectionApi,
229
+ node: node,
230
+ getPos: getPos,
231
+ editorView: view,
232
+ container: container
233
+ })));
220
234
  }
221
235
  const Extension = props => {
222
236
  const {
@@ -0,0 +1,60 @@
1
+ import React, { useCallback, useMemo } from 'react';
2
+ import { VIEW_METHOD } from '../../analytics';
3
+ import { BlockNodeBadges } from '../../block-node-badges';
4
+ import { useSharedPluginStateWithSelector } from '../../hooks';
5
+ import { CommentBadgeNext } from '../../media-single/CommentBadgeNext';
6
+ // Owned by the extension node view, like media's badge. Annotation updates only
7
+ // render this sibling of the extension content; they never reparent its iframe.
8
+ export const ExtensionCommentBadge = ({
9
+ api,
10
+ editorView,
11
+ node,
12
+ getPos,
13
+ container
14
+ }) => {
15
+ var _api$annotation4;
16
+ const {
17
+ annotationState
18
+ } = useSharedPluginStateWithSelector(api, ['annotation'], states => ({
19
+ annotationState: states.annotationState
20
+ }));
21
+ const drafting = Boolean((annotationState === null || annotationState === void 0 ? void 0 : annotationState.isDrafting) && node.attrs.localId && node.attrs.localId === annotationState.targetNodeId);
22
+ const hasOpenDraft = Boolean(annotationState === null || annotationState === void 0 ? void 0 : annotationState.isDrafting);
23
+ const unresolvedIds = useMemo(() => node.marks.filter(mark => mark.type.name === 'annotation' && (annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations[mark.attrs.id]) === false).map(mark => mark.attrs.id), [node.marks, annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations]);
24
+ const onClick = useCallback(async event => {
25
+ var _api$annotation, _api$annotation2;
26
+ event.preventDefault();
27
+ event.stopPropagation();
28
+ if (drafting) {
29
+ return;
30
+ }
31
+ if (hasOpenDraft && !(await (api === null || api === void 0 ? void 0 : (_api$annotation = api.annotation) === null || _api$annotation === void 0 ? void 0 : _api$annotation.actions.requestCloseInlineComment()))) {
32
+ return;
33
+ }
34
+ // Resolve the current position after the asynchronous discard confirmation.
35
+ const pos = getPos();
36
+ if (typeof pos !== 'number' || !Number.isFinite(pos) || pos < 0 || pos >= editorView.state.doc.content.size) {
37
+ return;
38
+ }
39
+ const currentNode = editorView.state.doc.nodeAt(pos);
40
+ if ((currentNode === null || currentNode === void 0 ? void 0 : currentNode.type) === node.type && currentNode.attrs.localId === node.attrs.localId && api !== null && api !== void 0 && (_api$annotation2 = api.annotation) !== null && _api$annotation2 !== void 0 && _api$annotation2.actions.isBlockNodeSupported(currentNode)) {
41
+ var _api$annotation3;
42
+ api === null || api === void 0 ? void 0 : (_api$annotation3 = api.annotation) === null || _api$annotation3 === void 0 ? void 0 : _api$annotation3.actions.showCommentForBlockNode(currentNode, VIEW_METHOD.BADGE)(editorView.state, editorView.dispatch);
43
+ }
44
+ }, [api, editorView, node, getPos, drafting, hasOpenDraft]);
45
+ if (!(annotationState !== null && annotationState !== void 0 && annotationState.isVisible) || node.type.name !== 'extension' || !(api !== null && api !== void 0 && (_api$annotation4 = api.annotation) !== null && _api$annotation4 !== void 0 && _api$annotation4.actions.isBlockNodeSupported(node))) {
46
+ return null;
47
+ }
48
+ if (!drafting && !unresolvedIds.length) {
49
+ return null;
50
+ }
51
+ const active = drafting || !annotationState.isInlineCommentViewClosed && annotationState.selectedAnnotations.some(({
52
+ id
53
+ }) => unresolvedIds.includes(id));
54
+ return /*#__PURE__*/React.createElement(BlockNodeBadges, {
55
+ element: container
56
+ }, /*#__PURE__*/React.createElement(CommentBadgeNext, {
57
+ onClick: onClick,
58
+ status: active ? 'active' : 'default'
59
+ }));
60
+ };
@@ -1,84 +1,17 @@
1
- import React, { useEffect, useState } from 'react';
2
- import debounce from 'lodash/debounce';
3
- import { fg } from '@atlaskit/platform-feature-flags/fg';
4
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
5
- import { Box, xcss } from '@atlaskit/primitives';
6
- const MEDIA_BADGE_VISIBILITY_BREAKPOINT = 200;
7
- const containerStyles = xcss({
8
- display: 'flex',
9
- position: 'absolute',
10
- top: 'space.0',
11
- right: 'space.0',
12
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
13
- lineHeight: "var(--ds-space-200, 16px)",
14
- gap: 'space.025',
15
- zIndex: 'card',
16
- height: 'fit-content',
17
- width: 'fit-content',
18
- margin: 'space.075'
19
- });
20
-
21
- // The above styles are used for both editor and renderer, and in renderer the
22
- // document body is the main scroll area. This means it overscrolls the primary
23
- // toolbar, where the z-index is "2". We have to hack in our own z-index less
24
- // than that to ensure our badge appears under the toolbar when scrolled.
25
- const hackedZIndexStyles = xcss({
26
- zIndex: '1'
27
- });
28
- const resizeOffsetStyles = xcss({
29
- right: 'space.150'
30
- });
31
- const getBadgeVisible = (width, height) => {
32
- return width && width < MEDIA_BADGE_VISIBILITY_BREAKPOINT || height && height < MEDIA_BADGE_VISIBILITY_BREAKPOINT ? false : true;
33
- };
1
+ import React from 'react';
2
+ import { BlockNodeBadges } from '../block-node-badges';
3
+ /** Compatibility wrapper for existing media consumers of BlockNodeBadges. */
34
4
  export const MediaBadges = ({
35
- children,
36
5
  mediaElement,
37
6
  mediaWidth,
38
7
  mediaHeight,
8
+ children,
39
9
  extendedResizeOffset,
40
- useMinimumZIndex = false
41
- }) => {
42
- const [visible, setVisible] = useState(getBadgeVisible(mediaWidth, mediaHeight));
43
- useEffect(() => {
44
- const observer = new ResizeObserver(debounce(entries => {
45
- const [entry] = entries;
46
- const {
47
- width,
48
- height
49
- } = entry.contentRect;
50
- setVisible(getBadgeVisible(width, height));
51
- }));
52
- if (mediaElement) {
53
- // Ignored via go/ees005
54
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
55
- observer.observe(mediaElement);
56
- }
57
- return () => {
58
- observer.disconnect();
59
- };
60
- }, [mediaElement]);
61
- if (typeof children === 'function') {
62
- children = children({
63
- visible
64
- });
65
- }
66
-
67
- // delete this block on cleanup of media-perf-uplift-mutation-fix
68
- if (!fg('media-perf-uplift-mutation-fix')) {
69
- // becuase it is wrapped in a fragment, React.Children.count(children) will always be 1.
70
- // That makes this check a source of late mutations that we don't need.
71
- if (!mediaElement || React.Children.count(children) === 0) {
72
- return null;
73
- }
74
- }
75
- return /*#__PURE__*/React.createElement(Box, {
76
- as: "div",
77
- testId: "media-badges",
78
- "data-media-badges": "true",
79
- contentEditable: false
80
- // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
81
- ,
82
- xcss: [containerStyles, useMinimumZIndex && hackedZIndexStyles, extendedResizeOffset && resizeOffsetStyles]
83
- }, children);
84
- };
10
+ useMinimumZIndex
11
+ }) => /*#__PURE__*/React.createElement(BlockNodeBadges, {
12
+ element: mediaElement,
13
+ width: mediaWidth,
14
+ height: mediaHeight,
15
+ extendedResizeOffset: extendedResizeOffset,
16
+ useMinimumZIndex: useMinimumZIndex
17
+ }, children);
@@ -205,11 +205,6 @@ export const toolbarInsertBlockMessages = defineMessages({
205
205
  defaultMessage: 'Add a custom status label',
206
206
  description: 'Menu description shown in the quick insert menu. Explains that users can add custom status labels.'
207
207
  },
208
- askRovo: {
209
- id: 'fabric.editor.askRovo',
210
- defaultMessage: 'Ask Rovo',
211
- description: 'Button label shown in the quick insert empty results state. Allows users to ask Rovo AI for help.'
212
- },
213
208
  viewMore: {
214
209
  id: 'fabric.editor.viewMore',
215
210
  defaultMessage: 'View more',
@@ -13,7 +13,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
13
13
  const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
14
14
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
15
15
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
16
- const packageVersion = "128.3.1";
16
+ const packageVersion = "128.4.0";
17
17
  const sanitiseSentryEvents = (data, _hint) => {
18
18
  // Remove URL as it has UGC
19
19
  // Ignored via go/ees007
@@ -0,0 +1,30 @@
1
+ const MAX_DATE_MS = 8.64e15; // largest valid Date value
2
+ const FAVORITE_TIER = -2;
3
+ const CURATED_TIER = 1;
4
+ export const TEMPLATE_GALLERY_MENU_RANK = 0;
5
+
6
+ /**
7
+ * Menu rank for a Block template within the Block templates section. Lower ranks appear first.
8
+ * Each rank is its tier plus a fraction in [0, 1), so tiers never overlap.
9
+ *
10
+ * Negative ranks are intentional and valid. This is a `parents[].rank` sort key, not a Fuse score:
11
+ * the registry menu compares ranks by subtraction, and Fuse's 0–1 `score` is a separate value that
12
+ * is compared first when searching, so rank only orders templates with equal scores.
13
+ */
14
+ export const getSnippetMenuRank = ({
15
+ insertCount,
16
+ isFavorite,
17
+ scope,
18
+ updatedAt
19
+ }) => {
20
+ if (isFavorite) {
21
+ // Stays in (-2, -1.5]; more inserts rank first.
22
+ return FAVORITE_TIER + 1 / ((insertCount !== null && insertCount !== void 0 ? insertCount : 0) + 2);
23
+ }
24
+ if (scope !== 'GLOBAL') {
25
+ const time = Number.isFinite(updatedAt) ? Math.max(updatedAt, 1) : 1;
26
+ // USER and SITE templates stay in [-1, 0); newer updates rank first.
27
+ return -time / MAX_DATE_MS;
28
+ }
29
+ return CURATED_TIER;
30
+ };
@@ -1,7 +1,5 @@
1
1
  import Fuse from 'fuse.js';
2
2
  import memoizeOne from 'memoize-one';
3
- import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
- import { boostNativeResultsAboveSkills } from './boost-native-results-above-skills';
5
3
  const processQuickInsertItems = (items, intl) => {
6
4
  return items.reduce((acc, item) => {
7
5
  if (typeof item === 'function' &&
@@ -51,7 +49,7 @@ const options = {
51
49
  */
52
50
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
53
51
  export function find(query, items, prioritySortingFn) {
54
- var _rerankedResults$data, _rerankedResults$lega;
52
+ var _results$datasourceIn, _results$legacyIndex$;
55
53
  if (query === '') {
56
54
  // Copy and sort list by priority
57
55
  return items.slice(0).sort((a, b) => (a.priority || Number.POSITIVE_INFINITY) - (b.priority || Number.POSITIVE_INFINITY));
@@ -70,22 +68,19 @@ export function find(query, items, prioritySortingFn) {
70
68
  const fuse = new Fuse(items, fuseOptions);
71
69
  const results = fuse.search(query);
72
70
 
73
- // platform_editor_insert_menu_ai: boost native editor elements above skills
74
- const rerankedResults = isExperimentEnabled('platform_editor_insert_menu_ai') ? boostNativeResultsAboveSkills(results) : results;
75
-
76
71
  // searching for jira work items macro first
77
- const datasourceIndex = rerankedResults.findIndex(r => {
72
+ const datasourceIndex = results.findIndex(r => {
78
73
  var _r$item$keywords;
79
74
  return r.item.id === 'datasource' && ((_r$item$keywords = r.item.keywords) === null || _r$item$keywords === void 0 ? void 0 : _r$item$keywords.includes('jira'));
80
75
  });
81
76
 
82
77
  // then searching for the legacy jira macro
83
- const legacyIndex = rerankedResults.findIndex(r => typeof r.item.key === 'string' && r.item.key.endsWith(':jira'));
78
+ const legacyIndex = results.findIndex(r => typeof r.item.key === 'string' && r.item.key.endsWith(':jira'));
84
79
 
85
80
  // the jira legcy macro is found before the jira work items macro then swap the two
86
- if (datasourceIndex > 0 && legacyIndex >= 0 && legacyIndex < datasourceIndex && Math.abs(((_rerankedResults$data = rerankedResults[datasourceIndex].score) !== null && _rerankedResults$data !== void 0 ? _rerankedResults$data : 0) - ((_rerankedResults$lega = rerankedResults[legacyIndex].score) !== null && _rerankedResults$lega !== void 0 ? _rerankedResults$lega : 0)) < 0.2) {
87
- const [datasource] = rerankedResults.splice(datasourceIndex, 1);
88
- rerankedResults.splice(legacyIndex, 0, datasource);
81
+ if (datasourceIndex > 0 && legacyIndex >= 0 && legacyIndex < datasourceIndex && Math.abs(((_results$datasourceIn = results[datasourceIndex].score) !== null && _results$datasourceIn !== void 0 ? _results$datasourceIn : 0) - ((_results$legacyIndex$ = results[legacyIndex].score) !== null && _results$legacyIndex$ !== void 0 ? _results$legacyIndex$ : 0)) < 0.2) {
82
+ const [datasource] = results.splice(datasourceIndex, 1);
83
+ results.splice(legacyIndex, 0, datasource);
89
84
  }
90
- return rerankedResults.map(result => result.item);
85
+ return results.map(result => result.item);
91
86
  }
@@ -5,7 +5,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
5
5
  import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
6
6
  import { isSSR } from '../core-utils/is-ssr';
7
7
  import { ErrorBoundary } from '../ui/ErrorBoundary';
8
- import { analyticsEventKey, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
8
+ import { analyticsEventKey } from '../utils';
9
9
  import { getBrowserInfo } from '../utils/browser';
10
10
  import { ZERO_WIDTH_SPACE } from '../whitespace';
11
11
  import { generateUniqueNodeKey } from './generateUniqueNodeKey';
@@ -71,23 +71,9 @@ function createNodeView({
71
71
  extraComponentProps
72
72
  }), domRef, key);
73
73
  }
74
- const {
75
- samplingRate,
76
- slowThreshold,
77
- trackingEnabled
78
- } = getPerformanceOptions(nodeViewParams.view);
79
- trackingEnabled && startMeasureReactNodeViewRendered({
80
- nodeTypeName: currentNode.type.name
81
- });
82
74
 
83
75
  // We render the component while creating the node view
84
76
  renderComponent();
85
- trackingEnabled && stopMeasureReactNodeViewRendered({
86
- nodeTypeName: currentNode.type.name,
87
- dispatchAnalyticsEvent,
88
- samplingRate,
89
- slowThreshold
90
- });
91
77
  const extraNodeViewPropsWithStopEvent = {
92
78
  ...extraNodeViewProps
93
79
  };