@atlaskit/editor-common 128.3.1 → 128.4.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 (83) hide show
  1. package/CHANGELOG.md +41 -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/element-browser/components/ElementList/ElementList.js +2 -3
  6. package/dist/cjs/element-browser/components/StatelessElementBrowser.js +2 -2
  7. package/dist/cjs/extensibility/Extension/Extension/index.js +20 -2
  8. package/dist/cjs/extensibility/Extension/ExtensionCommentBadge.js +110 -0
  9. package/dist/cjs/extensibility/MultiBodiedExtension/index.js +4 -21
  10. package/dist/cjs/media-single/MediaBadges.js +12 -85
  11. package/dist/cjs/monitoring/error.js +1 -1
  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/ui/DropList/index.js +1 -1
  15. package/dist/cjs/ui-menu/DropdownMenu/index.js +4 -6
  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/element-browser/components/ElementList/ElementList.js +2 -3
  20. package/dist/es2019/element-browser/components/StatelessElementBrowser.js +2 -2
  21. package/dist/es2019/extensibility/Extension/Extension/index.js +17 -3
  22. package/dist/es2019/extensibility/Extension/ExtensionCommentBadge.js +60 -0
  23. package/dist/es2019/extensibility/MultiBodiedExtension/index.js +4 -24
  24. package/dist/es2019/media-single/MediaBadges.js +12 -79
  25. package/dist/es2019/monitoring/error.js +1 -1
  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/ui/DropList/index.js +1 -1
  29. package/dist/es2019/ui-menu/DropdownMenu/index.js +4 -6
  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/element-browser/components/ElementList/ElementList.js +2 -3
  34. package/dist/esm/element-browser/components/StatelessElementBrowser.js +2 -2
  35. package/dist/esm/extensibility/Extension/Extension/index.js +21 -3
  36. package/dist/esm/extensibility/Extension/ExtensionCommentBadge.js +101 -0
  37. package/dist/esm/extensibility/MultiBodiedExtension/index.js +4 -21
  38. package/dist/esm/media-single/MediaBadges.js +12 -82
  39. package/dist/esm/monitoring/error.js +1 -1
  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/ui/DropList/index.js +1 -1
  43. package/dist/esm/ui-menu/DropdownMenu/index.js +4 -6
  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/types/index.d.ts +1 -1
  54. package/dist/types/types/performance-tracking.d.ts +0 -22
  55. package/dist/types/utils/index.d.ts +0 -5
  56. package/package.json +6 -5
  57. package/analytics/types/performance-report/package.json +0 -10
  58. package/dist/cjs/analytics/types/performance-report.js +0 -1
  59. package/dist/cjs/utils/get-performance-options.js +0 -65
  60. package/dist/cjs/utils/performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.js +0 -10
  61. package/dist/cjs/utils/performance/TTI_SEVERITY_THRESHOLD_DEFAULTS.js +0 -10
  62. package/dist/cjs/utils/performance/measure-tti.js +0 -112
  63. package/dist/cjs/utils/startMeasureReactNodeViewRendered.js +0 -11
  64. package/dist/es2019/analytics/types/performance-report.js +0 -0
  65. package/dist/es2019/utils/get-performance-options.js +0 -54
  66. package/dist/es2019/utils/performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.js +0 -4
  67. package/dist/es2019/utils/performance/TTI_SEVERITY_THRESHOLD_DEFAULTS.js +0 -4
  68. package/dist/es2019/utils/performance/measure-tti.js +0 -91
  69. package/dist/es2019/utils/startMeasureReactNodeViewRendered.js +0 -6
  70. package/dist/esm/analytics/types/performance-report.js +0 -0
  71. package/dist/esm/utils/get-performance-options.js +0 -53
  72. package/dist/esm/utils/performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.js +0 -4
  73. package/dist/esm/utils/performance/TTI_SEVERITY_THRESHOLD_DEFAULTS.js +0 -4
  74. package/dist/esm/utils/performance/measure-tti.js +0 -94
  75. package/dist/esm/utils/startMeasureReactNodeViewRendered.js +0 -5
  76. package/dist/types/analytics/types/performance-report.d.ts +0 -24
  77. package/dist/types/utils/get-performance-options.d.ts +0 -14
  78. package/dist/types/utils/performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.d.ts +0 -4
  79. package/dist/types/utils/performance/TTI_SEVERITY_THRESHOLD_DEFAULTS.d.ts +0 -4
  80. package/dist/types/utils/performance/measure-tti.d.ts +0 -8
  81. package/dist/types/utils/startMeasureReactNodeViewRendered.d.ts +0 -3
  82. package/performance/measure-tti/package.json +0 -10
  83. package/utils/get-performance-options/package.json +0 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 128.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`950fcabdaee51`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/950fcabdaee51) -
8
+ Show comment markers for eligible Remix extension nodes in the editor behind
9
+ `cc_maui_annotations_on_extensions`. Highlight an open draft or selected unresolved thread, open
10
+ existing comments from the marker, and preserve the embedded iframe and unsaved drafts when
11
+ switching threads.
12
+
13
+ Render each badge from its extension node view, using its node and current position instead of
14
+ scanning the document. Both standard and referentiality extension node views render the shared
15
+ badge directly, using annotation state and logic-only actions. Expose the reusable badge container
16
+ as BlockNodeBadges, retaining MediaBadges as a compatibility wrapper for existing media consumers.
17
+
18
+ Preserve the existing Emotion styling for the shared badge container; defer its Compiled migration
19
+ with a file-scoped ratcheting exception.
20
+
21
+ - [`be603fee7766f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/be603fee7766f) -
22
+ Remove unused performance analytics code: ACTION enum members WITH_PLUGIN_STATE_CALLED,
23
+ DISPATCHED_VALID_TRANSACTION, EDITOR_CONTENT_RETRIEVAL_PERFORMED, ON_CHANGE_CALLBACK,
24
+ RENDERED_SAMPLED and REACT_NODEVIEW_RENDERED with their payload types, TransactionEventPayload,
25
+ PluginPerformanceReportData types, measureTTI / getTTISeverity and TTI threshold defaults,
26
+ reactNodeViewRendered tracking (getPerformanceOptions, start/stopMeasureReactNodeViewRendered,
27
+ PerformanceTracking.nodeViewTracking), and the `./performance/measure-tti`,
28
+ `./utils/get-performance-options` and `./analytics/types/performance-report` entry points
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies
33
+
34
+ ## 128.3.2
35
+
36
+ ### Patch Changes
37
+
38
+ - [`7690092b13a84`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7690092b13a84) -
39
+ Clean up the fully rolled out nested MultiBodiedExtension frame styling feature gate.
40
+ - [`042fa402a6460`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/042fa402a6460) -
41
+ Clean up experiment `platform_editor_august_a11y`
42
+ - Updated dependencies
43
+
3
44
  ## 128.3.1
4
45
 
5
46
  ### Patch Changes
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/block-node-badges",
3
+ "main": "../dist/cjs/block-node-badges.js",
4
+ "module": "../dist/esm/block-node-badges.js",
5
+ "module:es2019": "../dist/es2019/block-node-badges.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../dist/types/block-node-badges.d.ts"
10
+ }
@@ -54,14 +54,12 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
54
54
  ACTION["DISPLAYED"] = "displayed";
55
55
  ACTION["DIVERGED"] = "diverged";
56
56
  ACTION["DISPATCHED_INVALID_TRANSACTION"] = "dispatchedInvalidTransaction";
57
- ACTION["DISPATCHED_VALID_TRANSACTION"] = "dispatchedValidTransaction";
58
57
  ACTION["DOUBLE_CLICKED"] = "doubleClicked";
59
58
  ACTION["DRAGGED"] = "dragged";
60
59
  ACTION["EDITED"] = "edited";
61
60
  ACTION["EDITOR_CRASHED"] = "unhandledErrorCaught";
62
61
  ACTION["EDITOR_CRASHED_ADDITIONAL_INFORMATION"] = "unhandledErrorCaughtAdditionalInfov2";
63
62
  ACTION["EDITOR_MOUNTED"] = "mounted";
64
- ACTION["EDITOR_CONTENT_RETRIEVAL_PERFORMED"] = "contentRetrievalPerformed";
65
63
  ACTION["RE_RENDERED"] = "reRendered";
66
64
  ACTION["ENDED"] = "ended";
67
65
  ACTION["ENTERED"] = "entered";
@@ -120,7 +118,6 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
120
118
  ACTION["PRESSED"] = "pressed";
121
119
  ACTION["QUICK_INSERT_INFORMATION"] = "quickInsertInformation";
122
120
  ACTION["PROSEMIRROR_RENDERED"] = "proseMirrorRendered";
123
- ACTION["REACT_NODEVIEW_RENDERED"] = "reactNodeViewRendered";
124
121
  ACTION["REFERENCE_SYNCED_BLOCK_DELETE"] = "referenceSyncedBlockDelete";
125
122
  ACTION["REFERENCE_SYNCED_BLOCK_UPDATE"] = "referenceSyncedBlockUpdate";
126
123
  ACTION["REFERENCE_SYNCED_BLOCK_UNSYNC"] = "referenceSyncedBlockUnsync";
@@ -176,18 +173,9 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
176
173
  ACTION["UPLOAD_EXTERNAL_FAIL"] = "uploadExternalFailed";
177
174
  ACTION["VIEWED"] = "viewed";
178
175
  ACTION["VISITED"] = "visited";
179
- ACTION["WITH_PLUGIN_STATE_CALLED"] = "withPluginStateCalled";
180
176
  ACTION["RENDERED"] = "rendered";
181
- ACTION["RENDERED_SAMPLED"] = "renderedSampled";
182
177
  ACTION["REASONING_VIEWED"] = "reasoningViewed";
183
178
  ACTION["ON_EDITOR_READY_CALLBACK"] = "onEditorReadyCallback";
184
- /**
185
- * @private
186
- * @deprecated
187
- *
188
- * This is no longer used and can be removed at a later date
189
- */
190
- ACTION["ON_CHANGE_CALLBACK"] = "onChangeCalled";
191
179
  ACTION["NESTED_TABLE_TRANSFORMED"] = "nestedTableTransformed";
192
180
  ACTION["CONTAINER_NODE_TRANSFORMED"] = "containerNodeTransformed";
193
181
  ACTION["NATIVE_EMBEDS_TRANSFORMED"] = "nativeEmbedsTransformed";
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.BlockNodeBadges = void 0;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _debounce = _interopRequireDefault(require("lodash/debounce"));
12
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
13
+ var _primitives = require("@atlaskit/primitives");
14
+ 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); }
15
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
16
+
17
+ var BADGE_VISIBILITY_BREAKPOINT = 200;
18
+ var containerStyles = (0, _primitives.xcss)({
19
+ display: 'flex',
20
+ position: 'absolute',
21
+ top: 'space.0',
22
+ right: 'space.0',
23
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
24
+ lineHeight: "var(--ds-space-200, 16px)",
25
+ gap: 'space.025',
26
+ zIndex: 'card',
27
+ height: 'fit-content',
28
+ width: 'fit-content',
29
+ margin: 'space.075'
30
+ });
31
+
32
+ // The above styles are used for both editor and renderer, and in renderer the
33
+ // document body is the main scroll area. This means it overscrolls the primary
34
+ // toolbar, where the z-index is "2". We have to hack in our own z-index less
35
+ // than that to ensure our badge appears under the toolbar when scrolled.
36
+ var hackedZIndexStyles = (0, _primitives.xcss)({
37
+ zIndex: '1'
38
+ });
39
+ var resizeOffsetStyles = (0, _primitives.xcss)({
40
+ right: 'space.150'
41
+ });
42
+ var getBadgeVisible = function getBadgeVisible(width, height) {
43
+ return width && width < BADGE_VISIBILITY_BREAKPOINT || height && height < BADGE_VISIBILITY_BREAKPOINT ? false : true;
44
+ };
45
+ var BlockNodeBadges = exports.BlockNodeBadges = function BlockNodeBadges(_ref) {
46
+ var children = _ref.children,
47
+ element = _ref.element,
48
+ width = _ref.width,
49
+ height = _ref.height,
50
+ extendedResizeOffset = _ref.extendedResizeOffset,
51
+ _ref$useMinimumZIndex = _ref.useMinimumZIndex,
52
+ useMinimumZIndex = _ref$useMinimumZIndex === void 0 ? false : _ref$useMinimumZIndex;
53
+ var _useState = (0, _react.useState)(getBadgeVisible(width, height)),
54
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
55
+ visible = _useState2[0],
56
+ setVisible = _useState2[1];
57
+ (0, _react.useEffect)(function () {
58
+ var observer = new ResizeObserver((0, _debounce.default)(function (entries) {
59
+ var _entries = (0, _slicedToArray2.default)(entries, 1),
60
+ entry = _entries[0];
61
+ var _entry$contentRect = entry.contentRect,
62
+ width = _entry$contentRect.width,
63
+ height = _entry$contentRect.height;
64
+ setVisible(getBadgeVisible(width, height));
65
+ }));
66
+ if (element) {
67
+ // Ignored via go/ees005
68
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
69
+ observer.observe(element);
70
+ }
71
+ return function () {
72
+ observer.disconnect();
73
+ };
74
+ }, [element]);
75
+ if (typeof children === 'function') {
76
+ children = children({
77
+ visible: visible
78
+ });
79
+ }
80
+
81
+ // delete this block on cleanup of media-perf-uplift-mutation-fix
82
+ if (!(0, _fg.fg)('media-perf-uplift-mutation-fix')) {
83
+ // becuase it is wrapped in a fragment, React.Children.count(children) will always be 1.
84
+ // That makes this check a source of late mutations that we don't need.
85
+ if (!element || _react.default.Children.count(children) === 0) {
86
+ return null;
87
+ }
88
+ }
89
+ return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
90
+ as: "div",
91
+ testId: "media-badges",
92
+ "data-media-badges": "true",
93
+ contentEditable: false
94
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
95
+ ,
96
+ xcss: [containerStyles, useMinimumZIndex && hackedZIndexStyles, extendedResizeOffset && resizeOffsetStyles]
97
+ }, children);
98
+ };
@@ -243,7 +243,7 @@ var ElementListSingleColumn = function ElementListSingleColumn(props) {
243
243
  focus: focusedItemIndex === index,
244
244
  setFocusedItemIndex: setFocusedItemIndex,
245
245
  onInsertItem: onInsertItem,
246
- role: (0, _expValEquals.expValEquals)('platform_editor_august_a11y', 'isEnabled', true) ? 'option' : undefined
246
+ role: "option"
247
247
  })));
248
248
  };
249
249
  },
@@ -427,8 +427,7 @@ function ElementItem(_ref6) {
427
427
  title: title
428
428
  }),
429
429
  isSelected: selected,
430
- "aria-describedby": (0, _expValEquals.expValEquals)('platform_editor_august_a11y', 'isEnabled', true) ? undefined : title,
431
- "aria-label": (0, _expValEquals.expValEquals)('platform_editor_august_a11y', 'isEnabled', true) ? title : undefined,
430
+ "aria-label": title,
432
431
  ref: ref,
433
432
  testId: "element-item-".concat(index),
434
433
  id: "searched-item-".concat(index),
@@ -351,7 +351,7 @@ function MobileBrowser(_ref) {
351
351
  searchTerm: searchTerm,
352
352
  items: items,
353
353
  selectedItemIndex: selectedItemIndex,
354
- ariaControlsId: (0, _expValEquals.expValEquals)('platform_editor_august_a11y', 'isEnabled', true) ? _constants.ELEMENT_BROWSER_LIST_ID : undefined
354
+ ariaControlsId: _constants.ELEMENT_BROWSER_LIST_ID
355
355
  }), showCategories && (0, _react2.jsx)("nav", {
356
356
  css: mobileCategoryListWrapper,
357
357
  tabIndex: -1
@@ -365,7 +365,7 @@ function MobileBrowser(_ref) {
365
365
  setFocusOnSearch: setFocusOnSearch
366
366
  }))), (0, _react2.jsx)("div", {
367
367
  css: mobileMainContent,
368
- id: (0, _expValEquals.expValEquals)('platform_editor_august_a11y', 'isEnabled', true) ? _constants.ELEMENT_BROWSER_LIST_ID : undefined
368
+ id: _constants.ELEMENT_BROWSER_LIST_ID
369
369
  }, (0, _react2.jsx)(_ElementList.default, {
370
370
  items: items,
371
371
  mode: mode,
@@ -9,6 +9,7 @@ exports.default = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
13
  var _react = _interopRequireWildcard(require("react"));
13
14
  var _react2 = require("@emotion/react");
14
15
  var _classnames2 = _interopRequireDefault(require("classnames"));
@@ -20,6 +21,7 @@ var _NodeViewContentHole = require("../../../react-node-view/NodeViewContentHole
20
21
  var _ui = require("../../../ui");
21
22
  var _utils = require("../../../utils");
22
23
  var _shouldExtensionBreakout = require("../../utils/should-extension-breakout");
24
+ var _ExtensionCommentBadge = require("../ExtensionCommentBadge");
23
25
  var _Lozenge = _interopRequireDefault(require("../Lozenge"));
24
26
  var _styles = require("../styles");
25
27
  var _extensionUtils = require("./extension-utils");
@@ -62,6 +64,16 @@ function ExtensionWithPluginState(props) {
62
64
  pluginInjectionApi = props.pluginInjectionApi,
63
65
  isLivePageViewMode = props.isLivePageViewMode,
64
66
  hideConfigureLabel = props.hideConfigureLabel;
67
+ var _useState = (0, _react.useState)(null),
68
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
69
+ container = _useState2[0],
70
+ setContainer = _useState2[1];
71
+ var handleContainerRef = (0, _react.useCallback)(function (element) {
72
+ handleRef === null || handleRef === void 0 || handleRef(element);
73
+ if ((0, _fg.fg)('cc_maui_annotations_on_extensions')) {
74
+ setContainer(element);
75
+ }
76
+ }, [handleRef]);
65
77
  var _ref = macroInteractionDesignFeatureFlags || {},
66
78
  showMacroInteractionDesignUpdates = _ref.showMacroInteractionDesignUpdates;
67
79
  var isLegacyContentMacroExtension = function isLegacyContentMacroExtension(extensionNode) {
@@ -156,7 +168,7 @@ function ExtensionWithPluginState(props) {
156
168
  hideConfigureLabel: hideConfigureLabel
157
169
  }), (0, _react2.jsx)("div", {
158
170
  "data-testid": "extension-container",
159
- ref: handleRef,
171
+ ref: handleContainerRef,
160
172
  "data-layout": node.attrs.layout
161
173
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
162
174
  ,
@@ -220,7 +232,13 @@ function ExtensionWithPluginState(props) {
220
232
  className: contentClassNames
221
233
  }, (0, _react2.jsx)(_NodeViewContentHole.NodeViewContentHole, {
222
234
  ref: handleContentDOMRef
223
- }))))));
235
+ })))), (0, _fg.fg)('cc_maui_annotations_on_extensions') && node.type.name === 'extension' && container && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.annotation) && (0, _react2.jsx)(_ExtensionCommentBadge.ExtensionCommentBadge, {
236
+ api: pluginInjectionApi,
237
+ node: node,
238
+ getPos: getPos,
239
+ editorView: view,
240
+ container: container
241
+ })));
224
242
  }
225
243
  var Extension = function Extension(props) {
226
244
  var pluginInjectionApi = props.pluginInjectionApi;
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.ExtensionCommentBadge = void 0;
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _analytics = require("../../analytics");
13
+ var _blockNodeBadges = require("../../block-node-badges");
14
+ var _hooks = require("../../hooks");
15
+ var _CommentBadgeNext = require("../../media-single/CommentBadgeNext");
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 _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
17
+ // Owned by the extension node view, like media's badge. Annotation updates only
18
+ // render this sibling of the extension content; they never reparent its iframe.
19
+ var ExtensionCommentBadge = exports.ExtensionCommentBadge = function ExtensionCommentBadge(_ref) {
20
+ var _api$annotation4;
21
+ var api = _ref.api,
22
+ editorView = _ref.editorView,
23
+ node = _ref.node,
24
+ getPos = _ref.getPos,
25
+ container = _ref.container;
26
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['annotation'], function (states) {
27
+ return {
28
+ annotationState: states.annotationState
29
+ };
30
+ }),
31
+ annotationState = _useSharedPluginState.annotationState;
32
+ var drafting = Boolean((annotationState === null || annotationState === void 0 ? void 0 : annotationState.isDrafting) && node.attrs.localId && node.attrs.localId === annotationState.targetNodeId);
33
+ var hasOpenDraft = Boolean(annotationState === null || annotationState === void 0 ? void 0 : annotationState.isDrafting);
34
+ var unresolvedIds = (0, _react.useMemo)(function () {
35
+ return node.marks.filter(function (mark) {
36
+ return mark.type.name === 'annotation' && (annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations[mark.attrs.id]) === false;
37
+ }).map(function (mark) {
38
+ return mark.attrs.id;
39
+ });
40
+ }, [node.marks, annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations]);
41
+ var onClick = (0, _react.useCallback)( /*#__PURE__*/function () {
42
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(event) {
43
+ var _api$annotation, _api$annotation2;
44
+ var pos, currentNode, _api$annotation3, _t;
45
+ return _regenerator.default.wrap(function (_context) {
46
+ while (1) switch (_context.prev = _context.next) {
47
+ case 0:
48
+ event.preventDefault();
49
+ event.stopPropagation();
50
+ if (!drafting) {
51
+ _context.next = 1;
52
+ break;
53
+ }
54
+ return _context.abrupt("return");
55
+ case 1:
56
+ _t = hasOpenDraft;
57
+ if (!_t) {
58
+ _context.next = 3;
59
+ break;
60
+ }
61
+ _context.next = 2;
62
+ return api === null || api === void 0 || (_api$annotation = api.annotation) === null || _api$annotation === void 0 ? void 0 : _api$annotation.actions.requestCloseInlineComment();
63
+ case 2:
64
+ _t = !_context.sent;
65
+ case 3:
66
+ if (!_t) {
67
+ _context.next = 4;
68
+ break;
69
+ }
70
+ return _context.abrupt("return");
71
+ case 4:
72
+ // Resolve the current position after the asynchronous discard confirmation.
73
+ pos = getPos();
74
+ if (!(typeof pos !== 'number' || !Number.isFinite(pos) || pos < 0 || pos >= editorView.state.doc.content.size)) {
75
+ _context.next = 5;
76
+ break;
77
+ }
78
+ return _context.abrupt("return");
79
+ case 5:
80
+ currentNode = editorView.state.doc.nodeAt(pos);
81
+ 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)) {
82
+ api === null || api === void 0 || (_api$annotation3 = api.annotation) === null || _api$annotation3 === void 0 || _api$annotation3.actions.showCommentForBlockNode(currentNode, _analytics.VIEW_METHOD.BADGE)(editorView.state, editorView.dispatch);
83
+ }
84
+ case 6:
85
+ case "end":
86
+ return _context.stop();
87
+ }
88
+ }, _callee);
89
+ }));
90
+ return function (_x) {
91
+ return _ref2.apply(this, arguments);
92
+ };
93
+ }(), [api, editorView, node, getPos, drafting, hasOpenDraft]);
94
+ 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))) {
95
+ return null;
96
+ }
97
+ if (!drafting && !unresolvedIds.length) {
98
+ return null;
99
+ }
100
+ var active = drafting || !annotationState.isInlineCommentViewClosed && annotationState.selectedAnnotations.some(function (_ref3) {
101
+ var id = _ref3.id;
102
+ return unresolvedIds.includes(id);
103
+ });
104
+ return /*#__PURE__*/_react.default.createElement(_blockNodeBadges.BlockNodeBadges, {
105
+ element: container
106
+ }, /*#__PURE__*/_react.default.createElement(_CommentBadgeNext.CommentBadgeNext, {
107
+ onClick: onClick,
108
+ status: active ? 'active' : 'default'
109
+ }));
110
+ };
@@ -18,7 +18,6 @@ var _classnames = _interopRequireDefault(require("classnames"));
18
18
  var _reactIntl = require("react-intl");
19
19
  var _file = _interopRequireDefault(require("@atlaskit/icon/core/file"));
20
20
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
21
- var _fg = require("@atlaskit/platform-feature-flags/fg");
22
21
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
23
22
  var _hooks = require("../../hooks");
24
23
  var _placeholderText = require("../../messages/placeholder-text");
@@ -37,23 +36,7 @@ var _excluded = ["url"];
37
36
  */
38
37
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic
39
38
  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); }
40
- var getContainerCssExtendedStyles = function getContainerCssExtendedStyles(activeChildIndex, showMacroInteractionDesignUpdates) {
41
- if ((0, _fg.fg)('platform_editor_nested_mbe_frames')) {
42
- return _MultiBodiedExtension.sharedMultiBodiedExtensionStyles.mbeExtensionContainer;
43
- }
44
- var activeFrameSelector = ".multiBodiedExtension-content-dom-wrapper > [data-extension-frame='true']:nth-of-type(".concat(activeChildIndex + 1, ")");
45
-
46
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
47
- return (0, _react2.css)(_MultiBodiedExtension.sharedMultiBodiedExtensionStyles.mbeExtensionContainer, (0, _defineProperty2.default)({}, activeFrameSelector, (0, _react2.css)(
48
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
49
- _MultiBodiedExtension.sharedMultiBodiedExtensionStyles.extensionFrameContent,
50
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
51
- showMacroInteractionDesignUpdates && _MultiBodiedExtension.removeMarginsAndBorder)));
52
- };
53
39
  var getFramesActiveFrameStyles = function getFramesActiveFrameStyles(activeChildIndex, showMacroInteractionDesignUpdates) {
54
- if (!(0, _fg.fg)('platform_editor_nested_mbe_frames')) {
55
- return undefined;
56
- }
57
40
  var activeFrameSelector = "& > .multiBodiedExtension-content-dom-wrapper > [data-extension-frame='true']:nth-of-type(".concat(activeChildIndex + 1, ")");
58
41
  return (0, _react2.css)((0, _defineProperty2.default)({}, activeFrameSelector, (0, _react2.css)(
59
42
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
@@ -360,10 +343,10 @@ var MultiBodiedExtensionWithWidth = function MultiBodiedExtensionWithWidth(_ref2
360
343
  "data-testid": "multiBodiedExtension--overlay"
361
344
  }), getWrapperTitleContent(imageData, title, showMacroInteractionDesignUpdates), (0, _react2.jsx)("div", {
362
345
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
363
- className: containerClassNames,
364
- css: [/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766 */
365
- getContainerCssExtendedStyles(activeChildIndex, showMacroInteractionDesignUpdates)
366
- /* eslint-enable @atlaskit/design-system/consistent-css-prop-usage */],
346
+ className: containerClassNames
347
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
348
+ ,
349
+ css: _MultiBodiedExtension.sharedMultiBodiedExtensionStyles.mbeExtensionContainer,
367
350
  "data-testid": "multiBodiedExtension--container",
368
351
  "data-multiBodiedExtension-container": true,
369
352
  "data-active-child-index": activeChildIndex
@@ -1,98 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.MediaBadges = void 0;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = _interopRequireWildcard(require("react"));
11
- var _debounce = _interopRequireDefault(require("lodash/debounce"));
12
- var _fg = require("@atlaskit/platform-feature-flags/fg");
13
- var _primitives = require("@atlaskit/primitives");
14
- 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); }
15
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
16
-
17
- var MEDIA_BADGE_VISIBILITY_BREAKPOINT = 200;
18
- var containerStyles = (0, _primitives.xcss)({
19
- display: 'flex',
20
- position: 'absolute',
21
- top: 'space.0',
22
- right: 'space.0',
23
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
24
- lineHeight: "var(--ds-space-200, 16px)",
25
- gap: 'space.025',
26
- zIndex: 'card',
27
- height: 'fit-content',
28
- width: 'fit-content',
29
- margin: 'space.075'
30
- });
31
-
32
- // The above styles are used for both editor and renderer, and in renderer the
33
- // document body is the main scroll area. This means it overscrolls the primary
34
- // toolbar, where the z-index is "2". We have to hack in our own z-index less
35
- // than that to ensure our badge appears under the toolbar when scrolled.
36
- var hackedZIndexStyles = (0, _primitives.xcss)({
37
- zIndex: '1'
38
- });
39
- var resizeOffsetStyles = (0, _primitives.xcss)({
40
- right: 'space.150'
41
- });
42
- var getBadgeVisible = function getBadgeVisible(width, height) {
43
- return width && width < MEDIA_BADGE_VISIBILITY_BREAKPOINT || height && height < MEDIA_BADGE_VISIBILITY_BREAKPOINT ? false : true;
44
- };
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _blockNodeBadges = require("../block-node-badges");
10
+ /** Compatibility wrapper for existing media consumers of BlockNodeBadges. */
45
11
  var MediaBadges = exports.MediaBadges = function MediaBadges(_ref) {
46
- var children = _ref.children,
47
- mediaElement = _ref.mediaElement,
12
+ var mediaElement = _ref.mediaElement,
48
13
  mediaWidth = _ref.mediaWidth,
49
14
  mediaHeight = _ref.mediaHeight,
15
+ children = _ref.children,
50
16
  extendedResizeOffset = _ref.extendedResizeOffset,
51
- _ref$useMinimumZIndex = _ref.useMinimumZIndex,
52
- useMinimumZIndex = _ref$useMinimumZIndex === void 0 ? false : _ref$useMinimumZIndex;
53
- var _useState = (0, _react.useState)(getBadgeVisible(mediaWidth, mediaHeight)),
54
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
55
- visible = _useState2[0],
56
- setVisible = _useState2[1];
57
- (0, _react.useEffect)(function () {
58
- var observer = new ResizeObserver((0, _debounce.default)(function (entries) {
59
- var _entries = (0, _slicedToArray2.default)(entries, 1),
60
- entry = _entries[0];
61
- var _entry$contentRect = entry.contentRect,
62
- width = _entry$contentRect.width,
63
- height = _entry$contentRect.height;
64
- setVisible(getBadgeVisible(width, height));
65
- }));
66
- if (mediaElement) {
67
- // Ignored via go/ees005
68
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
69
- observer.observe(mediaElement);
70
- }
71
- return function () {
72
- observer.disconnect();
73
- };
74
- }, [mediaElement]);
75
- if (typeof children === 'function') {
76
- children = children({
77
- visible: visible
78
- });
79
- }
80
-
81
- // delete this block on cleanup of media-perf-uplift-mutation-fix
82
- if (!(0, _fg.fg)('media-perf-uplift-mutation-fix')) {
83
- // becuase it is wrapped in a fragment, React.Children.count(children) will always be 1.
84
- // That makes this check a source of late mutations that we don't need.
85
- if (!mediaElement || _react.default.Children.count(children) === 0) {
86
- return null;
87
- }
88
- }
89
- return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
90
- as: "div",
91
- testId: "media-badges",
92
- "data-media-badges": "true",
93
- contentEditable: false
94
- // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
95
- ,
96
- xcss: [containerStyles, useMinimumZIndex && hackedZIndexStyles, extendedResizeOffset && resizeOffsetStyles]
17
+ useMinimumZIndex = _ref.useMinimumZIndex;
18
+ return /*#__PURE__*/_react.default.createElement(_blockNodeBadges.BlockNodeBadges, {
19
+ element: mediaElement,
20
+ width: mediaWidth,
21
+ height: mediaHeight,
22
+ extendedResizeOffset: extendedResizeOffset,
23
+ useMinimumZIndex: useMinimumZIndex
97
24
  }, children);
98
25
  };
@@ -27,7 +27,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
27
27
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
28
28
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
29
29
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
30
- var packageVersion = "128.3.0";
30
+ var packageVersion = "128.3.2";
31
31
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
32
32
  // Remove URL as it has UGC
33
33
  // Ignored via go/ees007
@@ -81,22 +81,9 @@ function createNodeView(_ref) {
81
81
  extraComponentProps: extraComponentProps
82
82
  }), domRef, key);
83
83
  }
84
- var _getPerformanceOption = (0, _utils.getPerformanceOptions)(nodeViewParams.view),
85
- samplingRate = _getPerformanceOption.samplingRate,
86
- slowThreshold = _getPerformanceOption.slowThreshold,
87
- trackingEnabled = _getPerformanceOption.trackingEnabled;
88
- trackingEnabled && (0, _utils.startMeasureReactNodeViewRendered)({
89
- nodeTypeName: currentNode.type.name
90
- });
91
84
 
92
85
  // We render the component while creating the node view
93
86
  renderComponent();
94
- trackingEnabled && (0, _utils.stopMeasureReactNodeViewRendered)({
95
- nodeTypeName: currentNode.type.name,
96
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
97
- samplingRate: samplingRate,
98
- slowThreshold: slowThreshold
99
- });
100
87
  var extraNodeViewPropsWithStopEvent = _objectSpread({}, extraNodeViewProps);
101
88
 
102
89
  // https://prosemirror.net/docs/ref/#view.NodeView
@@ -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
 
@@ -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.0";
27
+ var packageVersion = "128.3.2";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({