@atlaskit/renderer 81.1.1 → 83.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 (73) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/dist/cjs/react/index.js +40 -12
  3. package/dist/cjs/react/marks/code.js +26 -4
  4. package/dist/cjs/react/marks/fragment.js +21 -0
  5. package/dist/cjs/react/marks/index.js +10 -1
  6. package/dist/cjs/react/nodes/codeBlock.js +17 -3
  7. package/dist/cjs/react/nodes/heading-anchor.js +1 -2
  8. package/dist/cjs/react/nodes/heading.js +5 -9
  9. package/dist/cjs/react/nodes/index.js +15 -1
  10. package/dist/cjs/react/nodes/media.js +4 -2
  11. package/dist/cjs/react/nodes/mediaInline.js +104 -0
  12. package/dist/cjs/react/nodes/panel.js +5 -7
  13. package/dist/cjs/react/nodes/text-wrapper.js +5 -6
  14. package/dist/cjs/ui/MediaCard.js +11 -5
  15. package/dist/cjs/ui/Renderer/index.js +4 -4
  16. package/dist/cjs/ui/Renderer/style.js +5 -5
  17. package/dist/cjs/ui/SortingIcon.js +1 -1
  18. package/dist/cjs/ui/annotations/draft/component.js +6 -6
  19. package/dist/cjs/ui/annotations/hooks/use-events.js +3 -1
  20. package/dist/cjs/version.json +1 -1
  21. package/dist/es2019/react/index.js +37 -8
  22. package/dist/es2019/react/marks/code.js +15 -3
  23. package/dist/es2019/react/marks/fragment.js +10 -0
  24. package/dist/es2019/react/marks/index.js +4 -2
  25. package/dist/es2019/react/nodes/codeBlock.js +13 -3
  26. package/dist/es2019/react/nodes/heading-anchor.js +1 -2
  27. package/dist/es2019/react/nodes/heading.js +5 -8
  28. package/dist/es2019/react/nodes/index.js +8 -1
  29. package/dist/es2019/react/nodes/media.js +4 -2
  30. package/dist/es2019/react/nodes/mediaInline.js +53 -0
  31. package/dist/es2019/react/nodes/panel.js +6 -7
  32. package/dist/es2019/react/nodes/text-wrapper.js +7 -6
  33. package/dist/es2019/ui/MediaCard.js +11 -5
  34. package/dist/es2019/ui/Renderer/index.js +4 -4
  35. package/dist/es2019/ui/Renderer/style.js +48 -82
  36. package/dist/es2019/ui/SortingIcon.js +1 -1
  37. package/dist/es2019/ui/annotations/draft/component.js +6 -6
  38. package/dist/es2019/ui/annotations/hooks/use-events.js +3 -1
  39. package/dist/es2019/version.json +1 -1
  40. package/dist/esm/react/index.js +39 -12
  41. package/dist/esm/react/marks/code.js +15 -3
  42. package/dist/esm/react/marks/fragment.js +10 -0
  43. package/dist/esm/react/marks/index.js +4 -2
  44. package/dist/esm/react/nodes/codeBlock.js +13 -3
  45. package/dist/esm/react/nodes/heading-anchor.js +1 -2
  46. package/dist/esm/react/nodes/heading.js +5 -8
  47. package/dist/esm/react/nodes/index.js +14 -1
  48. package/dist/esm/react/nodes/media.js +4 -2
  49. package/dist/esm/react/nodes/mediaInline.js +80 -0
  50. package/dist/esm/react/nodes/panel.js +6 -7
  51. package/dist/esm/react/nodes/text-wrapper.js +7 -6
  52. package/dist/esm/ui/MediaCard.js +11 -5
  53. package/dist/esm/ui/Renderer/index.js +4 -4
  54. package/dist/esm/ui/Renderer/style.js +5 -6
  55. package/dist/esm/ui/SortingIcon.js +1 -1
  56. package/dist/esm/ui/annotations/draft/component.js +6 -6
  57. package/dist/esm/ui/annotations/hooks/use-events.js +3 -1
  58. package/dist/esm/version.json +1 -1
  59. package/dist/types/index.d.ts +1 -0
  60. package/dist/types/react/index.d.ts +1 -0
  61. package/dist/types/react/marks/code.d.ts +15 -1
  62. package/dist/types/react/marks/fragment.d.ts +3 -0
  63. package/dist/types/react/marks/index.d.ts +2 -1
  64. package/dist/types/react/nodes/codeBlock.d.ts +4 -3
  65. package/dist/types/react/nodes/index.d.ts +8 -7
  66. package/dist/types/react/nodes/mediaInline.d.ts +17 -0
  67. package/dist/types/react/nodes/text-wrapper.d.ts +2 -3
  68. package/dist/types/renderer-context.d.ts +3 -1
  69. package/dist/types/types/mediaOptions.d.ts +7 -1
  70. package/dist/types/ui/MediaCard.d.ts +2 -0
  71. package/dist/types/ui/annotations/draft/component.d.ts +1 -1
  72. package/dist/types/ui/renderer-props.d.ts +1 -1
  73. package/package.json +22 -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
  }}
@@ -77,7 +76,7 @@ const Panel = props => {
77
76
  const icon = getIcon();
78
77
 
79
78
  if (icon) {
80
- return /*#__PURE__*/React.createElement("span", {
79
+ return /*#__PURE__*/React.createElement("div", {
81
80
  className: PanelSharedCssClassName.icon
82
81
  }, icon);
83
82
  }
@@ -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;
@@ -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
 
@@ -147,7 +147,7 @@ export class Renderer extends PureComponent {
147
147
  const nextMedia = nextProps.media || {};
148
148
  const media = this.props.media || {};
149
149
 
150
- if (nextProps.portal !== this.props.portal || nextProps.appearance !== this.props.appearance || nextProps.stickyHeaders !== this.props.stickyHeaders || nextProps.disableActions !== this.props.disableActions || nextProps.allowHeadingAnchorLinks !== this.props.allowHeadingAnchorLinks || nextMedia.allowLinking !== media.allowLinking) {
150
+ 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
151
  this.serializer = new ReactSerializer(this.deriveSerializerProps(nextProps));
152
152
  }
153
153
  }
@@ -183,7 +183,7 @@ export class Renderer extends PureComponent {
183
183
  surroundTextNodesWithTextWrapper: allowAnnotationsDraftMode,
184
184
  media: props.media,
185
185
  allowCopyToClipboard: props.allowCopyToClipboard,
186
- allowCustomPanels: props.UNSAFE_allowCustomPanels,
186
+ allowCustomPanels: props.allowCustomPanels,
187
187
  allowAnnotations: props.allowAnnotations,
188
188
  allowSelectAllTrap: props.allowSelectAllTrap,
189
189
  allowPlaceholderText: props.allowPlaceholderText
@@ -206,7 +206,7 @@ export class Renderer extends PureComponent {
206
206
  allowPlaceholderText,
207
207
  allowColumnSorting,
208
208
  allowCopyToClipboard,
209
- UNSAFE_allowCustomPanels
209
+ allowCustomPanels
210
210
  } = this.props;
211
211
  const allowNestedHeaderLinks = isNestedHeaderLinksEnabled(allowHeadingAnchorLinks);
212
212
  /**
@@ -280,7 +280,7 @@ export class Renderer extends PureComponent {
280
280
  allowNestedHeaderLinks: allowNestedHeaderLinks,
281
281
  allowColumnSorting: allowColumnSorting,
282
282
  allowCopyToClipboard: allowCopyToClipboard,
283
- allowCustomPanels: UNSAFE_allowCustomPanels,
283
+ allowCustomPanels: allowCustomPanels,
284
284
  allowPlaceholderText: allowPlaceholderText,
285
285
  innerRef: this.editorRef,
286
286
  onClick: handleWrapperOnClick,
@@ -7,7 +7,6 @@ import { tableSharedStyle, columnLayoutSharedStyle, blockquoteSharedStyles, head
7
7
  import { editorFontSize, blockNodesVerticalMargin, akEditorTableToolbar, akEditorTableToolbarDark, akEditorTableBorder, akEditorTableBorderDark, akEditorTableNumberColumnWidth, gridMediumMaxWidth, akEditorFullWidthLayoutWidth, akEditorStickyHeaderZIndex, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
8
8
  import { RendererCssClassName } from '../../consts';
9
9
  import { HeadingAnchorWrapperClassName } from '../../react/nodes/heading-anchor';
10
- import { h100, h300, h400, h500, h600, h700 } from '@atlaskit/theme/typography';
11
10
  export const FullPagePadding = 32;
12
11
 
13
12
  const getLineHeight = fontCode => headingSizesImport[fontCode].lineHeight / headingSizesImport[fontCode].size;
@@ -38,10 +37,12 @@ const headingAnchorStyle = headingTag => css`
38
37
  * The copy link button doesn't reserve space in the DOM so that
39
38
  * the text alignment isn't impacted by the button/icon's space.
40
39
  */
41
- display: inline-block;
42
- & + .${HeadingAnchorWrapperClassName} {
40
+ .${HeadingAnchorWrapperClassName} {
43
41
  position: absolute;
42
+ height: ${headingSizes[headingTag].lineHeight}em;
43
+
44
44
  margin-left: 6px;
45
+
45
46
  button {
46
47
  padding-left: 0;
47
48
  padding-right: 0;
@@ -58,16 +59,18 @@ const headingAnchorStyle = headingTag => css`
58
59
  * @see https://caniuse.com/mdn-css_at-rules_media_hover
59
60
  */
60
61
  @media (hover: hover) and (pointer: fine) {
61
- & + .${HeadingAnchorWrapperClassName} {
62
+ .${HeadingAnchorWrapperClassName} {
62
63
  > button {
63
64
  opacity: 0;
64
65
  transform: translate(-8px, 0px);
65
66
  transition: opacity 0.2s ease 0s, transform 0.2s ease 0s;
66
- &:focus {
67
- opacity: 1;
68
- transform: none !important;
69
- outline: solid 2px ${colors.B200};
70
- }
67
+ }
68
+ }
69
+
70
+ &:hover {
71
+ .${HeadingAnchorWrapperClassName} > button {
72
+ opacity: 1;
73
+ transform: none !important;
71
74
  }
72
75
  }
73
76
  }
@@ -93,39 +96,41 @@ const alignedHeadingAnchorStyle = ({
93
96
  * container edge.
94
97
  */
95
98
  .fabric-editor-block-mark:not([data-align='center'])[data-align] {
96
- .heading-wrapper {
97
- // Using right to left text to achieve the inverse effect
98
- // of where the copy link button icon sits for left/center
99
- // alignment.
100
- // Although this is unorthodox it's the only approach which
101
- // allows the button to sit flush against the left edge of
102
- // bottom line of text.
103
- direction: rtl;
104
-
105
- // By default RTL will negatively impact the layout of special
106
- // characters within the heading text, and potentially other
107
- // nested inline nodes. To prevent this we insert pseudo elements
108
- // containing HTML entities to retain LTR for all heading content
109
- // except for the copy link button.
110
- > *:not(.${HeadingAnchorWrapperClassName}):not(br) {
111
- ::before {
112
- // Open LTR: https://www.fileformat.info/info/unicode/char/202a/index.htm
113
- content: '\u202A';
114
- }
115
- ::after {
116
- // Close LTR: https://www.fileformat.info/info/unicode/char/202c/index.htm
117
- content: '\u202C';
99
+ > {
100
+ h1, h2, h3, h4, h5, h6 {
101
+ // Using right to left text to achieve the inverse effect
102
+ // of where the copy link button icon sits for left/center
103
+ // alignment.
104
+ // Although this is unorthodox it's the only approach which
105
+ // allows the button to sit flush against the left edge of
106
+ // bottom line of text.
107
+ direction: rtl;
108
+
109
+ // By default RTL will negatively impact the layout of special
110
+ // characters within the heading text, and potentially other
111
+ // nested inline nodes. To prevent this we insert pseudo elements
112
+ // containing HTML entities to retain LTR for all heading content
113
+ // except for the copy link button.
114
+ > *:not(.${HeadingAnchorWrapperClassName}):not(br) {
115
+ ::before {
116
+ // Open LTR: https://www.fileformat.info/info/unicode/char/202a/index.htm
117
+ content: '\u202A';
118
+ }
119
+ ::after {
120
+ // Close LTR: https://www.fileformat.info/info/unicode/char/202c/index.htm
121
+ content: '\u202C';
122
+ }
118
123
  }
119
124
  }
120
125
  }
121
- }
122
- .${HeadingAnchorWrapperClassName} {
123
- margin: 0 6px 0 0;
124
- }
126
+ .${HeadingAnchorWrapperClassName} {
127
+ margin: 0 6px 0 0;
128
+ }
125
129
 
126
- @media (hover: hover) and (pointer: fine) {
127
- .${HeadingAnchorWrapperClassName} > button {
128
- transform: translate(8px, 0);
130
+ @media (hover: hover) and (pointer: fine) {
131
+ .${HeadingAnchorWrapperClassName} > button {
132
+ transform: translate(8px, 0px);
133
+ }
129
134
  }
130
135
  }
131
136
  }
@@ -160,8 +165,10 @@ const tableSortableColumnStyle = ({
160
165
  .${HeadingAnchorWrapperClassName} {
161
166
  position: unset;
162
167
  }
163
- .heading-wrapper {
164
- margin-right: 30px;
168
+ > {
169
+ h1, h2, h3, h4, h5, h6 {
170
+ margin-right: 30px;
171
+ }
165
172
  }
166
173
  `;
167
174
  }
@@ -272,47 +279,6 @@ export const Wrapper = styled.div`
272
279
  ${fullPageStyles}
273
280
  ${fullWidthStyles}
274
281
 
275
- div.heading-wrapper{
276
- position: relative;
277
- h1, h2, h3, h4, h5, h6{
278
- margin-top: 0;
279
- font-size: inherit;
280
- }
281
- &.h1 {
282
- ${h700};
283
- margin-top: 1.667em;
284
- }
285
- &.h2 {
286
- ${h600};
287
- margin-top: 1.8em;
288
- }
289
- &.h3 {
290
- ${h500};
291
- margin-top: 2em;
292
- }
293
- &.h4 {
294
- ${h400};
295
- margin-top: 1.357em;
296
- }
297
- &.h5 {
298
- ${h300};
299
- margin-top: 1.667em;
300
- }
301
- &.h6 {
302
- ${h100};
303
- margin-top: 1.455em;
304
- }
305
- /* show copy button on heading wrapper hover */
306
- @media (hover: hover) and (pointer: fine) {
307
- &:hover {
308
- .${HeadingAnchorWrapperClassName} > button{
309
- opacity: 1;
310
- transform: none !important;
311
- }
312
- }
313
- }
314
- }
315
-
316
282
  & h1 {
317
283
  ${headingAnchorStyle('h1')}
318
284
  }
@@ -623,7 +589,7 @@ export const Wrapper = styled.div`
623
589
  margin-top: 0;
624
590
  }
625
591
 
626
- &:hover button.copy-to-clipboard{
592
+ &:hover button.copy-to-clipboard, .copy-to-clipboard:focus{
627
593
  opacity: 1;
628
594
  position: absolute;
629
595
  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": "81.1.1",
3
+ "version": "83.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -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
  }
@@ -212,6 +222,9 @@ var ReactSerializer = /*#__PURE__*/function () {
212
222
  case 'mediaGroup':
213
223
  return this.getMediaGroupProps(node);
214
224
 
225
+ case 'mediaInline':
226
+ return this.getMediaInlineProps(node);
227
+
215
228
  case 'mediaSingle':
216
229
  return this.getMediaSingleProps(node, path);
217
230
 
@@ -331,9 +344,8 @@ var ReactSerializer = /*#__PURE__*/function () {
331
344
  return /*#__PURE__*/React.createElement(TextWrapperComponent, {
332
345
  key: textKey,
333
346
  startPos: startPos + parentDepth,
334
- endPos: endPos + parentDepth,
335
- text: mark.text
336
- });
347
+ endPos: endPos + parentDepth
348
+ }, mark.text);
337
349
  }
338
350
 
339
351
  return mark.text || '';
@@ -418,7 +430,8 @@ var ReactSerializer = /*#__PURE__*/function () {
418
430
  }, {
419
431
  key: "getMediaProps",
420
432
  value: function getMediaProps(node) {
421
- var _this6 = this;
433
+ var _this6 = this,
434
+ _this$media;
422
435
 
423
436
  var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
424
437
  var link = node.type.schema.marks.link;
@@ -434,7 +447,8 @@ var ReactSerializer = /*#__PURE__*/function () {
434
447
  isLinkMark: isLinkMark,
435
448
  allowAltTextOnImages: this.allowAltTextOnImages,
436
449
  featureFlags: this.media && this.media.featureFlags,
437
- shouldOpenMediaViewer: this.shouldOpenMediaViewer
450
+ shouldOpenMediaViewer: this.shouldOpenMediaViewer,
451
+ ssr: (_this$media = this.media) === null || _this$media === void 0 ? void 0 : _this$media.ssr
438
452
  });
439
453
  }
440
454
  }, {
@@ -461,15 +475,21 @@ var ReactSerializer = /*#__PURE__*/function () {
461
475
  }, {
462
476
  key: "getMediaGroupProps",
463
477
  value: function getMediaGroupProps(node) {
464
- var _this$media;
478
+ var _this$media2, _this$media3;
465
479
 
466
480
  return _objectSpread(_objectSpread({}, this.getProps(node)), {}, {
467
481
  shouldOpenMediaViewer: this.shouldOpenMediaViewer,
468
482
  allowAltTextOnImages: this.allowAltTextOnImages,
469
483
  featureFlags: this.media && this.media.featureFlags,
470
- 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
471
486
  });
472
487
  }
488
+ }, {
489
+ key: "getMediaInlineProps",
490
+ value: function getMediaInlineProps(node) {
491
+ return _objectSpread({}, this.getProps(node));
492
+ }
473
493
  }, {
474
494
  key: "getTaskItemProps",
475
495
  value: function getTaskItemProps(node) {
@@ -496,8 +516,15 @@ var ReactSerializer = /*#__PURE__*/function () {
496
516
  }, {
497
517
  key: "getCodeBlockProps",
498
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';
499
525
  return _objectSpread(_objectSpread({}, this.getProps(node)), {}, {
500
- text: node.textContent
526
+ text: node.textContent,
527
+ codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
501
528
  });
502
529
  }
503
530
  }, {
@@ -1,8 +1,20 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
+ import { injectIntl } from 'react-intl';
3
4
  import AkCode from '@atlaskit/code/inline';
4
- export default function Code(props) {
5
+ import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
6
+ import { useFeatureFlags } from '../../use-feature-flags';
7
+ export var isCodeMark = function isCodeMark(mark) {
8
+ return mark && mark.type && mark.type.name === 'code';
9
+ };
10
+ export function CodeWithIntl(props) {
11
+ var featureFlags = useFeatureFlags();
12
+ var codeBidiWarningLabel = props.intl.formatMessage(codeBidiWarningMessages.label);
5
13
  return /*#__PURE__*/React.createElement(AkCode, _extends({
6
- className: "code"
14
+ className: "code",
15
+ codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
16
+ codeBidiWarningLabel: codeBidiWarningLabel,
17
+ codeBidiWarningTooltipEnabled: props.codeBidiWarningTooltipEnabled
7
18
  }, props.dataAttributes), props.children);
8
- }
19
+ }
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 };
@@ -3,19 +3,25 @@ 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
7
  import styled from 'styled-components';
7
8
  import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
8
9
  import { overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
9
10
  import { N20, DN50 } from '@atlaskit/theme/colors';
10
11
  import { themed } from '@atlaskit/theme/components';
11
12
  import { fontSize, gridSize } from '@atlaskit/theme/constants';
13
+ import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
14
+ import { useFeatureFlags } from '../../use-feature-flags';
12
15
  import CopyButton from './codeBlockCopyButton';
13
16
 
14
17
  function CodeBlock(props) {
15
18
  var text = props.text,
16
19
  language = props.language,
17
20
  _props$allowCopyToCli = props.allowCopyToClipboard,
18
- allowCopyToClipboard = _props$allowCopyToCli === void 0 ? false : _props$allowCopyToCli;
21
+ allowCopyToClipboard = _props$allowCopyToCli === void 0 ? false : _props$allowCopyToCli,
22
+ codeBidiWarningTooltipEnabled = props.codeBidiWarningTooltipEnabled;
23
+ var featureFlags = useFeatureFlags();
24
+ var codeBidiWarningLabel = props.intl.formatMessage(codeBidiWarningMessages.label);
19
25
  var className = ['code-block', props.className].join(' ');
20
26
  return /*#__PURE__*/React.createElement("div", {
21
27
  className: className
@@ -23,11 +29,15 @@ function CodeBlock(props) {
23
29
  content: text
24
30
  }) : null, /*#__PURE__*/React.createElement(AkCodeBlock, {
25
31
  language: language,
26
- text: text
32
+ text: text,
33
+ codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
34
+ codeBidiWarningLabel: codeBidiWarningLabel,
35
+ codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
27
36
  }));
28
37
  }
29
38
 
30
- export default styled(CodeBlock)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n tab-size: 4;\n [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n background-image: ", ";\n background-attachment: local, scroll, scroll;\n background-position: 100% 0, 100% 0, 0 0;\n }\n"])), relativeFontSizeToBase16(fontSize()), overflowShadow({
39
+ var IntlCodeBlock = injectIntl(CodeBlock);
40
+ export default styled(IntlCodeBlock)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n tab-size: 4;\n [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n background-image: ", ";\n background-attachment: local, scroll, scroll;\n background-position: 100% 0, 100% 0, 0 0;\n }\n"])), relativeFontSizeToBase16(fontSize()), overflowShadow({
31
41
  background: themed({
32
42
  light: N20,
33
43
  dark: DN50
@@ -111,8 +111,7 @@ var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
111
111
  _defineProperty(_assertThisInitialized(_this), "renderAnchorButton", function () {
112
112
  return /*#__PURE__*/React.createElement(CopyAnchorButton, {
113
113
  onMouseLeave: _this.resetMessage,
114
- onClick: _this.copyToClipboard,
115
- "aria-label": _this.state.tooltipMessage
114
+ onClick: _this.copyToClipboard
116
115
  }, /*#__PURE__*/React.createElement(LinkIcon, {
117
116
  label: "copy",
118
117
  size: _this.props.level > 3 ? 'small' : 'medium',