@atlaskit/renderer 82.1.0 → 84.1.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 (148) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/dist/cjs/actions/matches-utils.js +1 -1
  3. package/dist/cjs/analytics/enums.js +2 -1
  4. package/dist/cjs/analytics/events.js +1 -1
  5. package/dist/cjs/i18n/index.js +26 -26
  6. package/dist/cjs/index.js +8 -8
  7. package/dist/cjs/messages.js +4 -4
  8. package/dist/cjs/react/index.js +32 -12
  9. package/dist/cjs/react/marks/annotation.js +1 -1
  10. package/dist/cjs/react/marks/breakout.js +1 -1
  11. package/dist/cjs/react/marks/code.js +11 -4
  12. package/dist/cjs/react/marks/fragment.js +21 -0
  13. package/dist/cjs/react/marks/index.js +28 -19
  14. package/dist/cjs/react/marks/textColor.js +15 -4
  15. package/dist/cjs/react/nodes/codeBlock.js +6 -4
  16. package/dist/cjs/react/nodes/codeBlockCopyButton.js +2 -2
  17. package/dist/cjs/react/nodes/copy-text-provider.js +1 -1
  18. package/dist/cjs/react/nodes/date.js +2 -2
  19. package/dist/cjs/react/nodes/doc.js +1 -1
  20. package/dist/cjs/react/nodes/extension.js +1 -1
  21. package/dist/cjs/react/nodes/heading-anchor.js +2 -2
  22. package/dist/cjs/react/nodes/heading.js +2 -4
  23. package/dist/cjs/react/nodes/index.js +31 -22
  24. package/dist/cjs/react/nodes/media.js +4 -2
  25. package/dist/cjs/react/nodes/mediaSingle/index.js +3 -3
  26. package/dist/cjs/react/nodes/panel.js +4 -6
  27. package/dist/cjs/react/nodes/table/colgroup.js +1 -1
  28. package/dist/cjs/react/nodes/table/sticky.js +1 -1
  29. package/dist/cjs/react/nodes/tableCell.js +1 -1
  30. package/dist/cjs/react/nodes/text-wrapper.js +5 -6
  31. package/dist/cjs/react/renderer-node.js +1 -1
  32. package/dist/cjs/react/utils/links.js +1 -1
  33. package/dist/cjs/render-document.js +21 -1
  34. package/dist/cjs/renderer-context.js +1 -1
  35. package/dist/cjs/steps/index.js +2 -2
  36. package/dist/cjs/text/nodes/index.js +1 -1
  37. package/dist/cjs/ui/Expand.js +2 -2
  38. package/dist/cjs/ui/MediaCard.js +12 -6
  39. package/dist/cjs/ui/Renderer/breakout-ssr.js +1 -1
  40. package/dist/cjs/ui/Renderer/index.js +11 -11
  41. package/dist/cjs/ui/Renderer/style.js +9 -7
  42. package/dist/cjs/ui/RendererActionsContext/index.js +1 -1
  43. package/dist/cjs/ui/SortingIcon.js +2 -2
  44. package/dist/cjs/ui/active-header-id-provider.js +1 -1
  45. package/dist/cjs/ui/annotations/context.js +1 -1
  46. package/dist/cjs/ui/annotations/draft/component.js +7 -7
  47. package/dist/cjs/ui/annotations/draft/index.js +4 -4
  48. package/dist/cjs/ui/annotations/draft/text.js +1 -1
  49. package/dist/cjs/ui/annotations/hooks/index.js +8 -8
  50. package/dist/cjs/ui/annotations/hooks/use-events.js +4 -2
  51. package/dist/cjs/ui/annotations/index.js +5 -5
  52. package/dist/cjs/utils.js +2 -1
  53. package/dist/cjs/version.json +1 -1
  54. package/dist/es2019/analytics/enums.js +1 -0
  55. package/dist/es2019/messages.js +1 -1
  56. package/dist/es2019/react/index.js +29 -8
  57. package/dist/es2019/react/marks/code.js +6 -2
  58. package/dist/es2019/react/marks/fragment.js +10 -0
  59. package/dist/es2019/react/marks/index.js +4 -2
  60. package/dist/es2019/react/marks/textColor.js +7 -4
  61. package/dist/es2019/react/nodes/codeBlock.js +5 -3
  62. package/dist/es2019/react/nodes/codeBlockCopyButton.js +1 -1
  63. package/dist/es2019/react/nodes/date.js +1 -1
  64. package/dist/es2019/react/nodes/heading-anchor.js +1 -1
  65. package/dist/es2019/react/nodes/heading.js +2 -3
  66. package/dist/es2019/react/nodes/media.js +4 -2
  67. package/dist/es2019/react/nodes/mediaSingle/index.js +1 -1
  68. package/dist/es2019/react/nodes/panel.js +5 -6
  69. package/dist/es2019/react/nodes/text-wrapper.js +7 -6
  70. package/dist/es2019/render-document.js +19 -1
  71. package/dist/es2019/ui/Expand.js +1 -1
  72. package/dist/es2019/ui/MediaCard.js +11 -5
  73. package/dist/es2019/ui/Renderer/index.js +10 -10
  74. package/dist/es2019/ui/Renderer/style.js +4 -2
  75. package/dist/es2019/ui/SortingIcon.js +1 -1
  76. package/dist/es2019/ui/annotations/draft/component.js +6 -6
  77. package/dist/es2019/ui/annotations/hooks/use-events.js +3 -1
  78. package/dist/es2019/version.json +1 -1
  79. package/dist/esm/analytics/enums.js +1 -0
  80. package/dist/esm/messages.js +1 -1
  81. package/dist/esm/react/index.js +31 -12
  82. package/dist/esm/react/marks/code.js +6 -2
  83. package/dist/esm/react/marks/fragment.js +10 -0
  84. package/dist/esm/react/marks/index.js +4 -2
  85. package/dist/esm/react/marks/textColor.js +8 -4
  86. package/dist/esm/react/nodes/codeBlock.js +5 -3
  87. package/dist/esm/react/nodes/codeBlockCopyButton.js +1 -1
  88. package/dist/esm/react/nodes/date.js +1 -1
  89. package/dist/esm/react/nodes/heading-anchor.js +1 -1
  90. package/dist/esm/react/nodes/heading.js +2 -3
  91. package/dist/esm/react/nodes/media.js +4 -2
  92. package/dist/esm/react/nodes/mediaSingle/index.js +1 -1
  93. package/dist/esm/react/nodes/panel.js +5 -6
  94. package/dist/esm/react/nodes/text-wrapper.js +7 -6
  95. package/dist/esm/render-document.js +19 -1
  96. package/dist/esm/ui/Expand.js +1 -1
  97. package/dist/esm/ui/MediaCard.js +11 -5
  98. package/dist/esm/ui/Renderer/index.js +10 -10
  99. package/dist/esm/ui/Renderer/style.js +4 -3
  100. package/dist/esm/ui/SortingIcon.js +1 -1
  101. package/dist/esm/ui/annotations/draft/component.js +6 -6
  102. package/dist/esm/ui/annotations/hooks/use-events.js +3 -1
  103. package/dist/esm/version.json +1 -1
  104. package/dist/types/analytics/enums.d.ts +1 -0
  105. package/dist/types/analytics/events.d.ts +5 -1
  106. package/dist/types/index.d.ts +1 -0
  107. package/dist/types/react/index.d.ts +1 -0
  108. package/dist/types/react/marks/alignment.d.ts +1 -0
  109. package/dist/types/react/marks/annotation.d.ts +1 -0
  110. package/dist/types/react/marks/code.d.ts +12 -4
  111. package/dist/types/react/marks/data-consumer.d.ts +1 -0
  112. package/dist/types/react/marks/em.d.ts +1 -0
  113. package/dist/types/react/marks/fragment.d.ts +4 -0
  114. package/dist/types/react/marks/indentation.d.ts +1 -0
  115. package/dist/types/react/marks/index.d.ts +2 -1
  116. package/dist/types/react/marks/link.d.ts +1 -0
  117. package/dist/types/react/marks/strike.d.ts +1 -0
  118. package/dist/types/react/marks/strong.d.ts +1 -0
  119. package/dist/types/react/marks/subsup.d.ts +1 -0
  120. package/dist/types/react/marks/textColor.d.ts +1 -0
  121. package/dist/types/react/marks/underline.d.ts +1 -0
  122. package/dist/types/react/marks/unsupportedMark.d.ts +1 -0
  123. package/dist/types/react/marks/unsupportedNodeAttribute.d.ts +1 -0
  124. package/dist/types/react/nodes/blockCard.d.ts +1 -0
  125. package/dist/types/react/nodes/caption.d.ts +1 -0
  126. package/dist/types/react/nodes/codeBlock.d.ts +12 -3
  127. package/dist/types/react/nodes/codeBlockCopyButton.d.ts +3 -3
  128. package/dist/types/react/nodes/date.d.ts +3 -3
  129. package/dist/types/react/nodes/decisionItem.d.ts +1 -0
  130. package/dist/types/react/nodes/doc.d.ts +1 -0
  131. package/dist/types/react/nodes/embedCard.d.ts +1 -0
  132. package/dist/types/react/nodes/heading-anchor.d.ts +4 -4
  133. package/dist/types/react/nodes/heading.d.ts +1 -0
  134. package/dist/types/react/nodes/index.d.ts +8 -8
  135. package/dist/types/react/nodes/mediaSingle/index.d.ts +3 -3
  136. package/dist/types/react/nodes/paragraph.d.ts +1 -0
  137. package/dist/types/react/nodes/placeholder.d.ts +1 -0
  138. package/dist/types/react/nodes/rule.d.ts +1 -0
  139. package/dist/types/react/nodes/table/colgroup.d.ts +1 -0
  140. package/dist/types/react/nodes/text-wrapper.d.ts +3 -3
  141. package/dist/types/types/mediaOptions.d.ts +7 -1
  142. package/dist/types/ui/Expand.d.ts +3 -3
  143. package/dist/types/ui/MediaCard.d.ts +2 -0
  144. package/dist/types/ui/Renderer/breakout-ssr.d.ts +1 -0
  145. package/dist/types/ui/SortingIcon.d.ts +1 -0
  146. package/dist/types/ui/annotations/draft/component.d.ts +1 -1
  147. package/dist/types/ui/renderer-props.d.ts +1 -1
  148. package/package.json +23 -23
@@ -13,21 +13,20 @@ import EmojiItem from './emoji'; // AFP-2532 TODO: Fix automatic suppressions be
13
13
  // eslint-disable-next-line @atlassian/tangerine/import/entry-points
14
14
 
15
15
  import { themed } from '@atlaskit/theme';
16
+ import { getPanelBackgroundDarkModeColors } from '@atlaskit/editor-common';
16
17
  const PanelStyled = styled.div`
17
18
  ${props => {
18
19
  if (props['data-panel-type'] !== PanelType.CUSTOM || !props.backgroundColor) {
19
20
  return '';
20
- }
21
+ } // Similar to mainDynamicStyles()
21
22
 
22
- const border = themed({
23
- light: 'none',
24
- dark: `1px solid rgba(255, 255, 255, 0.4)`
25
- })(props); // Similar to mainDynamicStyles()
26
23
 
27
24
  return `
28
25
  &[data-panel-type=${PanelType.CUSTOM}] {
29
26
  background-color: ${props.backgroundColor};
30
- border: ${border};
27
+ ${themed({
28
+ dark: getPanelBackgroundDarkModeColors
29
+ })};
31
30
  }
32
31
  `;
33
32
  }}
@@ -1,22 +1,23 @@
1
1
  import React from 'react';
2
2
  import { TextWithAnnotationDraft } from '../../ui/annotations';
3
- const TextWrapper = /*#__PURE__*/React.memo(props => {
3
+
4
+ const TextWrapper = props => {
4
5
  const {
5
6
  startPos,
6
7
  endPos
7
8
  } = props;
8
9
  const {
9
- text
10
+ children
10
11
  } = props;
11
12
 
12
- if (!text) {
13
+ if (!children) {
13
14
  return null;
14
15
  }
15
16
 
16
17
  return /*#__PURE__*/React.createElement(TextWithAnnotationDraft, {
17
- text: text,
18
18
  startPos: startPos,
19
19
  endPos: endPos
20
- });
21
- });
20
+ }, children);
21
+ };
22
+
22
23
  export default TextWrapper;
@@ -1,6 +1,8 @@
1
1
  import { defaultSchema } from '@atlaskit/adf-schema';
2
2
  import { getValidDocument } from '@atlaskit/editor-common/validator';
3
3
  import { validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaskit/editor-common';
4
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from './analytics/enums';
5
+ import { PLATFORM } from './analytics/events';
4
6
  import { trackUnsupportedContentLevels } from './analytics/unsupported-content';
5
7
  const SUPPORTS_HIRES_TIMER_API = !!(window.performance && performance.now);
6
8
 
@@ -59,7 +61,23 @@ export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage
59
61
  time: buildTreeTime
60
62
  } = withStopwatch(() => {
61
63
  const pmNode = schema.nodeFromJSON(validDoc);
62
- pmNode.check();
64
+
65
+ try {
66
+ pmNode.check();
67
+ } catch (err) {
68
+ if (dispatchAnalyticsEvent) {
69
+ dispatchAnalyticsEvent({
70
+ action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
71
+ actionSubject: ACTION_SUBJECT.RENDERER,
72
+ attributes: {
73
+ platform: PLATFORM.WEB,
74
+ error: err === null || err === void 0 ? void 0 : err.toString()
75
+ },
76
+ eventType: EVENT_TYPE.OPERATIONAL
77
+ });
78
+ }
79
+ }
80
+
63
81
  return pmNode;
64
82
  }); // save build tree time to stats
65
83
 
@@ -8,7 +8,7 @@ import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper, E
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';
11
- import { injectIntl } from 'react-intl';
11
+ import { injectIntl } from 'react-intl-next';
12
12
  import { ActiveHeaderIdConsumer } from './active-header-id-provider';
13
13
  import _uniqueId from 'lodash/uniqueId';
14
14
  const Title = styled.span`
@@ -174,7 +174,8 @@ export class MediaCardInternal extends Component {
174
174
  imageStatus,
175
175
  disableOverlay,
176
176
  alt,
177
- featureFlags
177
+ featureFlags,
178
+ ssr
178
179
  } = this.props;
179
180
 
180
181
  if (imageStatus === 'loading' || !url) {
@@ -200,7 +201,8 @@ export class MediaCardInternal extends Component {
200
201
  mediaViewerDataSource: {
201
202
  list: Array.from(mediaIdentifierMap.values())
202
203
  },
203
- featureFlags: featureFlags
204
+ featureFlags: featureFlags,
205
+ ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
204
206
  });
205
207
  }
206
208
  /**
@@ -214,7 +216,7 @@ export class MediaCardInternal extends Component {
214
216
  render() {
215
217
  const {
216
218
  contextIdentifierProvider,
217
- mediaClientConfig,
219
+ mediaClientConfig: mediaClientConfigInState,
218
220
  fileState
219
221
  } = this.state;
220
222
  const {
@@ -231,7 +233,8 @@ export class MediaCardInternal extends Component {
231
233
  originalDimensions,
232
234
  shouldOpenMediaViewer: forceOpenMediaViewer,
233
235
  featureFlags,
234
- shouldEnableDownloadButton
236
+ shouldEnableDownloadButton,
237
+ ssr
235
238
  } = this.props;
236
239
  const isMobile = rendererAppearance === 'mobile';
237
240
  const shouldPlayInline = useInlinePlayer !== undefined ? useInlinePlayer : true;
@@ -247,6 +250,8 @@ export class MediaCardInternal extends Component {
247
250
  return null;
248
251
  }
249
252
 
253
+ const mediaClientConfig = !!ssr ? ssr.config : mediaClientConfigInState;
254
+
250
255
  if (!mediaClientConfig || !id) {
251
256
  return this.renderLoadingCard();
252
257
  }
@@ -288,7 +293,8 @@ export class MediaCardInternal extends Component {
288
293
  list: Array.from(mediaIdentifierMap.values())
289
294
  },
290
295
  featureFlags: featureFlags,
291
- shouldEnableDownloadButton: shouldEnableDownloadButton
296
+ shouldEnableDownloadButton: shouldEnableDownloadButton,
297
+ ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
292
298
  }));
293
299
  }
294
300
 
@@ -2,10 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React, { useContext, useLayoutEffect, useRef } from 'react';
4
4
  import { PureComponent } from 'react';
5
- import { IntlProvider } from 'react-intl';
6
5
  import { getSchemaBasedOnStage } from '@atlaskit/adf-schema';
7
6
  import { reduce } from '@atlaskit/adf-utils';
8
- import { UnsupportedBlock, ProviderFactory, BaseTheme, WidthProvider, getAnalyticsAppearance, getAnalyticsEventSeverity, WithCreateAnalyticsEvent, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common';
7
+ import { UnsupportedBlock, ProviderFactory, BaseTheme, WidthProvider, getAnalyticsAppearance, getAnalyticsEventSeverity, WithCreateAnalyticsEvent, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking, IntlNextErrorBoundary, LegacyToNextIntlProvider, IntlLegacyFallbackProvider } from '@atlaskit/editor-common';
9
8
  import { normalizeFeatureFlags } from '@atlaskit/editor-common/normalize-feature-flags';
10
9
  import { akEditorFullPageDefaultFontSize } from '@atlaskit/editor-shared-styles';
11
10
  import { IframeWidthObserverFallbackWrapper, IframeWrapperConsumer } from '@atlaskit/width-detector';
@@ -147,7 +146,7 @@ export class Renderer extends PureComponent {
147
146
  const nextMedia = nextProps.media || {};
148
147
  const media = this.props.media || {};
149
148
 
150
- if (nextProps.portal !== this.props.portal || nextProps.appearance !== this.props.appearance || nextProps.stickyHeaders !== this.props.stickyHeaders || nextProps.disableActions !== this.props.disableActions || nextProps.UNSAFE_allowCustomPanels !== this.props.UNSAFE_allowCustomPanels || nextProps.allowHeadingAnchorLinks !== this.props.allowHeadingAnchorLinks || nextMedia.allowLinking !== media.allowLinking) {
149
+ if (nextProps.portal !== this.props.portal || nextProps.appearance !== this.props.appearance || nextProps.stickyHeaders !== this.props.stickyHeaders || nextProps.disableActions !== this.props.disableActions || nextProps.allowCustomPanels !== this.props.allowCustomPanels || nextProps.allowHeadingAnchorLinks !== this.props.allowHeadingAnchorLinks || nextMedia.allowLinking !== media.allowLinking) {
151
150
  this.serializer = new ReactSerializer(this.deriveSerializerProps(nextProps));
152
151
  }
153
152
  }
@@ -183,7 +182,7 @@ export class Renderer extends PureComponent {
183
182
  surroundTextNodesWithTextWrapper: allowAnnotationsDraftMode,
184
183
  media: props.media,
185
184
  allowCopyToClipboard: props.allowCopyToClipboard,
186
- allowCustomPanels: props.UNSAFE_allowCustomPanels,
185
+ allowCustomPanels: props.allowCustomPanels,
187
186
  allowAnnotations: props.allowAnnotations,
188
187
  allowSelectAllTrap: props.allowSelectAllTrap,
189
188
  allowPlaceholderText: props.allowPlaceholderText
@@ -206,7 +205,7 @@ export class Renderer extends PureComponent {
206
205
  allowPlaceholderText,
207
206
  allowColumnSorting,
208
207
  allowCopyToClipboard,
209
- UNSAFE_allowCustomPanels
208
+ allowCustomPanels
210
209
  } = this.props;
211
210
  const allowNestedHeaderLinks = isNestedHeaderLinksEnabled(allowHeadingAnchorLinks);
212
211
  /**
@@ -270,7 +269,7 @@ export class Renderer extends PureComponent {
270
269
  value: this.featureFlags(this.props.featureFlags)
271
270
  }, /*#__PURE__*/React.createElement(CopyTextProvider, null, /*#__PURE__*/React.createElement(ActiveHeaderIdProvider, {
272
271
  value: getActiveHeadingId(allowHeadingAnchorLinks)
273
- }, /*#__PURE__*/React.createElement(IntlProvider, null, /*#__PURE__*/React.createElement(AnalyticsContext.Provider, {
272
+ }, /*#__PURE__*/React.createElement(LegacyToNextIntlProvider, null, /*#__PURE__*/React.createElement(IntlLegacyFallbackProvider, null, /*#__PURE__*/React.createElement(AnalyticsContext.Provider, {
274
273
  value: {
275
274
  fireAnalyticsEvent: event => this.fireAnalyticsEvent(event)
276
275
  }
@@ -280,7 +279,7 @@ export class Renderer extends PureComponent {
280
279
  allowNestedHeaderLinks: allowNestedHeaderLinks,
281
280
  allowColumnSorting: allowColumnSorting,
282
281
  allowCopyToClipboard: allowCopyToClipboard,
283
- allowCustomPanels: UNSAFE_allowCustomPanels,
282
+ allowCustomPanels: allowCustomPanels,
284
283
  allowPlaceholderText: allowPlaceholderText,
285
284
  innerRef: this.editorRef,
286
285
  onClick: handleWrapperOnClick,
@@ -291,7 +290,7 @@ export class Renderer extends PureComponent {
291
290
  doc: pmDoc,
292
291
  schema: schema,
293
292
  onAnalyticsEvent: this.fireAnalyticsEvent
294
- }, result))))))));
293
+ }, result)))))))));
295
294
  return truncated ? /*#__PURE__*/React.createElement(TruncatedWrapper, {
296
295
  height: maxHeight,
297
296
  fadeHeight: fadeOutHeight
@@ -340,14 +339,15 @@ const RendererWithAnalytics = /*#__PURE__*/React.memo(props => /*#__PURE__*/Reac
340
339
  }
341
340
  }, /*#__PURE__*/React.createElement(WithCreateAnalyticsEvent, {
342
341
  render: createAnalyticsEvent => {
342
+ // `IntlNextErrorBoundary` only captures Internationalisation errors, leaving others for `ErrorBoundary`.
343
343
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
344
344
  component: ACTION_SUBJECT.RENDERER,
345
345
  rethrowError: true,
346
346
  fallbackComponent: null,
347
347
  createAnalyticsEvent: createAnalyticsEvent
348
- }, /*#__PURE__*/React.createElement(Renderer, _extends({}, props, {
348
+ }, /*#__PURE__*/React.createElement(IntlNextErrorBoundary, null, /*#__PURE__*/React.createElement(Renderer, _extends({}, props, {
349
349
  createAnalyticsEvent: createAnalyticsEvent
350
- })));
350
+ }))));
351
351
  }
352
352
  })));
353
353
  const RendererWithIframeFallbackWrapper = /*#__PURE__*/React.memo(props => {
@@ -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
 
@@ -589,7 +591,7 @@ export const Wrapper = styled.div`
589
591
  margin-top: 0;
590
592
  }
591
593
 
592
- &:hover button.copy-to-clipboard{
594
+ &:hover button.copy-to-clipboard, .copy-to-clipboard:focus{
593
595
  opacity: 1;
594
596
  position: absolute;
595
597
  height: 32px;
@@ -52,7 +52,7 @@ const TableSortingIcon = styled.div`
52
52
  }
53
53
 
54
54
  &.${TABLE_SORTING_ICON_CLASS}-inactive {
55
- opacity: 0.5;
55
+ opacity: 0.7;
56
56
  }
57
57
  `;
58
58
 
@@ -59,7 +59,7 @@ export const applyAnnotationOnText = ({
59
59
  export const TextWithAnnotationDraft = ({
60
60
  startPos,
61
61
  endPos,
62
- text
62
+ children
63
63
  }) => {
64
64
  const textPosition = React.useMemo(() => ({
65
65
  start: startPos,
@@ -75,21 +75,21 @@ export const TextWithAnnotationDraft = ({
75
75
  }, [nextDraftPosition, textPosition]);
76
76
 
77
77
  if (shouldApplyAnnotationAt === false || !nextDraftPosition) {
78
- return /*#__PURE__*/React.createElement(React.Fragment, null, text);
78
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
79
79
  }
80
80
 
81
81
  if (shouldApplyAnnotationAt === InsertDraftPosition.AROUND_TEXT) {
82
82
  return /*#__PURE__*/React.createElement(AnnotationDraft, {
83
83
  key: 0,
84
84
  draftPosition: nextDraftPosition
85
- }, text);
85
+ }, children);
86
86
  }
87
87
 
88
- const offsets = calcTextSplitOffset(nextDraftPosition, textPosition, text);
89
- const texts = splitText(text, offsets);
88
+ const offsets = calcTextSplitOffset(nextDraftPosition, textPosition, children);
89
+ const texts = splitText(children, offsets);
90
90
 
91
91
  if (!texts) {
92
- return /*#__PURE__*/React.createElement(React.Fragment, null, text);
92
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
93
93
  }
94
94
 
95
95
  const components = applyAnnotationOnText({
@@ -20,8 +20,10 @@ export const useAnnotationStateByTypeEvent = ({
20
20
 
21
21
  const nextStates = Object.values(payload).reduce((acc, curr) => {
22
22
  if (curr.annotationType === type) {
23
+ // Check for empty state to prevent additional renders
24
+ const isEmpty = curr.state === null || curr.state === undefined;
23
25
  return { ...acc,
24
- [curr.id]: curr.state
26
+ [curr.id]: !isEmpty ? curr.state : states[curr.id]
25
27
  };
26
28
  }
27
29
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "82.1.0",
3
+ "version": "84.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -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";
@@ -1,4 +1,4 @@
1
- import { defineMessages } from 'react-intl';
1
+ import { defineMessages } from 'react-intl-next';
2
2
  export var headingAnchorLinkMessages = defineMessages({
3
3
  copyHeadingLinkToClipboard: {
4
4
  id: 'fabric.editor.headingLink.copyAnchorLink',
@@ -19,6 +19,7 @@ import { getMarksByOrder, isSameMark, calcTableColumnWidths } from '@atlaskit/ed
19
19
  import { getText } from '../utils';
20
20
  import { findChildrenByType } from 'prosemirror-utils';
21
21
  import { insideBreakoutLayout } from './renderer-node';
22
+ import { isCodeMark } from './marks/code';
22
23
 
23
24
  function mergeMarks(marksAndNodes) {
24
25
  return marksAndNodes.reduce(function (acc, markOrNode) {
@@ -144,13 +145,22 @@ var ReactSerializer = /*#__PURE__*/function () {
144
145
 
145
146
  var extraProps = {
146
147
  isInline: node === null || node === void 0 ? void 0 : node.isInline
147
- };
148
-
149
- var props = _objectSpread(_objectSpread(_objectSpread({
148
+ }; // currently the only mark which has custom props is the code mark
149
+
150
+ var markSpecificProps = isCodeMark(mark) ? {
151
+ // The appearance being mobile indicates we are in an renderer being
152
+ // rendered by mobile bridge in a web view.
153
+ // The tooltip is likely to have unexpected behaviour there, with being cut
154
+ // off, so we disable it. This is also to keep the behaviour consistent with
155
+ // the rendering in the mobile Native Renderer.
156
+ codeBidiWarningTooltipEnabled: _this.appearance !== 'mobile'
157
+ } : {};
158
+
159
+ var props = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
150
160
  eventHandlers: _this.eventHandlers,
151
161
  fireAnalyticsEvent: _this.fireAnalyticsEvent,
152
162
  markKey: key
153
- }, otherAttrs), extraProps), {}, {
163
+ }, otherAttrs), extraProps), markSpecificProps), {}, {
154
164
  dataAttributes: {
155
165
  'data-renderer-mark': true
156
166
  }
@@ -334,9 +344,8 @@ var ReactSerializer = /*#__PURE__*/function () {
334
344
  return /*#__PURE__*/React.createElement(TextWrapperComponent, {
335
345
  key: textKey,
336
346
  startPos: startPos + parentDepth,
337
- endPos: endPos + parentDepth,
338
- text: mark.text
339
- });
347
+ endPos: endPos + parentDepth
348
+ }, mark.text);
340
349
  }
341
350
 
342
351
  return mark.text || '';
@@ -421,7 +430,8 @@ var ReactSerializer = /*#__PURE__*/function () {
421
430
  }, {
422
431
  key: "getMediaProps",
423
432
  value: function getMediaProps(node) {
424
- var _this6 = this;
433
+ var _this6 = this,
434
+ _this$media;
425
435
 
426
436
  var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
427
437
  var link = node.type.schema.marks.link;
@@ -437,7 +447,8 @@ var ReactSerializer = /*#__PURE__*/function () {
437
447
  isLinkMark: isLinkMark,
438
448
  allowAltTextOnImages: this.allowAltTextOnImages,
439
449
  featureFlags: this.media && this.media.featureFlags,
440
- shouldOpenMediaViewer: this.shouldOpenMediaViewer
450
+ shouldOpenMediaViewer: this.shouldOpenMediaViewer,
451
+ ssr: (_this$media = this.media) === null || _this$media === void 0 ? void 0 : _this$media.ssr
441
452
  });
442
453
  }
443
454
  }, {
@@ -464,13 +475,14 @@ var ReactSerializer = /*#__PURE__*/function () {
464
475
  }, {
465
476
  key: "getMediaGroupProps",
466
477
  value: function getMediaGroupProps(node) {
467
- var _this$media;
478
+ var _this$media2, _this$media3;
468
479
 
469
480
  return _objectSpread(_objectSpread({}, this.getProps(node)), {}, {
470
481
  shouldOpenMediaViewer: this.shouldOpenMediaViewer,
471
482
  allowAltTextOnImages: this.allowAltTextOnImages,
472
483
  featureFlags: this.media && this.media.featureFlags,
473
- enableDownloadButton: (_this$media = this.media) === null || _this$media === void 0 ? void 0 : _this$media.enableDownloadButton
484
+ enableDownloadButton: (_this$media2 = this.media) === null || _this$media2 === void 0 ? void 0 : _this$media2.enableDownloadButton,
485
+ ssr: (_this$media3 = this.media) === null || _this$media3 === void 0 ? void 0 : _this$media3.ssr
474
486
  });
475
487
  }
476
488
  }, {
@@ -504,8 +516,15 @@ var ReactSerializer = /*#__PURE__*/function () {
504
516
  }, {
505
517
  key: "getCodeBlockProps",
506
518
  value: function getCodeBlockProps(node) {
519
+ // The appearance being mobile indicates we are in an renderer being
520
+ // rendered by mobile bridge in a web view.
521
+ // The tooltip is likely to have unexpected behaviour there, with being cut
522
+ // off, so we disable it. This is also to keep the behaviour consistent with
523
+ // the rendering in the mobile Native Renderer.
524
+ var codeBidiWarningTooltipEnabled = this.appearance !== 'mobile';
507
525
  return _objectSpread(_objectSpread({}, this.getProps(node)), {}, {
508
- text: node.textContent
526
+ text: node.textContent,
527
+ codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
509
528
  });
510
529
  }
511
530
  }, {
@@ -1,16 +1,20 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
- import { injectIntl } from 'react-intl';
3
+ import { injectIntl } from 'react-intl-next';
4
4
  import AkCode from '@atlaskit/code/inline';
5
5
  import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
6
6
  import { useFeatureFlags } from '../../use-feature-flags';
7
+ export var isCodeMark = function isCodeMark(mark) {
8
+ return mark && mark.type && mark.type.name === 'code';
9
+ };
7
10
  export function CodeWithIntl(props) {
8
11
  var featureFlags = useFeatureFlags();
9
12
  var codeBidiWarningLabel = props.intl.formatMessage(codeBidiWarningMessages.label);
10
13
  return /*#__PURE__*/React.createElement(AkCode, _extends({
11
14
  className: "code",
12
15
  codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
13
- codeBidiWarningLabel: codeBidiWarningLabel
16
+ codeBidiWarningLabel: codeBidiWarningLabel,
17
+ codeBidiWarningTooltipEnabled: props.codeBidiWarningTooltipEnabled
14
18
  }, props.dataAttributes), props.children);
15
19
  }
16
20
  export default injectIntl(CodeWithIntl);
@@ -0,0 +1,10 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ export default function FragmentMark(props) {
4
+ var WrapperElement = props.isInline ? 'span' : 'div';
5
+ return /*#__PURE__*/React.createElement(WrapperElement, _extends({
6
+ "data-localId": props.localId,
7
+ "data-name": props.name,
8
+ "data-mark-type": "fragment"
9
+ }, props.dataAttributes), props.children);
10
+ }
@@ -12,6 +12,7 @@ import Indentation from './indentation';
12
12
  import UnsupportedMark from './unsupportedMark';
13
13
  import UnsupportedNodeAttribute from './unsupportedNodeAttribute';
14
14
  import DataConsumer from './data-consumer';
15
+ import FragmentMark from './fragment';
15
16
  import Annotation, { isAnnotationMark } from './annotation'; // Stage0
16
17
 
17
18
  import ConfluenceInlineComment from './confluence-inline-comment';
@@ -32,9 +33,10 @@ export var markToReact = {
32
33
  indentation: Indentation,
33
34
  unsupportedMark: UnsupportedMark,
34
35
  unsupportedNodeAttribute: UnsupportedNodeAttribute,
35
- dataConsumer: DataConsumer
36
+ dataConsumer: DataConsumer,
37
+ fragment: FragmentMark
36
38
  };
37
39
  export var toReact = function toReact(mark) {
38
40
  return markToReact[mark.type.name];
39
41
  };
40
- export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer };
42
+ export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark };
@@ -1,9 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import React, { useMemo } from 'react';
3
4
  export default function TextColor(props) {
5
+ var style = useMemo(function () {
6
+ return _defineProperty({}, '--custom-text-color', props.color);
7
+ }, [props.color]);
4
8
  return /*#__PURE__*/React.createElement("span", _extends({}, props.dataAttributes, {
5
- style: {
6
- color: props.color
7
- }
9
+ "data-text-custom-color": props.color,
10
+ className: "fabric-text-color-mark",
11
+ style: style
8
12
  }), props.children);
9
13
  }
@@ -3,7 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
3
3
  var _templateObject;
4
4
 
5
5
  import React from 'react';
6
- import { injectIntl } from 'react-intl';
6
+ import { injectIntl } from 'react-intl-next';
7
7
  import styled from 'styled-components';
8
8
  import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
9
9
  import { overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
@@ -18,7 +18,8 @@ function CodeBlock(props) {
18
18
  var text = props.text,
19
19
  language = props.language,
20
20
  _props$allowCopyToCli = props.allowCopyToClipboard,
21
- allowCopyToClipboard = _props$allowCopyToCli === void 0 ? false : _props$allowCopyToCli;
21
+ allowCopyToClipboard = _props$allowCopyToCli === void 0 ? false : _props$allowCopyToCli,
22
+ codeBidiWarningTooltipEnabled = props.codeBidiWarningTooltipEnabled;
22
23
  var featureFlags = useFeatureFlags();
23
24
  var codeBidiWarningLabel = props.intl.formatMessage(codeBidiWarningMessages.label);
24
25
  var className = ['code-block', props.className].join(' ');
@@ -30,7 +31,8 @@ function CodeBlock(props) {
30
31
  language: language,
31
32
  text: text,
32
33
  codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
33
- codeBidiWarningLabel: codeBidiWarningLabel
34
+ codeBidiWarningLabel: codeBidiWarningLabel,
35
+ codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
34
36
  }));
35
37
  }
36
38
 
@@ -4,7 +4,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
4
4
  var _templateObject;
5
5
 
6
6
  import React, { useState } from 'react';
7
- import { injectIntl } from 'react-intl';
7
+ import { injectIntl } from 'react-intl-next';
8
8
  import styled from 'styled-components';
9
9
  import Tooltip from '@atlaskit/tooltip';
10
10
  import Button from '@atlaskit/button/custom-theme-button';
@@ -11,7 +11,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
11
11
  import React from 'react';
12
12
  import { PureComponent } from 'react';
13
13
  import { isPastDate, timestampToString, timestampToTaskContext, DateSharedCssClassName } from '@atlaskit/editor-common';
14
- import { injectIntl } from 'react-intl';
14
+ import { injectIntl } from 'react-intl-next';
15
15
 
16
16
  var Date = /*#__PURE__*/function (_PureComponent) {
17
17
  _inherits(Date, _PureComponent);
@@ -22,7 +22,7 @@ import styled from 'styled-components';
22
22
  import { N200, N500, B400 } from '@atlaskit/theme/colors';
23
23
  import LinkIcon from '@atlaskit/icon/glyph/link';
24
24
  import Tooltip from '@atlaskit/tooltip';
25
- import { injectIntl } from 'react-intl';
25
+ import { injectIntl } from 'react-intl-next';
26
26
  import { headingAnchorLinkMessages } from '../../messages';
27
27
  export var HeadingAnchorWrapperClassName = 'heading-anchor-wrapper';
28
28
  var CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef(function (props, ref) {
@@ -1,15 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import HeadingAnchor from './heading-anchor';
4
- import Url from 'url-parse';
5
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics/enums';
6
5
  import AnalyticsContext from '../../analytics/analyticsContext';
7
6
  import { CopyTextConsumer } from './copy-text-provider';
8
7
 
9
8
  var getCurrentUrlWithHash = function getCurrentUrlWithHash() {
10
9
  var hash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
11
- var url = new Url(window.location.href);
12
- url.set('hash', encodeURIComponent(hash));
10
+ var url = new URL(window.location.href);
11
+ url.hash = encodeURIComponent(hash);
13
12
  return url.href;
14
13
  };
15
14
 
@@ -44,7 +44,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
44
44
  alt = _this$props.alt,
45
45
  featureFlags = _this$props.featureFlags,
46
46
  allowMediaViewer = _this$props.shouldOpenMediaViewer,
47
- enableDownloadButton = _this$props.enableDownloadButton;
47
+ enableDownloadButton = _this$props.enableDownloadButton,
48
+ ssr = _this$props.ssr;
48
49
 
49
50
  var linkMark = _this.props.marks.find(_this.props.isLinkMark);
50
51
 
@@ -59,7 +60,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
59
60
  eventHandlers: eventHandlers,
60
61
  alt: allowAltTextOnImages ? alt : undefined,
61
62
  featureFlags: featureFlags,
62
- shouldEnableDownloadButton: enableDownloadButton
63
+ shouldEnableDownloadButton: enableDownloadButton,
64
+ ssr: ssr
63
65
  }));
64
66
  return linkHref ? /*#__PURE__*/React.createElement(MediaLink, {
65
67
  href: linkHref,
@@ -14,7 +14,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
14
14
  import { mapBreakpointToLayoutMaxWidth, WidthConsumer } from '@atlaskit/editor-common';
15
15
  import { akEditorFullWidthLayoutWidth, getAkEditorFullPageMaxWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
16
16
  import { Component, default as React } from 'react';
17
- import { injectIntl } from 'react-intl';
17
+ import { injectIntl } from 'react-intl-next';
18
18
  import { FullPagePadding } from '../../../ui/Renderer/style';
19
19
  import { ExtendedUIMediaSingle } from './styles';
20
20
  import { getMediaFeatureFlag } from '@atlaskit/media-common';