@atlaskit/editor-common 82.0.1 → 82.1.1

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 (48) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/cjs/element-browser/components/ElementList/ElementList.js +123 -27
  3. package/dist/cjs/element-browser/components/StatelessElementBrowser.js +7 -1
  4. package/dist/cjs/element-browser/constants.js +3 -2
  5. package/dist/cjs/mark/commands.js +8 -1
  6. package/dist/cjs/messages/card.js +5 -0
  7. package/dist/cjs/monitoring/environment.js +22 -0
  8. package/dist/cjs/monitoring/error.js +3 -2
  9. package/dist/cjs/styles/shared/annotation.js +67 -42
  10. package/dist/cjs/styles/shared/background-color.js +11 -13
  11. package/dist/cjs/ui/DropList/index.js +1 -1
  12. package/dist/cjs/utils/annotation/index.js +11 -3
  13. package/dist/cjs/utils/validator.js +24 -27
  14. package/dist/es2019/element-browser/components/ElementList/ElementList.js +100 -6
  15. package/dist/es2019/element-browser/components/StatelessElementBrowser.js +7 -1
  16. package/dist/es2019/element-browser/constants.js +2 -1
  17. package/dist/es2019/mark/commands.js +8 -1
  18. package/dist/es2019/messages/card.js +5 -0
  19. package/dist/es2019/monitoring/environment.js +16 -0
  20. package/dist/es2019/monitoring/error.js +3 -2
  21. package/dist/es2019/styles/shared/annotation.js +70 -43
  22. package/dist/es2019/styles/shared/background-color.js +3 -3
  23. package/dist/es2019/ui/DropList/index.js +1 -1
  24. package/dist/es2019/utils/annotation/index.js +11 -3
  25. package/dist/es2019/utils/validator.js +24 -24
  26. package/dist/esm/element-browser/components/ElementList/ElementList.js +124 -28
  27. package/dist/esm/element-browser/components/StatelessElementBrowser.js +7 -1
  28. package/dist/esm/element-browser/constants.js +2 -1
  29. package/dist/esm/mark/commands.js +8 -1
  30. package/dist/esm/messages/card.js +5 -0
  31. package/dist/esm/monitoring/environment.js +16 -0
  32. package/dist/esm/monitoring/error.js +3 -2
  33. package/dist/esm/styles/shared/annotation.js +67 -42
  34. package/dist/esm/styles/shared/background-color.js +11 -13
  35. package/dist/esm/ui/DropList/index.js +1 -1
  36. package/dist/esm/utils/annotation/index.js +11 -3
  37. package/dist/esm/utils/validator.js +24 -27
  38. package/dist/types/element-browser/components/ElementList/ElementList.d.ts +1 -0
  39. package/dist/types/element-browser/constants.d.ts +1 -0
  40. package/dist/types/messages/card.d.ts +5 -0
  41. package/dist/types/monitoring/environment.d.ts +1 -0
  42. package/dist/types/styles/shared/background-color.d.ts +1 -1
  43. package/dist/types-ts4.5/element-browser/components/ElementList/ElementList.d.ts +1 -0
  44. package/dist/types-ts4.5/element-browser/constants.d.ts +1 -0
  45. package/dist/types-ts4.5/messages/card.d.ts +5 -0
  46. package/dist/types-ts4.5/monitoring/environment.d.ts +1 -0
  47. package/dist/types-ts4.5/styles/shared/background-color.d.ts +1 -1
  48. package/package.json +12 -6
@@ -252,30 +252,36 @@ var getValidNode = exports.getValidNode = function getValidNode(originalNode) {
252
252
  case 'date':
253
253
  {
254
254
  if (attrs && attrs.timestamp) {
255
- return {
255
+ return _objectSpread({
256
256
  type: type,
257
257
  attrs: attrs
258
- };
258
+ }, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? {
259
+ marks: marks
260
+ } : {});
259
261
  }
260
262
  break;
261
263
  }
262
264
  case 'status':
263
265
  {
264
266
  if (attrs && attrs.text && attrs.color) {
265
- return {
267
+ return _objectSpread({
266
268
  type: type,
267
269
  attrs: attrs
268
- };
270
+ }, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? {
271
+ marks: marks
272
+ } : {});
269
273
  }
270
274
  break;
271
275
  }
272
276
  case 'emoji':
273
277
  {
274
278
  if (attrs && attrs.shortName) {
275
- return {
279
+ return _objectSpread({
276
280
  type: type,
277
281
  attrs: attrs
278
- };
282
+ }, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? {
283
+ marks: marks
284
+ } : {});
279
285
  }
280
286
  break;
281
287
  }
@@ -292,26 +298,15 @@ var getValidNode = exports.getValidNode = function getValidNode(originalNode) {
292
298
  }
293
299
  case 'inlineCard':
294
300
  {
295
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes')) {
296
- var inlineCardNode = {
297
- type: type
298
- };
299
- if (attrs && (attrs.datasource && !attrs.url || attrs.url && (0, _adfSchema.isSafeUrl)(attrs.url) || attrs.data && attrs.data.url && (0, _adfSchema.isSafeUrl)(attrs.data.url))) {
300
- inlineCardNode.attrs = _objectSpread({}, attrs);
301
- }
302
- if (marks) {
303
- inlineCardNode.marks = (0, _toConsumableArray2.default)(marks);
304
- }
305
- return inlineCardNode;
306
- } else {
307
- if (attrs && (attrs.datasource && !attrs.url || attrs.url && (0, _adfSchema.isSafeUrl)(attrs.url) || attrs.data && attrs.data.url && (0, _adfSchema.isSafeUrl)(attrs.data.url))) {
308
- return {
309
- type: type,
310
- attrs: attrs
311
- };
312
- }
313
- break;
301
+ if (attrs && (attrs.datasource && !attrs.url || attrs.url && (0, _adfSchema.isSafeUrl)(attrs.url) || attrs.data && attrs.data.url && (0, _adfSchema.isSafeUrl)(attrs.data.url))) {
302
+ return _objectSpread({
303
+ type: type,
304
+ attrs: attrs
305
+ }, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes') ? {
306
+ marks: marks
307
+ } : {});
314
308
  }
309
+ break;
315
310
  }
316
311
  case 'blockCard':
317
312
  {
@@ -507,14 +502,16 @@ var getValidNode = exports.getValidNode = function getValidNode(originalNode) {
507
502
  mentionText = text || '@unknown';
508
503
  }
509
504
  if (mentionText && mentionId) {
510
- var mentionNode = {
505
+ var mentionNode = _objectSpread({
511
506
  type: type,
512
507
  attrs: {
513
508
  id: mentionId,
514
509
  text: mentionText,
515
510
  accessLevel: ''
516
511
  }
517
- };
512
+ }, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? {
513
+ marks: marks
514
+ } : {});
518
515
  if (mentionAccess) {
519
516
  mentionNode.attrs.accessLevel = mentionAccess;
520
517
  }
@@ -2,7 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
3
  import React, { Fragment, memo, useCallback, useEffect, useMemo, useState } from 'react';
4
4
  import { css, jsx } from '@emotion/react';
5
+ import { Grid } from 'react-virtualized';
5
6
  import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer';
7
+ import { CellMeasurer, CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
6
8
  import { Collection } from 'react-virtualized/dist/commonjs/Collection';
7
9
  import { withAnalyticsContext } from '@atlaskit/analytics-next';
8
10
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
@@ -14,7 +16,7 @@ import { borderRadius } from '@atlaskit/theme/constants';
14
16
  import Tooltip from '@atlaskit/tooltip';
15
17
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../../analytics';
16
18
  import { IconFallback } from '../../../quick-insert';
17
- import { ELEMENT_LIST_PADDING, SCROLLBAR_WIDTH } from '../../constants';
19
+ import { ELEMENT_ITEM_HEIGHT, ELEMENT_ITEM_PADDING, ELEMENT_LIST_PADDING, SCROLLBAR_WIDTH } from '../../constants';
18
20
  import useContainerWidth from '../../hooks/use-container-width';
19
21
  import useFocus from '../../hooks/use-focus';
20
22
  import { Modes } from '../../types';
@@ -43,6 +45,7 @@ function ElementList({
43
45
  mode,
44
46
  selectedItemIndex,
45
47
  focusedItemIndex,
48
+ columnCount,
46
49
  setColumnCount,
47
50
  createAnalyticsEvent,
48
51
  emptyStateHandler,
@@ -81,6 +84,22 @@ function ElementList({
81
84
  }
82
85
  });
83
86
  }, [createAnalyticsEvent]);
87
+
88
+ // eslint-disable-next-line react-hooks/exhaustive-deps
89
+ const cache = new CellMeasurerCache({
90
+ fixedWidth: true,
91
+ defaultHeight: ELEMENT_ITEM_HEIGHT,
92
+ minHeight: ELEMENT_ITEM_HEIGHT
93
+ });
94
+ const columnWidth = (containerWidth - ELEMENT_ITEM_PADDING * 2) / columnCount;
95
+ const rowCount = Math.ceil(items.length / columnCount);
96
+ const rowHeight = ({
97
+ index
98
+ }) => cache.rowHeight({
99
+ index
100
+ }) <= ELEMENT_ITEM_HEIGHT ? ELEMENT_ITEM_HEIGHT : cache.rowHeight({
101
+ index
102
+ }) + ELEMENT_ITEM_PADDING * 2;
84
103
  const cellRenderer = useMemo(() => ({
85
104
  index,
86
105
  key,
@@ -127,6 +146,60 @@ function ElementList({
127
146
  setFocusedItemIndex: setFocusedItemIndex
128
147
  }, props)));
129
148
  }, [items, fullMode, selectedItemIndex, focusedItemIndex, selectedCategoryIndex, setFocusedCategoryIndex, setFocusedItemIndex, props]);
149
+ const gridCellRenderer = useMemo(() => ({
150
+ columnIndex,
151
+ key,
152
+ parent,
153
+ rowIndex,
154
+ style
155
+ }) => {
156
+ const index = rowIndex * columnCount + columnIndex;
157
+ if (items[index] == null) {
158
+ return;
159
+ }
160
+ return index > items.length - 1 ? null : jsx(CellMeasurer, {
161
+ cache: cache,
162
+ key: key,
163
+ rowIndex: rowIndex,
164
+ columnIndex: columnIndex,
165
+ parent: parent
166
+ }, jsx("div", {
167
+ style: style,
168
+ key: key,
169
+ className: "element-item-wrapper",
170
+ css: elementItemWrapper,
171
+ onKeyDown: getBooleanFF('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1') ? e => {
172
+ if (e.key === 'Tab') {
173
+ if (e.shiftKey && index === 0) {
174
+ if (setFocusedCategoryIndex) {
175
+ if (!!selectedCategoryIndex) {
176
+ setFocusedCategoryIndex(selectedCategoryIndex);
177
+ } else {
178
+ setFocusedCategoryIndex(0);
179
+ }
180
+ e.preventDefault();
181
+ }
182
+ }
183
+ // before focus jumps from elements list we need to rerender react-virtualized collection.
184
+ // Otherwise on the next render 'scrollToCell' will have same cached value
185
+ // and collection will not be scrolled to top.
186
+ // So Tab press on category will not work anymore due to invisible 1-t element.
187
+ else if (index === items.length - 2) {
188
+ setFocusedItemIndex(items.length - 1);
189
+ }
190
+ }
191
+ } : undefined
192
+ }, jsx(MemoizedElementItem, _extends({
193
+ inlineMode: !fullMode,
194
+ index: index,
195
+ item: items[index],
196
+ selected: selectedItemIndex === index,
197
+ focus: focusedItemIndex === index,
198
+ setFocusedItemIndex: setFocusedItemIndex
199
+ }, props))));
200
+ },
201
+ // eslint-disable-next-line react-hooks/exhaustive-deps
202
+ [cache, items, fullMode, selectedItemIndex, columnCount, focusedItemIndex, selectedCategoryIndex, setFocusedCategoryIndex, setFocusedItemIndex, props]);
130
203
  return jsx(Fragment, null, jsx(ContainerWidthMonitor, null), jsx("div", {
131
204
  css: elementItemsWrapper,
132
205
  "data-testid": "element-items",
@@ -144,7 +217,28 @@ function ElementList({
144
217
  disableWidth: true
145
218
  }, ({
146
219
  height
147
- }) => jsx(Collection, {
220
+ }) => getBooleanFF('platform.editor.a11y-element-browser') ? jsx(Grid, _extends({
221
+ cellRenderer: gridCellRenderer,
222
+ height: height,
223
+ width: containerWidth - ELEMENT_LIST_PADDING * 2 // containerWidth - padding on Left/Right (for focus outline)
224
+ /**
225
+ * Refresh Grid on WidthObserver value change.
226
+ * Length of the items used to force re-render to solve Firefox bug with react-virtualized retaining
227
+ * scroll position after updating the data. If new data has different number of cells, a re-render
228
+ * is forced to prevent the scroll position render bug.
229
+ */,
230
+ key: containerWidth + items.length,
231
+ rowHeight: rowHeight,
232
+ rowCount: rowCount,
233
+ columnCount: columnCount,
234
+ columnWidth: columnWidth,
235
+ deferredMeasurementCache: cache
236
+ }, selectedItemIndex && {
237
+ scrollToCell: {
238
+ rowIndex: selectedItemIndex / columnCount,
239
+ columnIndex: selectedItemIndex % columnCount
240
+ }
241
+ })) : jsx(Collection, {
148
242
  cellCount: items.length,
149
243
  cellRenderer: cellRenderer,
150
244
  cellSizeAndPositionGetter: cellSizeAndPositionGetter(containerWidth - ELEMENT_LIST_PADDING * 2, scrollbarWidth),
@@ -272,14 +366,14 @@ const elementItemsWrapper = css({
272
366
  justifyContent: 'flex-start',
273
367
  overflow: 'hidden',
274
368
  padding: "var(--ds-space-025, 2px)",
275
- '.ReactVirtualized__Collection': {
369
+ '.ReactVirtualized__Collection, .ReactVirtualized__Grid': {
276
370
  borderRadius: '3px',
277
371
  outline: 'none',
278
- ':focus': {
372
+ '&:focus': {
279
373
  boxShadow: `0 0 0 ${ELEMENT_LIST_PADDING}px ${`var(--ds-border-focused, ${B100})`}`
280
374
  }
281
375
  },
282
- '.ReactVirtualized__Collection__innerScrollContainer': {
376
+ '.ReactVirtualized__Collection__innerScrollContainer, .ReactVirtualized__Grid__innerScrollContainer': {
283
377
  "div[class='element-item-wrapper']:last-child": {
284
378
  paddingBottom: "var(--ds-space-050, 4px)"
285
379
  }
@@ -288,7 +382,7 @@ const elementItemsWrapper = css({
288
382
  const elementItemWrapper = css({
289
383
  div: {
290
384
  button: {
291
- height: '75px',
385
+ minHeight: '75px',
292
386
  alignItems: 'flex-start',
293
387
  padding: `${"var(--ds-space-150, 12px)"} ${"var(--ds-space-150, 12px)"} 11px`
294
388
  }
@@ -75,7 +75,7 @@ const mobileCategoryListWrapper = css({
75
75
  padding: `${"var(--ds-space-200, 8px)"} 0 ${"var(--ds-space-200, 16px)"} 0`,
76
76
  minHeight: `${GRID_SIZE * 4}px`,
77
77
  overflow: '-moz-scrollbars-none',
78
- '::-webkit-scrollbar': {
78
+ '&::-webkit-scrollbar': {
79
79
  display: 'none'
80
80
  },
81
81
  scrollbarWidth: 'none',
@@ -208,6 +208,7 @@ function StatelessElementBrowser(props) {
208
208
  focusedCategoryIndex: focusedCategoryIndex,
209
209
  setFocusedCategoryIndex: setFocusedCategoryIndex,
210
210
  focusOnSearch: focusOnSearch,
211
+ columnCount: columnCount,
211
212
  setColumnCount: setColumnCount,
212
213
  setFocusOnSearch: setFocusOnSearch,
213
214
  onKeyPress: onItemsEnterTabKeyPress,
@@ -220,6 +221,7 @@ function StatelessElementBrowser(props) {
220
221
  setFocusedItemIndex: setFocusedItemIndex,
221
222
  focusOnSearch: focusOnSearch,
222
223
  setColumnCount: setColumnCount,
224
+ columnCount: columnCount,
223
225
  setFocusOnSearch: setFocusOnSearch,
224
226
  onKeyPress: onItemsEnterTabKeyPress,
225
227
  onKeyDown: onKeyDown,
@@ -246,6 +248,7 @@ function MobileBrowser({
246
248
  setFocusedCategoryIndex,
247
249
  focusOnSearch,
248
250
  focusOnViewMore,
251
+ columnCount,
249
252
  setColumnCount,
250
253
  setFocusOnSearch,
251
254
  onKeyPress,
@@ -290,6 +293,7 @@ function MobileBrowser({
290
293
  selectedItemIndex: selectedItemIndex,
291
294
  focusedItemIndex: focusedItemIndex,
292
295
  setFocusedItemIndex: setFocusedItemIndex,
296
+ columnCount: columnCount,
293
297
  setColumnCount: setColumnCount,
294
298
  createAnalyticsEvent: createAnalyticsEvent,
295
299
  emptyStateHandler: emptyStateHandler,
@@ -317,6 +321,7 @@ function DesktopBrowser({
317
321
  setFocusedCategoryIndex,
318
322
  selectedCategoryIndex,
319
323
  focusOnSearch,
324
+ columnCount,
320
325
  setColumnCount,
321
326
  setFocusOnSearch,
322
327
  onKeyPress,
@@ -375,6 +380,7 @@ function DesktopBrowser({
375
380
  selectedItemIndex: selectedItemIndex,
376
381
  focusedItemIndex: focusedItemIndex,
377
382
  setFocusedItemIndex: setFocusedItemIndex,
383
+ columnCount: columnCount,
378
384
  setColumnCount: setColumnCount,
379
385
  createAnalyticsEvent: createAnalyticsEvent,
380
386
  emptyStateHandler: emptyStateHandler,
@@ -20,4 +20,5 @@ export const INLINE_SIDEBAR_HEIGHT = '54px';
20
20
  export const SEARCH_ITEM_HEIGHT_WIDTH = '20px';
21
21
  export const SCROLLBAR_WIDTH = 15;
22
22
  export const ELEMENT_LIST_PADDING = 2;
23
- export const ELEMENT_ITEM_HEIGHT = 75;
23
+ export const ELEMENT_ITEM_HEIGHT = 75;
24
+ export const ELEMENT_ITEM_PADDING = 10;
@@ -157,7 +157,14 @@ export const applyMarkOnRange = (from, to, removeMark, mark, tr) => {
157
157
  getBooleanFF('platform.editor.simplify-inline-cards-in-code-blocks_jw6t1') ? transformNonTextNodesToText(from, to, tr) : transformSmartCharsMentionsAndEmojis(from, to, tr);
158
158
  }
159
159
  tr.doc.nodesBetween(tr.mapping.map(from), tr.mapping.map(to), (node, pos) => {
160
- if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
160
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
161
+ if (!node.isText) {
162
+ const isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
163
+ if (!isAllowedInlineNode) {
164
+ return true;
165
+ }
166
+ }
167
+ } else if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
161
168
  if (!node.isText && node.type !== inlineCard) {
162
169
  return true;
163
170
  }
@@ -145,6 +145,11 @@ export const messages = defineMessages({
145
145
  defaultMessage: 'Configure link',
146
146
  description: 'An icon shown when hovering over inline smart link to inform user they can click the icon to configure the links appearance.'
147
147
  },
148
+ inlineGoToLink: {
149
+ id: 'fabric.editor.inlineGoToLink',
150
+ defaultMessage: 'Go to link',
151
+ description: 'An option in the configure link dropdown that informs the user they can click the option to open the link'
152
+ },
148
153
  datasourceConfluenceSearch: {
149
154
  id: 'fabric.editor.datasource.confluenceSearch',
150
155
  defaultMessage: 'Insert Confluence list',
@@ -0,0 +1,16 @@
1
+ const FEDRAMP_MODERATE = 'fedramp-moderate';
2
+
3
+ // To determine whether an instance is a FedRAMP instance
4
+ // Copied from platform/packages/uip/atl-context/src/services/is-fedramp/index.tsx
5
+ // We cannot import the same-named function from @atlassian/atl-context due to editor-common being a public package (and atl-context being private)
6
+ // TODO: Seek alternatives
7
+ export function isFedRamp() {
8
+ var _globalThis$location, _globalThis$location$;
9
+ // MICROS_PERIMETER is already used by few products, so we need to keep it for backward compatibility
10
+ const env = globalThis.MICROS_PERIMETER || globalThis.UNSAFE_ATL_CONTEXT_BOUNDARY;
11
+ if (env) {
12
+ return env === FEDRAMP_MODERATE;
13
+ }
14
+ const matches = (_globalThis$location = globalThis.location) === null || _globalThis$location === void 0 ? void 0 : (_globalThis$location$ = _globalThis$location.hostname) === null || _globalThis$location$ === void 0 ? void 0 : _globalThis$location$.match(/atlassian-us-gov-mod\.(com|net)|atlassian-us-gov\.(com|net)|atlassian-fex\.(com|net)|atlassian-stg-fedm\.(com|net)/);
15
+ return matches ? matches.length > 0 : false;
16
+ }
@@ -1,6 +1,7 @@
1
+ import { isFedRamp } from './environment';
1
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "82.0.1";
4
+ const packageVersion = "82.1.1";
4
5
  const sanitiseSentryEvents = (data, _hint) => {
5
6
  // Remove URL as it has UGC
6
7
  // TODO: Sanitise the URL instead of just removing it
@@ -25,7 +26,7 @@ export const logException = async (error, tags) => {
25
26
  ExtraErrorData
26
27
  } = await import( /* webpackChunkName: "@atlaskit-internal_editor-sentryintegrations" */'@sentry/integrations');
27
28
  const sentryOptions = {
28
- dsn: SENTRY_DSN,
29
+ dsn: isFedRamp() ? undefined : SENTRY_DSN,
29
30
  release: `${packageName}@${packageVersion}`,
30
31
  environment: (_process$env$CLOUD_EN = process.env.CLOUD_ENV) !== null && _process$env$CLOUD_EN !== void 0 ? _process$env$CLOUD_EN : 'unknown',
31
32
  ignoreErrors: [
@@ -13,51 +13,78 @@ export const BlockAnnotationSharedClassNames = {
13
13
  blur: `${blockAnnotationPrefix}-blur`,
14
14
  draft: `${blockAnnotationPrefix}-draft`
15
15
  };
16
- const Y75a = 'rgba(255, 240, 179, 0.5)';
16
+ const Yellow100 = 'rgb(255, 247, 214)';
17
17
  const Y200a = 'rgba(255, 196, 0, 0.82)';
18
- export const AnnotationSharedCSSByState = () => getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') ? {
19
- focus: css({
20
- background: `var(--ds-background-accent-yellow-subtler, ${Y75})`,
21
- borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y300})`}`,
22
- boxShadow: `var(--ds-shadow-overlay, ${`1px 2px 3px ${N60A}, -1px 2px 3px ${N60A}`})`,
23
- cursor: 'pointer',
24
- '&:has(.card)': {
25
- fontSize: '1.5rem',
26
- lineHeight: '1.2rem',
27
- '& > *': {
28
- fontSize: '16px'
29
- }
30
- }
31
- }),
32
- blur: css({
33
- background: `var(--ds-background-accent-yellow-subtlest, ${Y75a})`,
34
- borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y200a})`}`,
35
- cursor: 'pointer',
36
- '&:has(.card)': {
37
- fontSize: '1.5rem',
38
- lineHeight: '1.2rem',
39
- '& > *': {
40
- fontSize: '16px'
41
- }
42
- }
43
- })
44
- } : {
45
- focus: css({
46
- // Background is not coming through in confluence, suspecting to be caused by some specific combination of
47
- // emotion and token look up
48
- background: `var(--ds-background-accent-yellow-subtler, ${Y75})`,
49
- borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y300})`}`,
50
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4147
51
- boxShadow: `var(--ds-shadow-overlay, ${`1px 2px 3px ${N60A}, -1px 2px 3px ${N60A}`})`,
52
- cursor: 'pointer'
53
- }),
54
- blur: css({
55
- background: `var(--ds-background-accent-yellow-subtlest, ${Y75a})`,
56
- borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y200a})`}`,
57
- cursor: 'pointer'
58
- })
18
+ export const AnnotationSharedCSSByState = () => {
19
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
20
+ return {
21
+ focus: css({
22
+ background: `var(--ds-background-accent-yellow-subtler, ${Y75})`,
23
+ borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y300})`}`,
24
+ boxShadow: `var(--ds-shadow-overlay, ${`1px 2px 3px ${N60A}, -1px 2px 3px ${N60A}`})`,
25
+ cursor: 'pointer',
26
+ padding: '1.5px 0',
27
+ '&:has(.card)': {
28
+ padding: '4.5px 0 3px 0'
29
+ }
30
+ }),
31
+ blur: css({
32
+ background: `var(--ds-background-accent-yellow-subtlest, ${Yellow100})`,
33
+ borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y200a})`}`,
34
+ cursor: 'pointer',
35
+ padding: '1.5px 0',
36
+ '&:has(.card)': {
37
+ padding: '4.5px 0 3px 0'
38
+ }
39
+ })
40
+ };
41
+ } else if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
42
+ return {
43
+ focus: css({
44
+ background: `var(--ds-background-accent-yellow-subtler, ${Y75})`,
45
+ borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y300})`}`,
46
+ boxShadow: `var(--ds-shadow-overlay, ${`1px 2px 3px ${N60A}, -1px 2px 3px ${N60A}`})`,
47
+ cursor: 'pointer',
48
+ '&:has(.card)': {
49
+ fontSize: '1.5rem',
50
+ lineHeight: '1.2rem',
51
+ '& > *': {
52
+ fontSize: '16px'
53
+ }
54
+ }
55
+ }),
56
+ blur: css({
57
+ background: `var(--ds-background-accent-yellow-subtlest, ${Yellow100})`,
58
+ borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y200a})`}`,
59
+ cursor: 'pointer',
60
+ '&:has(.card)': {
61
+ fontSize: '1.5rem',
62
+ lineHeight: '1.2rem',
63
+ '& > *': {
64
+ fontSize: '16px'
65
+ }
66
+ }
67
+ })
68
+ };
69
+ } else {
70
+ return {
71
+ focus: css({
72
+ // Background is not coming through in confluence, suspecting to be caused by some specific combination of
73
+ // emotion and token look up
74
+ background: `var(--ds-background-accent-yellow-subtler, ${Y75})`,
75
+ borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y300})`}`,
76
+ // TODO: https://product-fabric.atlassian.net/browse/DSP-4147
77
+ boxShadow: `var(--ds-shadow-overlay, ${`1px 2px 3px ${N60A}, -1px 2px 3px ${N60A}`})`,
78
+ cursor: 'pointer'
79
+ }),
80
+ blur: css({
81
+ background: `var(--ds-background-accent-yellow-subtlest, ${Yellow100})`,
82
+ borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y200a})`}`,
83
+ cursor: 'pointer'
84
+ })
85
+ };
86
+ }
59
87
  };
60
-
61
88
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- `AnnotationSharedCSSByState()` is not safe in object syntax
62
89
  export const annotationSharedStyles = () => css`
63
90
  .ProseMirror {
@@ -1,12 +1,12 @@
1
1
  import { css } from '@emotion/react';
2
- export const backgroundColorStyles = colorMode => css({
2
+ export const backgroundColorStyles = css({
3
3
  '.fabric-background-color-mark': {
4
4
  backgroundColor: 'var(--custom-palette-color, inherit)'
5
5
  },
6
6
  'a .fabric-background-color-mark': {
7
7
  backgroundColor: 'unset'
8
8
  },
9
- '.fabric-background-color-mark .ak-editor-annotation, .fabric-background-color-mark [data-mark-type="annotation"]': {
10
- mixBlendMode: colorMode === 'dark' ? 'color-dodge' : 'multiply'
9
+ '.fabric-background-color-mark .ak-editor-annotation': {
10
+ backgroundColor: 'unset'
11
11
  }
12
12
  });
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
7
7
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
8
8
  import Layer from '../Layer';
9
9
  const packageName = "@atlaskit/editor-common";
10
- const packageVersion = "82.0.1";
10
+ const packageVersion = "82.1.1";
11
11
  const halfFocusRing = 1;
12
12
  const dropOffset = '0, 8';
13
13
  class DropList extends Component {
@@ -21,9 +21,17 @@ export const canApplyAnnotationOnRange = (rangeSelection, doc, schema) => {
21
21
  // or if we're leaf and not text
22
22
 
23
23
  if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
24
- if (node.isInline && !node.isText && node.type !== inlineCard || node.isLeaf && !node.isText && node.type !== inlineCard || node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
25
- foundInvalid = true;
26
- return false;
24
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
25
+ const isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
26
+ if (node.isInline && !node.isText && !isAllowedInlineNode || node.isLeaf && !node.isText && !isAllowedInlineNode || node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
27
+ foundInvalid = true;
28
+ return false;
29
+ }
30
+ } else {
31
+ if (node.isInline && !node.isText && node.type !== inlineCard || node.isLeaf && !node.isText && node.type !== inlineCard || node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
32
+ foundInvalid = true;
33
+ return false;
34
+ }
27
35
  }
28
36
  } else {
29
37
  if (node.isInline && !node.isText || node.isLeaf && !node.isText || node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
@@ -235,7 +235,10 @@ export const getValidNode = (originalNode, schema = defaultSchema, adfStage = 'f
235
235
  if (attrs && attrs.timestamp) {
236
236
  return {
237
237
  type,
238
- attrs
238
+ attrs,
239
+ ...(getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? {
240
+ marks
241
+ } : {})
239
242
  };
240
243
  }
241
244
  break;
@@ -245,7 +248,10 @@ export const getValidNode = (originalNode, schema = defaultSchema, adfStage = 'f
245
248
  if (attrs && attrs.text && attrs.color) {
246
249
  return {
247
250
  type,
248
- attrs
251
+ attrs,
252
+ ...(getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? {
253
+ marks
254
+ } : {})
249
255
  };
250
256
  }
251
257
  break;
@@ -255,7 +261,10 @@ export const getValidNode = (originalNode, schema = defaultSchema, adfStage = 'f
255
261
  if (attrs && attrs.shortName) {
256
262
  return {
257
263
  type,
258
- attrs
264
+ attrs,
265
+ ...(getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? {
266
+ marks
267
+ } : {})
259
268
  };
260
269
  }
261
270
  break;
@@ -273,28 +282,16 @@ export const getValidNode = (originalNode, schema = defaultSchema, adfStage = 'f
273
282
  }
274
283
  case 'inlineCard':
275
284
  {
276
- if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
277
- let inlineCardNode = {
278
- type
285
+ if (attrs && (attrs.datasource && !attrs.url || attrs.url && isSafeUrl(attrs.url) || attrs.data && attrs.data.url && isSafeUrl(attrs.data.url))) {
286
+ return {
287
+ type,
288
+ attrs,
289
+ ...(getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') ? {
290
+ marks
291
+ } : {})
279
292
  };
280
- if (attrs && (attrs.datasource && !attrs.url || attrs.url && isSafeUrl(attrs.url) || attrs.data && attrs.data.url && isSafeUrl(attrs.data.url))) {
281
- inlineCardNode.attrs = {
282
- ...attrs
283
- };
284
- }
285
- if (marks) {
286
- inlineCardNode.marks = [...marks];
287
- }
288
- return inlineCardNode;
289
- } else {
290
- if (attrs && (attrs.datasource && !attrs.url || attrs.url && isSafeUrl(attrs.url) || attrs.data && attrs.data.url && isSafeUrl(attrs.data.url))) {
291
- return {
292
- type,
293
- attrs
294
- };
295
- }
296
- break;
297
293
  }
294
+ break;
298
295
  }
299
296
  case 'blockCard':
300
297
  {
@@ -500,7 +497,10 @@ export const getValidNode = (originalNode, schema = defaultSchema, adfStage = 'f
500
497
  id: mentionId,
501
498
  text: mentionText,
502
499
  accessLevel: ''
503
- }
500
+ },
501
+ ...(getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? {
502
+ marks
503
+ } : {})
504
504
  };
505
505
  if (mentionAccess) {
506
506
  mentionNode.attrs.accessLevel = mentionAccess;