@atlaskit/renderer 95.0.1 → 96.0.2

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 (78) hide show
  1. package/CHANGELOG.md +40 -1
  2. package/dist/cjs/react/index.js +0 -2
  3. package/dist/cjs/react/nodes/embedCard.js +2 -5
  4. package/dist/cjs/react/nodes/inlineCard.js +5 -1
  5. package/dist/cjs/react/nodes/mediaInline.js +41 -4
  6. package/dist/cjs/react/nodes/mediaSingle/index.js +3 -7
  7. package/dist/cjs/react/nodes/panel.js +7 -5
  8. package/dist/cjs/react/nodes/table/colgroup.js +6 -12
  9. package/dist/cjs/react/nodes/table/sticky.js +28 -17
  10. package/dist/cjs/react/nodes/table/table.js +1 -3
  11. package/dist/cjs/react/nodes/table.js +20 -9
  12. package/dist/cjs/react/nodes/tableCell.js +5 -3
  13. package/dist/cjs/render-document.js +2 -2
  14. package/dist/cjs/ui/MediaCard.js +2 -2
  15. package/dist/cjs/ui/Renderer/breakout-ssr.js +6 -8
  16. package/dist/cjs/ui/Renderer/index.js +4 -12
  17. package/dist/cjs/ui/Renderer/style.js +3 -3
  18. package/dist/cjs/ui/annotations/hooks/use-events.js +4 -2
  19. package/dist/cjs/utils.js +0 -24
  20. package/dist/cjs/version.json +1 -1
  21. package/dist/es2019/react/index.js +0 -2
  22. package/dist/es2019/react/nodes/embedCard.js +4 -7
  23. package/dist/es2019/react/nodes/inlineCard.js +4 -1
  24. package/dist/es2019/react/nodes/mediaInline.js +36 -4
  25. package/dist/es2019/react/nodes/mediaSingle/index.js +5 -9
  26. package/dist/es2019/react/nodes/panel.js +19 -16
  27. package/dist/es2019/react/nodes/table/colgroup.js +2 -8
  28. package/dist/es2019/react/nodes/table/sticky.js +26 -10
  29. package/dist/es2019/react/nodes/table/table.js +1 -3
  30. package/dist/es2019/react/nodes/table.js +18 -9
  31. package/dist/es2019/react/nodes/tableCell.js +4 -1
  32. package/dist/es2019/render-document.js +1 -1
  33. package/dist/es2019/ui/MediaCard.js +1 -1
  34. package/dist/es2019/ui/Renderer/breakout-ssr.js +6 -8
  35. package/dist/es2019/ui/Renderer/index.js +3 -11
  36. package/dist/es2019/ui/Renderer/style.js +16 -3
  37. package/dist/es2019/ui/annotations/hooks/use-events.js +2 -2
  38. package/dist/es2019/utils.js +0 -22
  39. package/dist/es2019/version.json +1 -1
  40. package/dist/esm/react/index.js +0 -2
  41. package/dist/esm/react/nodes/embedCard.js +4 -7
  42. package/dist/esm/react/nodes/heading-anchor.js +1 -1
  43. package/dist/esm/react/nodes/inlineCard.js +4 -1
  44. package/dist/esm/react/nodes/mediaInline.js +37 -5
  45. package/dist/esm/react/nodes/mediaSingle/index.js +5 -9
  46. package/dist/esm/react/nodes/panel.js +7 -5
  47. package/dist/esm/react/nodes/table/colgroup.js +6 -12
  48. package/dist/esm/react/nodes/table/sticky.js +26 -8
  49. package/dist/esm/react/nodes/table/table.js +1 -3
  50. package/dist/esm/react/nodes/table.js +20 -9
  51. package/dist/esm/react/nodes/tableCell.js +5 -3
  52. package/dist/esm/react/nodes/task-item-with-providers.js +1 -1
  53. package/dist/esm/render-document.js +1 -1
  54. package/dist/esm/ui/MediaCard.js +3 -2
  55. package/dist/esm/ui/Renderer/breakout-ssr.js +6 -8
  56. package/dist/esm/ui/Renderer/index.js +3 -11
  57. package/dist/esm/ui/Renderer/style.js +4 -3
  58. package/dist/esm/ui/annotations/hooks/use-events.js +4 -2
  59. package/dist/esm/utils.js +0 -22
  60. package/dist/esm/version.json +1 -1
  61. package/dist/types/react/index.d.ts +0 -2
  62. package/dist/types/react/nodes/embedCard.d.ts +0 -1
  63. package/dist/types/react/nodes/extension.d.ts +6 -0
  64. package/dist/types/react/nodes/index.d.ts +1 -2
  65. package/dist/types/react/nodes/media.d.ts +0 -1
  66. package/dist/types/react/nodes/mediaInline.d.ts +6 -3
  67. package/dist/types/react/nodes/mediaSingle/index.d.ts +0 -1
  68. package/dist/types/react/nodes/table/sticky.d.ts +1 -2
  69. package/dist/types/react/nodes/table/table.d.ts +1 -1
  70. package/dist/types/react/nodes/table/types.d.ts +0 -1
  71. package/dist/types/react/types.d.ts +0 -1
  72. package/dist/types/renderer-context.d.ts +1 -0
  73. package/dist/types/ui/MediaCard.d.ts +1 -1
  74. package/dist/types/ui/Renderer/breakout-ssr.d.ts +2 -4
  75. package/dist/types/ui/renderer-props.d.ts +1 -0
  76. package/dist/types/utils.d.ts +4 -8
  77. package/package.json +20 -18
  78. package/report.api.md +225 -0
@@ -116,8 +116,11 @@ export const withSortableColumn = WrapperComponent => {
116
116
 
117
117
  _defineProperty(this, "onKeyPress", event => {
118
118
  const keys = [' ', 'Enter', 'Spacebar'];
119
+ const {
120
+ tagName
121
+ } = event.target; // trigger sorting if space or enter are clicked but not when in an input field (template variables)
119
122
 
120
- if (keys.includes(event.key)) {
123
+ if (keys.includes(event.key) && !IgnoreSorting.includes(tagName)) {
121
124
  event.preventDefault();
122
125
  this.onClick(event);
123
126
  }
@@ -5,7 +5,7 @@ import { validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaski
5
5
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from './analytics/enums';
6
6
  import { PLATFORM } from './analytics/events';
7
7
  import { trackUnsupportedContentLevels } from './analytics/unsupported-content';
8
- import { transformMediaLinkMarks } from '@atlaskit/adf-utils';
8
+ import { transformMediaLinkMarks } from '@atlaskit/adf-utils/transforms';
9
9
  const SUPPORTS_HIRES_TIMER_API = !!(window.performance && performance.now);
10
10
 
11
11
  const withStopwatch = cb => {
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React, { Component } from 'react';
3
- import { filter } from '@atlaskit/adf-utils';
3
+ import { filter } from '@atlaskit/adf-utils/traverse';
4
4
  import { Card, CardLoading, CardError } from '@atlaskit/media-card';
5
5
  import { getMediaClient } from '@atlaskit/media-client';
6
6
  import { withImageLoader } from '@atlaskit/editor-common/utils';
@@ -7,9 +7,7 @@ import { breakoutConsts } from '@atlaskit/editor-common/utils';
7
7
  * More info: https://product-fabric.atlassian.net/wiki/spaces/E/pages/1216218119/Renderer+SSR+for+Breakout+Nodes
8
8
  */
9
9
 
10
- export function BreakoutSSRInlineScript({
11
- allowDynamicTextSizing
12
- }) {
10
+ export function BreakoutSSRInlineScript() {
13
11
  /**
14
12
  * Should only inline this script while SSR,
15
13
  * not needed on the client side.
@@ -19,7 +17,7 @@ export function BreakoutSSRInlineScript({
19
17
  }
20
18
 
21
19
  const id = Math.floor(Math.random() * (9999999999 - 9999 + 1)) + 9999;
22
- const context = createBreakoutInlineScript(id, allowDynamicTextSizing);
20
+ const context = createBreakoutInlineScript(id);
23
21
  return /*#__PURE__*/React.createElement("script", {
24
22
  "data-breakout-script-id": id,
25
23
  dangerouslySetInnerHTML: {
@@ -27,11 +25,11 @@ export function BreakoutSSRInlineScript({
27
25
  }
28
26
  });
29
27
  }
30
- export function createBreakoutInlineScript(id, allowDynamicTextSizing) {
28
+ export function createBreakoutInlineScript(id) {
31
29
  return `
32
30
  (function(window){
33
31
  ${breakoutInlineScriptContext};
34
- (${applyBreakoutAfterSSR.toString()})("${id}", ${allowDynamicTextSizing}, breakoutConsts);
32
+ (${applyBreakoutAfterSSR.toString()})("${id}", breakoutConsts);
35
33
  })(window);
36
34
  `;
37
35
  }
@@ -44,7 +42,7 @@ export const breakoutInlineScriptContext = `
44
42
  breakoutConsts.calcWideWidth = ${breakoutConsts.calcWideWidth.toString()};
45
43
  `;
46
44
 
47
- function applyBreakoutAfterSSR(id, allowDynamicTextSizing, breakoutConsts) {
45
+ function applyBreakoutAfterSSR(id, breakoutConsts) {
48
46
  const MEDIA_NODE_TYPE = 'mediaSingle';
49
47
  const WIDE_LAYOUT_MODES = ['full-width', 'wide'];
50
48
 
@@ -98,7 +96,7 @@ function applyBreakoutAfterSSR(id, allowDynamicTextSizing, breakoutConsts) {
98
96
  // https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
99
97
 
100
98
  if (node.classList.contains('pm-table-container')) {
101
- const lineLength = breakoutConsts.calcLineLength(renderer.offsetWidth, allowDynamicTextSizing);
99
+ const lineLength = breakoutConsts.calcLineLength();
102
100
  const left = lineLength / 2 - parseInt(width) / 2;
103
101
 
104
102
  if (left < 0) {
@@ -6,7 +6,7 @@ import React, { Fragment, useContext, useLayoutEffect, useRef } from 'react';
6
6
  import { jsx } from '@emotion/react';
7
7
  import { PureComponent } from 'react';
8
8
  import { getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
9
- import { reduce } from '@atlaskit/adf-utils';
9
+ import { reduce } from '@atlaskit/adf-utils/traverse';
10
10
  import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
11
11
  import { UnsupportedBlock, BaseTheme, WidthProvider, WithCreateAnalyticsEvent, IntlErrorBoundary } from '@atlaskit/editor-common/ui';
12
12
  import { getAnalyticsAppearance, getAnalyticsEventSeverity, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking, measureTTI } from '@atlaskit/editor-common/utils';
@@ -192,7 +192,6 @@ export class Renderer extends PureComponent {
192
192
  appearance: props.appearance,
193
193
  disableHeadingIDs: props.disableHeadingIDs,
194
194
  disableActions: props.disableActions,
195
- allowDynamicTextSizing: props.allowDynamicTextSizing,
196
195
  allowHeadingAnchorLinks: props.allowHeadingAnchorLinks,
197
196
  allowColumnSorting: props.allowColumnSorting,
198
197
  fireAnalyticsEvent: this.fireAnalyticsEvent,
@@ -218,7 +217,6 @@ export class Renderer extends PureComponent {
218
217
  onError,
219
218
  appearance,
220
219
  adfStage,
221
- allowDynamicTextSizing,
222
220
  truncated,
223
221
  maxHeight,
224
222
  fadeOutHeight,
@@ -299,7 +297,6 @@ export class Renderer extends PureComponent {
299
297
  }
300
298
  }, jsx(SmartCardStorageProvider, null, jsx(RendererWrapper, {
301
299
  appearance: appearance,
302
- dynamicTextSizing: !!allowDynamicTextSizing,
303
300
  allowNestedHeaderLinks: allowNestedHeaderLinks,
304
301
  allowColumnSorting: allowColumnSorting,
305
302
  allowCopyToClipboard: allowCopyToClipboard,
@@ -308,9 +305,7 @@ export class Renderer extends PureComponent {
308
305
  innerRef: this.editorRef,
309
306
  onClick: handleWrapperOnClick,
310
307
  onMouseDown: this.onMouseDownEditView
311
- }, enableSsrInlineScripts ? jsx(BreakoutSSRInlineScript, {
312
- allowDynamicTextSizing: !!allowDynamicTextSizing
313
- }) : null, jsx(RendererActionsInternalUpdater, {
308
+ }, enableSsrInlineScripts ? jsx(BreakoutSSRInlineScript, null) : null, jsx(RendererActionsInternalUpdater, {
314
309
  doc: pmDoc,
315
310
  schema: schema,
316
311
  onAnalyticsEvent: this.fireAnalyticsEvent
@@ -335,7 +330,6 @@ export class Renderer extends PureComponent {
335
330
 
336
331
  return jsx(RendererWrapper, {
337
332
  appearance: appearance,
338
- dynamicTextSizing: !!allowDynamicTextSizing,
339
333
  allowCopyToClipboard: allowCopyToClipboard,
340
334
  allowPlaceholderText: allowPlaceholderText,
341
335
  allowColumnSorting: allowColumnSorting,
@@ -386,7 +380,6 @@ const RendererWithAnalytics = /*#__PURE__*/React.memo(props => jsx(FabricEditorA
386
380
  const RendererWrapper = /*#__PURE__*/React.memo(props => {
387
381
  const {
388
382
  allowColumnSorting,
389
- dynamicTextSizing,
390
383
  allowNestedHeaderLinks,
391
384
  innerRef,
392
385
  appearance,
@@ -397,8 +390,7 @@ const RendererWrapper = /*#__PURE__*/React.memo(props => {
397
390
  return jsx(WidthProvider, {
398
391
  className: "ak-renderer-wrapper"
399
392
  }, jsx(BaseTheme, {
400
- dynamicTextSizing: dynamicTextSizing,
401
- baseFontSize: !dynamicTextSizing && appearance && appearance !== 'comment' ? akEditorFullPageDefaultFontSize : undefined
393
+ baseFontSize: appearance && appearance !== 'comment' ? akEditorFullPageDefaultFontSize : undefined
402
394
  }, jsx("div", {
403
395
  ref: innerRef,
404
396
  onClick: onClick,
@@ -9,6 +9,7 @@ import { shadowClassNames } from '@atlaskit/editor-common/ui';
9
9
  import { editorFontSize, blockNodesVerticalMargin, akEditorTableToolbar, akEditorTableToolbarDark, akEditorTableBorder, akEditorTableBorderDark, akEditorTableNumberColumnWidth, gridMediumMaxWidth, akEditorFullWidthLayoutWidth, akEditorStickyHeaderZIndex, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
10
10
  import { RendererCssClassName } from '../../consts';
11
11
  import { HeadingAnchorWrapperClassName } from '../../react/nodes/heading-anchor';
12
+ import { shadowObserverClassNames } from '@atlaskit/editor-common/ui';
12
13
  export const FullPagePadding = 32;
13
14
 
14
15
  const getLineHeight = fontCode => headingSizesImport[fontCode].lineHeight / headingSizesImport[fontCode].size;
@@ -201,11 +202,11 @@ const tableSortableColumnStyle = ({
201
202
  margin-top: 0;
202
203
  }
203
204
 
204
- > .ProseMirror-gapcursor.-right:first-child + * {
205
+ > .ProseMirror-gapcursor.-right:first-of-type + * {
205
206
  margin-top: 0;
206
207
  }
207
208
 
208
- > .ProseMirror-gapcursor:first-child + span + * {
209
+ > .ProseMirror-gapcursor:first-of-type + span + * {
209
210
  margin-top: 0;
210
211
  }
211
212
 
@@ -469,6 +470,11 @@ export const rendererStyles = wrapperProps => theme => {
469
470
  .${TableSharedCssClassName.TABLE_NODE_WRAPPER} {
470
471
  overflow-x: auto;
471
472
  }
473
+
474
+ .${shadowObserverClassNames.SHADOW_CONTAINER}
475
+ .${TableSharedCssClassName.TABLE_NODE_WRAPPER} {
476
+ display: flex;
477
+ }
472
478
  }
473
479
 
474
480
  ${tableSharedStyle(themeProps)}
@@ -486,6 +492,13 @@ export const rendererStyles = wrapperProps => theme => {
486
492
  z-index: ${akEditorStickyHeaderZIndex};
487
493
  }
488
494
 
495
+ &
496
+ .${shadowObserverClassNames.SENTINEL_LEFT},
497
+ &
498
+ .${shadowObserverClassNames.SENTINEL_RIGHT} {
499
+ height: calc(100% - ${tableMarginTop}px);
500
+ }
501
+
489
502
  /**
490
503
  * A hack for making all the <th /> heights equal in case some have shorter
491
504
  * content than others.
@@ -499,7 +512,7 @@ export const rendererStyles = wrapperProps => theme => {
499
512
  margin-right: 0;
500
513
  }
501
514
 
502
- table tr:first-child {
515
+ table tr:first-of-type {
503
516
  height: 100%;
504
517
 
505
518
  td,
@@ -19,7 +19,7 @@ export const useAnnotationStateByTypeEvent = ({
19
19
  }
20
20
 
21
21
  const nextStates = Object.values(payload).reduce((acc, curr) => {
22
- if (curr.annotationType === type) {
22
+ if (curr.id && curr.annotationType === type) {
23
23
  // Check for empty state to prevent additional renders
24
24
  const isEmpty = curr.state === null || curr.state === undefined;
25
25
  return { ...acc,
@@ -83,7 +83,7 @@ export const useAnnotationClickEvent = props => {
83
83
  annotationIds,
84
84
  eventTarget
85
85
  }) => {
86
- const annotationsByType = annotationIds.map(id => ({
86
+ const annotationsByType = annotationIds.filter(id => !!id).map(id => ({
87
87
  id,
88
88
  type: AnnotationTypes.INLINE_COMMENT
89
89
  }));
@@ -18,28 +18,6 @@ export const getText = node => {
18
18
  export const getEventHandler = (eventHandlers, type, eventName = 'onClick') => {
19
19
  return eventHandlers && type && eventHandlers[type] && eventHandlers[type][eventName];
20
20
  };
21
- /**
22
- * Traverse DOM Tree upwards looking for table parents with "overflow: scroll".
23
- */
24
-
25
- export function findHorizontalOverflowScrollParent(table) {
26
- let parent = table;
27
-
28
- if (!parent) {
29
- return null;
30
- }
31
-
32
- while (parent = parent.parentElement) {
33
- // IE11 on Window 8 doesn't show styles from CSS when accessing through element.style property.
34
- const style = window.getComputedStyle(parent);
35
-
36
- if (style.overflow === 'scroll' || style.overflowY === 'scroll') {
37
- return parent;
38
- }
39
- }
40
-
41
- return null;
42
- }
43
21
  export const getPlatform = rendererAppearance => {
44
22
  if (rendererAppearance === 'mobile') {
45
23
  return 'mobile';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "95.0.1",
3
+ "version": "96.0.2",
4
4
  "sideEffects": false
5
5
  }
@@ -179,7 +179,6 @@ var ReactSerializer = /*#__PURE__*/function () {
179
179
  this.appearance = init.appearance;
180
180
  this.disableHeadingIDs = init.disableHeadingIDs;
181
181
  this.disableActions = init.disableActions;
182
- this.allowDynamicTextSizing = init.allowDynamicTextSizing;
183
182
  this.allowHeadingAnchorLinks = init.allowHeadingAnchorLinks;
184
183
  this.allowCopyToClipboard = init.allowCopyToClipboard;
185
184
  this.allowPlaceholderText = init.allowPlaceholderText;
@@ -550,7 +549,6 @@ var ReactSerializer = /*#__PURE__*/function () {
550
549
  rendererContext: this.rendererContext,
551
550
  serializer: this,
552
551
  content: node.content ? node.content.toJSON() : undefined,
553
- allowDynamicTextSizing: this.allowDynamicTextSizing,
554
552
  allowHeadingAnchorLinks: this.allowHeadingAnchorLinks,
555
553
  allowCopyToClipboard: this.allowCopyToClipboard,
556
554
  allowPlaceholderText: this.allowPlaceholderText,
@@ -8,8 +8,8 @@ var _templateObject, _templateObject2;
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { useMemo, useContext, useState, useRef } from 'react';
10
10
  import { Card, Context as CardContext, EmbedResizeMessageListener } from '@atlaskit/smart-card';
11
- import { WidthConsumer, mapBreakpointToLayoutMaxWidth, UnsupportedBlock, MediaSingle as UIMediaSingle } from '@atlaskit/editor-common/ui';
12
- import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, getAkEditorFullPageMaxWidth } from '@atlaskit/editor-shared-styles';
11
+ import { WidthConsumer, UnsupportedBlock, MediaSingle as UIMediaSingle } from '@atlaskit/editor-common/ui';
12
+ import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
13
13
  import { getPlatform } from '../../utils';
14
14
  import { CardErrorBoundary } from './fallback';
15
15
  import { FullPagePadding } from '../../ui/Renderer/style';
@@ -24,7 +24,6 @@ export default function EmbedCard(props) {
24
24
  layout = props.layout,
25
25
  width = props.width,
26
26
  isInsideOfBlockNode = props.isInsideOfBlockNode,
27
- allowDynamicTextSizing = props.allowDynamicTextSizing,
28
27
  rendererAppearance = props.rendererAppearance;
29
28
  var embedIframeRef = useRef(null);
30
29
  var onClick = getCardClickHandler(eventHandlers, url);
@@ -103,10 +102,8 @@ export default function EmbedCard(props) {
103
102
  if (!isInsideOfBlockNode && rendererAppearance !== 'comment') {
104
103
  var isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >= akEditorDefaultLayoutWidth;
105
104
 
106
- if (isContainerSizeGreaterThanMaxFullPageWidth && allowDynamicTextSizing) {
107
- nonFullWidthSize = mapBreakpointToLayoutMaxWidth(breakpoint);
108
- } else if (isContainerSizeGreaterThanMaxFullPageWidth) {
109
- nonFullWidthSize = getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
105
+ if (isContainerSizeGreaterThanMaxFullPageWidth) {
106
+ nonFullWidthSize = akEditorDefaultLayoutWidth;
110
107
  } else {
111
108
  nonFullWidthSize = containerWidth - padding;
112
109
  }
@@ -1,4 +1,3 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -14,6 +13,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
14
13
  var _templateObject;
15
14
 
16
15
  var _excluded = ["children"];
16
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
17
17
 
18
18
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
19
19
 
@@ -6,6 +6,7 @@ import { UnsupportedInline } from '@atlaskit/editor-common/ui';
6
6
  import { CardErrorBoundary } from './fallback';
7
7
  import { withSmartCardStorage } from '../../ui/SmartCardStorage';
8
8
  import { getCardClickHandler } from '../utils/getCardClickHandler';
9
+ import { useFeatureFlags } from '../../use-feature-flags';
9
10
 
10
11
  var InlineCard = function InlineCard(props) {
11
12
  var url = props.url,
@@ -20,6 +21,7 @@ var InlineCard = function InlineCard(props) {
20
21
  onClick: onClick,
21
22
  container: portal
22
23
  };
24
+ var featureFlags = useFeatureFlags();
23
25
 
24
26
  if (smartLinks !== null && smartLinks !== void 0 && smartLinks.ssr && url) {
25
27
  return /*#__PURE__*/React.createElement(CardSSR, {
@@ -35,7 +37,8 @@ var InlineCard = function InlineCard(props) {
35
37
  }, /*#__PURE__*/React.createElement(CardErrorBoundary, _extends({
36
38
  unsupportedComponent: UnsupportedInline
37
39
  }, cardProps), /*#__PURE__*/React.createElement(Card, _extends({
38
- appearance: "inline"
40
+ appearance: "inline",
41
+ showHoverPreview: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.showHoverPreview
39
42
  }, cardProps, {
40
43
  onResolve: function onResolve(data) {
41
44
  if (!data.url || !data.title) {
@@ -1,13 +1,17 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
1
+ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
5
  import React, { useEffect, useState } from 'react';
5
6
  import { MediaInlineCard } from '@atlaskit/media-card';
7
+ import { MediaInlineCardErroredView, MediaInlineCardLoadingView, messages } from '@atlaskit/media-ui';
6
8
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
9
+ import { getClipboardAttrs } from '../../ui/MediaCard';
10
+ import { createIntl, injectIntl } from 'react-intl-next';
7
11
  export var RenderMediaInline = function RenderMediaInline(props) {
8
12
  var mediaProvider = props.mediaProvider;
9
13
 
10
- var _useState = useState({}),
14
+ var _useState = useState(),
11
15
  _useState2 = _slicedToArray(_useState, 2),
12
16
  viewMediaClientConfigState = _useState2[0],
13
17
  setViewMediaClientConfigState = _useState2[1];
@@ -47,6 +51,18 @@ export var RenderMediaInline = function RenderMediaInline(props) {
47
51
  return _ref.apply(this, arguments);
48
52
  };
49
53
  }();
54
+ /*
55
+ * Only show the loading view if the media provider is not ready
56
+ * prevents calling the media API before the provider is ready
57
+ */
58
+
59
+
60
+ if (!viewMediaClientConfigState) {
61
+ return /*#__PURE__*/React.createElement(MediaInlineCardLoadingView, {
62
+ message: "",
63
+ isSelected: false
64
+ });
65
+ }
50
66
 
51
67
  return /*#__PURE__*/React.createElement(MediaInlineCard, {
52
68
  identifier: props.identifier,
@@ -58,17 +74,33 @@ export var RenderMediaInline = function RenderMediaInline(props) {
58
74
  var MediaInline = function MediaInline(props) {
59
75
  var collection = props.collection,
60
76
  id = props.id,
61
- providers = props.providers;
77
+ providers = props.providers,
78
+ intl = props.intl;
62
79
  var identifier = {
63
80
  id: id,
64
81
  mediaItemType: 'file',
65
82
  collectionName: collection
66
83
  };
67
- return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(WithProviders, {
84
+ var defaultIntl = createIntl({
85
+ locale: 'en'
86
+ });
87
+ return /*#__PURE__*/React.createElement("span", _extends({}, getClipboardAttrs({
88
+ id: id,
89
+ collection: collection
90
+ }), {
91
+ "data-node-type": "mediaInline"
92
+ }), /*#__PURE__*/React.createElement(WithProviders, {
68
93
  providers: ['mediaProvider'],
69
94
  providerFactory: providers,
70
95
  renderNode: function renderNode(providers) {
71
96
  var mediaProvider = providers.mediaProvider;
97
+
98
+ if (!mediaProvider) {
99
+ return /*#__PURE__*/React.createElement(MediaInlineCardErroredView, {
100
+ message: (intl || defaultIntl).formatMessage(messages.couldnt_load_file)
101
+ });
102
+ }
103
+
72
104
  return /*#__PURE__*/React.createElement(RenderMediaInline, {
73
105
  identifier: identifier,
74
106
  mediaProvider: mediaProvider
@@ -77,4 +109,4 @@ var MediaInline = function MediaInline(props) {
77
109
  }));
78
110
  };
79
111
 
80
- export default MediaInline;
112
+ export default injectIntl(MediaInline);
@@ -5,8 +5,8 @@ import { default as React, Fragment } from 'react';
5
5
  import { jsx } from '@emotion/react';
6
6
  import { injectIntl } from 'react-intl-next';
7
7
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
8
- import { mapBreakpointToLayoutMaxWidth, getBreakpoint, MediaSingle as UIMediaSingle, WidthConsumer } from '@atlaskit/editor-common/ui';
9
- import { akEditorFullWidthLayoutWidth, getAkEditorFullPageMaxWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
8
+ import { MediaSingle as UIMediaSingle, WidthConsumer } from '@atlaskit/editor-common/ui';
9
+ import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
10
10
  import { FullPagePadding } from '../../../ui/Renderer/style';
11
11
  import { useObservedWidth } from '../../hooks/use-observed-width';
12
12
  import { uiMediaSingleBaseStyles, uiMediaSingleLayoutStyles } from './styles';
@@ -51,7 +51,6 @@ var MediaSingle = function MediaSingle(props) {
51
51
  var rendererAppearance = props.rendererAppearance,
52
52
  featureFlags = props.featureFlags,
53
53
  isInsideOfBlockNode = props.isInsideOfBlockNode,
54
- allowDynamicTextSizing = props.allowDynamicTextSizing,
55
54
  layout = props.layout,
56
55
  children = props.children,
57
56
  pctWidth = props.width;
@@ -129,7 +128,6 @@ var MediaSingle = function MediaSingle(props) {
129
128
 
130
129
  var calcDimensions = function calcDimensions(mediaContainerWidth, mediaBreakpoint) {
131
130
  var containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
132
- var breakpoint = mediaBreakpoint || getBreakpoint(containerWidth);
133
131
  var maxWidth = containerWidth;
134
132
  var maxHeight = height / width * maxWidth;
135
133
  var cardDimensions = {
@@ -139,12 +137,10 @@ var MediaSingle = function MediaSingle(props) {
139
137
  var nonFullWidthSize = containerWidth;
140
138
 
141
139
  if (!isInsideOfBlockNode && rendererAppearance !== 'comment') {
142
- var isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >= getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
140
+ var isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >= akEditorDefaultLayoutWidth;
143
141
 
144
- if (isContainerSizeGreaterThanMaxFullPageWidth && allowDynamicTextSizing) {
145
- nonFullWidthSize = mapBreakpointToLayoutMaxWidth(breakpoint);
146
- } else if (isContainerSizeGreaterThanMaxFullPageWidth) {
147
- nonFullWidthSize = getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
142
+ if (isContainerSizeGreaterThanMaxFullPageWidth) {
143
+ nonFullWidthSize = akEditorDefaultLayoutWidth;
148
144
  } else {
149
145
  nonFullWidthSize = containerWidth - padding;
150
146
  }
@@ -25,13 +25,15 @@ var PanelStyled = function PanelStyled(props) {
25
25
 
26
26
  if (props['data-panel-type'] === PanelType.CUSTOM && props.backgroundColor) {
27
27
  styles = function styles(theme) {
28
- return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &.", " {\n ", "\n }\n\n &[data-panel-type=", "] {\n background-color: ", ";\n ", ";\n }\n "])), PanelSharedCssClassName.prefix, panelSharedStylesWithoutPrefix({
29
- theme: theme
30
- }), PanelType.CUSTOM, props.backgroundColor, themed({
31
- dark: getPanelBackgroundDarkModeColors
28
+ var customStyle = themed({
29
+ dark: getPanelBackgroundDarkModeColors,
30
+ light: "background-color: ".concat(props.backgroundColor, ";")
32
31
  })({
33
32
  theme: theme
34
- }));
33
+ });
34
+ return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &.", " {\n ", "\n }\n\n &[data-panel-type=", "] {\n ", ";\n }\n "])), PanelSharedCssClassName.prefix, panelSharedStylesWithoutPrefix({
35
+ theme: theme
36
+ }), PanelType.CUSTOM, customStyle);
35
37
  };
36
38
  }
37
39
 
@@ -14,11 +14,7 @@ var getTableLayoutWidth = function getTableLayoutWidth(layout, opts) {
14
14
  return akEditorWideLayoutWidth;
15
15
 
16
16
  default:
17
- var _ref = opts || {},
18
- containerWidth = _ref.containerWidth,
19
- isDynamicTextSizingEnabled = _ref.isDynamicTextSizingEnabled;
20
-
21
- return calcLineLength(containerWidth, isDynamicTextSizingEnabled);
17
+ return calcLineLength();
22
18
  }
23
19
  };
24
20
 
@@ -44,10 +40,10 @@ var fixColumnWidth = function fixColumnWidth(columnWidth, _tableWidth, _layoutWi
44
40
  columnWidth - tableCellBorderWidth, zeroWidthColumnsCount ? akEditorTableLegacyCellMinWidth : tableCellMinWidth);
45
41
  };
46
42
 
47
- export var calcScalePercent = function calcScalePercent(_ref2) {
48
- var renderWidth = _ref2.renderWidth,
49
- tableWidth = _ref2.tableWidth,
50
- maxScale = _ref2.maxScale;
43
+ export var calcScalePercent = function calcScalePercent(_ref) {
44
+ var renderWidth = _ref.renderWidth,
45
+ tableWidth = _ref.tableWidth,
46
+ maxScale = _ref.maxScale;
51
47
  var diffPercent = 1 - renderWidth / tableWidth;
52
48
  return diffPercent < maxScale ? diffPercent : maxScale;
53
49
  };
@@ -55,8 +51,7 @@ export var Colgroup = function Colgroup(props) {
55
51
  var columnWidths = props.columnWidths,
56
52
  layout = props.layout,
57
53
  isNumberColumnEnabled = props.isNumberColumnEnabled,
58
- renderWidth = props.renderWidth,
59
- allowDynamicTextSizing = props.allowDynamicTextSizing;
54
+ renderWidth = props.renderWidth;
60
55
 
61
56
  if (!columnWidths || !isTableResized(columnWidths)) {
62
57
  return null;
@@ -64,7 +59,6 @@ export var Colgroup = function Colgroup(props) {
64
59
 
65
60
 
66
61
  var layoutWidth = getTableLayoutWidth(layout, {
67
- isDynamicTextSizingEnabled: allowDynamicTextSizing,
68
62
  containerWidth: renderWidth
69
63
  });
70
64
  var maxTableWidth = renderWidth < layoutWidth ? renderWidth : layoutWidth; // If table has a layout of default, it is confined by the defined column width.
@@ -10,11 +10,8 @@ import React from 'react';
10
10
  import { css, jsx } from '@emotion/react';
11
11
  import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
12
12
  import { akEditorStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
13
- import * as colors from '@atlaskit/theme/colors'; // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
14
-
15
- var N40A = colors.N40A;
13
+ import { N40A } from '@atlaskit/theme/colors';
16
14
  import { token } from '@atlaskit/tokens';
17
- import { findHorizontalOverflowScrollParent } from '../../../utils';
18
15
  import { Table } from './table';
19
16
  import { recursivelyInjectProps } from '../../utils/inject-props';
20
17
  export var tableStickyPadding = 8;
@@ -54,7 +51,6 @@ export var StickyTable = function StickyTable(_ref) {
54
51
  children = _ref.children,
55
52
  columnWidths = _ref.columnWidths,
56
53
  renderWidth = _ref.renderWidth,
57
- allowDynamicTextSizing = _ref.allowDynamicTextSizing,
58
54
  rowHeight = _ref.rowHeight;
59
55
  return jsx("div", {
60
56
  css: {
@@ -67,7 +63,7 @@ export var StickyTable = function StickyTable(_ref) {
67
63
  mode: rowHeight > 300 ? 'none' : mode,
68
64
  wrapperWidth: wrapperWidth
69
65
  }, jsx("div", {
70
- className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(shadowClassNames),
66
+ className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(shadowClassNames || ''),
71
67
  "data-layout": layout,
72
68
  style: {
73
69
  width: tableWidth
@@ -82,8 +78,7 @@ export var StickyTable = function StickyTable(_ref) {
82
78
  columnWidths: columnWidths,
83
79
  layout: layout,
84
80
  isNumberColumnEnabled: isNumberColumnEnabled,
85
- renderWidth: renderWidth,
86
- allowDynamicTextSizing: allowDynamicTextSizing
81
+ renderWidth: renderWidth
87
82
  },
88
83
  /**
89
84
  * @see https://product-fabric.atlassian.net/browse/ED-10235
@@ -95,6 +90,29 @@ export var StickyTable = function StickyTable(_ref) {
95
90
  invisible: true
96
91
  }))))));
97
92
  };
93
+ /**
94
+ * Traverse DOM Tree upwards looking for table parents with "overflow: scroll".
95
+ */
96
+
97
+ function findHorizontalOverflowScrollParent(table) {
98
+ var parent = table;
99
+
100
+ if (!parent) {
101
+ return null;
102
+ }
103
+
104
+ while (parent = parent.parentElement) {
105
+ // IE11 on Window 8 doesn't show styles from CSS when accessing through element.style property.
106
+ var style = window.getComputedStyle(parent);
107
+
108
+ if (style.overflow === 'scroll' || style.overflowY === 'scroll') {
109
+ return parent;
110
+ }
111
+ }
112
+
113
+ return null;
114
+ }
115
+
98
116
  export var OverflowParent = /*#__PURE__*/function () {
99
117
  function OverflowParent(ref) {
100
118
  _classCallCheck(this, OverflowParent);
@@ -6,7 +6,6 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
6
6
  columnWidths = _ref.columnWidths,
7
7
  layout = _ref.layout,
8
8
  renderWidth = _ref.renderWidth,
9
- allowDynamicTextSizing = _ref.allowDynamicTextSizing,
10
9
  children = _ref.children;
11
10
  return /*#__PURE__*/React.createElement("table", {
12
11
  "data-number-column": isNumberColumnEnabled,
@@ -15,7 +14,6 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
15
14
  columnWidths: columnWidths,
16
15
  layout: layout,
17
16
  isNumberColumnEnabled: isNumberColumnEnabled,
18
- renderWidth: renderWidth,
19
- allowDynamicTextSizing: allowDynamicTextSizing
17
+ renderWidth: renderWidth
20
18
  }), /*#__PURE__*/React.createElement("tbody", null, children));
21
19
  });