@atlaskit/renderer 84.1.0 → 87.0.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 (194) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/dist/cjs/actions/index.js +3 -3
  3. package/dist/cjs/analytics/enums.js +1 -0
  4. package/dist/cjs/analytics/unsupported-content.js +3 -3
  5. package/dist/cjs/messages.js +47 -1
  6. package/dist/cjs/react/hooks/use-observed-width.js +94 -0
  7. package/dist/cjs/react/index.js +15 -9
  8. package/dist/cjs/react/marks/annotation.js +2 -2
  9. package/dist/cjs/react/marks/breakout.js +5 -3
  10. package/dist/cjs/react/nodes/blockCard.js +2 -2
  11. package/dist/cjs/react/nodes/caption.js +2 -2
  12. package/dist/cjs/react/nodes/copy-text-provider.js +2 -1
  13. package/dist/cjs/react/nodes/date.js +6 -4
  14. package/dist/cjs/react/nodes/embedCard.js +5 -5
  15. package/dist/cjs/react/nodes/emoji.js +2 -2
  16. package/dist/cjs/react/nodes/extension.js +6 -4
  17. package/dist/cjs/react/nodes/heading-anchor.js +11 -3
  18. package/dist/cjs/react/nodes/index.js +80 -55
  19. package/dist/cjs/react/nodes/inlineCard.js +14 -3
  20. package/dist/cjs/react/nodes/layoutColumn.js +2 -2
  21. package/dist/cjs/react/nodes/media.js +5 -3
  22. package/dist/cjs/react/nodes/mediaGroup.js +2 -2
  23. package/dist/cjs/react/nodes/mediaInline.js +2 -2
  24. package/dist/cjs/react/nodes/mediaSingle/index.js +146 -152
  25. package/dist/cjs/react/nodes/mediaSingle/styles.js +2 -2
  26. package/dist/cjs/react/nodes/mention.js +2 -4
  27. package/dist/cjs/react/nodes/panel.js +18 -20
  28. package/dist/cjs/react/nodes/status.js +2 -1
  29. package/dist/cjs/react/nodes/table/colgroup.js +2 -2
  30. package/dist/cjs/react/nodes/table/sticky.js +4 -4
  31. package/dist/cjs/react/nodes/table.js +19 -13
  32. package/dist/cjs/react/nodes/tableCell.js +34 -21
  33. package/dist/cjs/react/nodes/tableRow.js +6 -4
  34. package/dist/cjs/react/nodes/task-item-with-providers.js +6 -2
  35. package/dist/cjs/react/nodes/taskItem.js +4 -3
  36. package/dist/cjs/render-document.js +19 -3
  37. package/dist/cjs/text/nodes/date.js +3 -3
  38. package/dist/cjs/types/smartLinksOptions.js +5 -0
  39. package/dist/cjs/ui/Expand.js +9 -9
  40. package/dist/cjs/ui/ExtensionRenderer.js +8 -4
  41. package/dist/cjs/ui/MediaCard.js +4 -4
  42. package/dist/cjs/ui/Renderer/breakout-ssr.js +50 -7
  43. package/dist/cjs/ui/Renderer/index.js +23 -18
  44. package/dist/cjs/ui/SortingIcon.js +30 -17
  45. package/dist/cjs/ui/annotations/draft/component.js +2 -2
  46. package/dist/cjs/ui/annotations/element/index.js +2 -2
  47. package/dist/cjs/ui/annotations/element/mark.js +4 -4
  48. package/dist/cjs/ui/annotations/hooks/use-events.js +11 -11
  49. package/dist/cjs/ui/annotations/hooks/use-load-annotations.js +4 -4
  50. package/dist/cjs/utils.js +4 -3
  51. package/dist/cjs/version.json +1 -1
  52. package/dist/es2019/actions/index.js +1 -1
  53. package/dist/es2019/analytics/enums.js +1 -0
  54. package/dist/es2019/analytics/unsupported-content.js +1 -1
  55. package/dist/es2019/messages.js +44 -0
  56. package/dist/es2019/react/hooks/use-observed-width.js +59 -0
  57. package/dist/es2019/react/index.js +4 -1
  58. package/dist/es2019/react/marks/breakout.js +2 -1
  59. package/dist/es2019/react/nodes/blockCard.js +1 -1
  60. package/dist/es2019/react/nodes/caption.js +1 -1
  61. package/dist/es2019/react/nodes/copy-text-provider.js +2 -1
  62. package/dist/es2019/react/nodes/date.js +2 -1
  63. package/dist/es2019/react/nodes/embedCard.js +1 -1
  64. package/dist/es2019/react/nodes/emoji.js +1 -1
  65. package/dist/es2019/react/nodes/extension.js +2 -1
  66. package/dist/es2019/react/nodes/heading-anchor.js +11 -2
  67. package/dist/es2019/react/nodes/index.js +32 -7
  68. package/dist/es2019/react/nodes/inlineCard.js +12 -2
  69. package/dist/es2019/react/nodes/layoutColumn.js +1 -1
  70. package/dist/es2019/react/nodes/media.js +2 -1
  71. package/dist/es2019/react/nodes/mediaInline.js +1 -1
  72. package/dist/es2019/react/nodes/mediaSingle/index.js +132 -112
  73. package/dist/es2019/react/nodes/mediaSingle/styles.js +1 -1
  74. package/dist/es2019/react/nodes/mention.js +1 -3
  75. package/dist/es2019/react/nodes/panel.js +14 -12
  76. package/dist/es2019/react/nodes/status.js +2 -1
  77. package/dist/es2019/react/nodes/table/colgroup.js +1 -1
  78. package/dist/es2019/react/nodes/table/sticky.js +1 -1
  79. package/dist/es2019/react/nodes/table.js +4 -1
  80. package/dist/es2019/react/nodes/tableCell.js +22 -10
  81. package/dist/es2019/react/nodes/tableRow.js +2 -1
  82. package/dist/es2019/react/nodes/task-item-with-providers.js +3 -1
  83. package/dist/es2019/react/nodes/taskItem.js +2 -1
  84. package/dist/es2019/render-document.js +18 -2
  85. package/dist/es2019/text/nodes/date.js +1 -1
  86. package/dist/es2019/types/smartLinksOptions.js +1 -0
  87. package/dist/es2019/ui/Expand.js +1 -1
  88. package/dist/es2019/ui/ExtensionRenderer.js +3 -1
  89. package/dist/es2019/ui/MediaCard.js +1 -1
  90. package/dist/es2019/ui/Renderer/breakout-ssr.js +46 -5
  91. package/dist/es2019/ui/Renderer/index.js +4 -1
  92. package/dist/es2019/ui/SortingIcon.js +23 -11
  93. package/dist/es2019/ui/annotations/draft/component.js +1 -1
  94. package/dist/es2019/ui/annotations/element/index.js +1 -1
  95. package/dist/es2019/ui/annotations/element/mark.js +1 -1
  96. package/dist/es2019/ui/annotations/hooks/use-events.js +1 -1
  97. package/dist/es2019/ui/annotations/hooks/use-load-annotations.js +1 -1
  98. package/dist/es2019/version.json +1 -1
  99. package/dist/esm/actions/index.js +1 -1
  100. package/dist/esm/analytics/enums.js +1 -0
  101. package/dist/esm/analytics/unsupported-content.js +1 -1
  102. package/dist/esm/messages.js +44 -0
  103. package/dist/esm/react/hooks/use-observed-width.js +80 -0
  104. package/dist/esm/react/index.js +8 -4
  105. package/dist/esm/react/marks/annotation.js +2 -2
  106. package/dist/esm/react/marks/breakout.js +2 -1
  107. package/dist/esm/react/nodes/blockCard.js +1 -1
  108. package/dist/esm/react/nodes/caption.js +1 -1
  109. package/dist/esm/react/nodes/copy-text-provider.js +2 -1
  110. package/dist/esm/react/nodes/date.js +2 -1
  111. package/dist/esm/react/nodes/embedCard.js +1 -1
  112. package/dist/esm/react/nodes/emoji.js +1 -1
  113. package/dist/esm/react/nodes/extension.js +2 -1
  114. package/dist/esm/react/nodes/heading-anchor.js +12 -3
  115. package/dist/esm/react/nodes/index.js +62 -7
  116. package/dist/esm/react/nodes/inlineCard.js +12 -2
  117. package/dist/esm/react/nodes/layoutColumn.js +1 -1
  118. package/dist/esm/react/nodes/media.js +2 -1
  119. package/dist/esm/react/nodes/mediaGroup.js +2 -2
  120. package/dist/esm/react/nodes/mediaInline.js +1 -1
  121. package/dist/esm/react/nodes/mediaSingle/index.js +140 -141
  122. package/dist/esm/react/nodes/mediaSingle/styles.js +1 -1
  123. package/dist/esm/react/nodes/mention.js +1 -3
  124. package/dist/esm/react/nodes/panel.js +14 -12
  125. package/dist/esm/react/nodes/status.js +2 -1
  126. package/dist/esm/react/nodes/table/colgroup.js +1 -1
  127. package/dist/esm/react/nodes/table/sticky.js +1 -1
  128. package/dist/esm/react/nodes/table.js +4 -1
  129. package/dist/esm/react/nodes/tableCell.js +19 -9
  130. package/dist/esm/react/nodes/tableRow.js +2 -1
  131. package/dist/esm/react/nodes/task-item-with-providers.js +5 -2
  132. package/dist/esm/react/nodes/taskItem.js +2 -1
  133. package/dist/esm/render-document.js +17 -2
  134. package/dist/esm/text/nodes/date.js +1 -1
  135. package/dist/esm/types/smartLinksOptions.js +1 -0
  136. package/dist/esm/ui/Expand.js +1 -1
  137. package/dist/esm/ui/ExtensionRenderer.js +3 -1
  138. package/dist/esm/ui/MediaCard.js +3 -3
  139. package/dist/esm/ui/Renderer/breakout-ssr.js +48 -5
  140. package/dist/esm/ui/Renderer/index.js +6 -3
  141. package/dist/esm/ui/SortingIcon.js +21 -11
  142. package/dist/esm/ui/annotations/draft/component.js +1 -1
  143. package/dist/esm/ui/annotations/element/index.js +1 -1
  144. package/dist/esm/ui/annotations/element/mark.js +3 -3
  145. package/dist/esm/ui/annotations/hooks/use-events.js +3 -3
  146. package/dist/esm/ui/annotations/hooks/use-load-annotations.js +3 -3
  147. package/dist/esm/utils.js +3 -2
  148. package/dist/esm/version.json +1 -1
  149. package/dist/types/actions/index.d.ts +1 -1
  150. package/dist/types/analytics/enums.d.ts +2 -1
  151. package/dist/types/analytics/events.d.ts +5 -2
  152. package/dist/types/analytics/unsupported-content.d.ts +1 -1
  153. package/dist/types/messages.d.ts +44 -0
  154. package/dist/types/react/hooks/use-observed-width.d.ts +3 -0
  155. package/dist/types/react/index.d.ts +6 -1
  156. package/dist/types/react/nodes/blockCard.d.ts +1 -1
  157. package/dist/types/react/nodes/bodiedExtension.d.ts +2 -1
  158. package/dist/types/react/nodes/codeBlock.d.ts +3 -3
  159. package/dist/types/react/nodes/embedCard.d.ts +1 -1
  160. package/dist/types/react/nodes/emoji.d.ts +1 -1
  161. package/dist/types/react/nodes/extension.d.ts +14 -13
  162. package/dist/types/react/nodes/index.d.ts +39 -15
  163. package/dist/types/react/nodes/inlineCard.d.ts +23 -21
  164. package/dist/types/react/nodes/inlineExtension.d.ts +2 -1
  165. package/dist/types/react/nodes/media.d.ts +2 -2
  166. package/dist/types/react/nodes/mediaGroup.d.ts +1 -1
  167. package/dist/types/react/nodes/mediaInline.d.ts +1 -1
  168. package/dist/types/react/nodes/mediaSingle/index.d.ts +3 -7
  169. package/dist/types/react/nodes/mediaSingle/styles.d.ts +1 -1
  170. package/dist/types/react/nodes/mention.d.ts +2 -2
  171. package/dist/types/react/nodes/panel.d.ts +3 -1
  172. package/dist/types/react/nodes/table/sticky.d.ts +1 -1
  173. package/dist/types/react/nodes/table.d.ts +22 -21
  174. package/dist/types/react/nodes/tableCell.d.ts +7 -60
  175. package/dist/types/react/nodes/tableRow.d.ts +1 -1
  176. package/dist/types/react/nodes/task-item-with-providers.d.ts +2 -1
  177. package/dist/types/react/nodes/taskItem.d.ts +1 -1
  178. package/dist/types/react/types.d.ts +3 -1
  179. package/dist/types/react/utils/getCardClickHandler.d.ts +1 -1
  180. package/dist/types/render-document.d.ts +1 -1
  181. package/dist/types/types/smartLinksOptions.d.ts +3 -0
  182. package/dist/types/ui/ExtensionRenderer.d.ts +3 -1
  183. package/dist/types/ui/MediaCard.d.ts +3 -2
  184. package/dist/types/ui/SortingIcon.d.ts +7 -4
  185. package/dist/types/ui/annotations/context.d.ts +1 -1
  186. package/dist/types/ui/annotations/element/mark.d.ts +1 -1
  187. package/dist/types/ui/annotations/hooks/use-events.d.ts +2 -1
  188. package/dist/types/ui/annotations/hooks/use-inline-comment-subscriber.d.ts +1 -1
  189. package/dist/types/ui/annotations/selection/mounter.d.ts +1 -1
  190. package/dist/types/ui/annotations/selection/range-validator.d.ts +1 -1
  191. package/dist/types/ui/annotations/types.d.ts +1 -1
  192. package/dist/types/ui/renderer-props.d.ts +8 -1
  193. package/dist/types/utils.d.ts +3 -1
  194. package/package.json +21 -22
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useMemo, useContext, useState, useRef } from 'react';
3
3
  import { Card, Context as CardContext, EmbedResizeMessageListener } from '@atlaskit/smart-card';
4
- import { WidthConsumer, mapBreakpointToLayoutMaxWidth, UnsupportedBlock, MediaSingle as UIMediaSingle } from '@atlaskit/editor-common';
4
+ import { WidthConsumer, mapBreakpointToLayoutMaxWidth, UnsupportedBlock, MediaSingle as UIMediaSingle } from '@atlaskit/editor-common/ui';
5
5
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, getAkEditorFullPageMaxWidth } from '@atlaskit/editor-shared-styles';
6
6
  import { getPlatform } from '../../utils';
7
7
  import { CardErrorBoundary } from './fallback';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { PureComponent } from 'react';
3
- import { Emoji } from '@atlaskit/editor-common';
3
+ import { Emoji } from '@atlaskit/editor-common/emoji';
4
4
  export default class EmojiItem extends PureComponent {
5
5
  render() {
6
6
  const {
@@ -1,7 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import ExtensionRenderer from '../../ui/ExtensionRenderer';
4
- import { calcBreakoutWidth, overflowShadow, WidthConsumer } from '@atlaskit/editor-common';
4
+ import { overflowShadow, WidthConsumer } from '@atlaskit/editor-common/ui';
5
+ import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
5
6
  import { RendererCssClassName } from '../../consts';
6
7
  export const renderExtension = (content, layout, options = {}, removeOverflow) => {
7
8
  const overflowContainerClass = !removeOverflow ? RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER : ''; // by default, we assume the extension is at top level, (direct child of doc node)
@@ -39,11 +39,19 @@ class HeadingAnchor extends React.PureComponent {
39
39
 
40
40
  _defineProperty(this, "setTooltipState", (message, isClicked = false) => {
41
41
  this.setState({
42
+ // TODO: ED-14403 investigate why this does not translate
42
43
  tooltipMessage: this.props.intl.formatMessage(message),
43
44
  isClicked
44
45
  });
45
46
  });
46
47
 
48
+ _defineProperty(this, "getCopyAriaLabel", () => {
49
+ const {
50
+ copyAriaLabel
51
+ } = headingAnchorLinkMessages;
52
+ return this.props.intl.formatMessage(copyAriaLabel);
53
+ });
54
+
47
55
  _defineProperty(this, "copyToClipboard", async event => {
48
56
  const {
49
57
  copiedHeadingLinkToClipboard,
@@ -66,9 +74,10 @@ class HeadingAnchor extends React.PureComponent {
66
74
  _defineProperty(this, "renderAnchorButton", () => {
67
75
  return /*#__PURE__*/React.createElement(CopyAnchorButton, {
68
76
  onMouseLeave: this.resetMessage,
69
- onClick: this.copyToClipboard
77
+ onClick: this.copyToClipboard,
78
+ "aria-label": this.state.tooltipMessage
70
79
  }, /*#__PURE__*/React.createElement(LinkIcon, {
71
- label: "copy",
80
+ label: this.getCopyAriaLabel(),
72
81
  size: this.props.level > 3 ? 'small' : 'medium',
73
82
  primaryColor: this.state.isClicked ? B400 : N200
74
83
  }));
@@ -1,7 +1,7 @@
1
+ import Loadable from 'react-loadable';
1
2
  import Blockquote from './blockquote';
2
3
  import BodiedExtension from './bodiedExtension';
3
4
  import BulletList from './bulletList';
4
- import DecisionList from './decisionList';
5
5
  import Doc, { DocWithSelectAllTrap } from './doc';
6
6
  import Extension from './extension';
7
7
  import HardBreak from './hardBreak';
@@ -10,33 +10,40 @@ import InlineExtension from './inlineExtension';
10
10
  import LayoutSection from './layoutSection';
11
11
  import LayoutColumn from './layoutColumn';
12
12
  import ListItem from './listItem';
13
- import MediaSingle from './mediaSingle';
14
13
  import Caption from './caption';
15
14
  import OrderedList from './orderedList';
16
- import Panel from './panel';
17
15
  import Paragraph from './paragraph';
18
16
  import Placeholder from './placeholder';
19
17
  import Rule from './rule';
20
- import TaskList from './taskList';
21
18
  import Table from './table';
22
19
  import { TableCell, TableHeader } from './tableCell';
23
20
  import TableRow from './tableRow';
24
21
  import UnknownBlock from './unknownBlock';
25
- import Loadable from 'react-loadable';
26
- import EmbedCard from './embedCard';
27
- import { UnsupportedBlock, UnsupportedInline } from '@atlaskit/editor-common';
22
+ import { UnsupportedBlock, UnsupportedInline } from '@atlaskit/editor-common/ui';
28
23
  const CodeBlock = Loadable({
29
24
  loader: () => import(
30
25
  /* webpackChunkName: "@atlaskit-internal_renderer-node_CodeBlock" */
31
26
  './codeBlock').then(mod => mod.default),
32
27
  loading: () => null
33
28
  });
29
+ const TaskList = Loadable({
30
+ loader: () => import(
31
+ /* webpackChunkName: "@atlaskit-internal_renderer-node_TaskList" */
32
+ './taskList').then(mod => mod.default),
33
+ loading: () => null
34
+ });
34
35
  const TaskItem = Loadable({
35
36
  loader: () => import(
36
37
  /* webpackChunkName: "@atlaskit-internal_renderer-node_TaskItem" */
37
38
  './taskItem').then(mod => mod.default),
38
39
  loading: () => null
39
40
  });
41
+ const DecisionList = Loadable({
42
+ loader: () => import(
43
+ /* webpackChunkName: "@atlaskit-internal_renderer-node_DecisionList" */
44
+ './decisionList').then(mod => mod.default),
45
+ loading: () => null
46
+ });
40
47
  const DecisionItem = Loadable({
41
48
  loader: () => import(
42
49
  /* webpackChunkName: "@atlaskit-internal_renderer-node_DecisionItem" */
@@ -61,6 +68,18 @@ const Emoji = Loadable({
61
68
  './emoji').then(mod => mod.default),
62
69
  loading: () => null
63
70
  });
71
+ const Panel = Loadable({
72
+ loader: () => import(
73
+ /* webpackChunkName: "@atlaskit-internal_renderer-node_Panel" */
74
+ './panel').then(mod => mod.default),
75
+ loading: () => null
76
+ });
77
+ const EmbedCard = Loadable({
78
+ loader: () => import(
79
+ /* webpackChunkName: "@atlaskit-internal_renderer-node_EmbedCard" */
80
+ './embedCard').then(mod => mod.default),
81
+ loading: () => null
82
+ });
64
83
  const InlineCard = Loadable({
65
84
  loader: () => import(
66
85
  /* webpackChunkName: "@atlaskit-internal_renderer-node_InlineCard" */
@@ -91,6 +110,12 @@ const MediaInline = Loadable({
91
110
  './mediaInline').then(mod => mod.default),
92
111
  loading: () => null
93
112
  });
113
+ const MediaSingle = Loadable({
114
+ loader: () => import(
115
+ /* webpackChunkName: "@atlaskit-internal_renderer-node_MediaSingle" */
116
+ './mediaSingle').then(mod => mod.default),
117
+ loading: () => null
118
+ });
94
119
  const Mention = Loadable({
95
120
  loader: () => import(
96
121
  /* webpackChunkName: "@atlaskit-internal_renderer-node_Mention" */
@@ -1,7 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import { Card } from '@atlaskit/smart-card';
4
- import { UnsupportedInline } from '@atlaskit/editor-common';
4
+ import { CardSSR } from '@atlaskit/smart-card/ssr';
5
+ import { UnsupportedInline } from '@atlaskit/editor-common/ui';
5
6
  import { CardErrorBoundary } from './fallback';
6
7
  import { withSmartCardStorage } from '../../ui/SmartCardStorage';
7
8
  import { getCardClickHandler } from '../utils/getCardClickHandler';
@@ -11,7 +12,8 @@ const InlineCard = props => {
11
12
  url,
12
13
  data,
13
14
  eventHandlers,
14
- portal
15
+ portal,
16
+ smartLinks
15
17
  } = props;
16
18
  const onClick = getCardClickHandler(eventHandlers, url);
17
19
  const cardProps = {
@@ -20,6 +22,14 @@ const InlineCard = props => {
20
22
  onClick,
21
23
  container: portal
22
24
  };
25
+
26
+ if (smartLinks !== null && smartLinks !== void 0 && smartLinks.ssr && url) {
27
+ return /*#__PURE__*/React.createElement(CardSSR, {
28
+ appearance: "inline",
29
+ url: url
30
+ });
31
+ }
32
+
23
33
  return /*#__PURE__*/React.createElement("span", {
24
34
  "data-inline-card": true,
25
35
  "data-card-data": data ? JSON.stringify(data) : undefined,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { WidthProvider, ClearNextSiblingMarginTop } from '@atlaskit/editor-common';
2
+ import { WidthProvider, ClearNextSiblingMarginTop } from '@atlaskit/editor-common/ui';
3
3
  export default function LayoutSection(props) {
4
4
  return /*#__PURE__*/React.createElement("div", {
5
5
  "data-layout-column": true,
@@ -2,7 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React from 'react';
4
4
  import { PureComponent } from 'react';
5
- import { WithProviders, MediaLink } from '@atlaskit/editor-common';
5
+ import { WithProviders } from '@atlaskit/editor-common/provider-factory';
6
+ import { MediaLink } from '@atlaskit/editor-common/ui';
6
7
  import { MediaCard } from '../../ui/MediaCard';
7
8
  import { getEventHandler } from '../../utils';
8
9
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics/enums';
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { MediaInlineCard } from '@atlaskit/media-card';
3
- import { WithProviders } from '@atlaskit/editor-common';
3
+ import { WithProviders } from '@atlaskit/editor-common/provider-factory';
4
4
  export const RenderMediaInline = props => {
5
5
  const {
6
6
  mediaProvider
@@ -1,11 +1,11 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { mapBreakpointToLayoutMaxWidth, WidthConsumer } from '@atlaskit/editor-common';
3
- import { akEditorFullWidthLayoutWidth, getAkEditorFullPageMaxWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
4
- import { Component, default as React } from 'react';
1
+ import { default as React } from 'react';
5
2
  import { injectIntl } from 'react-intl-next';
3
+ import { getMediaFeatureFlag } from '@atlaskit/media-common';
4
+ import { mapBreakpointToLayoutMaxWidth, getBreakpoint, WidthConsumer } from '@atlaskit/editor-common/ui';
5
+ import { akEditorFullWidthLayoutWidth, getAkEditorFullPageMaxWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
6
6
  import { FullPagePadding } from '../../../ui/Renderer/style';
7
+ import { useObservedWidth } from '../../hooks/use-observed-width';
7
8
  import { ExtendedUIMediaSingle } from './styles';
8
- import { getMediaFeatureFlag } from '@atlaskit/media-common';
9
9
  const DEFAULT_WIDTH = 250;
10
10
  const DEFAULT_HEIGHT = 200;
11
11
 
@@ -39,131 +39,151 @@ export const getMediaContainerWidth = (currentContainerWidth, layout) => {
39
39
  return !currentContainerWidth && layout !== 'full-width' && layout !== 'wide' ? akEditorDefaultLayoutWidth : currentContainerWidth;
40
40
  };
41
41
 
42
- class MediaSingle extends Component {
43
- constructor(props) {
44
- super(props);
42
+ const MediaSingle = props => {
43
+ var _ref$current;
45
44
 
46
- _defineProperty(this, "onExternalImageLoaded", ({
45
+ const {
46
+ rendererAppearance,
47
+ featureFlags,
48
+ isInsideOfBlockNode,
49
+ allowDynamicTextSizing,
50
+ layout,
51
+ children,
52
+ width: pctWidth
53
+ } = props;
54
+ const isCaptionsFlaggedOn = getMediaFeatureFlag('captions', featureFlags);
55
+ const [externalImageDimensions, setExternalImageDimensions] = React.useState({
56
+ width: 0,
57
+ height: 0
58
+ });
59
+ const ref = React.useRef(null);
60
+ const onExternalImageLoaded = React.useCallback(({
61
+ width,
62
+ height
63
+ }) => {
64
+ setExternalImageDimensions({
47
65
  width,
48
66
  height
49
- }) => {
50
- this.setState({
51
- width,
52
- height
53
- });
54
67
  });
68
+ }, []);
69
+ const observedWidthFlag = getMediaFeatureFlag('observedWidth', featureFlags);
70
+ const {
71
+ width: observedWidth
72
+ } = useObservedWidth((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.parentElement, observedWidthFlag);
73
+ let media;
74
+ const [node, caption] = React.Children.toArray(children);
55
75
 
56
- _defineProperty(this, "isCaptionsFlaggedOn", getMediaFeatureFlag('captions', this.props.featureFlags));
76
+ if (!isMediaElement(node)) {
77
+ const mediaElement = checkForMediaElement(node.props.children);
57
78
 
58
- this.state = {}; // Need to initialize with empty state.
59
- }
79
+ if (!mediaElement) {
80
+ return node;
81
+ }
60
82
 
61
- render() {
62
- const {
63
- props
64
- } = this;
65
- let media;
66
- const [node, caption] = React.Children.toArray(props.children);
83
+ media = mediaElement;
84
+ } else {
85
+ media = node;
86
+ }
67
87
 
68
- if (!isMediaElement(node)) {
69
- const mediaElement = checkForMediaElement(node.props.children);
88
+ let {
89
+ width = DEFAULT_WIDTH,
90
+ height = DEFAULT_HEIGHT,
91
+ type
92
+ } = media.props;
70
93
 
71
- if (!mediaElement) {
72
- return node;
73
- }
94
+ if (type === 'external') {
95
+ const {
96
+ width: stateWidth,
97
+ height: stateHeight
98
+ } = externalImageDimensions;
74
99
 
75
- media = mediaElement;
76
- } else {
77
- media = node;
100
+ if (width === null) {
101
+ width = stateWidth || DEFAULT_WIDTH;
78
102
  }
79
103
 
80
- let {
81
- width = DEFAULT_WIDTH,
82
- height = DEFAULT_HEIGHT,
83
- type
84
- } = media.props;
85
-
86
- if (type === 'external') {
87
- const {
88
- width: stateWidth,
89
- height: stateHeight
90
- } = this.state;
91
-
92
- if (width === null) {
93
- width = stateWidth || DEFAULT_WIDTH;
94
- }
104
+ if (height === null) {
105
+ height = stateHeight || DEFAULT_HEIGHT;
106
+ }
107
+ }
95
108
 
96
- if (height === null) {
97
- height = stateHeight || DEFAULT_HEIGHT;
109
+ if (width === null) {
110
+ width = DEFAULT_WIDTH;
111
+ height = DEFAULT_HEIGHT;
112
+ } // TODO: put appearance-based padding into theme instead
113
+
114
+
115
+ const padding = rendererAppearance === 'full-page' ? FullPagePadding * 2 : 0;
116
+ const isFullWidth = rendererAppearance === 'full-width';
117
+
118
+ const calcDimensions = (mediaContainerWidth, mediaBreakpoint) => {
119
+ const containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
120
+ const breakpoint = mediaBreakpoint || getBreakpoint(containerWidth);
121
+ const maxWidth = containerWidth;
122
+ const maxHeight = height / width * maxWidth;
123
+ const cardDimensions = {
124
+ width: `${maxWidth}px`,
125
+ height: `${maxHeight}px`
126
+ };
127
+ let nonFullWidthSize = containerWidth;
128
+
129
+ if (!isInsideOfBlockNode && rendererAppearance !== 'comment') {
130
+ const isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >= getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
131
+
132
+ if (isContainerSizeGreaterThanMaxFullPageWidth && allowDynamicTextSizing) {
133
+ nonFullWidthSize = mapBreakpointToLayoutMaxWidth(breakpoint);
134
+ } else if (isContainerSizeGreaterThanMaxFullPageWidth) {
135
+ nonFullWidthSize = getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
136
+ } else {
137
+ nonFullWidthSize = containerWidth - padding;
98
138
  }
99
139
  }
100
140
 
101
- if (width === null) {
102
- width = DEFAULT_WIDTH;
103
- height = DEFAULT_HEIGHT;
104
- } // TODO: put appearance-based padding into theme instead
105
-
106
-
141
+ const minWidth = Math.min(akEditorFullWidthLayoutWidth, containerWidth - padding);
142
+ const lineLength = isFullWidth ? minWidth : nonFullWidthSize;
143
+ return {
144
+ cardDimensions,
145
+ lineLength,
146
+ containerWidth
147
+ };
148
+ };
149
+
150
+ const originalDimensions = {
151
+ height,
152
+ width
153
+ };
154
+
155
+ const renderMediaSingle = (renderWidth, mediaBreakpoint) => {
107
156
  const {
108
- rendererAppearance,
157
+ cardDimensions,
158
+ lineLength,
159
+ containerWidth
160
+ } = calcDimensions(renderWidth, mediaBreakpoint);
161
+ const mediaComponent = /*#__PURE__*/React.cloneElement(media, {
162
+ resizeMode: 'stretchy-fit',
163
+ cardDimensions,
164
+ originalDimensions,
165
+ onExternalImageLoaded,
166
+ disableOverlay: true,
109
167
  featureFlags
110
- } = this.props;
111
- const padding = rendererAppearance === 'full-page' ? FullPagePadding * 2 : 0;
112
- return /*#__PURE__*/React.createElement(WidthConsumer, null, ({
113
- width: widthConsumerValue,
114
- breakpoint
115
- }) => {
116
- const containerWidth = getMediaContainerWidth(widthConsumerValue, props.layout);
117
- const {
118
- isInsideOfBlockNode,
119
- allowDynamicTextSizing
120
- } = this.props;
121
- const maxWidth = containerWidth;
122
- const maxHeight = height / width * maxWidth;
123
- const cardDimensions = {
124
- width: `${maxWidth}px`,
125
- height: `${maxHeight}px`
126
- };
127
- const isFullWidth = rendererAppearance === 'full-width';
128
- let nonFullWidthSize = containerWidth;
129
-
130
- if (!isInsideOfBlockNode && rendererAppearance !== 'comment') {
131
- const isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >= getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
132
-
133
- if (isContainerSizeGreaterThanMaxFullPageWidth && allowDynamicTextSizing) {
134
- nonFullWidthSize = mapBreakpointToLayoutMaxWidth(breakpoint);
135
- } else if (isContainerSizeGreaterThanMaxFullPageWidth) {
136
- nonFullWidthSize = getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
137
- } else {
138
- nonFullWidthSize = containerWidth - padding;
139
- }
140
- }
141
-
142
- const lineLength = isFullWidth ? Math.min(akEditorFullWidthLayoutWidth, containerWidth - padding) : nonFullWidthSize;
143
- const originalDimensions = {
144
- height,
145
- width
146
- };
147
- const mediaComponent = /*#__PURE__*/React.cloneElement(media, {
148
- resizeMode: 'stretchy-fit',
149
- cardDimensions,
150
- originalDimensions,
151
- onExternalImageLoaded: this.onExternalImageLoaded,
152
- disableOverlay: true,
153
- featureFlags: featureFlags
154
- });
155
- return /*#__PURE__*/React.createElement(ExtendedUIMediaSingle, {
156
- layout: props.layout,
157
- width: width,
158
- height: height,
159
- lineLength: isInsideOfBlockNode ? containerWidth : lineLength,
160
- containerWidth: containerWidth,
161
- pctWidth: props.width,
162
- fullWidthMode: isFullWidth
163
- }, /*#__PURE__*/React.createElement(React.Fragment, null, mediaComponent), this.isCaptionsFlaggedOn && caption);
164
168
  });
165
- }
166
-
167
- }
169
+ return /*#__PURE__*/React.createElement(ExtendedUIMediaSingle, {
170
+ handleMediaSingleRef: ref,
171
+ layout: layout,
172
+ width: width,
173
+ height: height,
174
+ lineLength: isInsideOfBlockNode ? containerWidth : lineLength,
175
+ containerWidth: containerWidth,
176
+ pctWidth: pctWidth,
177
+ fullWidthMode: isFullWidth
178
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, mediaComponent), isCaptionsFlaggedOn && caption);
179
+ };
180
+
181
+ return observedWidthFlag ? renderMediaSingle(observedWidth || document.body.offsetWidth) : /*#__PURE__*/React.createElement(WidthConsumer, null, ({
182
+ width,
183
+ breakpoint
184
+ }) => {
185
+ return renderMediaSingle(width, breakpoint);
186
+ });
187
+ };
168
188
 
169
189
  export default injectIntl(MediaSingle);
@@ -1,5 +1,5 @@
1
1
  import styled from 'styled-components';
2
- import { MediaSingle as UIMediaSingle } from '@atlaskit/editor-common';
2
+ import { MediaSingle as UIMediaSingle } from '@atlaskit/editor-common/ui';
3
3
  export const ExtendedUIMediaSingle = styled(UIMediaSingle)`
4
4
  ${({
5
5
  layout
@@ -1,12 +1,11 @@
1
1
  import React from 'react';
2
2
  import { PureComponent } from 'react';
3
- import { Mention } from '@atlaskit/editor-common';
3
+ import { Mention } from '@atlaskit/editor-common/mention';
4
4
  export default class MentionItem extends PureComponent {
5
5
  render() {
6
6
  const {
7
7
  eventHandlers,
8
8
  id,
9
- portal,
10
9
  providers,
11
10
  text,
12
11
  accessLevel
@@ -16,7 +15,6 @@ export default class MentionItem extends PureComponent {
16
15
  text: text,
17
16
  accessLevel: accessLevel,
18
17
  providers: providers,
19
- portal: portal,
20
18
  eventHandlers: eventHandlers && eventHandlers.mention
21
19
  });
22
20
  }
@@ -1,19 +1,15 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import InfoIcon from '@atlaskit/icon/glyph/editor/info';
4
3
  import TipIcon from '@atlaskit/icon/glyph/editor/hint';
5
- import SuccessIcon from '@atlaskit/icon/glyph/editor/success';
6
- import ErrorIcon from '@atlaskit/icon/glyph/editor/error';
7
- import NoteIcon from '@atlaskit/icon/glyph/editor/note';
8
- import WarningIcon from '@atlaskit/icon/glyph/warning';
9
4
  import { PanelType } from '@atlaskit/adf-schema';
10
- import { PanelSharedCssClassName } from '@atlaskit/editor-common';
5
+ import { PanelSharedCssClassName } from '@atlaskit/editor-common/styles';
11
6
  import EmojiIcon from '@atlaskit/icon/glyph/editor/emoji';
12
7
  import EmojiItem from './emoji'; // AFP-2532 TODO: Fix automatic suppressions below
13
8
  // eslint-disable-next-line @atlassian/tangerine/import/entry-points
14
9
 
15
10
  import { themed } from '@atlaskit/theme';
16
- import { getPanelBackgroundDarkModeColors } from '@atlaskit/editor-common';
11
+ import { getPanelBackgroundDarkModeColors } from '@atlaskit/editor-common/styles';
12
+ import { PanelInfoIcon, PanelSuccessIcon, PanelNoteIcon, PanelWarningIcon, PanelErrorIcon } from '@atlaskit/editor-common/icons';
17
13
  const PanelStyled = styled.div`
18
14
  ${props => {
19
15
  if (props['data-panel-type'] !== PanelType.CUSTOM || !props.backgroundColor) {
@@ -32,12 +28,12 @@ const PanelStyled = styled.div`
32
28
  }}
33
29
  `;
34
30
  const panelIcons = {
35
- info: InfoIcon,
36
- success: SuccessIcon,
37
- note: NoteIcon,
31
+ info: PanelInfoIcon,
32
+ success: PanelSuccessIcon,
33
+ note: PanelNoteIcon,
38
34
  tip: TipIcon,
39
- warning: WarningIcon,
40
- error: ErrorIcon,
35
+ warning: PanelWarningIcon,
36
+ error: PanelErrorIcon,
41
37
  custom: EmojiIcon
42
38
  };
43
39
 
@@ -47,6 +43,8 @@ const Panel = props => {
47
43
  panelType: type,
48
44
  panelColor,
49
45
  panelIcon,
46
+ panelIconId,
47
+ panelIconText,
50
48
  providers,
51
49
  children
52
50
  } = props; // only allow custom panel type if flag is set
@@ -58,6 +56,8 @@ const Panel = props => {
58
56
  if (panelType === PanelType.CUSTOM) {
59
57
  if (panelIcon && providers) {
60
58
  return /*#__PURE__*/React.createElement(EmojiItem, {
59
+ id: panelIconId,
60
+ text: panelIconText,
61
61
  shortName: panelIcon,
62
62
  providers: providers
63
63
  });
@@ -87,6 +87,8 @@ const Panel = props => {
87
87
  "data-panel-type": panelType,
88
88
  "data-panel-color": panelColor,
89
89
  "data-panel-icon": panelIcon,
90
+ "data-panel-icon-id": panelIconId,
91
+ "data-panel-icon-text": panelIconText,
90
92
  backgroundColor: panelColor
91
93
  }, renderIcon(), /*#__PURE__*/React.createElement("div", {
92
94
  className: PanelSharedCssClassName.content
@@ -16,7 +16,8 @@ export default class Status extends PureComponent {
16
16
  }, /*#__PURE__*/React.createElement(AkStatus, {
17
17
  text: text,
18
18
  color: color,
19
- localId: localId
19
+ localId: localId,
20
+ role: "presentation"
20
21
  }));
21
22
  }
22
23
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common';
2
+ import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
3
3
  import { akEditorTableNumberColumnWidth, akEditorWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorTableLegacyCellMinWidth } from '@atlaskit/editor-shared-styles';
4
4
  import { calcLineLength } from '../../../ui/Renderer/breakout-ssr';
5
5
  // we allow scaling down column widths by no more than 15%
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { TableSharedCssClassName } from '@atlaskit/editor-common';
3
+ import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
4
4
  import { akEditorStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
5
5
  import * as colors from '@atlaskit/theme/colors';
6
6
  const {
@@ -2,7 +2,10 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React from 'react';
4
4
  import styled from 'styled-components';
5
- import { calcTableWidth, WidthConsumer, TableSharedCssClassName, overflowShadow, createCompareNodes, SortOrder, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose, tableMarginTop } from '@atlaskit/editor-common';
5
+ import { calcTableWidth, TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
6
+ import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
7
+ import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
8
+ import { SortOrder } from '@atlaskit/editor-common/types';
6
9
  import { FullPagePadding } from '../../ui/Renderer/style';
7
10
  import { TableHeader } from './tableCell';
8
11
  import { withSmartCardStorage } from '../../ui/SmartCardStorage';