@atlaskit/editor-common 101.1.2 → 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 (125) hide show
  1. package/CHANGELOG.md +25 -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/selection/utils.js +2 -2
  24. package/dist/cjs/styles/shared/annotation.js +1 -1
  25. package/dist/cjs/ugc-tokens/index.js +13 -0
  26. package/dist/cjs/ui/DropList/index.js +1 -1
  27. package/dist/cjs/ui/Layer/index.js +0 -1
  28. package/dist/cjs/ui-menu/ColorPickerButton/index.js +1 -1
  29. package/dist/cjs/ui-menu/ToolbarButton/styles.js +2 -0
  30. package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +13 -4
  31. package/dist/cjs/utils/calculate-toolbar-position.js +4 -0
  32. package/dist/cjs/utils/compareNodes.js +0 -1
  33. package/dist/cjs/utils/get-performance-options.js +0 -1
  34. package/dist/cjs/utils/is-text-input.js +0 -2
  35. package/dist/cjs/utils/table.js +2 -0
  36. package/dist/cjs/utils/validate-using-spec.js +2 -0
  37. package/dist/cjs/with-plugin-state/index.js +4 -270
  38. package/dist/es2019/ai-messages/ai.js +5 -0
  39. package/dist/es2019/analytics/types/general-events.js +1 -3
  40. package/dist/es2019/collab/index.js +2 -0
  41. package/dist/es2019/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +28 -54
  42. package/dist/es2019/extensibility/MultiBodiedExtension/action-api.js +2 -0
  43. package/dist/es2019/insert/index.js +2 -0
  44. package/dist/es2019/keymaps/keymap.js +4 -2
  45. package/dist/es2019/lazy-node-view/index.js +1 -1
  46. package/dist/es2019/media-inline/inline-image-card.js +2 -0
  47. package/dist/es2019/messages/annotation.js +2 -0
  48. package/dist/es2019/messages/help-dialog.js +2 -0
  49. package/dist/es2019/monitoring/environment.js +2 -0
  50. package/dist/es2019/monitoring/error.js +3 -1
  51. package/dist/es2019/node-width/index.js +0 -1
  52. package/dist/es2019/quick-insert/assets/datasource-assets-objects.js +1 -1
  53. package/dist/es2019/quick-insert/assets/datasource-jira-issue.js +1 -1
  54. package/dist/es2019/quick-insert/assets/feedback.js +1 -1
  55. package/dist/es2019/quick-insert/assets/quote.js +1 -1
  56. package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +1 -1
  57. package/dist/es2019/react-node-view/index.js +1 -1
  58. package/dist/es2019/selection/gap-cursor/selection.js +1 -1
  59. package/dist/es2019/selection/utils.js +2 -2
  60. package/dist/es2019/styles/shared/annotation.js +1 -1
  61. package/dist/es2019/ugc-tokens/index.js +3 -0
  62. package/dist/es2019/ui/DropList/index.js +1 -1
  63. package/dist/es2019/ui/Layer/index.js +0 -1
  64. package/dist/es2019/ui-menu/ColorPickerButton/index.js +1 -1
  65. package/dist/es2019/ui-menu/ToolbarButton/styles.js +2 -0
  66. package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +12 -3
  67. package/dist/es2019/utils/calculate-toolbar-position.js +4 -0
  68. package/dist/es2019/utils/compareNodes.js +0 -1
  69. package/dist/es2019/utils/get-performance-options.js +0 -1
  70. package/dist/es2019/utils/is-text-input.js +0 -2
  71. package/dist/es2019/utils/table.js +2 -0
  72. package/dist/es2019/utils/validate-using-spec.js +2 -0
  73. package/dist/es2019/with-plugin-state/index.js +2 -241
  74. package/dist/esm/ai-messages/ai.js +5 -0
  75. package/dist/esm/analytics/types/general-events.js +1 -3
  76. package/dist/esm/collab/index.js +2 -0
  77. package/dist/esm/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +27 -52
  78. package/dist/esm/extensibility/MultiBodiedExtension/action-api.js +2 -0
  79. package/dist/esm/insert/index.js +2 -0
  80. package/dist/esm/keymaps/keymap.js +4 -2
  81. package/dist/esm/lazy-node-view/index.js +1 -1
  82. package/dist/esm/media-inline/inline-image-card.js +2 -0
  83. package/dist/esm/messages/annotation.js +2 -0
  84. package/dist/esm/messages/help-dialog.js +2 -0
  85. package/dist/esm/monitoring/environment.js +2 -0
  86. package/dist/esm/monitoring/error.js +3 -1
  87. package/dist/esm/node-width/index.js +0 -1
  88. package/dist/esm/quick-insert/assets/datasource-assets-objects.js +1 -1
  89. package/dist/esm/quick-insert/assets/datasource-jira-issue.js +1 -1
  90. package/dist/esm/quick-insert/assets/feedback.js +1 -1
  91. package/dist/esm/quick-insert/assets/quote.js +1 -1
  92. package/dist/esm/react-node-view/getInlineNodeViewProducer.js +1 -1
  93. package/dist/esm/react-node-view/index.js +1 -1
  94. package/dist/esm/selection/gap-cursor/selection.js +1 -1
  95. package/dist/esm/selection/utils.js +2 -2
  96. package/dist/esm/styles/shared/annotation.js +1 -1
  97. package/dist/esm/ugc-tokens/index.js +3 -0
  98. package/dist/esm/ui/DropList/index.js +1 -1
  99. package/dist/esm/ui/Layer/index.js +0 -1
  100. package/dist/esm/ui-menu/ColorPickerButton/index.js +1 -1
  101. package/dist/esm/ui-menu/ToolbarButton/styles.js +2 -0
  102. package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +13 -4
  103. package/dist/esm/utils/calculate-toolbar-position.js +4 -0
  104. package/dist/esm/utils/compareNodes.js +0 -1
  105. package/dist/esm/utils/get-performance-options.js +0 -1
  106. package/dist/esm/utils/is-text-input.js +0 -2
  107. package/dist/esm/utils/table.js +2 -0
  108. package/dist/esm/utils/validate-using-spec.js +2 -0
  109. package/dist/esm/with-plugin-state/index.js +2 -270
  110. package/dist/types/ai-messages/ai.d.ts +5 -0
  111. package/dist/types/analytics/types/ai-unified-events.d.ts +13 -6
  112. package/dist/types/selection/utils.d.ts +3 -4
  113. package/dist/types/types/annotation/index.d.ts +0 -3
  114. package/dist/types/ugc-tokens/index.d.ts +2 -0
  115. package/dist/types/ui-react/with-react-editor-view-outer-listeners.d.ts +6 -0
  116. package/dist/types/with-plugin-state/index.d.ts +0 -42
  117. package/dist/types-ts4.5/ai-messages/ai.d.ts +5 -0
  118. package/dist/types-ts4.5/analytics/types/ai-unified-events.d.ts +13 -6
  119. package/dist/types-ts4.5/selection/utils.d.ts +3 -4
  120. package/dist/types-ts4.5/types/annotation/index.d.ts +0 -3
  121. package/dist/types-ts4.5/ugc-tokens/index.d.ts +2 -0
  122. package/dist/types-ts4.5/ui-react/with-react-editor-view-outer-listeners.d.ts +6 -0
  123. package/dist/types-ts4.5/with-plugin-state/index.d.ts +0 -42
  124. package/package.json +8 -10
  125. package/ugc-tokens/package.json +17 -0
@@ -0,0 +1,3 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ import editorUGCToken from './get-editor-ugc-token';
3
+ export { editorUGCToken };
@@ -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 = "101.1.2";
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) {
@@ -1,8 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import React from 'react';
4
- import PropTypes from 'prop-types';
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
4
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
7
5
  import { createDispatch } from '../event-dispatcher';
8
6
  import { startMeasure, stopMeasure } from '../performance-measures';
@@ -59,17 +57,12 @@ class WithPluginState extends React.Component {
59
57
  super(props);
60
58
  }
61
59
  render() {
62
- if (fg('platform_editor_react18_phase2_v2')) {
63
- // Ignored via go/ees005
64
- // eslint-disable-next-line react/jsx-props-no-spreading
65
- return /*#__PURE__*/React.createElement(WithPluginStateNew, this.props);
66
- }
67
60
  // Ignored via go/ees005
68
61
  // eslint-disable-next-line react/jsx-props-no-spreading
69
- return /*#__PURE__*/React.createElement(WithPluginStateOld, this.props);
62
+ return /*#__PURE__*/React.createElement(WithPluginStateEditionActionsWrapper, this.props);
70
63
  }
71
64
  }
72
- function WithPluginStateNew(props) {
65
+ function WithPluginStateEditionActionsWrapper(props) {
73
66
  const context = React.useContext(EditorContext);
74
67
  return /*#__PURE__*/React.createElement(WithPluginStateInner
75
68
  // Ignored via go/ees005
@@ -188,7 +181,6 @@ export class WithPluginStateInner extends React.Component {
188
181
  return;
189
182
  }
190
183
 
191
- // TODO: ED-15663
192
184
  // Please, do not copy or use this kind of code below
193
185
  // @ts-ignore
194
186
  const fakePluginKey = {
@@ -299,236 +291,5 @@ export class WithPluginStateInner extends React.Component {
299
291
  return render(this.state);
300
292
  }
301
293
  }
302
-
303
- // Ignored via go/ees005
304
- // eslint-disable-next-line @repo/internal/react/no-class-components
305
294
  _defineProperty(WithPluginStateInner, "displayName", 'WithPluginState');
306
- export class WithPluginStateOld extends React.Component {
307
- constructor(props, context) {
308
- super(props, context);
309
- _defineProperty(this, "listeners", {});
310
- _defineProperty(this, "debounce", null);
311
- _defineProperty(this, "notAppliedState", {});
312
- _defineProperty(this, "isSubscribed", false);
313
- _defineProperty(this, "callsCount", 0);
314
- _defineProperty(this, "handlePluginStateChange", (propName, pluginName, performanceOptions, skipEqualityCheck) =>
315
- // Ignored via go/ees005
316
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
317
- pluginState => {
318
- // skipEqualityCheck is being used for old plugins since they are mutating plugin state instead of creating a new one
319
- // Ignored via go/ees005
320
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
321
- if (this.state[propName] !== pluginState || skipEqualityCheck) {
322
- this.updateState({
323
- stateSubset: {
324
- [propName]: pluginState
325
- },
326
- pluginName,
327
- performanceOptions
328
- });
329
- }
330
- });
331
- /**
332
- * Debounces setState calls in order to reduce number of re-renders caused by several plugin state changes.
333
- */
334
- _defineProperty(this, "updateState", ({
335
- stateSubset,
336
- pluginName,
337
- performanceOptions
338
- }) => {
339
- this.notAppliedState = {
340
- ...this.notAppliedState,
341
- ...stateSubset
342
- };
343
- if (this.debounce) {
344
- window.clearTimeout(this.debounce);
345
- }
346
- const debounce = this.props.debounce !== false ? fn => window.setTimeout(fn, 0) : fn => fn();
347
- this.debounce = debounce(() => {
348
- const measure = `🦉${pluginName}::WithPluginState`;
349
- performanceOptions.trackingEnabled && startMeasure(measure);
350
- this.setState(this.notAppliedState, () => {
351
- performanceOptions.trackingEnabled && stopMeasure(measure, duration => {
352
- // Each WithPluginState component will fire analytics event no more than once every `samplingLimit` times
353
- if (++this.callsCount % performanceOptions.samplingRate === 0 && duration > performanceOptions.slowThreshold) {
354
- this.dispatchAnalyticsEvent({
355
- action: ACTION.WITH_PLUGIN_STATE_CALLED,
356
- actionSubject: ACTION_SUBJECT.EDITOR,
357
- eventType: EVENT_TYPE.OPERATIONAL,
358
- attributes: {
359
- plugin: pluginName,
360
- duration
361
- }
362
- });
363
- }
364
- });
365
- });
366
- this.debounce = null;
367
- this.notAppliedState = {};
368
- });
369
- });
370
- _defineProperty(this, "dispatchAnalyticsEvent", payload => {
371
- const eventDispatcher = this.getEventDispatcher();
372
- if (eventDispatcher) {
373
- const dispatch = createDispatch(eventDispatcher);
374
- dispatch(analyticsEventKey, {
375
- payload
376
- });
377
- }
378
- });
379
- _defineProperty(this, "onContextUpdate", () => {
380
- this.subscribe(this.props);
381
- });
382
- this.state = this.getPluginsStates(this.props.plugins, this.getEditorView(props, context));
383
- }
384
- getEditorView(maybeProps, maybeContext) {
385
- const props = maybeProps || this.props;
386
- const context = maybeContext || this.context;
387
- return props.editorView || context && context.editorActions && context.editorActions._privateGetEditorView() || context && context.editorSharedConfig && context.editorSharedConfig.editorView;
388
- }
389
- getEventDispatcher(maybeProps) {
390
- const props = maybeProps || this.props;
391
- return props.eventDispatcher || this.context && this.context.editorActions && this.context.editorActions._privateGetEventDispatcher() || this.context && this.context.editorSharedConfig && this.context.editorSharedConfig.eventDispatcher;
392
- }
393
- getPluginsStates(plugins, editorView) {
394
- if (!editorView || !plugins) {
395
- return {};
396
- }
397
- const keys = Object.keys(plugins);
398
- return keys.reduce((acc, propName) => {
399
- const pluginKey = plugins[propName];
400
- if (!pluginKey) {
401
- return acc;
402
- }
403
- acc[propName] = pluginKey.getState(editorView.state);
404
- return acc;
405
- }, {});
406
- }
407
- subscribe(props) {
408
- var _uiTracking$samplingR2, _uiTracking$slowThres2;
409
- const plugins = props.plugins;
410
- const eventDispatcher = this.getEventDispatcher(props);
411
- const editorView = this.getEditorView(props);
412
- if (!eventDispatcher || !editorView || this.isSubscribed) {
413
- return;
414
- }
415
-
416
- // TODO: ED-15663
417
- // Please, do not copy or use this kind of code below
418
- // @ts-ignore
419
- const fakePluginKey = {
420
- key: 'analyticsPlugin$',
421
- getState: state => {
422
- // Ignored via go/ees005
423
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
424
- return state['analyticsPlugin$'];
425
- }
426
- };
427
- const analyticsPlugin = fakePluginKey.getState(editorView.state);
428
- const uiTracking = analyticsPlugin && analyticsPlugin.performanceTracking ? analyticsPlugin.performanceTracking.uiTracking || {} : {};
429
- const trackingEnabled = uiTracking.enabled === true;
430
- const samplingRate = (_uiTracking$samplingR2 = uiTracking.samplingRate) !== null && _uiTracking$samplingR2 !== void 0 ? _uiTracking$samplingR2 : DEFAULT_SAMPLING_RATE;
431
- const slowThreshold = (_uiTracking$slowThres2 = uiTracking.slowThreshold) !== null && _uiTracking$slowThres2 !== void 0 ? _uiTracking$slowThres2 : DEFAULT_SLOW_THRESHOLD;
432
- this.isSubscribed = true;
433
- const pluginsStates = this.getPluginsStates(plugins, editorView);
434
- this.setState(pluginsStates);
435
- Object.keys(plugins).forEach(propName => {
436
- const pluginKey = plugins[propName];
437
- if (!pluginKey) {
438
- return;
439
- }
440
-
441
- // Ignored via go/ees005
442
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
443
- const pluginName = pluginKey.key;
444
- // Ignored via go/ees005
445
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
446
- const pluginState = pluginsStates[propName];
447
- const isPluginWithSubscribe = pluginState && pluginState.subscribe;
448
- const handler = this.handlePluginStateChange(propName, pluginName, {
449
- samplingRate,
450
- slowThreshold,
451
- trackingEnabled
452
- }, isPluginWithSubscribe);
453
- if (isPluginWithSubscribe) {
454
- pluginState.subscribe(handler);
455
- } else {
456
- // Ignored via go/ees005
457
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
458
- eventDispatcher.on(pluginKey.key, handler);
459
- }
460
-
461
- // Ignored via go/ees005
462
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
463
- // Ignored via go/ees005
464
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
465
- this.listeners[pluginKey.key] = {
466
- handler,
467
- pluginKey
468
- };
469
- });
470
- }
471
- unsubscribe() {
472
- const eventDispatcher = this.getEventDispatcher();
473
- const editorView = this.getEditorView();
474
- if (!eventDispatcher || !editorView || !this.isSubscribed) {
475
- return;
476
- }
477
- Object.keys(this.listeners).forEach(key => {
478
- // Ignored via go/ees005
479
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
480
- const pluginState = this.listeners[key].pluginKey.getState(editorView.state);
481
- if (pluginState && pluginState.unsubscribe) {
482
- // Ignored via go/ees005
483
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
484
- pluginState.unsubscribe(this.listeners[key].handler);
485
- } else {
486
- // Ignored via go/ees005
487
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
488
- eventDispatcher.off(key, this.listeners[key].handler);
489
- }
490
- });
491
- this.listeners = [];
492
- }
493
- subscribeToContextUpdates(context) {
494
- if (context && context.editorActions) {
495
- context.editorActions._privateSubscribe(this.onContextUpdate);
496
- }
497
- }
498
- unsubscribeFromContextUpdates(context) {
499
- if (context && context.editorActions) {
500
- context.editorActions._privateUnsubscribe(this.onContextUpdate);
501
- }
502
- }
503
- componentDidMount() {
504
- this.subscribe(this.props);
505
- this.subscribeToContextUpdates(this.context);
506
- }
507
-
508
- // Ignored via go/ees005
509
- // eslint-disable-next-line react/no-unsafe
510
- UNSAFE_componentWillReceiveProps(nextProps) {
511
- if (!this.isSubscribed) {
512
- this.subscribe(nextProps);
513
- }
514
- }
515
- componentWillUnmount() {
516
- if (this.debounce) {
517
- window.clearTimeout(this.debounce);
518
- }
519
- this.unsubscribeFromContextUpdates(this.context);
520
- this.unsubscribe();
521
- }
522
- render() {
523
- const {
524
- render
525
- } = this.props;
526
- return render(this.state);
527
- }
528
- }
529
- _defineProperty(WithPluginStateOld, "displayName", 'WithPluginState');
530
- _defineProperty(WithPluginStateOld, "contextTypes", {
531
- editorActions: PropTypes.object,
532
- editorSharedConfig: PropTypes.object
533
- });
534
295
  export { WithPluginState };
@@ -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
@@ -34,9 +34,11 @@ export function keymap(bindings) {
34
34
  var 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,
@@ -177,7 +177,7 @@ export var withLazyLoading = function withLazyLoading(_ref) {
177
177
  });
178
178
  requestedNodes.set(nodeName, loaderPromise);
179
179
  if (typeof ((_node$type = node.type) === null || _node$type === void 0 || (_node$type = _node$type.spec) === null || _node$type === void 0 ? void 0 : _node$type.toDOM) !== 'function') {
180
- // TODO: Analytics ED-23982
180
+ // TODO: ED-23982 - Analytics
181
181
  // dispatchAnalyticsEvent({
182
182
  // action: ACTION.LAZY_NODE_VIEW_ERROR,
183
183
  // actionSubject: ACTION_SUBJECT.LAZY_NODE_VIEW,
@@ -26,6 +26,8 @@ export var InlineImageCard = function InlineImageCard(_ref) {
26
26
  };
27
27
  }, []);
28
28
 
29
+ // Ignored via go/ees007
30
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
29
31
  // TODO do we need to handle nonCriticalError
30
32
  var _useFilePreview = useFilePreview({
31
33
  identifier: identifier,
@@ -5,6 +5,8 @@ export var 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 var 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',