@atlaskit/editor-common 94.3.1 → 94.5.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 (76) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/cjs/analytics/types/enums.js +3 -0
  3. package/dist/cjs/analytics/types/node-events.js +2 -0
  4. package/dist/cjs/element-browser/components/ElementList/ElementList.js +2 -2
  5. package/dist/cjs/media/messages/caption.js +5 -0
  6. package/dist/cjs/monitoring/error.js +1 -1
  7. package/dist/cjs/styles/index.js +6 -0
  8. package/dist/cjs/styles/shared/embedCard.js +45 -18
  9. package/dist/cjs/styles/shared/headings.js +2 -2
  10. package/dist/cjs/styles/shared/media-single.js +49 -2
  11. package/dist/cjs/styles/shared/paragraph.js +2 -2
  12. package/dist/cjs/ui/DropList/index.js +15 -10
  13. package/dist/cjs/ui/Emoji/index.js +17 -9
  14. package/dist/cjs/ui-menu/Dropdown/index.js +13 -7
  15. package/dist/cjs/ui-menu/DropdownMenu/index.js +11 -3
  16. package/dist/cjs/ui-react/index.js +10 -1
  17. package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +24 -13
  18. package/dist/es2019/analytics/types/enums.js +3 -0
  19. package/dist/es2019/analytics/types/node-events.js +2 -0
  20. package/dist/es2019/element-browser/components/ElementList/ElementList.js +2 -2
  21. package/dist/es2019/media/messages/caption.js +5 -0
  22. package/dist/es2019/monitoring/error.js +1 -1
  23. package/dist/es2019/styles/index.js +1 -1
  24. package/dist/es2019/styles/shared/embedCard.js +26 -1
  25. package/dist/es2019/styles/shared/headings.js +2 -2
  26. package/dist/es2019/styles/shared/media-single.js +68 -1
  27. package/dist/es2019/styles/shared/paragraph.js +2 -2
  28. package/dist/es2019/ui/DropList/index.js +7 -2
  29. package/dist/es2019/ui/Emoji/index.js +10 -8
  30. package/dist/es2019/ui-menu/Dropdown/index.js +6 -5
  31. package/dist/es2019/ui-menu/DropdownMenu/index.js +12 -4
  32. package/dist/es2019/ui-react/index.js +1 -1
  33. package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +23 -14
  34. package/dist/esm/analytics/types/enums.js +3 -0
  35. package/dist/esm/analytics/types/node-events.js +2 -0
  36. package/dist/esm/element-browser/components/ElementList/ElementList.js +2 -2
  37. package/dist/esm/media/messages/caption.js +5 -0
  38. package/dist/esm/monitoring/error.js +1 -1
  39. package/dist/esm/styles/index.js +1 -1
  40. package/dist/esm/styles/shared/embedCard.js +45 -18
  41. package/dist/esm/styles/shared/headings.js +2 -2
  42. package/dist/esm/styles/shared/media-single.js +49 -2
  43. package/dist/esm/styles/shared/paragraph.js +2 -2
  44. package/dist/esm/ui/DropList/index.js +15 -10
  45. package/dist/esm/ui/Emoji/index.js +14 -8
  46. package/dist/esm/ui-menu/Dropdown/index.js +14 -8
  47. package/dist/esm/ui-menu/DropdownMenu/index.js +12 -4
  48. package/dist/esm/ui-react/index.js +1 -1
  49. package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +23 -14
  50. package/dist/types/analytics/types/enums.d.ts +5 -2
  51. package/dist/types/analytics/types/index.d.ts +1 -1
  52. package/dist/types/analytics/types/media-events.d.ts +6 -2
  53. package/dist/types/analytics/types/node-events.d.ts +6 -4
  54. package/dist/types/media/messages/caption.d.ts +5 -0
  55. package/dist/types/styles/index.d.ts +1 -1
  56. package/dist/types/styles/shared/embedCard.d.ts +1 -1
  57. package/dist/types/styles/shared/media-single.d.ts +2 -1
  58. package/dist/types/ui/DropList/index.d.ts +6 -2
  59. package/dist/types/ui/Emoji/index.d.ts +3 -3
  60. package/dist/types/ui/index.d.ts +1 -1
  61. package/dist/types/ui-react/index.d.ts +1 -1
  62. package/dist/types/ui-react/with-react-editor-view-outer-listeners.d.ts +1 -0
  63. package/dist/types-ts4.5/analytics/types/enums.d.ts +5 -2
  64. package/dist/types-ts4.5/analytics/types/index.d.ts +1 -1
  65. package/dist/types-ts4.5/analytics/types/media-events.d.ts +6 -2
  66. package/dist/types-ts4.5/analytics/types/node-events.d.ts +6 -4
  67. package/dist/types-ts4.5/media/messages/caption.d.ts +5 -0
  68. package/dist/types-ts4.5/styles/index.d.ts +1 -1
  69. package/dist/types-ts4.5/styles/shared/embedCard.d.ts +1 -1
  70. package/dist/types-ts4.5/styles/shared/media-single.d.ts +2 -1
  71. package/dist/types-ts4.5/ui/DropList/index.d.ts +6 -2
  72. package/dist/types-ts4.5/ui/Emoji/index.d.ts +3 -3
  73. package/dist/types-ts4.5/ui/index.d.ts +1 -1
  74. package/dist/types-ts4.5/ui-react/index.d.ts +1 -1
  75. package/dist/types-ts4.5/ui-react/with-react-editor-view-outer-listeners.d.ts +1 -0
  76. package/package.json +15 -6
@@ -5,6 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.OutsideClickTargetRefContext = void 0;
8
9
  exports.default = withReactEditorViewOuterListeners;
9
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
@@ -17,13 +18,18 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
17
18
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
18
19
  var _react = _interopRequireWildcard(require("react"));
19
20
  var _reactDom = _interopRequireDefault(require("react-dom"));
21
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
22
  var _ReactEditorViewContext = _interopRequireDefault(require("./ReactEditorViewContext"));
21
23
  var _excluded = ["handleClickOutside", "handleEnterKeydown", "handleEscapeKeydown", "closeOnTab"];
22
24
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
23
25
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
24
26
  function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
25
27
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
26
- // This needs exporting to be used alongisde `withReactEditorViewOuterListeners`
28
+ // Use this context to pass in the reference of the element that should be considered as the outside click target
29
+ // The outside click target is the element that should be clicked outside of to trigger the `handleClickOutside` event
30
+ var OutsideClickTargetRefContext = exports.OutsideClickTargetRefContext = /*#__PURE__*/_react.default.createContext(function () {});
31
+
32
+ // This needs exporting to be used alongside `withReactEditorViewOuterListeners`
27
33
  var WithOutsideClick = /*#__PURE__*/function (_PureComponent) {
28
34
  (0, _inherits2.default)(WithOutsideClick, _PureComponent);
29
35
  var _super = _createSuper(WithOutsideClick);
@@ -35,19 +41,17 @@ var WithOutsideClick = /*#__PURE__*/function (_PureComponent) {
35
41
  }
36
42
  _this = _super.call.apply(_super, [this].concat(args));
37
43
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function (evt) {
38
- if (!_this.props.isActiveComponent) {
44
+ if (!_this.props.isActiveComponent || !_this.props.handleClickOutside) {
39
45
  return;
40
46
  }
41
- var domNode = _reactDom.default.findDOMNode((0, _assertThisInitialized2.default)(_this)); // eslint-disable-line react/no-find-dom-node
47
+ var domNode = (0, _platformFeatureFlags.fg)('platform_editor_replace_finddomnode_in_common') ? _this.props.outsideClickTargetRef.current : _reactDom.default.findDOMNode((0, _assertThisInitialized2.default)(_this));
42
48
  if (!domNode || evt.target instanceof Node && !domNode.contains(evt.target)) {
43
- if (_this.props.handleClickOutside) {
44
- var _this$props$editorVie;
45
- _this.props.handleClickOutside(evt);
46
- // When the menus are closed by clicking outside the focus is set on editor.
47
- if (!((_this$props$editorVie = _this.props.editorView) !== null && _this$props$editorVie !== void 0 && _this$props$editorVie.hasFocus())) {
48
- var _this$props$editorVie2;
49
- (_this$props$editorVie2 = _this.props.editorView) === null || _this$props$editorVie2 === void 0 || _this$props$editorVie2.focus();
50
- }
49
+ var _this$props$editorVie;
50
+ _this.props.handleClickOutside(evt);
51
+ // When the menus are closed by clicking outside the focus is set on editor.
52
+ if (!((_this$props$editorVie = _this.props.editorView) !== null && _this$props$editorVie !== void 0 && _this$props$editorVie.hasFocus())) {
53
+ var _this$props$editorVie2;
54
+ (_this$props$editorVie2 = _this.props.editorView) === null || _this$props$editorVie2 === void 0 || _this$props$editorVie2.focus();
51
55
  }
52
56
  }
53
57
  });
@@ -116,6 +120,10 @@ function withReactEditorViewOuterListeners(Component) {
116
120
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
117
121
  isActiveComponent = _useState2[0],
118
122
  setActiveComponent = _useState2[1];
123
+ var outsideClickTargetRef = (0, _react.useRef)(null);
124
+ var setOutsideClickTargetRef = (0, _react.useCallback)(function (el) {
125
+ outsideClickTargetRef.current = el;
126
+ }, [outsideClickTargetRef]);
119
127
  (0, _react.useEffect)(function () {
120
128
  requestAnimationFrame(function () {
121
129
  setActiveComponent(isActiveProp);
@@ -125,17 +133,20 @@ function withReactEditorViewOuterListeners(Component) {
125
133
  var editorView = _ref2.editorView,
126
134
  popupsMountPoint = _ref2.popupsMountPoint,
127
135
  editorRef = _ref2.editorRef;
128
- return /*#__PURE__*/_react.default.createElement(WithOutsideClick, {
136
+ return /*#__PURE__*/_react.default.createElement(OutsideClickTargetRefContext.Provider, {
137
+ value: setOutsideClickTargetRef
138
+ }, /*#__PURE__*/_react.default.createElement(WithOutsideClick, {
129
139
  editorView: editorView,
130
140
  editorRef: editorRef,
131
141
  targetRef: props.targetRef,
142
+ outsideClickTargetRef: outsideClickTargetRef,
132
143
  popupsMountPoint: popupsMountPoint,
133
144
  isActiveComponent: isActiveComponent,
134
145
  handleClickOutside: handleClickOutside,
135
146
  handleEnterKeydown: handleEnterKeydown,
136
147
  handleEscapeKeydown: handleEscapeKeydown,
137
148
  closeOnTab: closeOnTab
138
- }, /*#__PURE__*/_react.default.createElement(Component, props));
149
+ }, /*#__PURE__*/_react.default.createElement(Component, props)));
139
150
  });
140
151
  };
141
152
  }
@@ -35,6 +35,7 @@ export let 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 let 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 let INSERT_MEDIA_VIA = /*#__PURE__*/function (INSERT_MEDIA_VIA) {
@@ -257,6 +259,7 @@ export let 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 let ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
@@ -5,6 +5,8 @@ export let LAYOUT_TYPE = /*#__PURE__*/function (LAYOUT_TYPE) {
5
5
  LAYOUT_TYPE["LEFT_SIDEBAR"] = "twoColumnsLeftSidebar";
6
6
  LAYOUT_TYPE["RIGHT_SIDEBAR"] = "twoColumnsRightSidebar";
7
7
  LAYOUT_TYPE["THREE_WITH_SIDEBARS"] = "threeColumnsWithSidebars ";
8
+ LAYOUT_TYPE["FOUR_COLS_EQUAL"] = "fourColumnsEqual";
9
+ LAYOUT_TYPE["FIVE_COLS_EQUAL"] = "fiveColumnsEqual";
8
10
  return LAYOUT_TYPE;
9
11
  }({});
10
12
  export let SMART_LINK_TYPE = /*#__PURE__*/function (SMART_LINK_TYPE) {
@@ -14,8 +14,8 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
14
14
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
15
15
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
16
16
  import { ButtonItem } from '@atlaskit/menu';
17
+ import { fg } from '@atlaskit/platform-feature-flags';
17
18
  import { Stack, Text } from '@atlaskit/primitives';
18
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
19
19
  import Tooltip from '@atlaskit/tooltip';
20
20
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../../analytics';
21
21
  import { IconFallback } from '../../../quick-insert';
@@ -287,7 +287,7 @@ const ItemContent = /*#__PURE__*/memo(({
287
287
  description,
288
288
  keyshortcut
289
289
  }) => {
290
- if (editorExperiment('typography_migration_ugc', true)) {
290
+ if (fg('platform_editor_typography_ugc')) {
291
291
  return (
292
292
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
293
293
  jsx("div", {
@@ -4,5 +4,10 @@ export const 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
  });
@@ -1,7 +1,7 @@
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 = "94.3.1";
4
+ const packageVersion = "94.5.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -3,7 +3,7 @@ export { backgroundColorStyles } from './shared/background-color';
3
3
  export { tableSharedStyle, tableMarginTop, tableMarginBottom, tableMarginSides, tableCellMinWidth, tableNewColumnMinWidth, tableCellBorderWidth, calcTableWidth, TableSharedCssClassName, tableResizeHandleWidth, tableCellPadding, tableMarginTopWithControl } from './shared/table';
4
4
  export { AnnotationSharedClassNames, BlockAnnotationSharedClassNames, AnnotationSharedCSSByState, annotationSharedStyles } from './shared/annotation';
5
5
  export { columnLayoutSharedStyle } from './shared/column-layout';
6
- export { mediaSingleSharedStyle, richMediaClassName } from './shared/media-single';
6
+ export { mediaSingleSharedStyle, mediaSingleSharedStyleNew, richMediaClassName } from './shared/media-single';
7
7
  export { blockquoteSharedStyles } from './shared/blockquote';
8
8
  export { headingsSharedStyles } from './shared/headings';
9
9
  export { ruleSharedStyles } from './shared/rule';
@@ -1,7 +1,32 @@
1
1
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
2
2
  import { css } from '@emotion/react';
3
+ import { akEditorWrappedNodeZIndex } from '@atlaskit/editor-shared-styles';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
3
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
4
- export const embedCardStyles = css({
6
+ export const embedCardStyles = () => fg('platform_editor_element_dnd_nested_fix_patch_3') ? css({
7
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
8
+ '.ProseMirror': {
9
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
10
+ ".embedCardView-content-wrap[layout^='wrap-']": {
11
+ maxWidth: '100%',
12
+ position: 'relative',
13
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
14
+ zIndex: akEditorWrappedNodeZIndex
15
+ },
16
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
17
+ ".embedCardView-content-wrap[layout='wrap-left']": {
18
+ float: 'left'
19
+ },
20
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
21
+ ".embedCardView-content-wrap[layout='wrap-right']": {
22
+ float: 'right'
23
+ },
24
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
25
+ ".embedCardView-content-wrap[layout='wrap-right'] + .embedCardView-content-wrap[layout='wrap-left']": {
26
+ clear: 'both'
27
+ }
28
+ }
29
+ }) : css({
5
30
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
6
31
  '.ProseMirror': {
7
32
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
@@ -6,7 +6,6 @@
6
6
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
7
  import { css } from '@emotion/react';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
9
  import editorUGCToken from '../../ugc-tokens/get-editor-ugc-token';
11
10
  const headingWithAlignmentStyles = () =>
12
11
  // Override marginTop: 0 with default margin found in headingsSharedStyles for first heading in alignment block that is not the first child
@@ -42,7 +41,7 @@ fg('platform_editor_heading_margin_fix') ? {
42
41
  // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
43
42
  // text sizing prototype: http://proto/fabricrender/
44
43
  export const headingsSharedStyles = typographyTheme => {
45
- const isADSTokenMigrationEnabled = editorExperiment('typography_migration_ugc', true);
44
+ const isADSTokenMigrationEnabled = fg('platform_editor_typography_ugc');
46
45
  if (isADSTokenMigrationEnabled) {
47
46
  return css({
48
47
  '& h1': {
@@ -66,6 +65,7 @@ export const headingsSharedStyles = typographyTheme => {
66
65
  },
67
66
  '& h5': {
68
67
  font: editorUGCToken('editor.font.heading.h5', typographyTheme),
68
+ marginTop: '1.667em',
69
69
  textTransform: 'none'
70
70
  },
71
71
  '& h6': {
@@ -1,5 +1,6 @@
1
1
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
2
2
  import { css } from '@emotion/react';
3
+ import { akEditorWrappedNodeZIndex } from '@atlaskit/editor-shared-styles';
3
4
  const richMediaClassName = 'rich-media-item';
4
5
  const wrappedMediaBreakoutPoint = 410;
5
6
  const mediaSingleSharedStyle = css({
@@ -62,6 +63,72 @@ const mediaSingleSharedStyle = css({
62
63
  }
63
64
  }
64
65
  });
66
+ const mediaSingleSharedStyleNew = css({
67
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
68
+ [`li .${richMediaClassName}`]: {
69
+ margin: 0
70
+ },
71
+ // Hack for chrome to fix media single position inside a list when media is the first child
72
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
73
+ '&.ua-chrome li > .mediaSingleView-content-wrap::before': {
74
+ content: "''",
75
+ display: 'block',
76
+ height: 0
77
+ },
78
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
79
+ '&.ua-firefox': {
80
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
81
+ '.mediaSingleView-content-wrap': {
82
+ userSelect: 'none'
83
+ },
84
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
85
+ '.captionView-content-wrap': {
86
+ userSelect: 'text'
87
+ }
88
+ },
89
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
90
+ ".mediaSingleView-content-wrap[layout^='wrap-']": {
91
+ position: 'relative',
92
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
93
+ zIndex: akEditorWrappedNodeZIndex
94
+ },
95
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
96
+ ".mediaSingleView-content-wrap[layout='center']": {
97
+ clear: 'both'
98
+ },
99
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
100
+ [`table .${richMediaClassName}`]: {
101
+ marginTop: "var(--ds-space-150, 12px)",
102
+ marginBottom: "var(--ds-space-150, 12px)",
103
+ clear: 'both',
104
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
105
+ '&.image-wrap-left[data-layout], &.image-wrap-right[data-layout]': {
106
+ clear: 'none',
107
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
108
+ '&:first-child': {
109
+ marginTop: "var(--ds-space-150, 12px)"
110
+ }
111
+ }
112
+ },
113
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
114
+ [`.${richMediaClassName}.image-wrap-right + .${richMediaClassName}.image-wrap-left`]: {
115
+ clear: 'both'
116
+ },
117
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
118
+ [`.${richMediaClassName}.image-wrap-left + .${richMediaClassName}.image-wrap-right, .${richMediaClassName}.image-wrap-right + .${richMediaClassName}.image-wrap-left, .${richMediaClassName}.image-wrap-left + .${richMediaClassName}.image-wrap-left, .${richMediaClassName}.image-wrap-right + .${richMediaClassName}.image-wrap-right`]: {
119
+ marginRight: 0,
120
+ marginLeft: 0
121
+ },
122
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
123
+ [`@media all and (max-width: ${wrappedMediaBreakoutPoint}px)`]: {
124
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
125
+ "div.mediaSingleView-content-wrap[layout='wrap-left'], div.mediaSingleView-content-wrap[data-layout='wrap-left'], div.mediaSingleView-content-wrap[layout='wrap-right'], div.mediaSingleView-content-wrap[data-layout='wrap-right']": {
126
+ float: 'none',
127
+ overflow: 'auto',
128
+ margin: `${"var(--ds-space-150, 12px)"} 0`
129
+ }
130
+ }
131
+ });
65
132
 
66
133
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
67
- export { mediaSingleSharedStyle, richMediaClassName };
134
+ export { mediaSingleSharedStyle, mediaSingleSharedStyleNew, richMediaClassName };
@@ -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.3.1";
16
+ const packageVersion = "94.5.0";
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
@@ -13,7 +13,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
13
13
  import Tooltip from '@atlaskit/tooltip';
14
14
  import { DropdownMenuSharedCssClassName } from '../../styles';
15
15
  import { KeyDownHandlerContext } from '../../ui-menu/ToolbarArrowKeyNavigationProvider';
16
- import { withReactEditorViewOuterListeners } from '../../ui-react';
16
+ import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners } from '../../ui-react';
17
17
  import DropList from '../../ui/DropList';
18
18
  import Popup from '../../ui/Popup';
19
19
  import { ArrowKeyNavigationProvider } from '../ArrowKeyNavigationProvider';
@@ -74,7 +74,13 @@ const buttonStyles = (isActive, submenuActive) => {
74
74
  `; // The default focus-visible style is removed to ensure consistency across browsers
75
75
  }
76
76
  };
77
- const DropListWithOutsideListeners = withReactEditorViewOuterListeners(DropList);
77
+ const DropListWithOutsideClickTargetRef = props => {
78
+ const setOutsideClickTargetRef = React.useContext(OutsideClickTargetRefContext);
79
+ return jsx(DropList, _extends({
80
+ onDroplistRef: setOutsideClickTargetRef
81
+ }, props));
82
+ };
83
+ const DropListWithOutsideListeners = withReactEditorViewOuterListeners(DropListWithOutsideClickTargetRef);
78
84
 
79
85
  /**
80
86
  * Wrapper around @atlaskit/droplist which uses Popup and Portal to render
@@ -311,7 +317,9 @@ export function DropdownMenuItem({
311
317
  // From time to time we don't want to have any tabIndex on item wrapper
312
318
  // especially when we pass any interactive element as a item.content
313
319
  const tabIndex = item.wrapperTabIndex === null ? undefined : item.wrapperTabIndex || -1;
314
- const dropListItem = jsx("div", {
320
+ const dropListItem =
321
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
322
+ jsx("div", {
315
323
  css: () => buttonStyles(item.isActive, submenuActive),
316
324
  tabIndex: tabIndex,
317
325
  "aria-disabled": item.isDisabled ? 'true' : 'false',
@@ -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) {
@@ -5,6 +5,8 @@ export var LAYOUT_TYPE = /*#__PURE__*/function (LAYOUT_TYPE) {
5
5
  LAYOUT_TYPE["LEFT_SIDEBAR"] = "twoColumnsLeftSidebar";
6
6
  LAYOUT_TYPE["RIGHT_SIDEBAR"] = "twoColumnsRightSidebar";
7
7
  LAYOUT_TYPE["THREE_WITH_SIDEBARS"] = "threeColumnsWithSidebars ";
8
+ LAYOUT_TYPE["FOUR_COLS_EQUAL"] = "fourColumnsEqual";
9
+ LAYOUT_TYPE["FIVE_COLS_EQUAL"] = "fiveColumnsEqual";
8
10
  return LAYOUT_TYPE;
9
11
  }({});
10
12
  export var SMART_LINK_TYPE = /*#__PURE__*/function (SMART_LINK_TYPE) {
@@ -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
  });