@atlaskit/editor-common 102.0.0 → 102.1.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 (110) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/ai-messages/ai.js +5 -0
  3. package/dist/cjs/analytics/types/general-events.js +1 -1
  4. package/dist/cjs/collab/index.js +2 -0
  5. package/dist/cjs/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +26 -52
  6. package/dist/cjs/extensibility/MultiBodiedExtension/action-api.js +2 -0
  7. package/dist/cjs/insert/index.js +2 -0
  8. package/dist/cjs/keymaps/keymap.js +4 -2
  9. package/dist/cjs/lazy-node-view/index.js +1 -1
  10. package/dist/cjs/media-inline/inline-image-card.js +2 -0
  11. package/dist/cjs/messages/annotation.js +2 -0
  12. package/dist/cjs/messages/help-dialog.js +2 -0
  13. package/dist/cjs/monitoring/environment.js +2 -0
  14. package/dist/cjs/monitoring/error.js +3 -1
  15. package/dist/cjs/node-width/index.js +0 -1
  16. package/dist/cjs/quick-insert/assets/datasource-assets-objects.js +1 -1
  17. package/dist/cjs/quick-insert/assets/datasource-jira-issue.js +1 -1
  18. package/dist/cjs/quick-insert/assets/feedback.js +1 -1
  19. package/dist/cjs/quick-insert/assets/quote.js +1 -1
  20. package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +1 -1
  21. package/dist/cjs/react-node-view/index.js +1 -1
  22. package/dist/cjs/selection/gap-cursor/selection.js +1 -1
  23. package/dist/cjs/styles/shared/annotation.js +1 -1
  24. package/dist/cjs/ui/DropList/index.js +1 -1
  25. package/dist/cjs/ui/Layer/index.js +0 -1
  26. package/dist/cjs/ui-menu/ColorPickerButton/index.js +1 -1
  27. package/dist/cjs/ui-menu/ToolbarButton/styles.js +2 -0
  28. package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +13 -4
  29. package/dist/cjs/utils/calculate-toolbar-position.js +4 -0
  30. package/dist/cjs/utils/compareNodes.js +0 -1
  31. package/dist/cjs/utils/get-performance-options.js +0 -1
  32. package/dist/cjs/utils/is-text-input.js +0 -2
  33. package/dist/cjs/utils/table.js +2 -0
  34. package/dist/cjs/utils/validate-using-spec.js +2 -0
  35. package/dist/cjs/with-plugin-state/index.js +0 -1
  36. package/dist/es2019/ai-messages/ai.js +5 -0
  37. package/dist/es2019/analytics/types/general-events.js +1 -3
  38. package/dist/es2019/collab/index.js +2 -0
  39. package/dist/es2019/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +28 -54
  40. package/dist/es2019/extensibility/MultiBodiedExtension/action-api.js +2 -0
  41. package/dist/es2019/insert/index.js +2 -0
  42. package/dist/es2019/keymaps/keymap.js +4 -2
  43. package/dist/es2019/lazy-node-view/index.js +1 -1
  44. package/dist/es2019/media-inline/inline-image-card.js +2 -0
  45. package/dist/es2019/messages/annotation.js +2 -0
  46. package/dist/es2019/messages/help-dialog.js +2 -0
  47. package/dist/es2019/monitoring/environment.js +2 -0
  48. package/dist/es2019/monitoring/error.js +3 -1
  49. package/dist/es2019/node-width/index.js +0 -1
  50. package/dist/es2019/quick-insert/assets/datasource-assets-objects.js +1 -1
  51. package/dist/es2019/quick-insert/assets/datasource-jira-issue.js +1 -1
  52. package/dist/es2019/quick-insert/assets/feedback.js +1 -1
  53. package/dist/es2019/quick-insert/assets/quote.js +1 -1
  54. package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +1 -1
  55. package/dist/es2019/react-node-view/index.js +1 -1
  56. package/dist/es2019/selection/gap-cursor/selection.js +1 -1
  57. package/dist/es2019/styles/shared/annotation.js +1 -1
  58. package/dist/es2019/ui/DropList/index.js +1 -1
  59. package/dist/es2019/ui/Layer/index.js +0 -1
  60. package/dist/es2019/ui-menu/ColorPickerButton/index.js +1 -1
  61. package/dist/es2019/ui-menu/ToolbarButton/styles.js +2 -0
  62. package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +12 -3
  63. package/dist/es2019/utils/calculate-toolbar-position.js +4 -0
  64. package/dist/es2019/utils/compareNodes.js +0 -1
  65. package/dist/es2019/utils/get-performance-options.js +0 -1
  66. package/dist/es2019/utils/is-text-input.js +0 -2
  67. package/dist/es2019/utils/table.js +2 -0
  68. package/dist/es2019/utils/validate-using-spec.js +2 -0
  69. package/dist/es2019/with-plugin-state/index.js +0 -1
  70. package/dist/esm/ai-messages/ai.js +5 -0
  71. package/dist/esm/analytics/types/general-events.js +1 -3
  72. package/dist/esm/collab/index.js +2 -0
  73. package/dist/esm/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +27 -52
  74. package/dist/esm/extensibility/MultiBodiedExtension/action-api.js +2 -0
  75. package/dist/esm/insert/index.js +2 -0
  76. package/dist/esm/keymaps/keymap.js +4 -2
  77. package/dist/esm/lazy-node-view/index.js +1 -1
  78. package/dist/esm/media-inline/inline-image-card.js +2 -0
  79. package/dist/esm/messages/annotation.js +2 -0
  80. package/dist/esm/messages/help-dialog.js +2 -0
  81. package/dist/esm/monitoring/environment.js +2 -0
  82. package/dist/esm/monitoring/error.js +3 -1
  83. package/dist/esm/node-width/index.js +0 -1
  84. package/dist/esm/quick-insert/assets/datasource-assets-objects.js +1 -1
  85. package/dist/esm/quick-insert/assets/datasource-jira-issue.js +1 -1
  86. package/dist/esm/quick-insert/assets/feedback.js +1 -1
  87. package/dist/esm/quick-insert/assets/quote.js +1 -1
  88. package/dist/esm/react-node-view/getInlineNodeViewProducer.js +1 -1
  89. package/dist/esm/react-node-view/index.js +1 -1
  90. package/dist/esm/selection/gap-cursor/selection.js +1 -1
  91. package/dist/esm/styles/shared/annotation.js +1 -1
  92. package/dist/esm/ui/DropList/index.js +1 -1
  93. package/dist/esm/ui/Layer/index.js +0 -1
  94. package/dist/esm/ui-menu/ColorPickerButton/index.js +1 -1
  95. package/dist/esm/ui-menu/ToolbarButton/styles.js +2 -0
  96. package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +13 -4
  97. package/dist/esm/utils/calculate-toolbar-position.js +4 -0
  98. package/dist/esm/utils/compareNodes.js +0 -1
  99. package/dist/esm/utils/get-performance-options.js +0 -1
  100. package/dist/esm/utils/is-text-input.js +0 -2
  101. package/dist/esm/utils/table.js +2 -0
  102. package/dist/esm/utils/validate-using-spec.js +2 -0
  103. package/dist/esm/with-plugin-state/index.js +0 -1
  104. package/dist/types/ai-messages/ai.d.ts +5 -0
  105. package/dist/types/types/annotation/index.d.ts +0 -3
  106. package/dist/types/ui-react/with-react-editor-view-outer-listeners.d.ts +6 -0
  107. package/dist/types-ts4.5/ai-messages/ai.d.ts +5 -0
  108. package/dist/types-ts4.5/types/annotation/index.d.ts +0 -3
  109. package/dist/types-ts4.5/ui-react/with-react-editor-view-outer-listeners.d.ts +6 -0
  110. package/package.json +1 -4
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useEffect, useReducer, useRef } from 'react';
2
- import { fg } from '@atlaskit/platform-feature-flags';
2
+
3
3
  /**
4
4
  * a custom hook that handles keyboard navigation for Arrow keys based on a
5
5
  * given listSize, and a step (for up and down arrows).
@@ -81,29 +81,19 @@ const moveReducer = (state, action) => {
81
81
  selectedItemIndex: canFocusViewMore ? undefined : listSize
82
82
  };
83
83
  } else {
84
- if (fg('platform_editor_is_disabled_state_element_browser')) {
85
- var _action$payload$step;
86
- const newIndex = action.payload.positions ? action.payload.positions - ((_action$payload$step = action.payload.step) !== null && _action$payload$step !== void 0 ? _action$payload$step : 1) : 0;
87
- const safeIndex = ensureSafeIndex(newIndex, state.listSize);
88
- const isLastItemFocused = newIndex > listSize;
89
- const focusOnSearch = isLastItemFocused && !canFocusViewMore;
90
- const focusOnViewMore = isLastItemFocused && !!canFocusViewMore;
91
- return {
92
- ...state,
93
- focusOnSearch: focusOnSearch,
94
- focusOnViewMore: focusOnViewMore,
95
- focusedItemIndex: safeIndex,
96
- selectedItemIndex: safeIndex
97
- };
98
- } else {
99
- return {
100
- ...state,
101
- focusOnSearch: false,
102
- focusOnViewMore: false,
103
- focusedItemIndex: 0,
104
- selectedItemIndex: 0
105
- };
106
- }
84
+ var _action$payload$step;
85
+ const newIndex = action.payload.positions ? action.payload.positions - ((_action$payload$step = action.payload.step) !== null && _action$payload$step !== void 0 ? _action$payload$step : 1) : 0;
86
+ const safeIndex = ensureSafeIndex(newIndex, state.listSize);
87
+ const isLastItemFocused = newIndex > listSize;
88
+ const focusOnSearch = isLastItemFocused && !canFocusViewMore;
89
+ const focusOnViewMore = isLastItemFocused && !!canFocusViewMore;
90
+ return {
91
+ ...state,
92
+ focusOnSearch: focusOnSearch,
93
+ focusOnViewMore: focusOnViewMore,
94
+ focusedItemIndex: safeIndex,
95
+ selectedItemIndex: safeIndex
96
+ };
107
97
  }
108
98
  }
109
99
  if (state.focusOnViewMore) {
@@ -328,45 +318,29 @@ function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore, it
328
318
  return setFocusOnSearch();
329
319
  case 'ArrowRight':
330
320
  {
331
- if (fg('platform_editor_is_disabled_state_element_browser')) {
332
- var _skipForwardOffsetToS;
333
- const itemIndex = focusOnSearch ? -1 : selectedItemIndex;
334
- const nextItem = (_skipForwardOffsetToS = skipForwardOffsetToSafeItem(itemIndex, listSize, 1, itemIsDisabled)) !== null && _skipForwardOffsetToS !== void 0 ? _skipForwardOffsetToS : 1;
335
- return move(e, nextItem);
336
- } else {
337
- return move(e, +1);
338
- }
321
+ var _skipForwardOffsetToS;
322
+ const itemIndex = focusOnSearch ? -1 : selectedItemIndex;
323
+ const nextItem = (_skipForwardOffsetToS = skipForwardOffsetToSafeItem(itemIndex, listSize, 1, itemIsDisabled)) !== null && _skipForwardOffsetToS !== void 0 ? _skipForwardOffsetToS : 1;
324
+ return move(e, nextItem);
339
325
  }
340
326
  case 'ArrowLeft':
341
327
  {
342
- if (fg('platform_editor_is_disabled_state_element_browser')) {
343
- var _skipBackwardOffsetTo;
344
- const nextItem = (_skipBackwardOffsetTo = skipBackwardOffsetToSafeItem(selectedItemIndex, 1, itemIsDisabled)) !== null && _skipBackwardOffsetTo !== void 0 ? _skipBackwardOffsetTo : 1;
345
- return move(e, -nextItem);
346
- } else {
347
- return move(e, -1);
348
- }
328
+ var _skipBackwardOffsetTo;
329
+ const nextItem = (_skipBackwardOffsetTo = skipBackwardOffsetToSafeItem(selectedItemIndex, 1, itemIsDisabled)) !== null && _skipBackwardOffsetTo !== void 0 ? _skipBackwardOffsetTo : 1;
330
+ return move(e, -nextItem);
349
331
  }
350
332
  case 'ArrowDown':
351
333
  {
352
- if (fg('platform_editor_is_disabled_state_element_browser')) {
353
- var _skipForwardOffsetToS2;
354
- const itemIndex = focusOnSearch ? -step : selectedItemIndex;
355
- const nextItem = (_skipForwardOffsetToS2 = skipForwardOffsetToSafeItem(itemIndex, listSize, step, itemIsDisabled)) !== null && _skipForwardOffsetToS2 !== void 0 ? _skipForwardOffsetToS2 : step;
356
- return move(e, +nextItem, step);
357
- } else {
358
- return move(e, +step);
359
- }
334
+ var _skipForwardOffsetToS2;
335
+ const itemIndex = focusOnSearch ? -step : selectedItemIndex;
336
+ const nextItem = (_skipForwardOffsetToS2 = skipForwardOffsetToSafeItem(itemIndex, listSize, step, itemIsDisabled)) !== null && _skipForwardOffsetToS2 !== void 0 ? _skipForwardOffsetToS2 : step;
337
+ return move(e, +nextItem, step);
360
338
  }
361
339
  case 'ArrowUp':
362
340
  {
363
- if (fg('platform_editor_is_disabled_state_element_browser')) {
364
- var _skipBackwardOffsetTo2;
365
- const nextItem = (_skipBackwardOffsetTo2 = skipBackwardOffsetToSafeItem(selectedItemIndex, step, itemIsDisabled)) !== null && _skipBackwardOffsetTo2 !== void 0 ? _skipBackwardOffsetTo2 : step;
366
- return move(e, Math.min(-nextItem, -step), step);
367
- } else {
368
- return move(e, -step, step);
369
- }
341
+ var _skipBackwardOffsetTo2;
342
+ const nextItem = (_skipBackwardOffsetTo2 = skipBackwardOffsetToSafeItem(selectedItemIndex, step, itemIsDisabled)) !== null && _skipBackwardOffsetTo2 !== void 0 ? _skipBackwardOffsetTo2 : step;
343
+ return move(e, Math.min(-nextItem, -step), step);
370
344
  }
371
345
  }
372
346
  }, [focusOnSearch, setFocusOnSearch, move, selectedItemIndex, itemIsDisabled, listSize, step]);
@@ -73,6 +73,8 @@ export const useMultiBodiedExtensionActions = ({
73
73
  },
74
74
  removeChild(index) {
75
75
  const pos = getPos();
76
+ // Ignored via go/ees007
77
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
76
78
  // TODO: Add child index validation here, don't trust this data
77
79
  if (typeof pos !== 'number' || typeof index !== 'number') {
78
80
  throw new Error('Position or index not valid');
@@ -73,6 +73,8 @@ const insertBeforeOrAfter = (tr, lookDirection, $parentPos, $proposedPosition, c
73
73
  return tr.insert($proposedPosition[lookDirection](), content);
74
74
  };
75
75
 
76
+ // Ignored via go/ees007
77
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
76
78
  // FIXME: A more sustainable and configurable way to choose when to split
77
79
  // Ignored via go/ees005
78
80
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -34,9 +34,11 @@ export function keymap(bindings) {
34
34
  const isDeadKey = name === 'Dead';
35
35
  if (isModKeyPressed && (isNonLatinKey || isDeadKey)) {
36
36
  keyboardEvent = new KeyboardEvent(event.type, {
37
+ // Ignored via go/ees007
38
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
37
39
  // FIXME: The event.keyCode is deprecated (see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode),
38
- // and could be removed in any time, but the w3c-keyname library doesn't provide a way to get
39
- // a key by event.code.
40
+ // and could be removed in any time, but the w3c-keyname library doesn't provide a way to get
41
+ // a key by event.code.
40
42
  key: base[event.keyCode],
41
43
  code: event.code,
42
44
  ctrlKey: event.ctrlKey,
@@ -174,7 +174,7 @@ export const withLazyLoading = ({
174
174
  });
175
175
  requestedNodes.set(nodeName, loaderPromise);
176
176
  if (typeof ((_node$type = node.type) === null || _node$type === void 0 ? void 0 : (_node$type$spec = _node$type.spec) === null || _node$type$spec === void 0 ? void 0 : _node$type$spec.toDOM) !== 'function') {
177
- // TODO: Analytics ED-23982
177
+ // TODO: ED-23982 - Analytics
178
178
  // dispatchAnalyticsEvent({
179
179
  // action: ACTION.LAZY_NODE_VIEW_ERROR,
180
180
  // actionSubject: ACTION_SUBJECT.LAZY_NODE_VIEW,
@@ -25,6 +25,8 @@ export const InlineImageCard = ({
25
25
  traceId: getRandomHex(8)
26
26
  }), []);
27
27
 
28
+ // Ignored via go/ees007
29
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
28
30
  // TODO do we need to handle nonCriticalError
29
31
  const {
30
32
  preview,
@@ -5,6 +5,8 @@ export const annotationMessages = defineMessages({
5
5
  defaultMessage: 'Comment',
6
6
  description: 'Create/add an inline comment based on the users selection'
7
7
  },
8
+ // Ignored via go/ees007
9
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
8
10
  // TODO: Remove this message when the editor_inline_comments_on_inline_nodes FF is removed
9
11
  createCommentInvalid: {
10
12
  id: 'fabric.editor.createCommentInvalid',
@@ -85,6 +85,8 @@ export const helpDialogMessages = defineMessages({
85
85
  defaultMessage: 'Close help dialog',
86
86
  description: ''
87
87
  },
88
+ // Ignored via go/ees007
89
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
88
90
  // TODO: Move it inside quick insert plugin
89
91
  quickInsert: {
90
92
  id: 'fabric.editor.quickInsert',
@@ -3,6 +3,8 @@ const FEDRAMP_MODERATE = 'fedramp-moderate';
3
3
  // To determine whether an instance is a FedRAMP instance
4
4
  // Copied from platform/packages/uip/atl-context/src/services/is-fedramp/index.tsx
5
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
+ // Ignored via go/ees007
7
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
6
8
  // TODO: Seek alternatives
7
9
  export function isFedRamp() {
8
10
  var _global$location, _global$location$host;
@@ -1,9 +1,11 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "102.0.0";
4
+ const packageVersion = "102.1.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
+ // Ignored via go/ees007
8
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
7
9
  // TODO: Sanitise the URL instead of just removing it
8
10
  if (data.request) {
9
11
  delete data.request.url;
@@ -37,7 +37,6 @@ export const getParentNodeWidth = (pos, state, containerWidth, isFullWidthModeEn
37
37
  }
38
38
  let parentWidth = calcBreakoutNodeWidth(layout, containerWidth, isFullWidthModeEnabled);
39
39
 
40
- // TODO: ED-15663
41
40
  // Please, do not copy or use this kind of code below
42
41
  // @ts-ignore
43
42
  const contextPanelPluginKey = {
@@ -1,4 +1,4 @@
1
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
1
+ // TODO: DSP-4138 - migrate to @atlaskit/design-system
2
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
3
  import React from 'react';
4
4
  export default function IconDatasourceAssetsObjects() {
@@ -1,4 +1,4 @@
1
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
1
+ // TODO: DSP-4138 - Migrate to @atlaskit/design-system
2
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
3
  import React from 'react';
4
4
  export default function IconDatasourceJiraIssue() {
@@ -1,4 +1,4 @@
1
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
1
+ // TODO: DSP-4138 - Migrate to @atlaskit/design-system
2
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
3
  import React from 'react';
4
4
  export default function IconFeedback() {
@@ -1,4 +1,4 @@
1
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
1
+ // TODO: DSP-4138 - Migrate to @atlaskit/design-system
2
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
3
  import React from 'react';
4
4
  import { useIconThemed } from '../use-icon-themed';
@@ -270,7 +270,7 @@ function getPortalChildren({
270
270
  className: `${inlineNodeViewClassname}AddZeroWidthSpace`
271
271
  }), ZERO_WIDTH_SPACE), jsx(Component, _extends({
272
272
  view: nodeViewParams.view
273
- // TODO: ED-13910 - Remove the boolean to fix the prosemirror view type
273
+ // TODO: ED-13910 - Remove the boolean to fix the prosemirror view type
274
274
  // Ignored via go/ees005
275
275
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
276
276
  ,
@@ -194,7 +194,7 @@ export default class ReactNodeView {
194
194
 
195
195
  // View should not process a re-render if this is false.
196
196
  // We dont want to destroy the view, so we return true.
197
- // TODO: ED-13910 Fix viewShouldUpdate readonly decoration array
197
+ // TODO: ED-13910 - Fix viewShouldUpdate readonly decoration array
198
198
  if (!this.viewShouldUpdate(node, decorations)) {
199
199
  this.node = node;
200
200
  return true;
@@ -42,7 +42,7 @@ export class GapCursorSelection extends Selection {
42
42
  }
43
43
  let pos = $pos.pos;
44
44
 
45
- // TODO: Fix any, potential issue. ED-5048
45
+ // TODO: ED-5048 - Fix any, potential issue.
46
46
  // Ignored via go/ees005
47
47
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
48
  let next = null;
@@ -59,7 +59,7 @@ export const AnnotationSharedCSSByState = () => {
59
59
  // emotion and token look up
60
60
  background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
61
61
  borderBottom: `2px solid ${"var(--ds-border-accent-yellow, #B38600)"}`,
62
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4147
62
+ // TODO: DSP-4147 - Annotation shadow
63
63
  boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)",
64
64
  cursor: 'pointer'
65
65
  }),
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "102.0.0";
16
+ const packageVersion = "102.1.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -14,7 +14,6 @@ const defaultState = {
14
14
  position: null
15
15
  }
16
16
  },
17
- // fix Safari parent width: https://product-fabric.atlassian.net/browse/ED-1784
18
17
  cssPosition: 'absolute',
19
18
  originalHeight: null,
20
19
  maxHeight: null
@@ -50,7 +50,7 @@ const colorPickerButtonStyle = css({
50
50
  });
51
51
 
52
52
  // Control the size of color picker buttons and preview
53
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4134
53
+ // TODO: DSP-4134 - Color picking UI
54
54
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
55
55
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
56
56
  const colorPickerWrapper = () => css({
@@ -9,6 +9,8 @@ export default /*#__PURE__*/React.forwardRef((props, ref) => {
9
9
  // Ignored via go/ees005
10
10
  // eslint-disable-next-line react/jsx-props-no-spreading
11
11
  }, props, {
12
+ // Ignored via go/ees007
13
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
12
14
  // TODO: (from codemod) Buttons with "component", "css" or "style" prop can't be automatically migrated with codemods. Please migrate it manually.
13
15
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
14
16
  style: {
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React, { PureComponent, useCallback, useEffect, useRef, useState } from 'react';
3
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
4
  import ReactEditorViewContext from './ReactEditorViewContext';
4
5
  // Use this context to pass in the reference of the element that should be considered as the outside click target
5
6
  // The outside click target is the element that should be clicked outside of to trigger the `handleClickOutside` event
@@ -48,9 +49,12 @@ class WithOutsideClick extends PureComponent {
48
49
  }
49
50
  componentDidMount() {
50
51
  if (this.props.handleClickOutside) {
52
+ const options = this.props.captureClick && editorExperiment('platform_editor_controls', 'variant1') ? {
53
+ capture: true
54
+ } : false;
51
55
  // Ignored via go/ees005
52
56
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
53
- document.addEventListener('click', this.handleClick, false);
57
+ document.addEventListener('click', this.handleClick, options);
54
58
  }
55
59
  if (this.props.handleEscapeKeydown) {
56
60
  var _this$props$editorRef;
@@ -66,9 +70,12 @@ class WithOutsideClick extends PureComponent {
66
70
  }
67
71
  componentWillUnmount() {
68
72
  if (this.props.handleClickOutside) {
73
+ const options = this.props.captureClick && editorExperiment('platform_editor_controls', 'variant1') ? {
74
+ capture: true
75
+ } : false;
69
76
  // Ignored via go/ees005
70
77
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
71
- document.removeEventListener('click', this.handleClick, false);
78
+ document.removeEventListener('click', this.handleClick, options);
72
79
  }
73
80
  if (this.props.handleEscapeKeydown) {
74
81
  var _this$props$editorRef2;
@@ -96,6 +103,7 @@ export default function withReactEditorViewOuterListeners(Component) {
96
103
  handleEnterKeydown,
97
104
  handleEscapeKeydown,
98
105
  closeOnTab,
106
+ captureClick,
99
107
  ...props
100
108
  }) => {
101
109
  const isActiveProp = hasIsOpen(props) ? props.isOpen : true;
@@ -125,7 +133,8 @@ export default function withReactEditorViewOuterListeners(Component) {
125
133
  handleClickOutside: handleClickOutside,
126
134
  handleEnterKeydown: handleEnterKeydown,
127
135
  handleEscapeKeydown: handleEscapeKeydown,
128
- closeOnTab: closeOnTab
136
+ closeOnTab: closeOnTab,
137
+ captureClick: captureClick
129
138
  }, /*#__PURE__*/React.createElement(Component
130
139
  // Ignored via go/ees005
131
140
  // eslint-disable-next-line react/jsx-props-no-spreading
@@ -17,6 +17,8 @@ export const calculateToolbarPositionAboveSelection = toolbarTitle => (editorVie
17
17
  return nextPos;
18
18
  }
19
19
  // scroll wrapper for full page, fall back to document body
20
+ // Ignored via go/ees007
21
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
20
22
  // TODO: look into using getScrollGutterOptions()
21
23
  const scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
22
24
  const wrapperBounds = scrollWrapper.getBoundingClientRect();
@@ -91,6 +93,8 @@ export const calculateToolbarPositionTrackHead = toolbarTitle => (editorView, ne
91
93
  return nextPos;
92
94
  }
93
95
  // scroll wrapper for full page, fall back to document body
96
+ // Ignored via go/ees007
97
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
94
98
  // TODO: look into using getScrollGutterOptions()
95
99
  const scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
96
100
  const wrapperBounds = scrollWrapper.getBoundingClientRect();
@@ -152,7 +152,6 @@ function getMetaFromNode(node, options, normalizeTextParser) {
152
152
  }
153
153
  case 'mention':
154
154
  {
155
- // TODO: Check what should be the fallback when mention does not have a text
156
155
  const text = firstChild.attrs.text || '';
157
156
  return {
158
157
  type: ContentType.MENTION,
@@ -8,7 +8,6 @@ const DEFAULT_SAMPLING_RATE = 100;
8
8
  const DEFAULT_SLOW_THRESHOLD = 7;
9
9
  export function getPerformanceOptions(view) {
10
10
  var _nodeViewTracking$sam, _nodeViewTracking$slo;
11
- // TODO: ED-15663
12
11
  // Please, do not copy or use this kind of code below
13
12
  // @ts-ignore
14
13
  const fakePluginKey = {
@@ -1,5 +1,3 @@
1
- // TODO: remove from editor-core utils, re-export from editor-common
2
-
3
1
  import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
4
2
  export const isTextInput = tr => {
5
3
  const [step] = tr.steps;
@@ -33,6 +33,8 @@ export function getColumnWidths(node) {
33
33
  return tableColumnWidths;
34
34
  }
35
35
  export function calcTableColumnWidths(node) {
36
+ // Ignored via go/ees007
37
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
36
38
  // TODO: replaced with getColumnWidths, which correctly scans entire table for column widths
37
39
  if (fg('platform_editor_table_row_span_fix')) {
38
40
  const firstRow = node.firstChild;
@@ -42,6 +42,8 @@ export const validationErrorHandler = (entity, error, options, marks, validate,
42
42
  };
43
43
  }
44
44
 
45
+ // Ignored via go/ees007
46
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
45
47
  // TODO: We can repair missing content like `panel` without a `paragraph`.
46
48
  if (error.code === 'INVALID_CONTENT_LENGTH') {
47
49
  if (error.meta && options.allowUnsupportedBlock && entity.content) {
@@ -181,7 +181,6 @@ export class WithPluginStateInner extends React.Component {
181
181
  return;
182
182
  }
183
183
 
184
- // TODO: ED-15663
185
184
  // Please, do not copy or use this kind of code below
186
185
  // @ts-ignore
187
186
  const fakePluginKey = {
@@ -6,6 +6,11 @@ export var aiMessages = defineMessages({
6
6
  defaultMessage: 'Page title',
7
7
  description: 'A fallback suggested title for the suggest title prompt'
8
8
  },
9
+ eventHubfallbackSuggestedTitlePrefix: {
10
+ id: 'fabric.editor.ai.eventHub.fallbackSuggestedTitlePrefix',
11
+ defaultMessage: 'Page',
12
+ description: 'A fallback suggested title prefix for the suggest title prompt'
13
+ },
9
14
  // Toolbar messages
10
15
  aiToolbarTitle: {
11
16
  id: 'fabric.editor.ai.toolbar.titleText',
@@ -20,6 +20,4 @@ export var BROWSER_FREEZE_INTERACTION_TYPE = /*#__PURE__*/function (BROWSER_FREE
20
20
  BROWSER_FREEZE_INTERACTION_TYPE["CLICKING"] = "clicking";
21
21
  BROWSER_FREEZE_INTERACTION_TYPE["PASTING"] = "pasting";
22
22
  return BROWSER_FREEZE_INTERACTION_TYPE;
23
- }({});
24
-
25
- // TODO: https://product-fabric.atlassian.net/browse/AFP-1418
23
+ }({});
@@ -119,6 +119,8 @@ export var PROVIDER_ERROR_CODE = /*#__PURE__*/function (PROVIDER_ERROR_CODE) {
119
119
 
120
120
  // Collab Provider interface
121
121
 
122
+ // Ignored via go/ees007
123
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
122
124
  // TODO: Deprecate redundant payload types
123
125
 
124
126
  export var DisconnectReason = /*#__PURE__*/function (DisconnectReason) {
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import { useCallback, useEffect, useReducer, useRef } from 'react';
6
- import { fg } from '@atlaskit/platform-feature-flags';
6
+
7
7
  /**
8
8
  * a custom hook that handles keyboard navigation for Arrow keys based on a
9
9
  * given listSize, and a step (for up and down arrows).
@@ -78,27 +78,18 @@ var moveReducer = function moveReducer(state, action) {
78
78
  selectedItemIndex: canFocusViewMore ? undefined : listSize
79
79
  });
80
80
  } else {
81
- if (fg('platform_editor_is_disabled_state_element_browser')) {
82
- var _action$payload$step;
83
- var _newIndex = action.payload.positions ? action.payload.positions - ((_action$payload$step = action.payload.step) !== null && _action$payload$step !== void 0 ? _action$payload$step : 1) : 0;
84
- var _safeIndex = ensureSafeIndex(_newIndex, state.listSize);
85
- var isLastItemFocused = _newIndex > listSize;
86
- var focusOnSearch = isLastItemFocused && !canFocusViewMore;
87
- var focusOnViewMore = isLastItemFocused && !!canFocusViewMore;
88
- return _objectSpread(_objectSpread({}, state), {}, {
89
- focusOnSearch: focusOnSearch,
90
- focusOnViewMore: focusOnViewMore,
91
- focusedItemIndex: _safeIndex,
92
- selectedItemIndex: _safeIndex
93
- });
94
- } else {
95
- return _objectSpread(_objectSpread({}, state), {}, {
96
- focusOnSearch: false,
97
- focusOnViewMore: false,
98
- focusedItemIndex: 0,
99
- selectedItemIndex: 0
100
- });
101
- }
81
+ var _action$payload$step;
82
+ var _newIndex = action.payload.positions ? action.payload.positions - ((_action$payload$step = action.payload.step) !== null && _action$payload$step !== void 0 ? _action$payload$step : 1) : 0;
83
+ var _safeIndex = ensureSafeIndex(_newIndex, state.listSize);
84
+ var isLastItemFocused = _newIndex > listSize;
85
+ var focusOnSearch = isLastItemFocused && !canFocusViewMore;
86
+ var focusOnViewMore = isLastItemFocused && !!canFocusViewMore;
87
+ return _objectSpread(_objectSpread({}, state), {}, {
88
+ focusOnSearch: focusOnSearch,
89
+ focusOnViewMore: focusOnViewMore,
90
+ focusedItemIndex: _safeIndex,
91
+ selectedItemIndex: _safeIndex
92
+ });
102
93
  }
103
94
  }
104
95
  if (state.focusOnViewMore) {
@@ -321,45 +312,29 @@ function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore, it
321
312
  return setFocusOnSearch();
322
313
  case 'ArrowRight':
323
314
  {
324
- if (fg('platform_editor_is_disabled_state_element_browser')) {
325
- var _skipForwardOffsetToS;
326
- var itemIndex = focusOnSearch ? -1 : selectedItemIndex;
327
- var nextItem = (_skipForwardOffsetToS = skipForwardOffsetToSafeItem(itemIndex, listSize, 1, itemIsDisabled)) !== null && _skipForwardOffsetToS !== void 0 ? _skipForwardOffsetToS : 1;
328
- return move(e, nextItem);
329
- } else {
330
- return move(e, +1);
331
- }
315
+ var _skipForwardOffsetToS;
316
+ var itemIndex = focusOnSearch ? -1 : selectedItemIndex;
317
+ var nextItem = (_skipForwardOffsetToS = skipForwardOffsetToSafeItem(itemIndex, listSize, 1, itemIsDisabled)) !== null && _skipForwardOffsetToS !== void 0 ? _skipForwardOffsetToS : 1;
318
+ return move(e, nextItem);
332
319
  }
333
320
  case 'ArrowLeft':
334
321
  {
335
- if (fg('platform_editor_is_disabled_state_element_browser')) {
336
- var _skipBackwardOffsetTo;
337
- var _nextItem = (_skipBackwardOffsetTo = skipBackwardOffsetToSafeItem(selectedItemIndex, 1, itemIsDisabled)) !== null && _skipBackwardOffsetTo !== void 0 ? _skipBackwardOffsetTo : 1;
338
- return move(e, -_nextItem);
339
- } else {
340
- return move(e, -1);
341
- }
322
+ var _skipBackwardOffsetTo;
323
+ var _nextItem = (_skipBackwardOffsetTo = skipBackwardOffsetToSafeItem(selectedItemIndex, 1, itemIsDisabled)) !== null && _skipBackwardOffsetTo !== void 0 ? _skipBackwardOffsetTo : 1;
324
+ return move(e, -_nextItem);
342
325
  }
343
326
  case 'ArrowDown':
344
327
  {
345
- if (fg('platform_editor_is_disabled_state_element_browser')) {
346
- var _skipForwardOffsetToS2;
347
- var _itemIndex = focusOnSearch ? -step : selectedItemIndex;
348
- var _nextItem2 = (_skipForwardOffsetToS2 = skipForwardOffsetToSafeItem(_itemIndex, listSize, step, itemIsDisabled)) !== null && _skipForwardOffsetToS2 !== void 0 ? _skipForwardOffsetToS2 : step;
349
- return move(e, +_nextItem2, step);
350
- } else {
351
- return move(e, +step);
352
- }
328
+ var _skipForwardOffsetToS2;
329
+ var _itemIndex = focusOnSearch ? -step : selectedItemIndex;
330
+ var _nextItem2 = (_skipForwardOffsetToS2 = skipForwardOffsetToSafeItem(_itemIndex, listSize, step, itemIsDisabled)) !== null && _skipForwardOffsetToS2 !== void 0 ? _skipForwardOffsetToS2 : step;
331
+ return move(e, +_nextItem2, step);
353
332
  }
354
333
  case 'ArrowUp':
355
334
  {
356
- if (fg('platform_editor_is_disabled_state_element_browser')) {
357
- var _skipBackwardOffsetTo2;
358
- var _nextItem3 = (_skipBackwardOffsetTo2 = skipBackwardOffsetToSafeItem(selectedItemIndex, step, itemIsDisabled)) !== null && _skipBackwardOffsetTo2 !== void 0 ? _skipBackwardOffsetTo2 : step;
359
- return move(e, Math.min(-_nextItem3, -step), step);
360
- } else {
361
- return move(e, -step, step);
362
- }
335
+ var _skipBackwardOffsetTo2;
336
+ var _nextItem3 = (_skipBackwardOffsetTo2 = skipBackwardOffsetToSafeItem(selectedItemIndex, step, itemIsDisabled)) !== null && _skipBackwardOffsetTo2 !== void 0 ? _skipBackwardOffsetTo2 : step;
337
+ return move(e, Math.min(-_nextItem3, -step), step);
363
338
  }
364
339
  }
365
340
  }, [focusOnSearch, setFocusOnSearch, move, selectedItemIndex, itemIsDisabled, listSize, step]);
@@ -71,6 +71,8 @@ export var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActi
71
71
  },
72
72
  removeChild: function removeChild(index) {
73
73
  var pos = getPos();
74
+ // Ignored via go/ees007
75
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
74
76
  // TODO: Add child index validation here, don't trust this data
75
77
  if (typeof pos !== 'number' || typeof index !== 'number') {
76
78
  throw new Error('Position or index not valid');
@@ -72,6 +72,8 @@ var insertBeforeOrAfter = function insertBeforeOrAfter(tr, lookDirection, $paren
72
72
  return tr.insert($proposedPosition[lookDirection](), content);
73
73
  };
74
74
 
75
+ // Ignored via go/ees007
76
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
75
77
  // FIXME: A more sustainable and configurable way to choose when to split
76
78
  // Ignored via go/ees005
77
79
  // eslint-disable-next-line @typescript-eslint/no-explicit-any