@atlaskit/renderer 84.0.0 → 86.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +100 -0
- package/dist/cjs/actions/index.js +3 -3
- package/dist/cjs/analytics/enums.js +2 -0
- package/dist/cjs/analytics/unsupported-content.js +3 -3
- package/dist/cjs/messages.js +47 -1
- package/dist/cjs/react/hooks/use-observed-width.js +94 -0
- package/dist/cjs/react/index.js +15 -9
- package/dist/cjs/react/marks/annotation.js +2 -2
- package/dist/cjs/react/marks/breakout.js +5 -3
- package/dist/cjs/react/marks/textColor.js +15 -4
- package/dist/cjs/react/nodes/blockCard.js +2 -2
- package/dist/cjs/react/nodes/caption.js +2 -2
- package/dist/cjs/react/nodes/copy-text-provider.js +2 -1
- package/dist/cjs/react/nodes/date.js +6 -4
- package/dist/cjs/react/nodes/embedCard.js +5 -5
- package/dist/cjs/react/nodes/emoji.js +2 -2
- package/dist/cjs/react/nodes/extension.js +6 -4
- package/dist/cjs/react/nodes/heading-anchor.js +11 -3
- package/dist/cjs/react/nodes/index.js +80 -55
- package/dist/cjs/react/nodes/inlineCard.js +14 -3
- package/dist/cjs/react/nodes/layoutColumn.js +2 -2
- package/dist/cjs/react/nodes/media.js +5 -3
- package/dist/cjs/react/nodes/mediaGroup.js +2 -2
- package/dist/cjs/react/nodes/mediaInline.js +2 -2
- package/dist/cjs/react/nodes/mediaSingle/index.js +146 -152
- package/dist/cjs/react/nodes/mediaSingle/styles.js +2 -2
- package/dist/cjs/react/nodes/mention.js +2 -4
- package/dist/cjs/react/nodes/panel.js +18 -20
- package/dist/cjs/react/nodes/status.js +2 -1
- package/dist/cjs/react/nodes/table/colgroup.js +2 -2
- package/dist/cjs/react/nodes/table/sticky.js +4 -4
- package/dist/cjs/react/nodes/table.js +19 -13
- package/dist/cjs/react/nodes/tableCell.js +34 -21
- package/dist/cjs/react/nodes/tableRow.js +6 -4
- package/dist/cjs/react/nodes/task-item-with-providers.js +6 -2
- package/dist/cjs/react/nodes/taskItem.js +4 -3
- package/dist/cjs/render-document.js +40 -4
- package/dist/cjs/text/nodes/date.js +3 -3
- package/dist/cjs/types/smartLinksOptions.js +5 -0
- package/dist/cjs/ui/Expand.js +9 -9
- package/dist/cjs/ui/ExtensionRenderer.js +8 -4
- package/dist/cjs/ui/MediaCard.js +4 -4
- package/dist/cjs/ui/Renderer/breakout-ssr.js +50 -7
- package/dist/cjs/ui/Renderer/index.js +23 -18
- package/dist/cjs/ui/Renderer/style.js +8 -6
- package/dist/cjs/ui/SortingIcon.js +30 -17
- package/dist/cjs/ui/annotations/draft/component.js +2 -2
- package/dist/cjs/ui/annotations/element/index.js +2 -2
- package/dist/cjs/ui/annotations/element/mark.js +4 -4
- package/dist/cjs/ui/annotations/hooks/use-events.js +11 -11
- package/dist/cjs/ui/annotations/hooks/use-load-annotations.js +4 -4
- package/dist/cjs/utils.js +4 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +1 -1
- package/dist/es2019/analytics/enums.js +2 -0
- package/dist/es2019/analytics/unsupported-content.js +1 -1
- package/dist/es2019/messages.js +44 -0
- package/dist/es2019/react/hooks/use-observed-width.js +59 -0
- package/dist/es2019/react/index.js +4 -1
- package/dist/es2019/react/marks/breakout.js +2 -1
- package/dist/es2019/react/marks/textColor.js +7 -4
- package/dist/es2019/react/nodes/blockCard.js +1 -1
- package/dist/es2019/react/nodes/caption.js +1 -1
- package/dist/es2019/react/nodes/copy-text-provider.js +2 -1
- package/dist/es2019/react/nodes/date.js +2 -1
- package/dist/es2019/react/nodes/embedCard.js +1 -1
- package/dist/es2019/react/nodes/emoji.js +1 -1
- package/dist/es2019/react/nodes/extension.js +2 -1
- package/dist/es2019/react/nodes/heading-anchor.js +11 -2
- package/dist/es2019/react/nodes/index.js +32 -7
- package/dist/es2019/react/nodes/inlineCard.js +12 -2
- package/dist/es2019/react/nodes/layoutColumn.js +1 -1
- package/dist/es2019/react/nodes/media.js +2 -1
- package/dist/es2019/react/nodes/mediaInline.js +1 -1
- package/dist/es2019/react/nodes/mediaSingle/index.js +132 -112
- package/dist/es2019/react/nodes/mediaSingle/styles.js +1 -1
- package/dist/es2019/react/nodes/mention.js +1 -3
- package/dist/es2019/react/nodes/panel.js +14 -12
- package/dist/es2019/react/nodes/status.js +2 -1
- package/dist/es2019/react/nodes/table/colgroup.js +1 -1
- package/dist/es2019/react/nodes/table/sticky.js +1 -1
- package/dist/es2019/react/nodes/table.js +4 -1
- package/dist/es2019/react/nodes/tableCell.js +22 -10
- package/dist/es2019/react/nodes/tableRow.js +2 -1
- package/dist/es2019/react/nodes/task-item-with-providers.js +3 -1
- package/dist/es2019/react/nodes/taskItem.js +2 -1
- package/dist/es2019/render-document.js +37 -3
- package/dist/es2019/text/nodes/date.js +1 -1
- package/dist/es2019/types/smartLinksOptions.js +1 -0
- package/dist/es2019/ui/Expand.js +1 -1
- package/dist/es2019/ui/ExtensionRenderer.js +3 -1
- package/dist/es2019/ui/MediaCard.js +1 -1
- package/dist/es2019/ui/Renderer/breakout-ssr.js +46 -5
- package/dist/es2019/ui/Renderer/index.js +4 -1
- package/dist/es2019/ui/Renderer/style.js +3 -1
- package/dist/es2019/ui/SortingIcon.js +23 -11
- package/dist/es2019/ui/annotations/draft/component.js +1 -1
- package/dist/es2019/ui/annotations/element/index.js +1 -1
- package/dist/es2019/ui/annotations/element/mark.js +1 -1
- package/dist/es2019/ui/annotations/hooks/use-events.js +1 -1
- package/dist/es2019/ui/annotations/hooks/use-load-annotations.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +1 -1
- package/dist/esm/analytics/enums.js +2 -0
- package/dist/esm/analytics/unsupported-content.js +1 -1
- package/dist/esm/messages.js +44 -0
- package/dist/esm/react/hooks/use-observed-width.js +80 -0
- package/dist/esm/react/index.js +8 -4
- package/dist/esm/react/marks/annotation.js +2 -2
- package/dist/esm/react/marks/breakout.js +2 -1
- package/dist/esm/react/marks/textColor.js +8 -4
- package/dist/esm/react/nodes/blockCard.js +1 -1
- package/dist/esm/react/nodes/caption.js +1 -1
- package/dist/esm/react/nodes/copy-text-provider.js +2 -1
- package/dist/esm/react/nodes/date.js +2 -1
- package/dist/esm/react/nodes/embedCard.js +1 -1
- package/dist/esm/react/nodes/emoji.js +1 -1
- package/dist/esm/react/nodes/extension.js +2 -1
- package/dist/esm/react/nodes/heading-anchor.js +12 -3
- package/dist/esm/react/nodes/index.js +62 -7
- package/dist/esm/react/nodes/inlineCard.js +12 -2
- package/dist/esm/react/nodes/layoutColumn.js +1 -1
- package/dist/esm/react/nodes/media.js +2 -1
- package/dist/esm/react/nodes/mediaGroup.js +2 -2
- package/dist/esm/react/nodes/mediaInline.js +1 -1
- package/dist/esm/react/nodes/mediaSingle/index.js +140 -141
- package/dist/esm/react/nodes/mediaSingle/styles.js +1 -1
- package/dist/esm/react/nodes/mention.js +1 -3
- package/dist/esm/react/nodes/panel.js +14 -12
- package/dist/esm/react/nodes/status.js +2 -1
- package/dist/esm/react/nodes/table/colgroup.js +1 -1
- package/dist/esm/react/nodes/table/sticky.js +1 -1
- package/dist/esm/react/nodes/table.js +4 -1
- package/dist/esm/react/nodes/tableCell.js +19 -9
- package/dist/esm/react/nodes/tableRow.js +2 -1
- package/dist/esm/react/nodes/task-item-with-providers.js +5 -2
- package/dist/esm/react/nodes/taskItem.js +2 -1
- package/dist/esm/render-document.js +36 -3
- package/dist/esm/text/nodes/date.js +1 -1
- package/dist/esm/types/smartLinksOptions.js +1 -0
- package/dist/esm/ui/Expand.js +1 -1
- package/dist/esm/ui/ExtensionRenderer.js +3 -1
- package/dist/esm/ui/MediaCard.js +3 -3
- package/dist/esm/ui/Renderer/breakout-ssr.js +48 -5
- package/dist/esm/ui/Renderer/index.js +6 -3
- package/dist/esm/ui/Renderer/style.js +4 -3
- package/dist/esm/ui/SortingIcon.js +21 -11
- package/dist/esm/ui/annotations/draft/component.js +1 -1
- package/dist/esm/ui/annotations/element/index.js +1 -1
- package/dist/esm/ui/annotations/element/mark.js +3 -3
- package/dist/esm/ui/annotations/hooks/use-events.js +3 -3
- package/dist/esm/ui/annotations/hooks/use-load-annotations.js +3 -3
- package/dist/esm/utils.js +3 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +1 -1
- package/dist/types/analytics/enums.d.ts +3 -1
- package/dist/types/analytics/events.d.ts +9 -2
- package/dist/types/analytics/unsupported-content.d.ts +1 -1
- package/dist/types/messages.d.ts +44 -0
- package/dist/types/react/hooks/use-observed-width.d.ts +3 -0
- package/dist/types/react/index.d.ts +6 -1
- package/dist/types/react/nodes/blockCard.d.ts +1 -1
- package/dist/types/react/nodes/bodiedExtension.d.ts +2 -1
- package/dist/types/react/nodes/codeBlock.d.ts +3 -3
- package/dist/types/react/nodes/embedCard.d.ts +1 -1
- package/dist/types/react/nodes/emoji.d.ts +1 -1
- package/dist/types/react/nodes/extension.d.ts +14 -13
- package/dist/types/react/nodes/index.d.ts +39 -15
- package/dist/types/react/nodes/inlineCard.d.ts +23 -21
- package/dist/types/react/nodes/inlineExtension.d.ts +2 -1
- package/dist/types/react/nodes/media.d.ts +2 -2
- package/dist/types/react/nodes/mediaGroup.d.ts +1 -1
- package/dist/types/react/nodes/mediaInline.d.ts +1 -1
- package/dist/types/react/nodes/mediaSingle/index.d.ts +3 -7
- package/dist/types/react/nodes/mediaSingle/styles.d.ts +1 -1
- package/dist/types/react/nodes/mention.d.ts +2 -2
- package/dist/types/react/nodes/panel.d.ts +3 -1
- package/dist/types/react/nodes/table/sticky.d.ts +1 -1
- package/dist/types/react/nodes/table.d.ts +22 -21
- package/dist/types/react/nodes/tableCell.d.ts +7 -60
- package/dist/types/react/nodes/tableRow.d.ts +1 -1
- package/dist/types/react/nodes/task-item-with-providers.d.ts +2 -1
- package/dist/types/react/nodes/taskItem.d.ts +1 -1
- package/dist/types/react/types.d.ts +3 -1
- package/dist/types/react/utils/getCardClickHandler.d.ts +1 -1
- package/dist/types/render-document.d.ts +1 -1
- package/dist/types/types/smartLinksOptions.d.ts +3 -0
- package/dist/types/ui/ExtensionRenderer.d.ts +3 -1
- package/dist/types/ui/MediaCard.d.ts +3 -2
- package/dist/types/ui/SortingIcon.d.ts +7 -4
- package/dist/types/ui/annotations/context.d.ts +1 -1
- package/dist/types/ui/annotations/element/mark.d.ts +1 -1
- package/dist/types/ui/annotations/hooks/use-events.d.ts +2 -1
- package/dist/types/ui/annotations/hooks/use-inline-comment-subscriber.d.ts +1 -1
- package/dist/types/ui/annotations/selection/mounter.d.ts +1 -1
- package/dist/types/ui/annotations/selection/range-validator.d.ts +1 -1
- package/dist/types/ui/annotations/types.d.ts +1 -1
- package/dist/types/ui/renderer-props.d.ts +8 -1
- package/dist/types/utils.d.ts +3 -1
- package/package.json +21 -22
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
let resizeObserver;
|
|
3
|
+
const nodeToCallback = new WeakMap();
|
|
4
|
+
export const useObservedWidth = (node, useObservedWidthFlag) => {
|
|
5
|
+
const [rect, setRect] = React.useState({
|
|
6
|
+
x: 0,
|
|
7
|
+
y: 0,
|
|
8
|
+
width: 0,
|
|
9
|
+
height: 0,
|
|
10
|
+
top: 0,
|
|
11
|
+
left: 0,
|
|
12
|
+
bottom: 0,
|
|
13
|
+
right: 0
|
|
14
|
+
});
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (!node || !useObservedWidthFlag) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!resizeObserver) {
|
|
21
|
+
resizeObserver = new ResizeObserver(entries => {
|
|
22
|
+
for (let entry of entries) {
|
|
23
|
+
if (nodeToCallback.has(entry.target)) {
|
|
24
|
+
nodeToCallback.get(entry.target)(entry.contentRect);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
nodeToCallback.set(node, rect => {
|
|
31
|
+
const {
|
|
32
|
+
x,
|
|
33
|
+
y,
|
|
34
|
+
width,
|
|
35
|
+
height,
|
|
36
|
+
top,
|
|
37
|
+
left,
|
|
38
|
+
bottom,
|
|
39
|
+
right
|
|
40
|
+
} = rect;
|
|
41
|
+
return setRect({
|
|
42
|
+
x,
|
|
43
|
+
y,
|
|
44
|
+
width,
|
|
45
|
+
height,
|
|
46
|
+
top,
|
|
47
|
+
left,
|
|
48
|
+
bottom,
|
|
49
|
+
right
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
resizeObserver.observe(node);
|
|
53
|
+
return () => {
|
|
54
|
+
resizeObserver.unobserve(node);
|
|
55
|
+
nodeToCallback.delete(node);
|
|
56
|
+
};
|
|
57
|
+
}, [node, useObservedWidthFlag]);
|
|
58
|
+
return rect;
|
|
59
|
+
};
|
|
@@ -6,7 +6,8 @@ import { isNestedHeaderLinksEnabled } from './utils/links';
|
|
|
6
6
|
import { Doc, DocWithSelectAllTrap, mergeTextNodes, isTextWrapper, isTextNode, toReact } from './nodes';
|
|
7
7
|
import TextWrapperComponent from './nodes/text-wrapper';
|
|
8
8
|
import { toReact as markToReact, isAnnotationMark } from './marks';
|
|
9
|
-
import { getMarksByOrder, isSameMark
|
|
9
|
+
import { getMarksByOrder, isSameMark } from '@atlaskit/editor-common/validator';
|
|
10
|
+
import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
|
|
10
11
|
import { getText } from '../utils';
|
|
11
12
|
import { findChildrenByType } from 'prosemirror-utils';
|
|
12
13
|
import { insideBreakoutLayout } from './renderer-node';
|
|
@@ -175,6 +176,7 @@ export default class ReactSerializer {
|
|
|
175
176
|
this.allowAnnotations = Boolean(init.allowAnnotations);
|
|
176
177
|
this.surroundTextNodesWithTextWrapper = Boolean(init.surroundTextNodesWithTextWrapper);
|
|
177
178
|
this.media = init.media;
|
|
179
|
+
this.smartLinks = init.smartLinks;
|
|
178
180
|
this.allowSelectAllTrap = init.allowSelectAllTrap;
|
|
179
181
|
}
|
|
180
182
|
|
|
@@ -488,6 +490,7 @@ export default class ReactSerializer {
|
|
|
488
490
|
fireAnalyticsEvent: this.fireAnalyticsEvent,
|
|
489
491
|
nodeType: node.type.name,
|
|
490
492
|
marks: node.marks,
|
|
493
|
+
smartLinks: this.smartLinks,
|
|
491
494
|
dataAttributes: {
|
|
492
495
|
// We need to account for depth (path.length gives up depth) here
|
|
493
496
|
// but depth doesnt increment the pos, only accounted for.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import {
|
|
3
|
+
import { WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
4
|
+
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
4
5
|
import { blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
5
6
|
export const Wrapper = styled.div`
|
|
6
7
|
margin: ${blockNodesVerticalMargin} 0;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
export default function TextColor(props) {
|
|
4
|
+
const style = useMemo(() => ({
|
|
5
|
+
['--custom-text-color']: props.color
|
|
6
|
+
}), [props.color]);
|
|
4
7
|
return /*#__PURE__*/React.createElement("span", _extends({}, props.dataAttributes, {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
"data-text-custom-color": props.color,
|
|
9
|
+
className: "fabric-text-color-mark",
|
|
10
|
+
style: style
|
|
8
11
|
}), props.children);
|
|
9
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { Card } from '@atlaskit/smart-card';
|
|
4
|
-
import { UnsupportedBlock } from '@atlaskit/editor-common';
|
|
4
|
+
import { UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { getPlatform } from '../../utils';
|
|
6
6
|
import { CardErrorBoundary } from './fallback';
|
|
7
7
|
import { getCardClickHandler } from '../utils/getCardClickHandler';
|
|
@@ -51,7 +51,8 @@ const {
|
|
|
51
51
|
Consumer
|
|
52
52
|
} = CopyTextContext;
|
|
53
53
|
export const CopyArea = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("div", _extends({
|
|
54
|
-
ref: ref
|
|
54
|
+
ref: ref // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
|
|
55
|
+
,
|
|
55
56
|
style: {
|
|
56
57
|
position: 'absolute',
|
|
57
58
|
left: '-9999px',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PureComponent } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { DateSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { isPastDate, timestampToString, timestampToTaskContext } from '@atlaskit/editor-common/utils';
|
|
4
5
|
import { injectIntl } from 'react-intl-next';
|
|
5
6
|
|
|
6
7
|
class Date extends PureComponent {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useMemo, useContext, useState, useRef } from 'react';
|
|
3
3
|
import { Card, Context as CardContext, EmbedResizeMessageListener } from '@atlaskit/smart-card';
|
|
4
|
-
import { WidthConsumer, mapBreakpointToLayoutMaxWidth, UnsupportedBlock, MediaSingle as UIMediaSingle } from '@atlaskit/editor-common';
|
|
4
|
+
import { WidthConsumer, mapBreakpointToLayoutMaxWidth, UnsupportedBlock, MediaSingle as UIMediaSingle } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, getAkEditorFullPageMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { getPlatform } from '../../utils';
|
|
7
7
|
import { CardErrorBoundary } from './fallback';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import ExtensionRenderer from '../../ui/ExtensionRenderer';
|
|
4
|
-
import {
|
|
4
|
+
import { overflowShadow, WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
5
|
+
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
5
6
|
import { RendererCssClassName } from '../../consts';
|
|
6
7
|
export const renderExtension = (content, layout, options = {}, removeOverflow) => {
|
|
7
8
|
const overflowContainerClass = !removeOverflow ? RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER : ''; // by default, we assume the extension is at top level, (direct child of doc node)
|
|
@@ -39,11 +39,19 @@ class HeadingAnchor extends React.PureComponent {
|
|
|
39
39
|
|
|
40
40
|
_defineProperty(this, "setTooltipState", (message, isClicked = false) => {
|
|
41
41
|
this.setState({
|
|
42
|
+
// TODO: ED-14403 investigate why this does not translate
|
|
42
43
|
tooltipMessage: this.props.intl.formatMessage(message),
|
|
43
44
|
isClicked
|
|
44
45
|
});
|
|
45
46
|
});
|
|
46
47
|
|
|
48
|
+
_defineProperty(this, "getCopyAriaLabel", () => {
|
|
49
|
+
const {
|
|
50
|
+
copyAriaLabel
|
|
51
|
+
} = headingAnchorLinkMessages;
|
|
52
|
+
return this.props.intl.formatMessage(copyAriaLabel);
|
|
53
|
+
});
|
|
54
|
+
|
|
47
55
|
_defineProperty(this, "copyToClipboard", async event => {
|
|
48
56
|
const {
|
|
49
57
|
copiedHeadingLinkToClipboard,
|
|
@@ -66,9 +74,10 @@ class HeadingAnchor extends React.PureComponent {
|
|
|
66
74
|
_defineProperty(this, "renderAnchorButton", () => {
|
|
67
75
|
return /*#__PURE__*/React.createElement(CopyAnchorButton, {
|
|
68
76
|
onMouseLeave: this.resetMessage,
|
|
69
|
-
onClick: this.copyToClipboard
|
|
77
|
+
onClick: this.copyToClipboard,
|
|
78
|
+
"aria-label": this.state.tooltipMessage
|
|
70
79
|
}, /*#__PURE__*/React.createElement(LinkIcon, {
|
|
71
|
-
label:
|
|
80
|
+
label: this.getCopyAriaLabel(),
|
|
72
81
|
size: this.props.level > 3 ? 'small' : 'medium',
|
|
73
82
|
primaryColor: this.state.isClicked ? B400 : N200
|
|
74
83
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import Loadable from 'react-loadable';
|
|
1
2
|
import Blockquote from './blockquote';
|
|
2
3
|
import BodiedExtension from './bodiedExtension';
|
|
3
4
|
import BulletList from './bulletList';
|
|
4
|
-
import DecisionList from './decisionList';
|
|
5
5
|
import Doc, { DocWithSelectAllTrap } from './doc';
|
|
6
6
|
import Extension from './extension';
|
|
7
7
|
import HardBreak from './hardBreak';
|
|
@@ -10,33 +10,40 @@ import InlineExtension from './inlineExtension';
|
|
|
10
10
|
import LayoutSection from './layoutSection';
|
|
11
11
|
import LayoutColumn from './layoutColumn';
|
|
12
12
|
import ListItem from './listItem';
|
|
13
|
-
import MediaSingle from './mediaSingle';
|
|
14
13
|
import Caption from './caption';
|
|
15
14
|
import OrderedList from './orderedList';
|
|
16
|
-
import Panel from './panel';
|
|
17
15
|
import Paragraph from './paragraph';
|
|
18
16
|
import Placeholder from './placeholder';
|
|
19
17
|
import Rule from './rule';
|
|
20
|
-
import TaskList from './taskList';
|
|
21
18
|
import Table from './table';
|
|
22
19
|
import { TableCell, TableHeader } from './tableCell';
|
|
23
20
|
import TableRow from './tableRow';
|
|
24
21
|
import UnknownBlock from './unknownBlock';
|
|
25
|
-
import
|
|
26
|
-
import EmbedCard from './embedCard';
|
|
27
|
-
import { UnsupportedBlock, UnsupportedInline } from '@atlaskit/editor-common';
|
|
22
|
+
import { UnsupportedBlock, UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
28
23
|
const CodeBlock = Loadable({
|
|
29
24
|
loader: () => import(
|
|
30
25
|
/* webpackChunkName: "@atlaskit-internal_renderer-node_CodeBlock" */
|
|
31
26
|
'./codeBlock').then(mod => mod.default),
|
|
32
27
|
loading: () => null
|
|
33
28
|
});
|
|
29
|
+
const TaskList = Loadable({
|
|
30
|
+
loader: () => import(
|
|
31
|
+
/* webpackChunkName: "@atlaskit-internal_renderer-node_TaskList" */
|
|
32
|
+
'./taskList').then(mod => mod.default),
|
|
33
|
+
loading: () => null
|
|
34
|
+
});
|
|
34
35
|
const TaskItem = Loadable({
|
|
35
36
|
loader: () => import(
|
|
36
37
|
/* webpackChunkName: "@atlaskit-internal_renderer-node_TaskItem" */
|
|
37
38
|
'./taskItem').then(mod => mod.default),
|
|
38
39
|
loading: () => null
|
|
39
40
|
});
|
|
41
|
+
const DecisionList = Loadable({
|
|
42
|
+
loader: () => import(
|
|
43
|
+
/* webpackChunkName: "@atlaskit-internal_renderer-node_DecisionList" */
|
|
44
|
+
'./decisionList').then(mod => mod.default),
|
|
45
|
+
loading: () => null
|
|
46
|
+
});
|
|
40
47
|
const DecisionItem = Loadable({
|
|
41
48
|
loader: () => import(
|
|
42
49
|
/* webpackChunkName: "@atlaskit-internal_renderer-node_DecisionItem" */
|
|
@@ -61,6 +68,18 @@ const Emoji = Loadable({
|
|
|
61
68
|
'./emoji').then(mod => mod.default),
|
|
62
69
|
loading: () => null
|
|
63
70
|
});
|
|
71
|
+
const Panel = Loadable({
|
|
72
|
+
loader: () => import(
|
|
73
|
+
/* webpackChunkName: "@atlaskit-internal_renderer-node_Panel" */
|
|
74
|
+
'./panel').then(mod => mod.default),
|
|
75
|
+
loading: () => null
|
|
76
|
+
});
|
|
77
|
+
const EmbedCard = Loadable({
|
|
78
|
+
loader: () => import(
|
|
79
|
+
/* webpackChunkName: "@atlaskit-internal_renderer-node_EmbedCard" */
|
|
80
|
+
'./embedCard').then(mod => mod.default),
|
|
81
|
+
loading: () => null
|
|
82
|
+
});
|
|
64
83
|
const InlineCard = Loadable({
|
|
65
84
|
loader: () => import(
|
|
66
85
|
/* webpackChunkName: "@atlaskit-internal_renderer-node_InlineCard" */
|
|
@@ -91,6 +110,12 @@ const MediaInline = Loadable({
|
|
|
91
110
|
'./mediaInline').then(mod => mod.default),
|
|
92
111
|
loading: () => null
|
|
93
112
|
});
|
|
113
|
+
const MediaSingle = Loadable({
|
|
114
|
+
loader: () => import(
|
|
115
|
+
/* webpackChunkName: "@atlaskit-internal_renderer-node_MediaSingle" */
|
|
116
|
+
'./mediaSingle').then(mod => mod.default),
|
|
117
|
+
loading: () => null
|
|
118
|
+
});
|
|
94
119
|
const Mention = Loadable({
|
|
95
120
|
loader: () => import(
|
|
96
121
|
/* webpackChunkName: "@atlaskit-internal_renderer-node_Mention" */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Card } from '@atlaskit/smart-card';
|
|
4
|
-
import {
|
|
4
|
+
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
5
|
+
import { UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
5
6
|
import { CardErrorBoundary } from './fallback';
|
|
6
7
|
import { withSmartCardStorage } from '../../ui/SmartCardStorage';
|
|
7
8
|
import { getCardClickHandler } from '../utils/getCardClickHandler';
|
|
@@ -11,7 +12,8 @@ const InlineCard = props => {
|
|
|
11
12
|
url,
|
|
12
13
|
data,
|
|
13
14
|
eventHandlers,
|
|
14
|
-
portal
|
|
15
|
+
portal,
|
|
16
|
+
smartLinks
|
|
15
17
|
} = props;
|
|
16
18
|
const onClick = getCardClickHandler(eventHandlers, url);
|
|
17
19
|
const cardProps = {
|
|
@@ -20,6 +22,14 @@ const InlineCard = props => {
|
|
|
20
22
|
onClick,
|
|
21
23
|
container: portal
|
|
22
24
|
};
|
|
25
|
+
|
|
26
|
+
if (smartLinks !== null && smartLinks !== void 0 && smartLinks.ssr && url) {
|
|
27
|
+
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
28
|
+
appearance: "inline",
|
|
29
|
+
url: url
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
23
33
|
return /*#__PURE__*/React.createElement("span", {
|
|
24
34
|
"data-inline-card": true,
|
|
25
35
|
"data-card-data": data ? JSON.stringify(data) : undefined,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { WidthProvider, ClearNextSiblingMarginTop } from '@atlaskit/editor-common';
|
|
2
|
+
import { WidthProvider, ClearNextSiblingMarginTop } from '@atlaskit/editor-common/ui';
|
|
3
3
|
export default function LayoutSection(props) {
|
|
4
4
|
return /*#__PURE__*/React.createElement("div", {
|
|
5
5
|
"data-layout-column": true,
|
|
@@ -2,7 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { PureComponent } from 'react';
|
|
5
|
-
import { WithProviders
|
|
5
|
+
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
import { MediaLink } from '@atlaskit/editor-common/ui';
|
|
6
7
|
import { MediaCard } from '../../ui/MediaCard';
|
|
7
8
|
import { getEventHandler } from '../../utils';
|
|
8
9
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics/enums';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
3
|
-
import { WithProviders } from '@atlaskit/editor-common';
|
|
3
|
+
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
4
4
|
export const RenderMediaInline = props => {
|
|
5
5
|
const {
|
|
6
6
|
mediaProvider
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { mapBreakpointToLayoutMaxWidth, WidthConsumer } from '@atlaskit/editor-common';
|
|
3
|
-
import { akEditorFullWidthLayoutWidth, getAkEditorFullPageMaxWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import { Component, default as React } from 'react';
|
|
1
|
+
import { default as React } from 'react';
|
|
5
2
|
import { injectIntl } from 'react-intl-next';
|
|
3
|
+
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
4
|
+
import { mapBreakpointToLayoutMaxWidth, getBreakpoint, WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
5
|
+
import { akEditorFullWidthLayoutWidth, getAkEditorFullPageMaxWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { FullPagePadding } from '../../../ui/Renderer/style';
|
|
7
|
+
import { useObservedWidth } from '../../hooks/use-observed-width';
|
|
7
8
|
import { ExtendedUIMediaSingle } from './styles';
|
|
8
|
-
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
9
9
|
const DEFAULT_WIDTH = 250;
|
|
10
10
|
const DEFAULT_HEIGHT = 200;
|
|
11
11
|
|
|
@@ -39,131 +39,151 @@ export const getMediaContainerWidth = (currentContainerWidth, layout) => {
|
|
|
39
39
|
return !currentContainerWidth && layout !== 'full-width' && layout !== 'wide' ? akEditorDefaultLayoutWidth : currentContainerWidth;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
super(props);
|
|
42
|
+
const MediaSingle = props => {
|
|
43
|
+
var _ref$current;
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
const {
|
|
46
|
+
rendererAppearance,
|
|
47
|
+
featureFlags,
|
|
48
|
+
isInsideOfBlockNode,
|
|
49
|
+
allowDynamicTextSizing,
|
|
50
|
+
layout,
|
|
51
|
+
children,
|
|
52
|
+
width: pctWidth
|
|
53
|
+
} = props;
|
|
54
|
+
const isCaptionsFlaggedOn = getMediaFeatureFlag('captions', featureFlags);
|
|
55
|
+
const [externalImageDimensions, setExternalImageDimensions] = React.useState({
|
|
56
|
+
width: 0,
|
|
57
|
+
height: 0
|
|
58
|
+
});
|
|
59
|
+
const ref = React.useRef(null);
|
|
60
|
+
const onExternalImageLoaded = React.useCallback(({
|
|
61
|
+
width,
|
|
62
|
+
height
|
|
63
|
+
}) => {
|
|
64
|
+
setExternalImageDimensions({
|
|
47
65
|
width,
|
|
48
66
|
height
|
|
49
|
-
}) => {
|
|
50
|
-
this.setState({
|
|
51
|
-
width,
|
|
52
|
-
height
|
|
53
|
-
});
|
|
54
67
|
});
|
|
68
|
+
}, []);
|
|
69
|
+
const observedWidthFlag = getMediaFeatureFlag('observedWidth', featureFlags);
|
|
70
|
+
const {
|
|
71
|
+
width: observedWidth
|
|
72
|
+
} = useObservedWidth((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.parentElement, observedWidthFlag);
|
|
73
|
+
let media;
|
|
74
|
+
const [node, caption] = React.Children.toArray(children);
|
|
55
75
|
|
|
56
|
-
|
|
76
|
+
if (!isMediaElement(node)) {
|
|
77
|
+
const mediaElement = checkForMediaElement(node.props.children);
|
|
57
78
|
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
if (!mediaElement) {
|
|
80
|
+
return node;
|
|
81
|
+
}
|
|
60
82
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
let media;
|
|
66
|
-
const [node, caption] = React.Children.toArray(props.children);
|
|
83
|
+
media = mediaElement;
|
|
84
|
+
} else {
|
|
85
|
+
media = node;
|
|
86
|
+
}
|
|
67
87
|
|
|
68
|
-
|
|
69
|
-
|
|
88
|
+
let {
|
|
89
|
+
width = DEFAULT_WIDTH,
|
|
90
|
+
height = DEFAULT_HEIGHT,
|
|
91
|
+
type
|
|
92
|
+
} = media.props;
|
|
70
93
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
94
|
+
if (type === 'external') {
|
|
95
|
+
const {
|
|
96
|
+
width: stateWidth,
|
|
97
|
+
height: stateHeight
|
|
98
|
+
} = externalImageDimensions;
|
|
74
99
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
media = node;
|
|
100
|
+
if (width === null) {
|
|
101
|
+
width = stateWidth || DEFAULT_WIDTH;
|
|
78
102
|
}
|
|
79
103
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} = media.props;
|
|
85
|
-
|
|
86
|
-
if (type === 'external') {
|
|
87
|
-
const {
|
|
88
|
-
width: stateWidth,
|
|
89
|
-
height: stateHeight
|
|
90
|
-
} = this.state;
|
|
91
|
-
|
|
92
|
-
if (width === null) {
|
|
93
|
-
width = stateWidth || DEFAULT_WIDTH;
|
|
94
|
-
}
|
|
104
|
+
if (height === null) {
|
|
105
|
+
height = stateHeight || DEFAULT_HEIGHT;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
95
108
|
|
|
96
|
-
|
|
97
|
-
|
|
109
|
+
if (width === null) {
|
|
110
|
+
width = DEFAULT_WIDTH;
|
|
111
|
+
height = DEFAULT_HEIGHT;
|
|
112
|
+
} // TODO: put appearance-based padding into theme instead
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
const padding = rendererAppearance === 'full-page' ? FullPagePadding * 2 : 0;
|
|
116
|
+
const isFullWidth = rendererAppearance === 'full-width';
|
|
117
|
+
|
|
118
|
+
const calcDimensions = (mediaContainerWidth, mediaBreakpoint) => {
|
|
119
|
+
const containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
120
|
+
const breakpoint = mediaBreakpoint || getBreakpoint(containerWidth);
|
|
121
|
+
const maxWidth = containerWidth;
|
|
122
|
+
const maxHeight = height / width * maxWidth;
|
|
123
|
+
const cardDimensions = {
|
|
124
|
+
width: `${maxWidth}px`,
|
|
125
|
+
height: `${maxHeight}px`
|
|
126
|
+
};
|
|
127
|
+
let nonFullWidthSize = containerWidth;
|
|
128
|
+
|
|
129
|
+
if (!isInsideOfBlockNode && rendererAppearance !== 'comment') {
|
|
130
|
+
const isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >= getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
|
|
131
|
+
|
|
132
|
+
if (isContainerSizeGreaterThanMaxFullPageWidth && allowDynamicTextSizing) {
|
|
133
|
+
nonFullWidthSize = mapBreakpointToLayoutMaxWidth(breakpoint);
|
|
134
|
+
} else if (isContainerSizeGreaterThanMaxFullPageWidth) {
|
|
135
|
+
nonFullWidthSize = getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
|
|
136
|
+
} else {
|
|
137
|
+
nonFullWidthSize = containerWidth - padding;
|
|
98
138
|
}
|
|
99
139
|
}
|
|
100
140
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
141
|
+
const minWidth = Math.min(akEditorFullWidthLayoutWidth, containerWidth - padding);
|
|
142
|
+
const lineLength = isFullWidth ? minWidth : nonFullWidthSize;
|
|
143
|
+
return {
|
|
144
|
+
cardDimensions,
|
|
145
|
+
lineLength,
|
|
146
|
+
containerWidth
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const originalDimensions = {
|
|
151
|
+
height,
|
|
152
|
+
width
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const renderMediaSingle = (renderWidth, mediaBreakpoint) => {
|
|
107
156
|
const {
|
|
108
|
-
|
|
157
|
+
cardDimensions,
|
|
158
|
+
lineLength,
|
|
159
|
+
containerWidth
|
|
160
|
+
} = calcDimensions(renderWidth, mediaBreakpoint);
|
|
161
|
+
const mediaComponent = /*#__PURE__*/React.cloneElement(media, {
|
|
162
|
+
resizeMode: 'stretchy-fit',
|
|
163
|
+
cardDimensions,
|
|
164
|
+
originalDimensions,
|
|
165
|
+
onExternalImageLoaded,
|
|
166
|
+
disableOverlay: true,
|
|
109
167
|
featureFlags
|
|
110
|
-
} = this.props;
|
|
111
|
-
const padding = rendererAppearance === 'full-page' ? FullPagePadding * 2 : 0;
|
|
112
|
-
return /*#__PURE__*/React.createElement(WidthConsumer, null, ({
|
|
113
|
-
width: widthConsumerValue,
|
|
114
|
-
breakpoint
|
|
115
|
-
}) => {
|
|
116
|
-
const containerWidth = getMediaContainerWidth(widthConsumerValue, props.layout);
|
|
117
|
-
const {
|
|
118
|
-
isInsideOfBlockNode,
|
|
119
|
-
allowDynamicTextSizing
|
|
120
|
-
} = this.props;
|
|
121
|
-
const maxWidth = containerWidth;
|
|
122
|
-
const maxHeight = height / width * maxWidth;
|
|
123
|
-
const cardDimensions = {
|
|
124
|
-
width: `${maxWidth}px`,
|
|
125
|
-
height: `${maxHeight}px`
|
|
126
|
-
};
|
|
127
|
-
const isFullWidth = rendererAppearance === 'full-width';
|
|
128
|
-
let nonFullWidthSize = containerWidth;
|
|
129
|
-
|
|
130
|
-
if (!isInsideOfBlockNode && rendererAppearance !== 'comment') {
|
|
131
|
-
const isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >= getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
|
|
132
|
-
|
|
133
|
-
if (isContainerSizeGreaterThanMaxFullPageWidth && allowDynamicTextSizing) {
|
|
134
|
-
nonFullWidthSize = mapBreakpointToLayoutMaxWidth(breakpoint);
|
|
135
|
-
} else if (isContainerSizeGreaterThanMaxFullPageWidth) {
|
|
136
|
-
nonFullWidthSize = getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
|
|
137
|
-
} else {
|
|
138
|
-
nonFullWidthSize = containerWidth - padding;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const lineLength = isFullWidth ? Math.min(akEditorFullWidthLayoutWidth, containerWidth - padding) : nonFullWidthSize;
|
|
143
|
-
const originalDimensions = {
|
|
144
|
-
height,
|
|
145
|
-
width
|
|
146
|
-
};
|
|
147
|
-
const mediaComponent = /*#__PURE__*/React.cloneElement(media, {
|
|
148
|
-
resizeMode: 'stretchy-fit',
|
|
149
|
-
cardDimensions,
|
|
150
|
-
originalDimensions,
|
|
151
|
-
onExternalImageLoaded: this.onExternalImageLoaded,
|
|
152
|
-
disableOverlay: true,
|
|
153
|
-
featureFlags: featureFlags
|
|
154
|
-
});
|
|
155
|
-
return /*#__PURE__*/React.createElement(ExtendedUIMediaSingle, {
|
|
156
|
-
layout: props.layout,
|
|
157
|
-
width: width,
|
|
158
|
-
height: height,
|
|
159
|
-
lineLength: isInsideOfBlockNode ? containerWidth : lineLength,
|
|
160
|
-
containerWidth: containerWidth,
|
|
161
|
-
pctWidth: props.width,
|
|
162
|
-
fullWidthMode: isFullWidth
|
|
163
|
-
}, /*#__PURE__*/React.createElement(React.Fragment, null, mediaComponent), this.isCaptionsFlaggedOn && caption);
|
|
164
168
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
169
|
+
return /*#__PURE__*/React.createElement(ExtendedUIMediaSingle, {
|
|
170
|
+
handleMediaSingleRef: ref,
|
|
171
|
+
layout: layout,
|
|
172
|
+
width: width,
|
|
173
|
+
height: height,
|
|
174
|
+
lineLength: isInsideOfBlockNode ? containerWidth : lineLength,
|
|
175
|
+
containerWidth: containerWidth,
|
|
176
|
+
pctWidth: pctWidth,
|
|
177
|
+
fullWidthMode: isFullWidth
|
|
178
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, mediaComponent), isCaptionsFlaggedOn && caption);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
return observedWidthFlag ? renderMediaSingle(observedWidth || document.body.offsetWidth) : /*#__PURE__*/React.createElement(WidthConsumer, null, ({
|
|
182
|
+
width,
|
|
183
|
+
breakpoint
|
|
184
|
+
}) => {
|
|
185
|
+
return renderMediaSingle(width, breakpoint);
|
|
186
|
+
});
|
|
187
|
+
};
|
|
168
188
|
|
|
169
189
|
export default injectIntl(MediaSingle);
|