@atlaskit/renderer 84.0.0 → 86.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 (200) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/dist/cjs/actions/index.js +3 -3
  3. package/dist/cjs/analytics/enums.js +2 -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/marks/textColor.js +15 -4
  11. package/dist/cjs/react/nodes/blockCard.js +2 -2
  12. package/dist/cjs/react/nodes/caption.js +2 -2
  13. package/dist/cjs/react/nodes/copy-text-provider.js +2 -1
  14. package/dist/cjs/react/nodes/date.js +6 -4
  15. package/dist/cjs/react/nodes/embedCard.js +5 -5
  16. package/dist/cjs/react/nodes/emoji.js +2 -2
  17. package/dist/cjs/react/nodes/extension.js +6 -4
  18. package/dist/cjs/react/nodes/heading-anchor.js +11 -3
  19. package/dist/cjs/react/nodes/index.js +80 -55
  20. package/dist/cjs/react/nodes/inlineCard.js +14 -3
  21. package/dist/cjs/react/nodes/layoutColumn.js +2 -2
  22. package/dist/cjs/react/nodes/media.js +5 -3
  23. package/dist/cjs/react/nodes/mediaGroup.js +2 -2
  24. package/dist/cjs/react/nodes/mediaInline.js +2 -2
  25. package/dist/cjs/react/nodes/mediaSingle/index.js +146 -152
  26. package/dist/cjs/react/nodes/mediaSingle/styles.js +2 -2
  27. package/dist/cjs/react/nodes/mention.js +2 -4
  28. package/dist/cjs/react/nodes/panel.js +18 -20
  29. package/dist/cjs/react/nodes/status.js +2 -1
  30. package/dist/cjs/react/nodes/table/colgroup.js +2 -2
  31. package/dist/cjs/react/nodes/table/sticky.js +4 -4
  32. package/dist/cjs/react/nodes/table.js +19 -13
  33. package/dist/cjs/react/nodes/tableCell.js +34 -21
  34. package/dist/cjs/react/nodes/tableRow.js +6 -4
  35. package/dist/cjs/react/nodes/task-item-with-providers.js +6 -2
  36. package/dist/cjs/react/nodes/taskItem.js +4 -3
  37. package/dist/cjs/render-document.js +40 -4
  38. package/dist/cjs/text/nodes/date.js +3 -3
  39. package/dist/cjs/types/smartLinksOptions.js +5 -0
  40. package/dist/cjs/ui/Expand.js +9 -9
  41. package/dist/cjs/ui/ExtensionRenderer.js +8 -4
  42. package/dist/cjs/ui/MediaCard.js +4 -4
  43. package/dist/cjs/ui/Renderer/breakout-ssr.js +50 -7
  44. package/dist/cjs/ui/Renderer/index.js +23 -18
  45. package/dist/cjs/ui/Renderer/style.js +8 -6
  46. package/dist/cjs/ui/SortingIcon.js +30 -17
  47. package/dist/cjs/ui/annotations/draft/component.js +2 -2
  48. package/dist/cjs/ui/annotations/element/index.js +2 -2
  49. package/dist/cjs/ui/annotations/element/mark.js +4 -4
  50. package/dist/cjs/ui/annotations/hooks/use-events.js +11 -11
  51. package/dist/cjs/ui/annotations/hooks/use-load-annotations.js +4 -4
  52. package/dist/cjs/utils.js +4 -3
  53. package/dist/cjs/version.json +1 -1
  54. package/dist/es2019/actions/index.js +1 -1
  55. package/dist/es2019/analytics/enums.js +2 -0
  56. package/dist/es2019/analytics/unsupported-content.js +1 -1
  57. package/dist/es2019/messages.js +44 -0
  58. package/dist/es2019/react/hooks/use-observed-width.js +59 -0
  59. package/dist/es2019/react/index.js +4 -1
  60. package/dist/es2019/react/marks/breakout.js +2 -1
  61. package/dist/es2019/react/marks/textColor.js +7 -4
  62. package/dist/es2019/react/nodes/blockCard.js +1 -1
  63. package/dist/es2019/react/nodes/caption.js +1 -1
  64. package/dist/es2019/react/nodes/copy-text-provider.js +2 -1
  65. package/dist/es2019/react/nodes/date.js +2 -1
  66. package/dist/es2019/react/nodes/embedCard.js +1 -1
  67. package/dist/es2019/react/nodes/emoji.js +1 -1
  68. package/dist/es2019/react/nodes/extension.js +2 -1
  69. package/dist/es2019/react/nodes/heading-anchor.js +11 -2
  70. package/dist/es2019/react/nodes/index.js +32 -7
  71. package/dist/es2019/react/nodes/inlineCard.js +12 -2
  72. package/dist/es2019/react/nodes/layoutColumn.js +1 -1
  73. package/dist/es2019/react/nodes/media.js +2 -1
  74. package/dist/es2019/react/nodes/mediaInline.js +1 -1
  75. package/dist/es2019/react/nodes/mediaSingle/index.js +132 -112
  76. package/dist/es2019/react/nodes/mediaSingle/styles.js +1 -1
  77. package/dist/es2019/react/nodes/mention.js +1 -3
  78. package/dist/es2019/react/nodes/panel.js +14 -12
  79. package/dist/es2019/react/nodes/status.js +2 -1
  80. package/dist/es2019/react/nodes/table/colgroup.js +1 -1
  81. package/dist/es2019/react/nodes/table/sticky.js +1 -1
  82. package/dist/es2019/react/nodes/table.js +4 -1
  83. package/dist/es2019/react/nodes/tableCell.js +22 -10
  84. package/dist/es2019/react/nodes/tableRow.js +2 -1
  85. package/dist/es2019/react/nodes/task-item-with-providers.js +3 -1
  86. package/dist/es2019/react/nodes/taskItem.js +2 -1
  87. package/dist/es2019/render-document.js +37 -3
  88. package/dist/es2019/text/nodes/date.js +1 -1
  89. package/dist/es2019/types/smartLinksOptions.js +1 -0
  90. package/dist/es2019/ui/Expand.js +1 -1
  91. package/dist/es2019/ui/ExtensionRenderer.js +3 -1
  92. package/dist/es2019/ui/MediaCard.js +1 -1
  93. package/dist/es2019/ui/Renderer/breakout-ssr.js +46 -5
  94. package/dist/es2019/ui/Renderer/index.js +4 -1
  95. package/dist/es2019/ui/Renderer/style.js +3 -1
  96. package/dist/es2019/ui/SortingIcon.js +23 -11
  97. package/dist/es2019/ui/annotations/draft/component.js +1 -1
  98. package/dist/es2019/ui/annotations/element/index.js +1 -1
  99. package/dist/es2019/ui/annotations/element/mark.js +1 -1
  100. package/dist/es2019/ui/annotations/hooks/use-events.js +1 -1
  101. package/dist/es2019/ui/annotations/hooks/use-load-annotations.js +1 -1
  102. package/dist/es2019/version.json +1 -1
  103. package/dist/esm/actions/index.js +1 -1
  104. package/dist/esm/analytics/enums.js +2 -0
  105. package/dist/esm/analytics/unsupported-content.js +1 -1
  106. package/dist/esm/messages.js +44 -0
  107. package/dist/esm/react/hooks/use-observed-width.js +80 -0
  108. package/dist/esm/react/index.js +8 -4
  109. package/dist/esm/react/marks/annotation.js +2 -2
  110. package/dist/esm/react/marks/breakout.js +2 -1
  111. package/dist/esm/react/marks/textColor.js +8 -4
  112. package/dist/esm/react/nodes/blockCard.js +1 -1
  113. package/dist/esm/react/nodes/caption.js +1 -1
  114. package/dist/esm/react/nodes/copy-text-provider.js +2 -1
  115. package/dist/esm/react/nodes/date.js +2 -1
  116. package/dist/esm/react/nodes/embedCard.js +1 -1
  117. package/dist/esm/react/nodes/emoji.js +1 -1
  118. package/dist/esm/react/nodes/extension.js +2 -1
  119. package/dist/esm/react/nodes/heading-anchor.js +12 -3
  120. package/dist/esm/react/nodes/index.js +62 -7
  121. package/dist/esm/react/nodes/inlineCard.js +12 -2
  122. package/dist/esm/react/nodes/layoutColumn.js +1 -1
  123. package/dist/esm/react/nodes/media.js +2 -1
  124. package/dist/esm/react/nodes/mediaGroup.js +2 -2
  125. package/dist/esm/react/nodes/mediaInline.js +1 -1
  126. package/dist/esm/react/nodes/mediaSingle/index.js +140 -141
  127. package/dist/esm/react/nodes/mediaSingle/styles.js +1 -1
  128. package/dist/esm/react/nodes/mention.js +1 -3
  129. package/dist/esm/react/nodes/panel.js +14 -12
  130. package/dist/esm/react/nodes/status.js +2 -1
  131. package/dist/esm/react/nodes/table/colgroup.js +1 -1
  132. package/dist/esm/react/nodes/table/sticky.js +1 -1
  133. package/dist/esm/react/nodes/table.js +4 -1
  134. package/dist/esm/react/nodes/tableCell.js +19 -9
  135. package/dist/esm/react/nodes/tableRow.js +2 -1
  136. package/dist/esm/react/nodes/task-item-with-providers.js +5 -2
  137. package/dist/esm/react/nodes/taskItem.js +2 -1
  138. package/dist/esm/render-document.js +36 -3
  139. package/dist/esm/text/nodes/date.js +1 -1
  140. package/dist/esm/types/smartLinksOptions.js +1 -0
  141. package/dist/esm/ui/Expand.js +1 -1
  142. package/dist/esm/ui/ExtensionRenderer.js +3 -1
  143. package/dist/esm/ui/MediaCard.js +3 -3
  144. package/dist/esm/ui/Renderer/breakout-ssr.js +48 -5
  145. package/dist/esm/ui/Renderer/index.js +6 -3
  146. package/dist/esm/ui/Renderer/style.js +4 -3
  147. package/dist/esm/ui/SortingIcon.js +21 -11
  148. package/dist/esm/ui/annotations/draft/component.js +1 -1
  149. package/dist/esm/ui/annotations/element/index.js +1 -1
  150. package/dist/esm/ui/annotations/element/mark.js +3 -3
  151. package/dist/esm/ui/annotations/hooks/use-events.js +3 -3
  152. package/dist/esm/ui/annotations/hooks/use-load-annotations.js +3 -3
  153. package/dist/esm/utils.js +3 -2
  154. package/dist/esm/version.json +1 -1
  155. package/dist/types/actions/index.d.ts +1 -1
  156. package/dist/types/analytics/enums.d.ts +3 -1
  157. package/dist/types/analytics/events.d.ts +9 -2
  158. package/dist/types/analytics/unsupported-content.d.ts +1 -1
  159. package/dist/types/messages.d.ts +44 -0
  160. package/dist/types/react/hooks/use-observed-width.d.ts +3 -0
  161. package/dist/types/react/index.d.ts +6 -1
  162. package/dist/types/react/nodes/blockCard.d.ts +1 -1
  163. package/dist/types/react/nodes/bodiedExtension.d.ts +2 -1
  164. package/dist/types/react/nodes/codeBlock.d.ts +3 -3
  165. package/dist/types/react/nodes/embedCard.d.ts +1 -1
  166. package/dist/types/react/nodes/emoji.d.ts +1 -1
  167. package/dist/types/react/nodes/extension.d.ts +14 -13
  168. package/dist/types/react/nodes/index.d.ts +39 -15
  169. package/dist/types/react/nodes/inlineCard.d.ts +23 -21
  170. package/dist/types/react/nodes/inlineExtension.d.ts +2 -1
  171. package/dist/types/react/nodes/media.d.ts +2 -2
  172. package/dist/types/react/nodes/mediaGroup.d.ts +1 -1
  173. package/dist/types/react/nodes/mediaInline.d.ts +1 -1
  174. package/dist/types/react/nodes/mediaSingle/index.d.ts +3 -7
  175. package/dist/types/react/nodes/mediaSingle/styles.d.ts +1 -1
  176. package/dist/types/react/nodes/mention.d.ts +2 -2
  177. package/dist/types/react/nodes/panel.d.ts +3 -1
  178. package/dist/types/react/nodes/table/sticky.d.ts +1 -1
  179. package/dist/types/react/nodes/table.d.ts +22 -21
  180. package/dist/types/react/nodes/tableCell.d.ts +7 -60
  181. package/dist/types/react/nodes/tableRow.d.ts +1 -1
  182. package/dist/types/react/nodes/task-item-with-providers.d.ts +2 -1
  183. package/dist/types/react/nodes/taskItem.d.ts +1 -1
  184. package/dist/types/react/types.d.ts +3 -1
  185. package/dist/types/react/utils/getCardClickHandler.d.ts +1 -1
  186. package/dist/types/render-document.d.ts +1 -1
  187. package/dist/types/types/smartLinksOptions.d.ts +3 -0
  188. package/dist/types/ui/ExtensionRenderer.d.ts +3 -1
  189. package/dist/types/ui/MediaCard.d.ts +3 -2
  190. package/dist/types/ui/SortingIcon.d.ts +7 -4
  191. package/dist/types/ui/annotations/context.d.ts +1 -1
  192. package/dist/types/ui/annotations/element/mark.d.ts +1 -1
  193. package/dist/types/ui/annotations/hooks/use-events.d.ts +2 -1
  194. package/dist/types/ui/annotations/hooks/use-inline-comment-subscriber.d.ts +1 -1
  195. package/dist/types/ui/annotations/selection/mounter.d.ts +1 -1
  196. package/dist/types/ui/annotations/selection/range-validator.d.ts +1 -1
  197. package/dist/types/ui/annotations/types.d.ts +1 -1
  198. package/dist/types/ui/renderer-props.d.ts +8 -1
  199. package/dist/types/utils.d.ts +3 -1
  200. package/package.json +21 -22
@@ -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';
@@ -2,11 +2,14 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import React from 'react';
4
4
  import { tableBackgroundColorPalette } from '@atlaskit/adf-schema';
5
- import { compose, SortOrder } from '@atlaskit/editor-common';
5
+ import { compose } from '@atlaskit/editor-common/utils';
6
+ import { SortOrder } from '@atlaskit/editor-common/types';
6
7
  import SortingIcon from '../../ui/SortingIcon';
7
8
  import { MODE, PLATFORM } from '../../analytics/events';
8
9
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics/enums';
9
10
  import { RendererCssClassName } from '../../consts';
11
+ import { injectIntl } from 'react-intl-next';
12
+ import { tableCellMessages } from '../../messages';
10
13
  const IgnoreSorting = ['LABEL', 'INPUT'];
11
14
 
12
15
  const nextStatusOrder = currentSortOrder => {
@@ -24,19 +27,25 @@ const nextStatusOrder = currentSortOrder => {
24
27
  return SortOrder.NO_ORDER;
25
28
  };
26
29
 
27
- const getSortOrderLabel = currentSortOrder => {
30
+ const getSortOrderLabel = (intl, currentSortOrder) => {
31
+ const {
32
+ noneSortingLabel,
33
+ ascSortingLabel,
34
+ descSortingLabel
35
+ } = tableCellMessages;
36
+
28
37
  switch (currentSortOrder) {
29
38
  case SortOrder.NO_ORDER:
30
- return 'none';
39
+ return intl.formatMessage(noneSortingLabel);
31
40
 
32
41
  case SortOrder.ASC:
33
- return 'ascending';
42
+ return intl.formatMessage(ascSortingLabel);
34
43
 
35
44
  case SortOrder.DESC:
36
- return 'descending';
45
+ return intl.formatMessage(descSortingLabel);
37
46
 
38
47
  default:
39
- return 'none';
48
+ return intl.formatMessage(noneSortingLabel);
40
49
  }
41
50
  };
42
51
 
@@ -101,7 +110,7 @@ const withCellProps = WrapperComponent => {
101
110
  };
102
111
 
103
112
  export const withSortableColumn = WrapperComponent => {
104
- return class WithSortableColumn extends React.Component {
113
+ class WithSortableColumn extends React.Component {
105
114
  constructor(props) {
106
115
  super(props);
107
116
 
@@ -165,7 +174,8 @@ export const withSortableColumn = WrapperComponent => {
165
174
  onSorting,
166
175
  children,
167
176
  sortOrdered,
168
- isHeaderRow
177
+ isHeaderRow,
178
+ intl
169
179
  } = this.props;
170
180
  const sortOrderedClassName = sortOrdered === SortOrder.NO_ORDER ? RendererCssClassName.SORTABLE_COLUMN_NO_ORDER : '';
171
181
 
@@ -181,7 +191,7 @@ export const withSortableColumn = WrapperComponent => {
181
191
 
182
192
  return /*#__PURE__*/React.createElement(WrapperComponent, _extends({}, this.props, {
183
193
  className: className,
184
- ariaSort: getSortOrderLabel(sortOrdered)
194
+ ariaSort: getSortOrderLabel(intl, sortOrdered)
185
195
  }), /*#__PURE__*/React.createElement("div", {
186
196
  className: RendererCssClassName.SORTABLE_COLUMN_BUTTON,
187
197
  role: "button",
@@ -198,7 +208,9 @@ export const withSortableColumn = WrapperComponent => {
198
208
  }))));
199
209
  }
200
210
 
201
- };
211
+ }
212
+
213
+ return injectIntl(WithSortableColumn);
202
214
  };
203
215
  export const TableHeader = compose(withSortableColumn, withCellProps)('th');
204
216
  export const TableCell = withCellProps('td');
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
- import { SortOrder, compose } from '@atlaskit/editor-common';
3
+ import { compose } from '@atlaskit/editor-common/utils';
4
+ import { SortOrder } from '@atlaskit/editor-common/types';
4
5
  import { RendererCssClassName } from '../../consts';
5
6
  export default class TableRow extends React.Component {
6
7
  constructor(...args) {
@@ -45,11 +45,13 @@ export default class TaskItemWithProviders extends Component {
45
45
  const {
46
46
  contextIdentifierProvider,
47
47
  objectAri,
48
+ isRenderer,
48
49
  ...otherProps
49
50
  } = this.props;
50
51
  const resolvedObjectId = this.state.resolvedContextProvider && this.state.resolvedContextProvider.objectId || objectAri;
51
52
  return /*#__PURE__*/React.createElement(ResourcedTaskItem, _extends({}, otherProps, {
52
- objectAri: resolvedObjectId
53
+ objectAri: resolvedObjectId,
54
+ isRenderer: isRenderer
53
55
  }));
54
56
  }
55
57
 
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import { PureComponent } from 'react';
4
- import { ProviderFactory, WithProviders } from '@atlaskit/editor-common';
4
+ import { ProviderFactory, WithProviders } from '@atlaskit/editor-common/provider-factory';
5
5
  import TaskItemWithProviders from './task-item-with-providers';
6
6
  import { FabricElementsAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
7
7
  export default class TaskItem extends PureComponent {
@@ -35,6 +35,7 @@ export default class TaskItem extends PureComponent {
35
35
  objectAri: objectAri,
36
36
  taskId: localId,
37
37
  isDone: state === 'DONE',
38
+ isRenderer: true,
38
39
  disabled: disabled,
39
40
  taskDecisionProvider: taskDecisionProvider,
40
41
  contextIdentifierProvider: contextIdentifierProvider,
@@ -1,7 +1,10 @@
1
1
  import { defaultSchema } from '@atlaskit/adf-schema';
2
2
  import { getValidDocument } from '@atlaskit/editor-common/validator';
3
- import { validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaskit/editor-common';
3
+ import { validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaskit/editor-common/utils';
4
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from './analytics/enums';
5
+ import { PLATFORM } from './analytics/events';
4
6
  import { trackUnsupportedContentLevels } from './analytics/unsupported-content';
7
+ import { transformMediaLinkMarks } from '@atlaskit/adf-utils';
5
8
  const SUPPORTS_HIRES_TIMER_API = !!(window.performance && performance.now);
6
9
 
7
10
  const withStopwatch = cb => {
@@ -24,7 +27,22 @@ export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage
24
27
  time: sanitizeTime
25
28
  } = withStopwatch(() => {
26
29
  if (useSpecBasedValidator) {
27
- return validateADFEntity(schema, doc, dispatchAnalyticsEvent);
30
+ // link mark on mediaSingle is deprecated, need to move link mark to child media node
31
+ // https://product-fabric.atlassian.net/browse/ED-14043
32
+ const {
33
+ transformedAdf,
34
+ isTransformed
35
+ } = transformMediaLinkMarks(doc);
36
+
37
+ if (isTransformed && dispatchAnalyticsEvent) {
38
+ dispatchAnalyticsEvent({
39
+ action: ACTION.MEDIA_LINK_TRANSFORMED,
40
+ actionSubject: ACTION_SUBJECT.RENDERER,
41
+ eventType: EVENT_TYPE.OPERATIONAL
42
+ });
43
+ }
44
+
45
+ return validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent);
28
46
  }
29
47
 
30
48
  return getValidDocument(doc, schema, adfStage);
@@ -59,7 +77,23 @@ export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage
59
77
  time: buildTreeTime
60
78
  } = withStopwatch(() => {
61
79
  const pmNode = schema.nodeFromJSON(validDoc);
62
- pmNode.check();
80
+
81
+ try {
82
+ pmNode.check();
83
+ } catch (err) {
84
+ if (dispatchAnalyticsEvent) {
85
+ dispatchAnalyticsEvent({
86
+ action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
87
+ actionSubject: ACTION_SUBJECT.RENDERER,
88
+ attributes: {
89
+ platform: PLATFORM.WEB,
90
+ error: err === null || err === void 0 ? void 0 : err.toString()
91
+ },
92
+ eventType: EVENT_TYPE.OPERATIONAL
93
+ });
94
+ }
95
+ }
96
+
63
97
  return pmNode;
64
98
  }); // save build tree time to stats
65
99
 
@@ -1,4 +1,4 @@
1
- import { timestampToIsoFormat } from '@atlaskit/editor-common';
1
+ import { timestampToIsoFormat } from '@atlaskit/editor-common/utils';
2
2
  import { getText } from '../../utils';
3
3
 
4
4
  const date = (node, schema) => {
@@ -0,0 +1 @@
1
+ export {};
@@ -4,7 +4,7 @@ import styled from 'styled-components';
4
4
  import { gridSize, fontSize } from '@atlaskit/theme/constants';
5
5
  import ChevronRightIcon from '@atlaskit/icon/glyph/chevron-right';
6
6
  import Tooltip from '@atlaskit/tooltip';
7
- import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper, ExpandLayoutWrapper, ClearNextSiblingMarginTop } from '@atlaskit/editor-common';
7
+ import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper, ExpandLayoutWrapper, ClearNextSiblingMarginTop } from '@atlaskit/editor-common/ui';
8
8
  import { akEditorLineHeight, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
9
9
  import { PLATFORM, MODE } from '../analytics/events';
10
10
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics/enums';
@@ -1,7 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import memoizeOne from 'memoize-one';
4
- import { getExtensionRenderer, WithProviders, getNodeRenderer } from '@atlaskit/editor-common';
4
+ import { getNodeRenderer } from '@atlaskit/editor-common/extensions';
5
+ import { WithProviders } from '@atlaskit/editor-common/provider-factory';
6
+ import { getExtensionRenderer } from '@atlaskit/editor-common/utils';
5
7
  export default class ExtensionRenderer extends React.Component {
6
8
  constructor(...args) {
7
9
  super(...args);
@@ -4,7 +4,7 @@ import { Component } from 'react';
4
4
  import { filter } from '@atlaskit/adf-utils';
5
5
  import { Card, CardLoading, CardError } from '@atlaskit/media-card';
6
6
  import { getMediaClient } from '@atlaskit/media-client';
7
- import { withImageLoader } from '@atlaskit/editor-common';
7
+ import { withImageLoader } from '@atlaskit/editor-common/utils';
8
8
  import styled from 'styled-components';
9
9
  const mediaIdentifierMap = new Map();
10
10
  export const getListOfIdentifiersFromDoc = doc => {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { breakoutConsts } from '@atlaskit/editor-common';
2
+ import { breakoutConsts } from '@atlaskit/editor-common/utils';
3
3
  /**
4
4
  * Inline Script that updates breakout node width on client side,
5
5
  * before main JavaScript bundle is ready.
@@ -45,13 +45,16 @@ export const breakoutInlineScriptContext = `
45
45
  `;
46
46
 
47
47
  function applyBreakoutAfterSSR(id, allowDynamicTextSizing, breakoutConsts) {
48
- function findUp(element, selector) {
48
+ const MEDIA_NODE_TYPE = 'mediaSingle';
49
+ const WIDE_LAYOUT_MODES = ['full-width', 'wide'];
50
+
51
+ function findUp(element, condition) {
49
52
  if (!element) {
50
53
  return;
51
54
  }
52
55
 
53
56
  while (element.parentElement) {
54
- if (element.parentElement.classList.contains(selector)) {
57
+ if (condition(element)) {
55
58
  return element.parentElement;
56
59
  }
57
60
 
@@ -59,7 +62,11 @@ function applyBreakoutAfterSSR(id, allowDynamicTextSizing, breakoutConsts) {
59
62
  }
60
63
  }
61
64
 
62
- const renderer = findUp(document.querySelector('[data-breakout-script-id="' + id + '"]'), 'ak-renderer-wrapper');
65
+ const renderer = findUp(document.querySelector('[data-breakout-script-id="' + id + '"]'), elem => {
66
+ var _elem$parentElement;
67
+
68
+ return !!((_elem$parentElement = elem.parentElement) !== null && _elem$parentElement !== void 0 && _elem$parentElement.classList.contains('ak-renderer-wrapper'));
69
+ });
63
70
 
64
71
  if (!renderer) {
65
72
  return;
@@ -76,7 +83,7 @@ function applyBreakoutAfterSSR(id, allowDynamicTextSizing, breakoutConsts) {
76
83
  const node = maybeNode;
77
84
  const mode = node.dataset.mode || node.dataset.layout || '';
78
85
 
79
- if (!mode || !['full-width', 'wide'].includes(mode)) {
86
+ if (!mode || !WIDE_LAYOUT_MODES.includes(mode)) {
80
87
  return;
81
88
  }
82
89
 
@@ -99,9 +106,43 @@ function applyBreakoutAfterSSR(id, allowDynamicTextSizing, breakoutConsts) {
99
106
  }
100
107
  }
101
108
  });
109
+ } else if (
110
+ /**
111
+ * The mutation observer is only called once per added node.
112
+ * The above condition only deals with direct children of <div class="ak-renderer-document" />
113
+ * When it is initially called on the direct children, not all the sub children have loaded.
114
+ * So nested media elements which are not immediately loaded as sub children are not availabe in the above conditional.
115
+ * Thus adding this conditional to deal with all meida elements directly.
116
+ */
117
+ item.target.dataset.nodeType === MEDIA_NODE_TYPE) {
118
+ applyMediaBreakout(item.target);
102
119
  }
103
120
  });
104
121
  });
122
+
123
+ const applyMediaBreakout = card => {
124
+ // width was already set by another breakout script
125
+ if (card.style.width) {
126
+ return;
127
+ }
128
+
129
+ const tableParent = findUp(card, elem => elem instanceof HTMLTableCellElement); // only apply the breakout to media elements not nested inside table
130
+ // table sizing is not based on percentage width
131
+
132
+ if (tableParent) {
133
+ return;
134
+ }
135
+
136
+ const mode = card.dataset.mode || card.dataset.layout || '';
137
+ const width = card.dataset.width;
138
+
139
+ if (WIDE_LAYOUT_MODES.includes(mode)) {
140
+ card.style.width = '100%';
141
+ } else if (width) {
142
+ card.style.width = `${width}%`;
143
+ }
144
+ };
145
+
105
146
  observer.observe(renderer, {
106
147
  childList: true,
107
148
  subtree: true
@@ -4,7 +4,9 @@ import React, { useContext, useLayoutEffect, useRef } from 'react';
4
4
  import { PureComponent } from 'react';
5
5
  import { getSchemaBasedOnStage } from '@atlaskit/adf-schema';
6
6
  import { reduce } from '@atlaskit/adf-utils';
7
- import { UnsupportedBlock, ProviderFactory, BaseTheme, WidthProvider, getAnalyticsAppearance, getAnalyticsEventSeverity, WithCreateAnalyticsEvent, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking, IntlNextErrorBoundary, LegacyToNextIntlProvider, IntlLegacyFallbackProvider } from '@atlaskit/editor-common';
7
+ import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
8
+ import { UnsupportedBlock, BaseTheme, WidthProvider, WithCreateAnalyticsEvent, LegacyToNextIntlProvider, IntlLegacyFallbackProvider, IntlNextErrorBoundary } from '@atlaskit/editor-common/ui';
9
+ import { getAnalyticsAppearance, getAnalyticsEventSeverity, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common/utils';
8
10
  import { normalizeFeatureFlags } from '@atlaskit/editor-common/normalize-feature-flags';
9
11
  import { akEditorFullPageDefaultFontSize } from '@atlaskit/editor-shared-styles';
10
12
  import { IframeWidthObserverFallbackWrapper, IframeWrapperConsumer } from '@atlaskit/width-detector';
@@ -181,6 +183,7 @@ export class Renderer extends PureComponent {
181
183
  allowMediaLinking: props.media && props.media.allowLinking,
182
184
  surroundTextNodesWithTextWrapper: allowAnnotationsDraftMode,
183
185
  media: props.media,
186
+ smartLinks: props.smartLinks,
184
187
  allowCopyToClipboard: props.allowCopyToClipboard,
185
188
  allowCustomPanels: props.allowCustomPanels,
186
189
  allowAnnotations: props.allowAnnotations,
@@ -3,7 +3,8 @@ import { themed } from '@atlaskit/theme/components';
3
3
  import { gridSize, fontFamily, fontSize, borderRadius } from '@atlaskit/theme/constants';
4
4
  import * as colors from '@atlaskit/theme/colors';
5
5
  import { headingSizes as headingSizesImport } from '@atlaskit/theme/typography';
6
- import { tableSharedStyle, columnLayoutSharedStyle, blockquoteSharedStyles, headingsSharedStyles, panelSharedStyles, ruleSharedStyles, whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, mediaSingleSharedStyle, TableSharedCssClassName, tableMarginTop, codeMarkSharedStyles, shadowSharedStyle, shadowClassNames, dateSharedStyle, richMediaClassName, tasksAndDecisionsStyles, smartCardSharedStyles, tableCellPadding } from '@atlaskit/editor-common';
6
+ import { tableSharedStyle, columnLayoutSharedStyle, blockquoteSharedStyles, headingsSharedStyles, panelSharedStyles, ruleSharedStyles, whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, mediaSingleSharedStyle, TableSharedCssClassName, tableMarginTop, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, richMediaClassName, tasksAndDecisionsStyles, smartCardSharedStyles, tableCellPadding, textColorStyles } from '@atlaskit/editor-common/styles';
7
+ import { shadowClassNames } from '@atlaskit/editor-common/ui';
7
8
  import { editorFontSize, blockNodesVerticalMargin, akEditorTableToolbar, akEditorTableToolbarDark, akEditorTableBorder, akEditorTableBorderDark, akEditorTableNumberColumnWidth, gridMediumMaxWidth, akEditorFullWidthLayoutWidth, akEditorStickyHeaderZIndex, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
8
9
  import { RendererCssClassName } from '../../consts';
9
10
  import { HeadingAnchorWrapperClassName } from '../../react/nodes/heading-anchor';
@@ -333,6 +334,7 @@ export const Wrapper = styled.div`
333
334
  ${codeMarkSharedStyles};
334
335
  ${shadowSharedStyle};
335
336
  ${dateSharedStyle};
337
+ ${textColorStyles};
336
338
  ${tasksAndDecisionsStyles};
337
339
  ${smartCardSharedStyles}
338
340
 
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { SortOrder } from '@atlaskit/editor-common';
4
3
  import Tooltip from '@atlaskit/tooltip';
5
4
  import { gridSize } from '@atlaskit/theme/constants';
6
- import { N20, N30 } from '@atlaskit/theme/colors'; // We use data url here because of this issue:
5
+ import { N20, N30 } from '@atlaskit/theme/colors';
6
+ import { SortOrder } from '@atlaskit/editor-common/types';
7
+ import { sortingIconMessages } from '../messages';
8
+ import { injectIntl } from 'react-intl-next'; // We use data url here because of this issue:
7
9
  // https://product-fabric.atlassian.net/browse/ED-8001
8
10
  // Remove this workaround if Firefox has fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=1664350
9
11
 
@@ -69,30 +71,40 @@ const getClassName = status => {
69
71
  }
70
72
  };
71
73
 
72
- const getTooltipTitle = status => {
74
+ const getTooltipTitle = (intl, isSortingAllowed, status) => {
75
+ const {
76
+ noOrderLabel,
77
+ ascOrderLabel,
78
+ descOrderLabel,
79
+ invalidLabel
80
+ } = sortingIconMessages;
81
+
82
+ if (!isSortingAllowed) {
83
+ return intl.formatMessage(invalidLabel);
84
+ }
85
+
73
86
  switch (status) {
74
87
  case SortOrder.NO_ORDER:
75
- return 'Sort column A to Z';
88
+ return intl.formatMessage(noOrderLabel);
76
89
 
77
90
  case SortOrder.ASC:
78
- return 'Sort column Z to A';
91
+ return intl.formatMessage(ascOrderLabel);
79
92
 
80
93
  case SortOrder.DESC:
81
- return 'Clear sorting';
94
+ return intl.formatMessage(descOrderLabel);
82
95
  }
83
96
 
84
97
  return '';
85
98
  };
86
99
 
87
- const notAllowedTooltip = `⚠️ You can't sort a table with merged cell`;
88
-
89
100
  const SortingIcon = ({
90
101
  isSortingAllowed,
91
- sortOrdered
102
+ sortOrdered,
103
+ intl
92
104
  }) => {
93
105
  const activated = sortOrdered !== SortOrder.NO_ORDER;
94
106
  const wrapperClassName = !isSortingAllowed ? StatusClassNames.SORTING_NOT_ALLOWED : '';
95
- const content = isSortingAllowed ? getTooltipTitle(sortOrdered) : notAllowedTooltip;
107
+ const content = getTooltipTitle(intl, isSortingAllowed, sortOrdered);
96
108
  return /*#__PURE__*/React.createElement(Tooltip, {
97
109
  delay: 0,
98
110
  content: content,
@@ -104,4 +116,4 @@ const SortingIcon = ({
104
116
  })));
105
117
  };
106
118
 
107
- export default SortingIcon;
119
+ export default injectIntl(SortingIcon);
@@ -6,7 +6,7 @@ import { splitText, calcTextSplitOffset } from './text';
6
6
  import { calcInsertDraftPositionOnText } from './position';
7
7
  import { dataAttributes } from './dom';
8
8
  import styled from 'styled-components';
9
- import { AnnotationSharedCSSByState } from '@atlaskit/editor-common';
9
+ import { AnnotationSharedCSSByState } from '@atlaskit/editor-common/styles';
10
10
  const DraftAnnotation = styled.mark`
11
11
  color: inherit;
12
12
  background-color: unset;
@@ -3,7 +3,7 @@ import { AnnotationMarkStates } from '@atlaskit/adf-schema';
3
3
  import { MarkComponent } from './mark';
4
4
  import { useInlineCommentSubscriberContext, useHasFocusEvent, useInlineCommentsFilter } from '../hooks';
5
5
  import { InlineCommentsStateContext } from '../context';
6
- import { AnnotationUpdateEvent } from '@atlaskit/editor-common';
6
+ import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
7
7
 
8
8
  const MarkElement = ({
9
9
  annotationParentIds,
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useMemo, useCallback } from 'react';
3
- import { AnnotationSharedCSSByState } from '@atlaskit/editor-common';
3
+ import { AnnotationSharedCSSByState } from '@atlaskit/editor-common/styles';
4
4
  import { AnnotationMarkStates } from '@atlaskit/adf-schema';
5
5
  import styled from 'styled-components';
6
6
  const MarkStyled = styled.mark`
@@ -1,5 +1,5 @@
1
1
  import { useLayoutEffect, useState } from 'react';
2
- import { AnnotationUpdateEvent } from '@atlaskit/editor-common';
2
+ import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
3
3
  import { AnnotationTypes } from '@atlaskit/adf-schema';
4
4
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '../../../analytics/enums';
5
5
  import { FabricChannel } from '@atlaskit/analytics-listeners';
@@ -1,5 +1,5 @@
1
1
  import { useContext, useEffect } from 'react';
2
- import { AnnotationUpdateEvent } from '@atlaskit/editor-common';
2
+ import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
3
3
  import { ProvidersContext } from '../context';
4
4
  import { RendererContext as ActionsContext } from '../../RendererActionsContext';
5
5
  export const useLoadAnnotations = ({
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "84.0.0",
3
+ "version": "86.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -3,7 +3,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  import { JSONTransformer } from '@atlaskit/editor-json-transformer';
6
- import { canApplyAnnotationOnRange, getAnnotationIdsFromRange } from '@atlaskit/editor-common';
6
+ import { canApplyAnnotationOnRange, getAnnotationIdsFromRange } from '@atlaskit/editor-common/utils';
7
7
  import { AnnotationTypes } from '@atlaskit/adf-schema';
8
8
  import { RemoveMarkStep } from 'prosemirror-transform';
9
9
  import { createAnnotationStep, getPosFromRange } from '../steps';
@@ -13,6 +13,7 @@ export var ACTION;
13
13
  ACTION["STARTED"] = "started";
14
14
  ACTION["RENDERED"] = "rendered";
15
15
  ACTION["CRASHED"] = "unhandledErrorCaught";
16
+ ACTION["INVALID_PROSEMIRROR_DOCUMENT"] = "invalidProsemirrorDocument";
16
17
  ACTION["SELECT_ALL_CAUGHT"] = "selectAllCaught";
17
18
  ACTION["SELECT_ALL_ESCAPED"] = "selectAllEscaped";
18
19
  ACTION["CLICKED"] = "clicked";
@@ -30,6 +31,7 @@ export var ACTION;
30
31
  ACTION["CREATE_NOT_ALLOWED"] = "createNotAllowed";
31
32
  ACTION["UNSUPPORTED_CONTENT_LEVELS_TRACKING_SUCCEEDED"] = "unsupportedContentLevelsTrackingSucceeded";
32
33
  ACTION["UNSUPPORTED_CONTENT_LEVELS_TRACKING_ERRORED"] = "unsupportedContentLevelsTrackingErrored";
34
+ ACTION["MEDIA_LINK_TRANSFORMED"] = "mediaLinkTransformed";
33
35
  })(ACTION || (ACTION = {}));
34
36
 
35
37
  export var ACTION_SUBJECT;