@atlaskit/editor-common 125.2.1 → 125.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 (95) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/dist/cjs/element-browser/components/ElementBrowserLoader.js +8 -31
  3. package/dist/cjs/extensions/buildMenuItem.js +6 -3
  4. package/dist/cjs/extensions/extension-handlers.js +17 -96
  5. package/dist/cjs/floating-toolbar/DropdownMenuExtensionItems.js +4 -25
  6. package/dist/cjs/icons/index.js +10 -33
  7. package/dist/cjs/monitoring/error.js +1 -1
  8. package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.compiled.css +0 -1
  9. package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +22 -28
  10. package/dist/cjs/quick-insert/QuickInsertHoverPreview.compiled.css +42 -1
  11. package/dist/cjs/quick-insert/QuickInsertHoverPreview.js +147 -68
  12. package/dist/cjs/quick-insert/QuickInsertMenuItem.js +4 -0
  13. package/dist/cjs/quick-insert/QuickInsertMenuSection.js +11 -4
  14. package/dist/cjs/quick-insert/assets/index.js +257 -888
  15. package/dist/cjs/quick-insert/confluence-attribution-icon.js +18 -0
  16. package/dist/cjs/quick-insert/jira-attribution-icon.js +18 -0
  17. package/dist/cjs/quick-insert/messages.js +30 -0
  18. package/dist/cjs/quick-insert/preview.js +5 -0
  19. package/dist/cjs/quick-insert/snippetPreviewImageUrls.js +43 -43
  20. package/dist/cjs/quick-insert/use-menu-list-height.js +58 -0
  21. package/dist/cjs/quick-insert/use-menu-popup-sizing.js +60 -0
  22. package/dist/cjs/toolbar-flag-check.js +2 -2
  23. package/dist/cjs/ui/DropList/index.js +1 -1
  24. package/dist/cjs/ui/Mention/mention-with-profilecard.js +19 -30
  25. package/dist/cjs/ui/Popup/index.js +101 -17
  26. package/dist/es2019/element-browser/components/ElementBrowserLoader.js +2 -16
  27. package/dist/es2019/extensions/buildMenuItem.js +5 -1
  28. package/dist/es2019/extensions/extension-handlers.js +15 -70
  29. package/dist/es2019/floating-toolbar/DropdownMenuExtensionItems.js +2 -16
  30. package/dist/es2019/icons/index.js +3 -17
  31. package/dist/es2019/monitoring/error.js +1 -1
  32. package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.compiled.css +0 -1
  33. package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +20 -29
  34. package/dist/es2019/quick-insert/QuickInsertHoverPreview.compiled.css +42 -1
  35. package/dist/es2019/quick-insert/QuickInsertHoverPreview.js +130 -55
  36. package/dist/es2019/quick-insert/QuickInsertMenuItem.js +4 -0
  37. package/dist/es2019/quick-insert/QuickInsertMenuSection.js +11 -4
  38. package/dist/es2019/quick-insert/assets/index.js +66 -386
  39. package/dist/es2019/quick-insert/confluence-attribution-icon.js +10 -0
  40. package/dist/es2019/quick-insert/jira-attribution-icon.js +10 -0
  41. package/dist/es2019/quick-insert/messages.js +30 -0
  42. package/dist/es2019/quick-insert/preview.js +1 -0
  43. package/dist/es2019/quick-insert/snippetPreviewImageUrls.js +43 -43
  44. package/dist/es2019/quick-insert/use-menu-list-height.js +37 -0
  45. package/dist/es2019/quick-insert/use-menu-popup-sizing.js +49 -0
  46. package/dist/es2019/toolbar-flag-check.js +2 -2
  47. package/dist/es2019/ui/DropList/index.js +1 -1
  48. package/dist/es2019/ui/Mention/mention-with-profilecard.js +12 -15
  49. package/dist/es2019/ui/Popup/index.js +89 -7
  50. package/dist/esm/element-browser/components/ElementBrowserLoader.js +6 -28
  51. package/dist/esm/extensions/buildMenuItem.js +6 -3
  52. package/dist/esm/extensions/extension-handlers.js +17 -97
  53. package/dist/esm/floating-toolbar/DropdownMenuExtensionItems.js +4 -24
  54. package/dist/esm/icons/index.js +7 -29
  55. package/dist/esm/monitoring/error.js +1 -1
  56. package/dist/esm/quick-insert/CompactQuickInsertMenuItem.compiled.css +0 -1
  57. package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +23 -29
  58. package/dist/esm/quick-insert/QuickInsertHoverPreview.compiled.css +42 -1
  59. package/dist/esm/quick-insert/QuickInsertHoverPreview.js +150 -68
  60. package/dist/esm/quick-insert/QuickInsertMenuItem.js +4 -0
  61. package/dist/esm/quick-insert/QuickInsertMenuSection.js +11 -4
  62. package/dist/esm/quick-insert/assets/index.js +194 -764
  63. package/dist/esm/quick-insert/confluence-attribution-icon.js +12 -0
  64. package/dist/esm/quick-insert/jira-attribution-icon.js +12 -0
  65. package/dist/esm/quick-insert/messages.js +30 -0
  66. package/dist/esm/quick-insert/preview.js +1 -0
  67. package/dist/esm/quick-insert/snippetPreviewImageUrls.js +43 -43
  68. package/dist/esm/quick-insert/use-menu-list-height.js +51 -0
  69. package/dist/esm/quick-insert/use-menu-popup-sizing.js +53 -0
  70. package/dist/esm/toolbar-flag-check.js +2 -2
  71. package/dist/esm/ui/DropList/index.js +1 -1
  72. package/dist/esm/ui/Mention/mention-with-profilecard.js +16 -25
  73. package/dist/esm/ui/Popup/index.js +101 -17
  74. package/dist/types/extensions/types/extension-manifest.d.ts +5 -0
  75. package/dist/types/extensions/types/utils.d.ts +2 -0
  76. package/dist/types/icons/index.d.ts +3 -5
  77. package/dist/types/provider-factory/profile-card-provider.d.ts +14 -1
  78. package/dist/types/provider-factory/quick-insert-provider.d.ts +3 -0
  79. package/dist/types/quick-insert/CompactQuickInsertMenuItem.d.ts +1 -1
  80. package/dist/types/quick-insert/QuickInsertHoverPreview.d.ts +7 -6
  81. package/dist/types/quick-insert/QuickInsertMenuItem.d.ts +7 -2
  82. package/dist/types/quick-insert/assets/index.d.ts +32 -34
  83. package/dist/types/quick-insert/confluence-attribution-icon.d.ts +3 -0
  84. package/dist/types/quick-insert/jira-attribution-icon.d.ts +3 -0
  85. package/dist/types/quick-insert/messages.d.ts +5 -2
  86. package/dist/types/quick-insert/preview.d.ts +16 -0
  87. package/dist/types/quick-insert/use-menu-list-height.d.ts +6 -0
  88. package/dist/types/quick-insert/use-menu-popup-sizing.d.ts +11 -0
  89. package/dist/types/ui/Popup/index.d.ts +11 -0
  90. package/package.json +6 -6
  91. package/quick-insert/confluence-attribution-icon/package.json +10 -0
  92. package/quick-insert/jira-attribution-icon/package.json +10 -0
  93. package/quick-insert/preview/package.json +10 -0
  94. package/quick-insert/use-menu-list-height/package.json +10 -0
  95. package/quick-insert/use-menu-popup-sizing/package.json +10 -0
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { confluenceIcon } from '@atlaskit/logo/raw-icons';
3
+
4
+ /** Decorative product icon accompanying the localized Confluence attribution name. */
5
+ export var ConfluenceAttributionIcon = function ConfluenceAttributionIcon() {
6
+ return /*#__PURE__*/React.createElement("img", {
7
+ src: confluenceIcon,
8
+ alt: "",
9
+ width: 16,
10
+ height: 16
11
+ });
12
+ };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { jiraIcon } from '@atlaskit/logo/raw-icons';
3
+
4
+ /** Decorative product icon accompanying the localized Jira attribution name. */
5
+ export var JiraAttributionIcon = function JiraAttributionIcon() {
6
+ return /*#__PURE__*/React.createElement("img", {
7
+ src: jiraIcon,
8
+ alt: "",
9
+ width: 16,
10
+ height: 16
11
+ });
12
+ };
@@ -129,5 +129,35 @@ export var messages = defineMessages({
129
129
  id: 'editor-common.quick-insert.categoryOther',
130
130
  defaultMessage: 'Other',
131
131
  description: 'Other items in the Quick Insert menu.'
132
+ },
133
+ previewAttributionBy: {
134
+ id: 'editor-common.quick-insert.previewAttributionBy',
135
+ defaultMessage: 'By {name}',
136
+ description: 'Attribution shown in a Quick Insert item preview.'
137
+ },
138
+ previewAttributionAtlassian: {
139
+ id: 'editor-common.quick-insert.previewAttributionAtlassian.ai-non-final',
140
+ defaultMessage: 'Atlassian',
141
+ description: 'Atlassian company name shown as the creator in a slash-command preview attribution.'
142
+ },
143
+ previewAttributionAssets: {
144
+ id: 'editor-common.quick-insert.previewAttributionAssets.ai-non-final',
145
+ defaultMessage: 'Assets',
146
+ description: 'Assets product name shown as the creator in a slash-command preview attribution.'
147
+ },
148
+ previewAttributionConfluence: {
149
+ id: 'editor-common.quick-insert.previewAttributionConfluence.ai-non-final',
150
+ defaultMessage: 'Confluence',
151
+ description: 'Confluence product name shown as the creator in a slash-command preview attribution.'
152
+ },
153
+ previewAttributionJira: {
154
+ id: 'editor-common.quick-insert.previewAttributionJira.ai-non-final',
155
+ defaultMessage: 'Jira',
156
+ description: 'Jira product name shown as the creator in a slash-command preview attribution.'
157
+ },
158
+ previewAttributionMicrosoft: {
159
+ id: 'editor-common.quick-insert.previewAttributionMicrosoft.ai-non-final',
160
+ defaultMessage: 'Microsoft',
161
+ description: 'Microsoft company name shown as the creator in a slash-command preview attribution.'
132
162
  }
133
163
  });
@@ -0,0 +1 @@
1
+ export {};
@@ -1,109 +1,109 @@
1
- var DAM_ASSET_LINK = 'https://dam-cdn.atl.orangelogic.com/AssetLink';
1
+ var DAM_CDN_LINK = 'https://dam-cdn.atl.orangelogic.com/CDNLink';
2
2
  var snippetPreviewImageUrlsByKey = {
3
3
  // Action items
4
4
  '019e5cd9-5ca1-7258-befd-4f50d491bb42': {
5
- light: "".concat(DAM_ASSET_LINK, "/qq0503l11x2ub0506p2s046o2ep5gw1w.png"),
6
- dark: "".concat(DAM_ASSET_LINK, "/i77e8128ir0e34t8w11mar77ngq53o00.png")
5
+ light: "".concat(DAM_CDN_LINK, "/AT12OVLE.png"),
6
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJI.png")
7
7
  },
8
8
  // Bug report
9
9
  '019e5cd9-5ca1-7258-befd-1c3c59b0aa00': {
10
- light: "".concat(DAM_ASSET_LINK, "/221f56s64c186314ka8a7uaj7m4di32l.png"),
11
- dark: "".concat(DAM_ASSET_LINK, "/1c86e0v3ygh5ct5600luum0w67unpa23.png")
10
+ light: "".concat(DAM_CDN_LINK, "/AT12OVMN.png"),
11
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJ6.png")
12
12
  },
13
13
  // Campaign brief
14
14
  '019e5cd9-5ca1-7258-befd-398bb4e40f15': {
15
- light: "".concat(DAM_ASSET_LINK, "/55j1ie55ad1nal6t3awxxui52rp47wn1.png"),
16
- dark: "".concat(DAM_ASSET_LINK, "/36h5jgou0pw7v532411mbl501b8de4hm.png")
15
+ light: "".concat(DAM_CDN_LINK, "/AT12OVMY.png"),
16
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJE.png")
17
17
  },
18
18
  // Colorful layout
19
19
  '019e5cd9-5ca1-7258-befd-53b6eec19427': {
20
- light: "".concat(DAM_ASSET_LINK, "/53j8kth40pkysk4rqs64038r4cw2i867.png"),
21
- dark: "".concat(DAM_ASSET_LINK, "/k7ofa1q6r10dydey04780514v75j3fvx.png")
20
+ light: "".concat(DAM_CDN_LINK, "/AT12OVN6.png"),
21
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVIG.png")
22
22
  },
23
23
  // Colorful numbered table
24
24
  '019e5cd9-5ca1-7258-befd-70a282facf16': {
25
- light: "".concat(DAM_ASSET_LINK, "/f02n6041opl0rqvbygs2hv162mt6jq3u.png"),
26
- dark: "".concat(DAM_ASSET_LINK, "/s63mw28263h0oi8we3x052m7rsw2o1k8.png")
25
+ light: "".concat(DAM_CDN_LINK, "/AT12OVN7.png"),
26
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJL.png")
27
27
  },
28
28
  // Colorful summary
29
29
  '019e5cd9-5ca1-7258-befd-7e200502de8e': {
30
- light: "".concat(DAM_ASSET_LINK, "/242qv11f2p7y1u461v71glq85x76b5gp.png"),
31
- dark: "".concat(DAM_ASSET_LINK, "/jeaj3a8g7x61syy45d73c2223647b14j.png")
30
+ light: "".concat(DAM_CDN_LINK, "/AT12OVN4.png"),
31
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVIE.png")
32
32
  },
33
33
  // Colorful table
34
34
  '019e5cd9-5ca1-7258-befd-5524d394ba0a': {
35
- light: "".concat(DAM_ASSET_LINK, "/8w8571k707dlx556rxr3hs72gs5q4m42.png"),
36
- dark: "".concat(DAM_ASSET_LINK, "/wkt55v21i5q520pqxjh31x5g2j8upth4.png")
35
+ light: "".concat(DAM_CDN_LINK, "/AT12OVMJ.png"),
36
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJM.png")
37
37
  },
38
38
  // Competitive snapshot
39
39
  '019e5cd9-5ca1-7258-befd-40d1947b7b84': {
40
- light: "".concat(DAM_ASSET_LINK, "/k5cm81s2h7i41d4d6832n67c2m767h6t.png"),
41
- dark: "".concat(DAM_ASSET_LINK, "/ks38nc26451n7384d52413lck2qhq4e6.png")
40
+ light: "".concat(DAM_CDN_LINK, "/AT12OVMR.png"),
41
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJC.png")
42
42
  },
43
43
  // Criteria rubric
44
44
  '019e5cd9-5ca1-7258-befd-84723a493931': {
45
- light: "".concat(DAM_ASSET_LINK, "/n00f5ur678kbqdqjj5e13xpij6u3kkuq.png"),
46
- dark: "".concat(DAM_ASSET_LINK, "/54k2y2f7n2tpg2n12is326376102c3b5.png")
45
+ light: "".concat(DAM_CDN_LINK, "/AT12OVMA.png"),
46
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJ1.png")
47
47
  },
48
48
  // Customer quote
49
49
  '019e5cd9-5ca1-7258-befd-5fcf6165870f': {
50
- light: "".concat(DAM_ASSET_LINK, "/k8q5l4htp63652mhw572ed6chren37mv.png"),
51
- dark: "".concat(DAM_ASSET_LINK, "/y0leijw14xp7mdpi3265xn0d5ymo5lfm.png")
50
+ light: "".concat(DAM_CDN_LINK, "/AT12OVLF.png"),
51
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJK.png")
52
52
  },
53
53
  // Decision log
54
54
  '019e5cd9-5ca1-7258-befd-30c6e8712ba4': {
55
- light: "".concat(DAM_ASSET_LINK, "/4vuxracm3c33555h1u4ug65q55267574.png"),
56
- dark: "".concat(DAM_ASSET_LINK, "/5445044f626dcb58dbc7s6axr32e4ywl.png")
55
+ light: "".concat(DAM_CDN_LINK, "/AT12OVMT.png"),
56
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJ9.png")
57
57
  },
58
58
  // Launch checklist
59
59
  '019e5cd9-5ca1-7258-befd-3ce1c551015e': {
60
- light: "".concat(DAM_ASSET_LINK, "/1o0gj47oprg341fe6iip8fdx8561t54n.png"),
61
- dark: "".concat(DAM_ASSET_LINK, "/lay6kpn21b264q2q8144h3s18uwjud0f.png")
60
+ light: "".concat(DAM_CDN_LINK, "/AT12OVKW.png"),
61
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVHN.png")
62
62
  },
63
63
  // Meeting agenda
64
64
  '019e5cd9-5ca1-7258-befd-47559a8d7cfc': {
65
- light: "".concat(DAM_ASSET_LINK, "/2hn6q5dt118vwyqi438725l141u70fb8.png"),
66
- dark: "".concat(DAM_ASSET_LINK, "/r4l0ydb7ujg4lms6n0wrrnsmsd1x65kw.png")
65
+ light: "".concat(DAM_CDN_LINK, "/AT12OVMU.png"),
66
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJD.png")
67
67
  },
68
68
  // Project status snapshot
69
69
  '019e5cd9-5ca1-7258-befd-2943939d1b79': {
70
- light: "".concat(DAM_ASSET_LINK, "/qk6emfe0oa2260ldt11748672gs65y1l.png"),
71
- dark: "".concat(DAM_ASSET_LINK, "/tt36rsll4cmq4607ik7g2d10fxmysyt4.png")
70
+ light: "".concat(DAM_CDN_LINK, "/AT12OVMO.png"),
71
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJU.png")
72
72
  },
73
73
  // Pros and cons
74
74
  '019e5cd9-5ca1-7258-befd-6db9658d75f4': {
75
- light: "".concat(DAM_ASSET_LINK, "/22078yl6viws8rc3au187m76x07xcu61.png"),
76
- dark: "".concat(DAM_ASSET_LINK, "/4tfd6w50y4yxfh4ks75w5ql04u17n7ub.png")
75
+ light: "".concat(DAM_CDN_LINK, "/AT12OVN5.png"),
76
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVHY.png")
77
77
  },
78
78
  // Quick project update
79
79
  '019e5cd9-5ca1-7258-befd-820ce1acd7a0': {
80
- light: "".concat(DAM_ASSET_LINK, "/i8cfkp8v6716121f0w054g85mkw15wgu.png"),
81
- dark: "".concat(DAM_ASSET_LINK, "/x7a25y5f33ok60871t31e1my5c7880cr.png")
80
+ light: "".concat(DAM_CDN_LINK, "/AT12OVNA.png"),
81
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVI5.png")
82
82
  },
83
83
  // Risks and assumptions
84
84
  '019e5cd9-5ca1-7258-befd-2da95ce98772': {
85
- light: "".concat(DAM_ASSET_LINK, "/yl7w10ms70ptlodhc703f6byo3wf7xty.png"),
86
- dark: "".concat(DAM_ASSET_LINK, "/mn14wqw150cu05w3s358w3f2f1vfgv7r.png")
85
+ light: "".concat(DAM_CDN_LINK, "/AT12OVMQ.png"),
86
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJ7.png")
87
87
  },
88
88
  // Roles and responsibilities matrix
89
89
  '019e5cd9-5ca1-7258-befd-37cd3a06776d': {
90
- light: "".concat(DAM_ASSET_LINK, "/67hs5t8u4t63c4fepm6ho1c4d5u12bed.png"),
91
- dark: "".concat(DAM_ASSET_LINK, "/wj5s3dy5nvb810t87f7x45cie88783h6.png")
90
+ light: "".concat(DAM_CDN_LINK, "/AT12OVM8.png"),
91
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVHG.png")
92
92
  },
93
93
  // Run sheet
94
94
  '019e5cd9-5ca1-7258-befd-4a9979f87235': {
95
- light: "".concat(DAM_ASSET_LINK, "/tt0n285m6jl5lxb46c5v4fn856540351.png"),
96
- dark: "".concat(DAM_ASSET_LINK, "/qcrcqcs14753208xqw1j8r38mgs57w2f.png")
95
+ light: "".concat(DAM_CDN_LINK, "/AT12OVMZ.png"),
96
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJB.png")
97
97
  },
98
98
  // Started → Now
99
99
  '019e5cd9-5ca1-7258-befd-74fb1585da6f': {
100
- light: "".concat(DAM_ASSET_LINK, "/5ggat8yryusxvaqj3o800t8v6hcyh22v.png"),
101
- dark: "".concat(DAM_ASSET_LINK, "/287u8yil1jb1j5p1fih0141h07k2f64w.png")
100
+ light: "".concat(DAM_CDN_LINK, "/AT12OVN8.png"),
101
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVJQ.png")
102
102
  },
103
103
  // Weekly calendar
104
104
  '019e5cd9-5ca1-7258-befd-580c2c95a0a0': {
105
- light: "".concat(DAM_ASSET_LINK, "/na153u604p852n54aji7aj1gf14431o7.png"),
106
- dark: "".concat(DAM_ASSET_LINK, "/sw7m5s5ay718h025c6ed3gaq63orv4gu.png")
105
+ light: "".concat(DAM_CDN_LINK, "/AT12OVN2.png"),
106
+ dark: "".concat(DAM_CDN_LINK, "/AT12OVIJ.png")
107
107
  }
108
108
  };
109
109
  export var getSnippetPreviewImageUrls = function getSnippetPreviewImageUrls(snippetKey) {
@@ -0,0 +1,51 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useCallback, useLayoutEffect, useRef, useState } from 'react';
3
+ /** Keep the list viewport in sync with measured rows, including short search results. */
4
+ export function useMenuListHeight(cache, rowCount, rowKeySignature) {
5
+ var _useState = useState(function () {
6
+ return Array.from({
7
+ length: rowCount
8
+ }, function (_, index) {
9
+ return cache.rowHeight({
10
+ index: index
11
+ });
12
+ }).reduce(function (sum, value) {
13
+ return sum + value;
14
+ }, 0);
15
+ }),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ height = _useState2[0],
18
+ setHeight = _useState2[1];
19
+ var frame = useRef();
20
+ var updateHeight = useCallback(function () {
21
+ if (frame.current !== undefined) {
22
+ cancelAnimationFrame(frame.current);
23
+ }
24
+ // CellMeasurer updates its cache during commit. Read it after all rows have measured.
25
+ frame.current = requestAnimationFrame(function () {
26
+ frame.current = undefined;
27
+ var total = Array.from({
28
+ length: rowCount
29
+ }, function (_, index) {
30
+ return cache.rowHeight({
31
+ index: index
32
+ });
33
+ }).reduce(function (sum, height) {
34
+ return sum + height;
35
+ }, 0);
36
+ setHeight(total);
37
+ });
38
+ }, [cache, rowCount]);
39
+ useLayoutEffect(function () {
40
+ updateHeight();
41
+ return function () {
42
+ if (frame.current !== undefined) {
43
+ cancelAnimationFrame(frame.current);
44
+ }
45
+ };
46
+ }, [rowKeySignature, updateHeight]);
47
+ return {
48
+ height: height,
49
+ updateHeight: updateHeight
50
+ };
51
+ }
@@ -0,0 +1,53 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useLayoutEffect, useState } from 'react';
3
+ import { bind } from 'bind-event-listener';
4
+ import rafSchedule from 'raf-schd';
5
+ import { findOverflowScrollParent } from '../ui/Popup/utils';
6
+ /** Constrain menu height to the available space; Popup chooses placement. */
7
+ export function useMenuPopupSizing(_ref) {
8
+ var target = _ref.target,
9
+ boundariesElement = _ref.boundariesElement,
10
+ scrollableElement = _ref.scrollableElement,
11
+ maxHeight = _ref.maxHeight,
12
+ offset = _ref.offset,
13
+ _ref$isOpen = _ref.isOpen,
14
+ isOpen = _ref$isOpen === void 0 ? true : _ref$isOpen;
15
+ var _useState = useState(maxHeight),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ height = _useState2[0],
18
+ setHeight = _useState2[1];
19
+ useLayoutEffect(function () {
20
+ var view = target === null || target === void 0 ? void 0 : target.ownerDocument.defaultView;
21
+ if (!target || !view || !isOpen) {
22
+ return;
23
+ }
24
+ var boundary = boundariesElement || target.ownerDocument.body;
25
+ var scrollParent = scrollableElement || findOverflowScrollParent(target);
26
+ var update = function update() {
27
+ var rect = target.getBoundingClientRect();
28
+ var bounds = boundary.getBoundingClientRect();
29
+ var above = Math.max(0, rect.top - (bounds.top - boundary.scrollTop) - offset);
30
+ var below = Math.max(0, bounds.bottom - rect.bottom - offset);
31
+ var space = below >= maxHeight ? below : Math.max(above, below);
32
+ // Popup rounds its position up to a CSS pixel. Reserve that pixel at the edge.
33
+ var available = Math.max(0, Math.floor(space) - 1);
34
+ setHeight(Math.min(maxHeight, available));
35
+ };
36
+ var schedule = rafSchedule(update);
37
+ update();
38
+ var unbindResize = bind(view, {
39
+ type: 'resize',
40
+ listener: schedule
41
+ });
42
+ var unbindScroll = scrollParent ? bind(scrollParent, {
43
+ type: 'scroll',
44
+ listener: schedule
45
+ }) : undefined;
46
+ return function () {
47
+ unbindResize();
48
+ unbindScroll === null || unbindScroll === void 0 || unbindScroll();
49
+ schedule.cancel();
50
+ };
51
+ }, [target, boundariesElement, scrollableElement, maxHeight, offset, isOpen]);
52
+ return height;
53
+ }
@@ -1,4 +1,4 @@
1
- import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
1
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
2
2
  export var areToolbarFlagsEnabled = function areToolbarFlagsEnabled(isNewToolbarEnabled) {
3
- return Boolean(expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1') || isNewToolbarEnabled);
3
+ return Boolean(editorExperiment('platform_editor_controls', 'variant1') || isNewToolbarEnabled);
4
4
  };
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags/fg';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "125.2.0";
24
+ var packageVersion = "125.3.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -1,7 +1,5 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import Loadable from 'react-loadable';
3
- // oxlint-disable-next-line @atlassian/no-restricted-imports
4
- import { lazy, LazySuspense } from 'react-loosely-lazy';
5
3
  import ResourcedMention from '@atlaskit/mention/resourced-mention';
6
4
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
7
5
  import { fg } from '@atlaskit/platform-feature-flags/fg';
@@ -13,33 +11,18 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
11
  // Lazy-loaded so the agent profile card chunk (and its `@atlaskit/rovo-agent-components`
14
12
  // dependency) stays off the critical path — it is only fetched when an agent mention
15
13
  // (`userType === 'APP'`) actually renders, never for person mentions.
16
- var loadAgentProfileCardTrigger = function loadAgentProfileCardTrigger() {
17
- return import( /* webpackChunkName: "@atlaskit-internal_profilecard/agent-profile-card-trigger" */
18
- '@atlaskit/profilecard/agent-profile-card-trigger').then(function (mod) {
19
- return mod.AgentProfileCardTrigger;
20
- });
21
- };
22
- var AgentProfileCardTriggerLazy = lazy(function () {
23
- return import( /* webpackChunkName: "@atlaskit-internal_profilecard/agent-profile-card-trigger" */
24
- '@atlaskit/profilecard/agent-profile-card-trigger').then(function (mod) {
25
- return mod.AgentProfileCardTrigger;
26
- });
27
- });
28
- AgentProfileCardTriggerLazy.displayName = 'lazy(AgentProfileCardTrigger)';
29
- var AgentProfileCardTriggerLoadable = Loadable({
30
- loader: loadAgentProfileCardTrigger,
14
+ // Uses react-loadable to match editor-common's code-splitting factory (see src/icons/index.ts).
15
+ var AgentProfileCardTrigger = Loadable({
16
+ loader: function loader() {
17
+ return import( /* webpackChunkName: "@atlaskit-internal_profilecard/agent-profile-card-trigger" */
18
+ '@atlaskit/profilecard/agent-profile-card-trigger').then(function (mod) {
19
+ return mod.AgentProfileCardTrigger;
20
+ });
21
+ },
31
22
  loading: function loading() {
32
23
  return null;
33
24
  }
34
25
  });
35
- var AgentProfileCardTrigger = function AgentProfileCardTrigger(props) {
36
- return isExperimentEnabled('platform_editor_loosely_lazy_migration') ? /*#__PURE__*/React.createElement(LazySuspense, {
37
- fallback: null
38
- }, /*#__PURE__*/React.createElement(AgentProfileCardTriggerLazy, props)) :
39
- /*#__PURE__*/
40
- // eslint-disable-next-line react/jsx-props-no-spreading
41
- React.createElement(AgentProfileCardTriggerLoadable, props);
42
- };
43
26
 
44
27
  // Ignored via go/ees005
45
28
  // eslint-disable-next-line require-unicode-regexp
@@ -68,6 +51,7 @@ export default function MentionWithProfileCard(_ref) {
68
51
  ssrPlaceholderId = _ref.ssrPlaceholderId,
69
52
  userType = _ref.userType;
70
53
  var cloudId = profilecardProvider.cloudId,
54
+ renderAgentMentionCard = profilecardProvider.renderAgentMentionCard,
71
55
  renderUserMentionCard = profilecardProvider.renderUserMentionCard,
72
56
  resourceClient = profilecardProvider.resourceClient;
73
57
  var actions = useMemo(function () {
@@ -92,6 +76,13 @@ export default function MentionWithProfileCard(_ref) {
92
76
 
93
77
  // Agent mentions (userType 'APP') open the Rovo agent profile card on click.
94
78
  if (userType === 'APP' && cloudId && isExperimentEnabled('rovo_chat_mention_agents')) {
79
+ if (renderAgentMentionCard) {
80
+ return /*#__PURE__*/React.createElement(React.Fragment, null, renderAgentMentionCard({
81
+ accountId: id,
82
+ children: mention,
83
+ cloudId: cloudId
84
+ }));
85
+ }
95
86
  return /*#__PURE__*/React.createElement(AgentProfileCardTrigger, {
96
87
  agentId: id,
97
88
  agentIdType: isExperimentEnabled('platform_editor_comment_mention_card_fixes') ? 'identity' : undefined,
@@ -14,6 +14,7 @@ import { bind } from 'bind-event-listener';
14
14
  import createFocusTrap from 'focus-trap';
15
15
  import rafSchedule from 'raf-schd';
16
16
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
17
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
17
18
  import { calculatePlacement, calculatePosition as _calculatePosition, findOverflowScrollParent } from './utils';
18
19
  import { validatePosition } from './validatePosition';
19
20
  // Ignored via go/ees005
@@ -29,10 +30,45 @@ var Popup = /*#__PURE__*/function (_React$Component) {
29
30
  _this = _callSuper(this, Popup, [].concat(args));
30
31
  _defineProperty(_this, "rafIds", new Set());
31
32
  _defineProperty(_this, "state", {
33
+ targetVisible: true,
32
34
  validPosition: true
33
35
  });
34
36
  _defineProperty(_this, "popupRef", /*#__PURE__*/React.createRef());
35
37
  _defineProperty(_this, "placement", ['', '']);
38
+ _defineProperty(_this, "setTargetVisibility", function (targetVisible) {
39
+ if (targetVisible !== _this.state.targetVisible) {
40
+ if (!targetVisible) {
41
+ var _this$focusTrap;
42
+ // Let consumers preserve focus before the popup becomes hidden.
43
+ _this.reportTargetVisibility(targetVisible);
44
+ (_this$focusTrap = _this.focusTrap) === null || _this$focusTrap === void 0 || _this$focusTrap.pause();
45
+ _this.setState({
46
+ targetVisible: targetVisible
47
+ });
48
+ return;
49
+ }
50
+
51
+ // Reveal the popup before consumers restore focus to its contents.
52
+ _this.setState({
53
+ targetVisible: targetVisible
54
+ }, function () {
55
+ if (_this.props.focusTrap) {
56
+ var _this$focusTrap2;
57
+ (_this$focusTrap2 = _this.focusTrap) === null || _this$focusTrap2 === void 0 || _this$focusTrap2.unpause();
58
+ }
59
+ _this.reportTargetVisibility(targetVisible);
60
+ });
61
+ return;
62
+ }
63
+ _this.reportTargetVisibility(targetVisible);
64
+ });
65
+ _defineProperty(_this, "reportTargetVisibility", function (targetVisible) {
66
+ if (targetVisible !== _this.reportedTargetVisibility) {
67
+ var _this$props$onTargetV, _this$props;
68
+ _this.reportedTargetVisibility = targetVisible;
69
+ (_this$props$onTargetV = (_this$props = _this.props).onTargetVisibilityChanged) === null || _this$props$onTargetV === void 0 || _this$props$onTargetV.call(_this$props, targetVisible);
70
+ }
71
+ });
36
72
  _defineProperty(_this, "handleRef", function (popup) {
37
73
  if (!popup) {
38
74
  return;
@@ -155,6 +191,41 @@ var Popup = /*#__PURE__*/function (_React$Component) {
155
191
  });
156
192
  }
157
193
  }
194
+ }, {
195
+ key: "initTargetVisibilityObserver",
196
+ value: function initTargetVisibilityObserver() {
197
+ var _this$targetVisibilit,
198
+ _observedTarget$owner,
199
+ _this3 = this;
200
+ var _this$props2 = this.props,
201
+ hideWhenTargetOutOfView = _this$props2.hideWhenTargetOutOfView,
202
+ target = _this$props2.target,
203
+ visibilityTarget = _this$props2.visibilityTarget;
204
+ var observedTarget = visibilityTarget !== null && visibilityTarget !== void 0 ? visibilityTarget : target;
205
+ (_this$targetVisibilit = this.targetVisibilityObserver) === null || _this$targetVisibilit === void 0 || _this$targetVisibilit.disconnect();
206
+ this.targetVisibilityObserver = undefined;
207
+ if (!hideWhenTargetOutOfView || !isExperimentEnabled('platform_editor_popup_target_visibility')) {
208
+ if (!this.state.targetVisible) {
209
+ this.setTargetVisibility(true);
210
+ }
211
+ return;
212
+ }
213
+ this.reportedTargetVisibility = undefined;
214
+ var IntersectionObserverConstructor = observedTarget === null || observedTarget === void 0 || (_observedTarget$owner = observedTarget.ownerDocument.defaultView) === null || _observedTarget$owner === void 0 ? void 0 : _observedTarget$owner.IntersectionObserver;
215
+ if (!IntersectionObserverConstructor || !observedTarget) {
216
+ this.setTargetVisibility(true);
217
+ return;
218
+ }
219
+ this.targetVisibilityObserver = new IntersectionObserverConstructor(function (entries) {
220
+ var _entry$isIntersecting;
221
+ var entry = entries[entries.length - 1];
222
+ _this3.setTargetVisibility((_entry$isIntersecting = entry === null || entry === void 0 ? void 0 : entry.isIntersecting) !== null && _entry$isIntersecting !== void 0 ? _entry$isIntersecting : true);
223
+ }, {
224
+ root: null
225
+ });
226
+ this.targetVisibilityObserver.observe(observedTarget);
227
+ this.setTargetVisibility(true);
228
+ }
158
229
  }, {
159
230
  key: "cannotSetPopup",
160
231
  value: function cannotSetPopup(popup, target, overflowScrollParent) {
@@ -222,9 +293,9 @@ var Popup = /*#__PURE__*/function (_React$Component) {
222
293
  * Deactivates the focus trap if it exists
223
294
  */
224
295
  function destroyFocusTrap() {
225
- var _this$focusTrap;
296
+ var _this$focusTrap3;
226
297
  this.initFocusTrap.cancel();
227
- (_this$focusTrap = this.focusTrap) === null || _this$focusTrap === void 0 || _this$focusTrap.deactivate();
298
+ (_this$focusTrap3 = this.focusTrap) === null || _this$focusTrap3 === void 0 || _this$focusTrap3.deactivate();
228
299
  }
229
300
 
230
301
  /**
@@ -236,8 +307,8 @@ var Popup = /*#__PURE__*/function (_React$Component) {
236
307
  if (prevProps.focusTrap !== this.props.focusTrap) {
237
308
  // If currently set to disable, then pause the trap if it exists
238
309
  if (!this.props.focusTrap) {
239
- var _this$focusTrap2;
240
- return (_this$focusTrap2 = this.focusTrap) === null || _this$focusTrap2 === void 0 ? void 0 : _this$focusTrap2.pause();
310
+ var _this$focusTrap4;
311
+ return (_this$focusTrap4 = this.focusTrap) === null || _this$focusTrap4 === void 0 ? void 0 : _this$focusTrap4.pause();
241
312
  }
242
313
 
243
314
  // If set to enabled and trap already exists, unpause
@@ -258,10 +329,10 @@ var Popup = /*#__PURE__*/function (_React$Component) {
258
329
  key: "initScrollElement",
259
330
  value: function initScrollElement() {
260
331
  var _this$unbindScroll;
261
- var _this$props = this.props,
262
- stick = _this$props.stick,
263
- target = _this$props.target,
264
- scrollableElement = _this$props.scrollableElement;
332
+ var _this$props3 = this.props,
333
+ stick = _this$props3.stick,
334
+ target = _this$props3.target,
335
+ scrollableElement = _this$props3.scrollableElement;
265
336
  (_this$unbindScroll = this.unbindScroll) === null || _this$unbindScroll === void 0 || _this$unbindScroll.call(this);
266
337
  if (this.scrollElement && this.resizeObserver) {
267
338
  this.resizeObserver.unobserve(this.scrollElement);
@@ -287,6 +358,11 @@ var Popup = /*#__PURE__*/function (_React$Component) {
287
358
  if (prevProps.scrollableElement !== this.props.scrollableElement) {
288
359
  this.initScrollElement();
289
360
  }
361
+ // Reconfigure while enabled, or once after disabling to clean up the existing observer.
362
+ // A different target must be observed again.
363
+ if ((prevProps.hideWhenTargetOutOfView || this.props.hideWhenTargetOutOfView) && (prevProps.hideWhenTargetOutOfView !== this.props.hideWhenTargetOutOfView || prevProps.target !== this.props.target || prevProps.visibilityTarget !== this.props.visibilityTarget)) {
364
+ this.initTargetVisibilityObserver();
365
+ }
290
366
  if (this.props !== prevProps) {
291
367
  this.scheduledUpdatePosition(prevProps);
292
368
  }
@@ -298,14 +374,18 @@ var Popup = /*#__PURE__*/function (_React$Component) {
298
374
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
299
375
  window.addEventListener('resize', this.onResize);
300
376
  this.initScrollElement();
377
+ if (this.props.hideWhenTargetOutOfView) {
378
+ this.initTargetVisibilityObserver();
379
+ }
301
380
  }
302
381
  }, {
303
382
  key: "componentWillUnmount",
304
383
  value: function componentWillUnmount() {
305
- var _this$unbindScroll2, _this$resizeObserver3;
384
+ var _this$targetVisibilit2, _this$unbindScroll2, _this$resizeObserver3;
306
385
  // Ignored via go/ees005
307
386
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
308
387
  window.removeEventListener('resize', this.onResize);
388
+ (_this$targetVisibilit2 = this.targetVisibilityObserver) === null || _this$targetVisibilit2 === void 0 || _this$targetVisibilit2.disconnect();
309
389
  (_this$unbindScroll2 = this.unbindScroll) === null || _this$unbindScroll2 === void 0 || _this$unbindScroll2.call(this);
310
390
  if (this.scrollElement) {
311
391
  // Ignored via go/ees005
@@ -324,8 +404,10 @@ var Popup = /*#__PURE__*/function (_React$Component) {
324
404
  key: "renderPopup",
325
405
  value: function renderPopup() {
326
406
  var _this$props$ariaLabel,
327
- _this3 = this;
328
- var position = this.state.position;
407
+ _this4 = this;
408
+ var _this$state = this.state,
409
+ position = _this$state.position,
410
+ targetVisible = _this$state.targetVisible;
329
411
  var shouldRenderPopup = this.props.shouldRenderPopup;
330
412
  if (shouldRenderPopup && !shouldRenderPopup(position || {})) {
331
413
  return null;
@@ -342,18 +424,20 @@ var Popup = /*#__PURE__*/function (_React$Component) {
342
424
  // use role = dialog as default role, as dialog role itself is not a parent role that requires specific children to function as some other ARIA roles(menu) do
343
425
  // if set default role to menu, tons of integration tests will fail as many of our popup usages do not have children that satisfy menu role requirements
344
426
  if (ariaLabel) {
345
- return _this3.props.role || 'dialog';
427
+ return _this4.props.role || 'dialog';
346
428
  }
347
429
  return undefined;
348
430
  };
349
431
  return /*#__PURE__*/React.createElement("div", {
350
432
  ref: this.handleRef,
351
- style: _objectSpread(_objectSpread({
433
+ style: _objectSpread(_objectSpread(_objectSpread({
352
434
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
353
435
  position: 'absolute',
354
436
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
355
437
  zIndex: this.props.zIndex || akEditorFloatingPanelZIndex
356
- }, position), this.props.style),
438
+ }, position), this.props.style), this.props.hideWhenTargetOutOfView && isExperimentEnabled('platform_editor_popup_target_visibility') && !targetVisible && {
439
+ visibility: 'hidden'
440
+ }),
357
441
  role: getRole(),
358
442
  "aria-label": ariaLabel,
359
443
  "data-testid": "popup-wrapper"
@@ -365,9 +449,9 @@ var Popup = /*#__PURE__*/function (_React$Component) {
365
449
  }, {
366
450
  key: "render",
367
451
  value: function render() {
368
- var _this$props2 = this.props,
369
- target = _this$props2.target,
370
- mountTo = _this$props2.mountTo;
452
+ var _this$props4 = this.props,
453
+ target = _this$props4.target,
454
+ mountTo = _this$props4.mountTo;
371
455
  var validPosition = this.state.validPosition;
372
456
  if (!target || !validPosition) {
373
457
  return null;