@atlaskit/renderer 84.1.1 → 88.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 +20 -21
@@ -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,9 +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
4
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from './analytics/enums';
5
5
  import { PLATFORM } from './analytics/events';
6
6
  import { trackUnsupportedContentLevels } from './analytics/unsupported-content';
7
+ import { transformMediaLinkMarks } from '@atlaskit/adf-utils';
7
8
  const SUPPORTS_HIRES_TIMER_API = !!(window.performance && performance.now);
8
9
 
9
10
  const withStopwatch = cb => {
@@ -26,7 +27,22 @@ export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage
26
27
  time: sanitizeTime
27
28
  } = withStopwatch(() => {
28
29
  if (useSpecBasedValidator) {
29
- 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);
30
46
  }
31
47
 
32
48
  return getValidDocument(doc, schema, adfStage);
@@ -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,
@@ -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.1.1",
3
+ "version": "88.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';
@@ -31,6 +31,7 @@ export var ACTION;
31
31
  ACTION["CREATE_NOT_ALLOWED"] = "createNotAllowed";
32
32
  ACTION["UNSUPPORTED_CONTENT_LEVELS_TRACKING_SUCCEEDED"] = "unsupportedContentLevelsTrackingSucceeded";
33
33
  ACTION["UNSUPPORTED_CONTENT_LEVELS_TRACKING_ERRORED"] = "unsupportedContentLevelsTrackingErrored";
34
+ ACTION["MEDIA_LINK_TRANSFORMED"] = "mediaLinkTransformed";
34
35
  })(ACTION || (ACTION = {}));
35
36
 
36
37
  export var ACTION_SUBJECT;
@@ -1,4 +1,4 @@
1
- import { getUnsupportedContentLevelData, getAnalyticsAppearance } from '@atlaskit/editor-common';
1
+ import { getUnsupportedContentLevelData, getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
2
2
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from './enums';
3
3
  import { PLATFORM } from './events';
4
4
  var rendersMap = {};
@@ -14,6 +14,50 @@ export var headingAnchorLinkMessages = defineMessages({
14
14
  id: 'fabric.editor.headingLink.failedToCopy',
15
15
  defaultMessage: 'Copy failed',
16
16
  description: 'failed to copy heading link to clipboard'
17
+ },
18
+ copyAriaLabel: {
19
+ id: 'fabric.editor.headingLink.copyAriaLabel',
20
+ defaultMessage: 'Copy',
21
+ description: 'copy aria label for link icon'
22
+ }
23
+ });
24
+ export var tableCellMessages = defineMessages({
25
+ noneSortingLabel: {
26
+ id: 'fabric.editor.headingLink.noneSortingLabel',
27
+ defaultMessage: 'none',
28
+ description: 'this table column is not sorted'
29
+ },
30
+ ascSortingLabel: {
31
+ id: 'fabric.editor.headingLink.ascSortingLabel',
32
+ defaultMessage: 'ascending',
33
+ description: 'this table column is sorted in ascending order'
34
+ },
35
+ descSortingLabel: {
36
+ id: 'fabric.editor.headingLink.noneSortingLabel',
37
+ defaultMessage: 'descending',
38
+ description: 'this table column is sorted in descending order'
39
+ }
40
+ });
41
+ export var sortingIconMessages = defineMessages({
42
+ noOrderLabel: {
43
+ id: 'fabric.editor.headingLink.noOrderLabel',
44
+ defaultMessage: 'Sort column A to Z',
45
+ description: 'Sort the column in ascending order'
46
+ },
47
+ ascOrderLabel: {
48
+ id: 'fabric.editor.headingLink.ascOrderLabel',
49
+ defaultMessage: 'Sort column Z to A',
50
+ description: 'Sort the column in descending order'
51
+ },
52
+ descOrderLabel: {
53
+ id: 'fabric.editor.headingLink.descOrderLabel',
54
+ defaultMessage: 'Clear sorting',
55
+ description: 'clear the sorting from this column'
56
+ },
57
+ invalidLabel: {
58
+ id: 'fabric.editor.headingLink.descOrderLabel',
59
+ defaultMessage: "\u26A0\uFE0F You can't sort a table with merged cell",
60
+ description: 'this sort is invalid for merged cells'
17
61
  }
18
62
  });
19
63
  export var codeBlockCopyButtonMessages = defineMessages({
@@ -0,0 +1,80 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+
3
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
+
9
+ import React from 'react';
10
+ var resizeObserver;
11
+ var nodeToCallback = new WeakMap();
12
+ export var useObservedWidth = function useObservedWidth(node, useObservedWidthFlag) {
13
+ var _React$useState = React.useState({
14
+ x: 0,
15
+ y: 0,
16
+ width: 0,
17
+ height: 0,
18
+ top: 0,
19
+ left: 0,
20
+ bottom: 0,
21
+ right: 0
22
+ }),
23
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24
+ rect = _React$useState2[0],
25
+ setRect = _React$useState2[1];
26
+
27
+ React.useEffect(function () {
28
+ if (!node || !useObservedWidthFlag) {
29
+ return;
30
+ }
31
+
32
+ if (!resizeObserver) {
33
+ resizeObserver = new ResizeObserver(function (entries) {
34
+ var _iterator = _createForOfIteratorHelper(entries),
35
+ _step;
36
+
37
+ try {
38
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
39
+ var entry = _step.value;
40
+
41
+ if (nodeToCallback.has(entry.target)) {
42
+ nodeToCallback.get(entry.target)(entry.contentRect);
43
+ }
44
+ }
45
+ } catch (err) {
46
+ _iterator.e(err);
47
+ } finally {
48
+ _iterator.f();
49
+ }
50
+ });
51
+ }
52
+
53
+ nodeToCallback.set(node, function (rect) {
54
+ var x = rect.x,
55
+ y = rect.y,
56
+ width = rect.width,
57
+ height = rect.height,
58
+ top = rect.top,
59
+ left = rect.left,
60
+ bottom = rect.bottom,
61
+ right = rect.right;
62
+ return setRect({
63
+ x: x,
64
+ y: y,
65
+ width: width,
66
+ height: height,
67
+ top: top,
68
+ left: left,
69
+ bottom: bottom,
70
+ right: right
71
+ });
72
+ });
73
+ resizeObserver.observe(node);
74
+ return function () {
75
+ resizeObserver.unobserve(node);
76
+ nodeToCallback.delete(node);
77
+ };
78
+ }, [node, useObservedWidthFlag]);
79
+ return rect;
80
+ };
@@ -4,10 +4,11 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
4
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
5
  import _createClass from "@babel/runtime/helpers/createClass";
6
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
+ var _excluded = ["key"];
7
8
 
8
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
10
 
10
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
11
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
12
 
12
13
  import React from 'react';
13
14
  import { MarkType } from 'prosemirror-model';
@@ -15,7 +16,8 @@ import { isNestedHeaderLinksEnabled } from './utils/links';
15
16
  import { Doc, DocWithSelectAllTrap, mergeTextNodes, isTextWrapper, isTextNode, toReact } from './nodes';
16
17
  import TextWrapperComponent from './nodes/text-wrapper';
17
18
  import { toReact as markToReact, isAnnotationMark } from './marks';
18
- import { getMarksByOrder, isSameMark, calcTableColumnWidths } from '@atlaskit/editor-common';
19
+ import { getMarksByOrder, isSameMark } from '@atlaskit/editor-common/validator';
20
+ import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
19
21
  import { getText } from '../utils';
20
22
  import { findChildrenByType } from 'prosemirror-utils';
21
23
  import { insideBreakoutLayout } from './renderer-node';
@@ -141,7 +143,7 @@ var ReactSerializer = /*#__PURE__*/function () {
141
143
 
142
144
  var _mark$attrs = mark.attrs,
143
145
  key = _mark$attrs.key,
144
- otherAttrs = _objectWithoutProperties(_mark$attrs, ["key"]);
146
+ otherAttrs = _objectWithoutProperties(_mark$attrs, _excluded);
145
147
 
146
148
  var extraProps = {
147
149
  isInline: node === null || node === void 0 ? void 0 : node.isInline
@@ -191,6 +193,7 @@ var ReactSerializer = /*#__PURE__*/function () {
191
193
  this.allowAnnotations = Boolean(init.allowAnnotations);
192
194
  this.surroundTextNodesWithTextWrapper = Boolean(init.surroundTextNodesWithTextWrapper);
193
195
  this.media = init.media;
196
+ this.smartLinks = init.smartLinks;
194
197
  this.allowSelectAllTrap = init.allowSelectAllTrap;
195
198
  }
196
199
 
@@ -555,6 +558,7 @@ var ReactSerializer = /*#__PURE__*/function () {
555
558
  fireAnalyticsEvent: this.fireAnalyticsEvent,
556
559
  nodeType: node.type.name,
557
560
  marks: node.marks,
561
+ smartLinks: this.smartLinks,
558
562
  dataAttributes: {
559
563
  // We need to account for depth (path.length gives up depth) here
560
564
  // but depth doesnt increment the pos, only accounted for.