@atlaskit/editor-common 94.4.0 → 94.5.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 (59) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/cjs/analytics/types/enums.js +3 -0
  3. package/dist/cjs/element-browser/components/ElementList/ElementList.js +2 -2
  4. package/dist/cjs/media/messages/caption.js +5 -0
  5. package/dist/cjs/monitoring/error.js +1 -1
  6. package/dist/cjs/styles/shared/headings.js +2 -2
  7. package/dist/cjs/styles/shared/paragraph.js +2 -2
  8. package/dist/cjs/ui/DropList/index.js +15 -10
  9. package/dist/cjs/ui/Emoji/index.js +17 -9
  10. package/dist/cjs/ui-menu/Dropdown/index.js +13 -7
  11. package/dist/cjs/ui-menu/DropdownMenu/index.js +18 -25
  12. package/dist/cjs/ui-menu/ToolbarButton/index.js +2 -3
  13. package/dist/cjs/ui-react/index.js +10 -1
  14. package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +24 -13
  15. package/dist/es2019/analytics/types/enums.js +3 -0
  16. package/dist/es2019/element-browser/components/ElementList/ElementList.js +2 -2
  17. package/dist/es2019/media/messages/caption.js +5 -0
  18. package/dist/es2019/monitoring/error.js +1 -1
  19. package/dist/es2019/styles/shared/headings.js +2 -2
  20. package/dist/es2019/styles/shared/paragraph.js +2 -2
  21. package/dist/es2019/ui/DropList/index.js +7 -2
  22. package/dist/es2019/ui/Emoji/index.js +10 -8
  23. package/dist/es2019/ui-menu/Dropdown/index.js +6 -5
  24. package/dist/es2019/ui-menu/DropdownMenu/index.js +19 -26
  25. package/dist/es2019/ui-menu/ToolbarButton/index.js +2 -3
  26. package/dist/es2019/ui-react/index.js +1 -1
  27. package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +23 -14
  28. package/dist/esm/analytics/types/enums.js +3 -0
  29. package/dist/esm/element-browser/components/ElementList/ElementList.js +2 -2
  30. package/dist/esm/media/messages/caption.js +5 -0
  31. package/dist/esm/monitoring/error.js +1 -1
  32. package/dist/esm/styles/shared/headings.js +2 -2
  33. package/dist/esm/styles/shared/paragraph.js +2 -2
  34. package/dist/esm/ui/DropList/index.js +15 -10
  35. package/dist/esm/ui/Emoji/index.js +14 -8
  36. package/dist/esm/ui-menu/Dropdown/index.js +14 -8
  37. package/dist/esm/ui-menu/DropdownMenu/index.js +19 -26
  38. package/dist/esm/ui-menu/ToolbarButton/index.js +2 -3
  39. package/dist/esm/ui-react/index.js +1 -1
  40. package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +23 -14
  41. package/dist/types/analytics/types/enums.d.ts +5 -2
  42. package/dist/types/analytics/types/index.d.ts +1 -1
  43. package/dist/types/analytics/types/media-events.d.ts +6 -2
  44. package/dist/types/media/messages/caption.d.ts +5 -0
  45. package/dist/types/ui/DropList/index.d.ts +6 -2
  46. package/dist/types/ui/Emoji/index.d.ts +3 -3
  47. package/dist/types/ui/index.d.ts +1 -1
  48. package/dist/types/ui-react/index.d.ts +1 -1
  49. package/dist/types/ui-react/with-react-editor-view-outer-listeners.d.ts +1 -0
  50. package/dist/types-ts4.5/analytics/types/enums.d.ts +5 -2
  51. package/dist/types-ts4.5/analytics/types/index.d.ts +1 -1
  52. package/dist/types-ts4.5/analytics/types/media-events.d.ts +6 -2
  53. package/dist/types-ts4.5/media/messages/caption.d.ts +5 -0
  54. package/dist/types-ts4.5/ui/DropList/index.d.ts +6 -2
  55. package/dist/types-ts4.5/ui/Emoji/index.d.ts +3 -3
  56. package/dist/types-ts4.5/ui/index.d.ts +1 -1
  57. package/dist/types-ts4.5/ui-react/index.d.ts +1 -1
  58. package/dist/types-ts4.5/ui-react/with-react-editor-view-outer-listeners.d.ts +1 -0
  59. package/package.json +9 -6
@@ -5,12 +5,12 @@
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css } from '@emotion/react';
7
7
  import { akEditorLineHeight, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
8
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import editorUGCToken from '../../ugc-tokens/get-editor-ugc-token';
10
10
 
11
11
  // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
12
12
  export const paragraphSharedStyles = typographyTheme => {
13
- return editorExperiment('typography_migration_ugc', true) ? css({
13
+ return fg('platform_editor_typography_ugc') ? css({
14
14
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
15
15
  '& p': {
16
16
  font: editorUGCToken('editor.font.body', typographyTheme),
@@ -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 = "94.4.0";
16
+ const packageVersion = "94.5.1";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -117,6 +117,10 @@ class DropList extends Component {
117
117
  ref.focus();
118
118
  }
119
119
  });
120
+ _defineProperty(this, "handleDroplistRef", ref => {
121
+ var _this$props$onDroplis, _this$props;
122
+ (_this$props$onDroplis = (_this$props = this.props).onDroplistRef) === null || _this$props$onDroplis === void 0 ? void 0 : _this$props$onDroplis.call(_this$props, ref);
123
+ });
120
124
  _defineProperty(this, "handleTriggerRef", ref => {
121
125
  this.triggerRef = ref;
122
126
  });
@@ -140,7 +144,8 @@ class DropList extends Component {
140
144
  role: "presentation"
141
145
  }, children) : null;
142
146
  return jsx("div", {
143
- css: this.wrapperStyles
147
+ css: this.wrapperStyles,
148
+ ref: this.handleDroplistRef
144
149
  }, jsx(Layer, {
145
150
  content: layerContent,
146
151
  offset: dropOffset,
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import { ResourcedEmoji } from '@atlaskit/emoji/element';
3
3
  const EmojiNodeFunctional = props => {
4
4
  var _resourceConfig$optim;
@@ -12,6 +12,12 @@ const EmojiNodeFunctional = props => {
12
12
  resourceConfig,
13
13
  emojiProvider
14
14
  } = props;
15
+ const emojiId = useMemo(() => ({
16
+ shortName,
17
+ id,
18
+ fallback
19
+ }), [shortName, id, fallback]);
20
+ const emojiProviderResolver = useMemo(() => Promise.resolve(emojiProvider), [emojiProvider]);
15
21
  if (allowTextFallback && !emojiProvider) {
16
22
  return /*#__PURE__*/React.createElement("span", {
17
23
  "data-emoji-id": id,
@@ -23,12 +29,8 @@ const EmojiNodeFunctional = props => {
23
29
  return null;
24
30
  }
25
31
  return /*#__PURE__*/React.createElement(ResourcedEmoji, {
26
- emojiId: {
27
- id,
28
- fallback,
29
- shortName
30
- },
31
- emojiProvider: Promise.resolve(emojiProvider),
32
+ emojiId: emojiId,
33
+ emojiProvider: emojiProviderResolver,
32
34
  showTooltip: showTooltip,
33
35
  fitToHeight: fitToHeight,
34
36
  optimistic: true,
@@ -43,4 +45,4 @@ const EmojiNodeFunctional = props => {
43
45
  const EmojiNode = props => {
44
46
  return /*#__PURE__*/React.createElement(EmojiNodeFunctional, props);
45
47
  };
46
- export default EmojiNode;
48
+ export default /*#__PURE__*/React.memo(EmojiNode);
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React, { PureComponent } from 'react';
4
- import { withReactEditorViewOuterListeners } from '../../ui-react';
4
+ import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners } from '../../ui-react';
5
5
  import DropdownList from '../../ui/DropList';
6
6
  import Popup from '../../ui/Popup';
7
7
  import { ArrowKeyNavigationProvider } from '../ArrowKeyNavigationProvider';
@@ -14,7 +14,8 @@ import { ArrowKeyNavigationProvider } from '../ArrowKeyNavigationProvider';
14
14
  export class Dropdown extends PureComponent {
15
15
  constructor(props) {
16
16
  super(props);
17
- _defineProperty(this, "handleRef", target => {
17
+ _defineProperty(this, "handleRef", setOutsideClickTargetRef => target => {
18
+ setOutsideClickTargetRef(target);
18
19
  this.setState({
19
20
  target: target || undefined
20
21
  });
@@ -90,9 +91,9 @@ export class Dropdown extends PureComponent {
90
91
  trigger,
91
92
  isOpen
92
93
  } = this.props;
93
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
94
- ref: this.handleRef
95
- }, trigger), isOpen ? this.renderDropdown() : null);
94
+ return /*#__PURE__*/React.createElement(OutsideClickTargetRefContext.Consumer, null, setOutsideClickTargetRef => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
95
+ ref: this.handleRef(setOutsideClickTargetRef)
96
+ }, trigger), isOpen ? this.renderDropdown() : null));
96
97
  }
97
98
  }
98
99
  const DropdownWithOuterListeners = withReactEditorViewOuterListeners(Dropdown);
@@ -1,5 +1,5 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
3
  /**
4
4
  * @jsxRuntime classic
5
5
  * @jsx jsx
@@ -9,11 +9,10 @@ import React, { PureComponent, useContext } from 'react';
9
9
  import { css, jsx } from '@emotion/react';
10
10
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
11
11
  import { CustomItem, MenuGroup, Section } from '@atlaskit/menu';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  import Tooltip from '@atlaskit/tooltip';
14
13
  import { DropdownMenuSharedCssClassName } from '../../styles';
15
14
  import { KeyDownHandlerContext } from '../../ui-menu/ToolbarArrowKeyNavigationProvider';
16
- import { withReactEditorViewOuterListeners } from '../../ui-react';
15
+ import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners } from '../../ui-react';
17
16
  import DropList from '../../ui/DropList';
18
17
  import Popup from '../../ui/Popup';
19
18
  import { ArrowKeyNavigationProvider } from '../ArrowKeyNavigationProvider';
@@ -74,7 +73,13 @@ const buttonStyles = (isActive, submenuActive) => {
74
73
  `; // The default focus-visible style is removed to ensure consistency across browsers
75
74
  }
76
75
  };
77
- const DropListWithOutsideListeners = withReactEditorViewOuterListeners(DropList);
76
+ const DropListWithOutsideClickTargetRef = props => {
77
+ const setOutsideClickTargetRef = React.useContext(OutsideClickTargetRefContext);
78
+ return jsx(DropList, _extends({
79
+ onDroplistRef: setOutsideClickTargetRef
80
+ }, props));
81
+ };
82
+ const DropListWithOutsideListeners = withReactEditorViewOuterListeners(DropListWithOutsideClickTargetRef);
78
83
 
79
84
  /**
80
85
  * Wrapper around @atlaskit/droplist which uses Popup and Portal to render
@@ -108,27 +113,17 @@ export default class DropdownMenuWrapper extends PureComponent {
108
113
  _defineProperty(this, "handleCloseAndFocus", event => {
109
114
  var _this$state$target, _this$state$target$qu;
110
115
  (_this$state$target = this.state.target) === null || _this$state$target === void 0 ? void 0 : (_this$state$target$qu = _this$state$target.querySelector('button')) === null || _this$state$target$qu === void 0 ? void 0 : _this$state$target$qu.focus();
111
- if (fg('platform_editor_a11y_table_context_menu')) {
112
- this.handleClose(event);
113
- } else {
114
- this.handleClose();
115
- }
116
+ this.handleClose(event);
116
117
  });
117
118
  _defineProperty(this, "handleClose", event => {
118
119
  const {
119
120
  onOpenChange
120
121
  } = this.props;
121
122
  if (onOpenChange) {
122
- if (fg('platform_editor_a11y_table_context_menu')) {
123
- onOpenChange({
124
- isOpen: false,
125
- event: event
126
- });
127
- } else {
128
- onOpenChange({
129
- isOpen: false
130
- });
131
- }
123
+ onOpenChange({
124
+ isOpen: false,
125
+ event: event
126
+ });
132
127
  }
133
128
  });
134
129
  }
@@ -197,11 +192,7 @@ export default class DropdownMenuWrapper extends PureComponent {
197
192
  handleClickOutside: this.handleClose,
198
193
  handleEscapeKeydown: handleEscapeKeydown || this.handleCloseAndFocus,
199
194
  handleEnterKeydown: e => {
200
- if (fg('platform_editor_a11y_table_context_menu')) {
201
- if (!allowEnterDefaultBehavior) {
202
- e.preventDefault();
203
- }
204
- } else {
195
+ if (!allowEnterDefaultBehavior) {
205
196
  e.preventDefault();
206
197
  }
207
198
  e.stopPropagation();
@@ -311,7 +302,9 @@ export function DropdownMenuItem({
311
302
  // From time to time we don't want to have any tabIndex on item wrapper
312
303
  // especially when we pass any interactive element as a item.content
313
304
  const tabIndex = item.wrapperTabIndex === null ? undefined : item.wrapperTabIndex || -1;
314
- const dropListItem = jsx("div", {
305
+ const dropListItem =
306
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
307
+ jsx("div", {
315
308
  css: () => buttonStyles(item.isActive, submenuActive),
316
309
  tabIndex: tabIndex,
317
310
  "aria-disabled": item.isDisabled ? 'true' : 'false',
@@ -340,7 +333,7 @@ export function DropdownMenuItem({
340
333
  onMouseLeave: () => onMouseLeave && onMouseLeave({
341
334
  item
342
335
  }),
343
- "aria-expanded": fg('platform_editor_a11y_table_context_menu') ? item['aria-expanded'] : undefined
336
+ "aria-expanded": item['aria-expanded']
344
337
  }, item.content));
345
338
  if (item.tooltipDescription) {
346
339
  var _item$key3;
@@ -9,7 +9,6 @@ import React, { useCallback } from 'react';
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
10
  import { css, jsx } from '@emotion/react';
11
11
  import { FabricChannel } from '@atlaskit/analytics-listeners/types';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  import Tooltip from '@atlaskit/tooltip';
14
13
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, TOOLBAR_ACTION_SUBJECT_ID } from '../../analytics';
15
14
  import { ToolTipContent } from '../../keymaps';
@@ -106,10 +105,10 @@ const ToolbarButton = /*#__PURE__*/React.forwardRef((props, ref) => {
106
105
  if (!title) {
107
106
  return button;
108
107
  }
109
- const tooltipContent = hideTooltip ? null : fg('platform_editor_a11y_table_context_menu') ? jsx(ToolTipContent, {
108
+ const tooltipContent = hideTooltip ? null : jsx(ToolTipContent, {
110
109
  description: title,
111
110
  keymap: keymap
112
- }) : title;
111
+ });
113
112
  return jsx(Tooltip, {
114
113
  content: tooltipContent,
115
114
  hideTooltipOnClick: true,
@@ -1,2 +1,2 @@
1
1
  export { default as ReactEditorViewContext } from './ReactEditorViewContext';
2
- export { default as withReactEditorViewOuterListeners } from './with-react-editor-view-outer-listeners';
2
+ export { default as withReactEditorViewOuterListeners, OutsideClickTargetRefContext } from './with-react-editor-view-outer-listeners';
@@ -1,27 +1,29 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import React, { PureComponent, useEffect, useState } from 'react';
2
+ import React, { PureComponent, useCallback, useEffect, useRef, useState } from 'react';
3
3
  import ReactDOM from 'react-dom';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import ReactEditorViewContext from './ReactEditorViewContext';
6
+ // Use this context to pass in the reference of the element that should be considered as the outside click target
7
+ // The outside click target is the element that should be clicked outside of to trigger the `handleClickOutside` event
8
+ export const OutsideClickTargetRefContext = /*#__PURE__*/React.createContext(() => {});
5
9
 
6
- // This needs exporting to be used alongisde `withReactEditorViewOuterListeners`
10
+ // This needs exporting to be used alongside `withReactEditorViewOuterListeners`
7
11
 
8
12
  class WithOutsideClick extends PureComponent {
9
13
  constructor(...args) {
10
14
  super(...args);
11
15
  _defineProperty(this, "handleClick", evt => {
12
- if (!this.props.isActiveComponent) {
16
+ if (!this.props.isActiveComponent || !this.props.handleClickOutside) {
13
17
  return;
14
18
  }
15
- const domNode = ReactDOM.findDOMNode(this); // eslint-disable-line react/no-find-dom-node
19
+ const domNode = fg('platform_editor_replace_finddomnode_in_common') ? this.props.outsideClickTargetRef.current : ReactDOM.findDOMNode(this);
16
20
  if (!domNode || evt.target instanceof Node && !domNode.contains(evt.target)) {
17
- if (this.props.handleClickOutside) {
18
- var _this$props$editorVie;
19
- this.props.handleClickOutside(evt);
20
- // When the menus are closed by clicking outside the focus is set on editor.
21
- if (!((_this$props$editorVie = this.props.editorView) !== null && _this$props$editorVie !== void 0 && _this$props$editorVie.hasFocus())) {
22
- var _this$props$editorVie2;
23
- (_this$props$editorVie2 = this.props.editorView) === null || _this$props$editorVie2 === void 0 ? void 0 : _this$props$editorVie2.focus();
24
- }
21
+ var _this$props$editorVie;
22
+ this.props.handleClickOutside(evt);
23
+ // When the menus are closed by clicking outside the focus is set on editor.
24
+ if (!((_this$props$editorVie = this.props.editorView) !== null && _this$props$editorVie !== void 0 && _this$props$editorVie.hasFocus())) {
25
+ var _this$props$editorVie2;
26
+ (_this$props$editorVie2 = this.props.editorView) === null || _this$props$editorVie2 === void 0 ? void 0 : _this$props$editorVie2.focus();
25
27
  }
26
28
  }
27
29
  });
@@ -79,6 +81,10 @@ export default function withReactEditorViewOuterListeners(Component) {
79
81
  }) => {
80
82
  const isActiveProp = hasIsOpen(props) ? props.isOpen : true;
81
83
  const [isActiveComponent, setActiveComponent] = useState(false);
84
+ const outsideClickTargetRef = useRef(null);
85
+ const setOutsideClickTargetRef = useCallback(el => {
86
+ outsideClickTargetRef.current = el;
87
+ }, [outsideClickTargetRef]);
82
88
  useEffect(() => {
83
89
  requestAnimationFrame(() => {
84
90
  setActiveComponent(isActiveProp);
@@ -88,16 +94,19 @@ export default function withReactEditorViewOuterListeners(Component) {
88
94
  editorView,
89
95
  popupsMountPoint,
90
96
  editorRef
91
- }) => /*#__PURE__*/React.createElement(WithOutsideClick, {
97
+ }) => /*#__PURE__*/React.createElement(OutsideClickTargetRefContext.Provider, {
98
+ value: setOutsideClickTargetRef
99
+ }, /*#__PURE__*/React.createElement(WithOutsideClick, {
92
100
  editorView: editorView,
93
101
  editorRef: editorRef,
94
102
  targetRef: props.targetRef,
103
+ outsideClickTargetRef: outsideClickTargetRef,
95
104
  popupsMountPoint: popupsMountPoint,
96
105
  isActiveComponent: isActiveComponent,
97
106
  handleClickOutside: handleClickOutside,
98
107
  handleEnterKeydown: handleEnterKeydown,
99
108
  handleEscapeKeydown: handleEscapeKeydown,
100
109
  closeOnTab: closeOnTab
101
- }, /*#__PURE__*/React.createElement(Component, props)));
110
+ }, /*#__PURE__*/React.createElement(Component, props))));
102
111
  };
103
112
  }
@@ -35,6 +35,7 @@ export var ACTION = /*#__PURE__*/function (ACTION) {
35
35
  ACTION["DISMISSED"] = "dismissed";
36
36
  ACTION["DISPATCHED_INVALID_TRANSACTION"] = "dispatchedInvalidTransaction";
37
37
  ACTION["DISPATCHED_VALID_TRANSACTION"] = "dispatchedValidTransaction";
38
+ ACTION["DOUBLE_CLICKED"] = "doubleClicked";
38
39
  ACTION["DRAGGED"] = "dragged";
39
40
  ACTION["EDITED"] = "edited";
40
41
  ACTION["EDITOR_CRASHED"] = "unhandledErrorCaught";
@@ -180,6 +181,7 @@ export var INPUT_METHOD = /*#__PURE__*/function (INPUT_METHOD) {
180
181
  INPUT_METHOD["TABLE_CONTEXT_MENU"] = "tableContextMenu";
181
182
  INPUT_METHOD["MOUSE"] = "mouse";
182
183
  INPUT_METHOD["BROWSER"] = "browser";
184
+ INPUT_METHOD["DOUBLE_CLICK"] = "doubleClick";
183
185
  return INPUT_METHOD;
184
186
  }({});
185
187
  export var INSERT_MEDIA_VIA = /*#__PURE__*/function (INSERT_MEDIA_VIA) {
@@ -257,6 +259,7 @@ export var ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJECT) {
257
259
  ACTION_SUBJECT["CONTEXT_MENU"] = "contextMenu";
258
260
  ACTION_SUBJECT["INLINE_DIALOG"] = "inlineDialog";
259
261
  ACTION_SUBJECT["ENGAGEMENT_PLATFORM"] = "engagementPlatform";
262
+ ACTION_SUBJECT["MEDIA_VIEWER"] = "mediaViewer";
260
263
  return ACTION_SUBJECT;
261
264
  }({});
262
265
  export var ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
@@ -17,8 +17,8 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
17
17
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
18
18
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
19
19
  import { ButtonItem } from '@atlaskit/menu';
20
+ import { fg } from '@atlaskit/platform-feature-flags';
20
21
  import { Stack, Text } from '@atlaskit/primitives';
21
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
22
22
  import Tooltip from '@atlaskit/tooltip';
23
23
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../../analytics';
24
24
  import { IconFallback } from '../../../quick-insert';
@@ -291,7 +291,7 @@ var ItemContent = /*#__PURE__*/memo(function (_ref7) {
291
291
  var title = _ref7.title,
292
292
  description = _ref7.description,
293
293
  keyshortcut = _ref7.keyshortcut;
294
- if (editorExperiment('typography_migration_ugc', true)) {
294
+ if (fg('platform_editor_typography_ugc')) {
295
295
  return (
296
296
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
297
297
  jsx("div", {
@@ -4,5 +4,10 @@ export var captionMessages = defineMessages({
4
4
  id: 'fabric.editor.captionPlaceholder',
5
5
  defaultMessage: 'Add a caption',
6
6
  description: 'Placeholder description for an empty (new) caption in the editor'
7
+ },
8
+ placeholderWithDoubleClickPrompt: {
9
+ id: 'fabric.editor.captionPlaceholderWithDoubleClickPrompt',
10
+ defaultMessage: 'Add a caption - double-click to preview',
11
+ description: 'Placeholder description to prompt users to add a caption and double click media to preview'
7
12
  }
8
13
  });
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "94.4.0";
10
+ var packageVersion = "94.5.1";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -9,7 +9,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
10
  import { css } from '@emotion/react';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
12
  import editorUGCToken from '../../ugc-tokens/get-editor-ugc-token';
14
13
  var headingWithAlignmentStyles = function headingWithAlignmentStyles() {
15
14
  return (
@@ -48,7 +47,7 @@ var headingWithAlignmentStyles = function headingWithAlignmentStyles() {
48
47
  // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
49
48
  // text sizing prototype: http://proto/fabricrender/
50
49
  export var headingsSharedStyles = function headingsSharedStyles(typographyTheme) {
51
- var isADSTokenMigrationEnabled = editorExperiment('typography_migration_ugc', true);
50
+ var isADSTokenMigrationEnabled = fg('platform_editor_typography_ugc');
52
51
  if (isADSTokenMigrationEnabled) {
53
52
  return css(_objectSpread({
54
53
  '& h1': {
@@ -72,6 +71,7 @@ export var headingsSharedStyles = function headingsSharedStyles(typographyTheme)
72
71
  },
73
72
  '& h5': {
74
73
  font: editorUGCToken('editor.font.heading.h5', typographyTheme),
74
+ marginTop: '1.667em',
75
75
  textTransform: 'none'
76
76
  },
77
77
  '& h6': {
@@ -5,12 +5,12 @@
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css } from '@emotion/react';
7
7
  import { akEditorLineHeight, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
8
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import editorUGCToken from '../../ugc-tokens/get-editor-ugc-token';
10
10
 
11
11
  // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
12
12
  export var paragraphSharedStyles = function paragraphSharedStyles(typographyTheme) {
13
- return editorExperiment('typography_migration_ugc', true) ? css({
13
+ return fg('platform_editor_typography_ugc') ? css({
14
14
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
15
15
  '& p': {
16
16
  font: editorUGCToken('editor.font.body', typographyTheme),
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
21
21
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "94.4.0";
24
+ var packageVersion = "94.5.1";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var DropList = /*#__PURE__*/function (_Component) {
@@ -129,6 +129,10 @@ var DropList = /*#__PURE__*/function (_Component) {
129
129
  ref.focus();
130
130
  }
131
131
  });
132
+ _defineProperty(_assertThisInitialized(_this), "handleDroplistRef", function (ref) {
133
+ var _this$props$onDroplis, _this$props;
134
+ (_this$props$onDroplis = (_this$props = _this.props).onDroplistRef) === null || _this$props$onDroplis === void 0 || _this$props$onDroplis.call(_this$props, ref);
135
+ });
132
136
  _defineProperty(_assertThisInitialized(_this), "handleTriggerRef", function (ref) {
133
137
  _this.triggerRef = ref;
134
138
  });
@@ -137,14 +141,14 @@ var DropList = /*#__PURE__*/function (_Component) {
137
141
  _createClass(DropList, [{
138
142
  key: "render",
139
143
  value: function render() {
140
- var _this$props = this.props,
141
- children = _this$props.children,
142
- isOpen = _this$props.isOpen,
143
- position = _this$props.position,
144
- trigger = _this$props.trigger,
145
- onPositioned = _this$props.onPositioned,
146
- testId = _this$props.testId,
147
- id = _this$props.id;
144
+ var _this$props2 = this.props,
145
+ children = _this$props2.children,
146
+ isOpen = _this$props2.isOpen,
147
+ position = _this$props2.position,
148
+ trigger = _this$props2.trigger,
149
+ onPositioned = _this$props2.onPositioned,
150
+ testId = _this$props2.testId,
151
+ id = _this$props2.id;
148
152
  var layerContent = isOpen ? jsx("div", {
149
153
  css: this.menuWrapper,
150
154
  "data-role": "droplistContent",
@@ -154,7 +158,8 @@ var DropList = /*#__PURE__*/function (_Component) {
154
158
  role: "presentation"
155
159
  }, children) : null;
156
160
  return jsx("div", {
157
- css: this.wrapperStyles
161
+ css: this.wrapperStyles,
162
+ ref: this.handleDroplistRef
158
163
  }, jsx(Layer, {
159
164
  content: layerContent,
160
165
  offset: dropOffset,
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import { ResourcedEmoji } from '@atlaskit/emoji/element';
3
3
  var EmojiNodeFunctional = function EmojiNodeFunctional(props) {
4
4
  var _resourceConfig$optim;
@@ -10,6 +10,16 @@ var EmojiNodeFunctional = function EmojiNodeFunctional(props) {
10
10
  showTooltip = props.showTooltip,
11
11
  resourceConfig = props.resourceConfig,
12
12
  emojiProvider = props.emojiProvider;
13
+ var emojiId = useMemo(function () {
14
+ return {
15
+ shortName: shortName,
16
+ id: id,
17
+ fallback: fallback
18
+ };
19
+ }, [shortName, id, fallback]);
20
+ var emojiProviderResolver = useMemo(function () {
21
+ return Promise.resolve(emojiProvider);
22
+ }, [emojiProvider]);
13
23
  if (allowTextFallback && !emojiProvider) {
14
24
  return /*#__PURE__*/React.createElement("span", {
15
25
  "data-emoji-id": id,
@@ -21,12 +31,8 @@ var EmojiNodeFunctional = function EmojiNodeFunctional(props) {
21
31
  return null;
22
32
  }
23
33
  return /*#__PURE__*/React.createElement(ResourcedEmoji, {
24
- emojiId: {
25
- id: id,
26
- fallback: fallback,
27
- shortName: shortName
28
- },
29
- emojiProvider: Promise.resolve(emojiProvider),
34
+ emojiId: emojiId,
35
+ emojiProvider: emojiProviderResolver,
30
36
  showTooltip: showTooltip,
31
37
  fitToHeight: fitToHeight,
32
38
  optimistic: true,
@@ -41,4 +47,4 @@ var EmojiNodeFunctional = function EmojiNodeFunctional(props) {
41
47
  var EmojiNode = function EmojiNode(props) {
42
48
  return /*#__PURE__*/React.createElement(EmojiNodeFunctional, props);
43
49
  };
44
- export default EmojiNode;
50
+ export default /*#__PURE__*/React.memo(EmojiNode);
@@ -9,7 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
9
  function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
10
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
11
  import React, { PureComponent } from 'react';
12
- import { withReactEditorViewOuterListeners } from '../../ui-react';
12
+ import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners } from '../../ui-react';
13
13
  import DropdownList from '../../ui/DropList';
14
14
  import Popup from '../../ui/Popup';
15
15
  import { ArrowKeyNavigationProvider } from '../ArrowKeyNavigationProvider';
@@ -26,10 +26,13 @@ export var Dropdown = /*#__PURE__*/function (_PureComponent) {
26
26
  var _this;
27
27
  _classCallCheck(this, Dropdown);
28
28
  _this = _super.call(this, props);
29
- _defineProperty(_assertThisInitialized(_this), "handleRef", function (target) {
30
- _this.setState({
31
- target: target || undefined
32
- });
29
+ _defineProperty(_assertThisInitialized(_this), "handleRef", function (setOutsideClickTargetRef) {
30
+ return function (target) {
31
+ setOutsideClickTargetRef(target);
32
+ _this.setState({
33
+ target: target || undefined
34
+ });
35
+ };
33
36
  });
34
37
  _defineProperty(_assertThisInitialized(_this), "updatePopupPlacement", function (placement) {
35
38
  _this.setState({
@@ -101,12 +104,15 @@ export var Dropdown = /*#__PURE__*/function (_PureComponent) {
101
104
  }, {
102
105
  key: "render",
103
106
  value: function render() {
107
+ var _this2 = this;
104
108
  var _this$props2 = this.props,
105
109
  trigger = _this$props2.trigger,
106
110
  isOpen = _this$props2.isOpen;
107
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
108
- ref: this.handleRef
109
- }, trigger), isOpen ? this.renderDropdown() : null);
111
+ return /*#__PURE__*/React.createElement(OutsideClickTargetRefContext.Consumer, null, function (setOutsideClickTargetRef) {
112
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
113
+ ref: _this2.handleRef(setOutsideClickTargetRef)
114
+ }, trigger), isOpen ? _this2.renderDropdown() : null);
115
+ });
110
116
  }
111
117
  }]);
112
118
  return Dropdown;