@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.
- package/CHANGELOG.md +72 -0
- package/dist/cjs/react/index.js +40 -12
- package/dist/cjs/react/marks/code.js +26 -4
- package/dist/cjs/react/marks/fragment.js +21 -0
- package/dist/cjs/react/marks/index.js +10 -1
- package/dist/cjs/react/nodes/codeBlock.js +17 -3
- package/dist/cjs/react/nodes/heading-anchor.js +1 -2
- package/dist/cjs/react/nodes/heading.js +5 -9
- package/dist/cjs/react/nodes/index.js +15 -1
- package/dist/cjs/react/nodes/media.js +4 -2
- package/dist/cjs/react/nodes/mediaInline.js +104 -0
- package/dist/cjs/react/nodes/panel.js +5 -7
- package/dist/cjs/react/nodes/text-wrapper.js +5 -6
- package/dist/cjs/ui/MediaCard.js +11 -5
- package/dist/cjs/ui/Renderer/index.js +4 -4
- package/dist/cjs/ui/Renderer/style.js +5 -5
- package/dist/cjs/ui/SortingIcon.js +1 -1
- package/dist/cjs/ui/annotations/draft/component.js +6 -6
- package/dist/cjs/ui/annotations/hooks/use-events.js +3 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/react/index.js +37 -8
- package/dist/es2019/react/marks/code.js +15 -3
- package/dist/es2019/react/marks/fragment.js +10 -0
- package/dist/es2019/react/marks/index.js +4 -2
- package/dist/es2019/react/nodes/codeBlock.js +13 -3
- package/dist/es2019/react/nodes/heading-anchor.js +1 -2
- package/dist/es2019/react/nodes/heading.js +5 -8
- package/dist/es2019/react/nodes/index.js +8 -1
- package/dist/es2019/react/nodes/media.js +4 -2
- package/dist/es2019/react/nodes/mediaInline.js +53 -0
- package/dist/es2019/react/nodes/panel.js +6 -7
- package/dist/es2019/react/nodes/text-wrapper.js +7 -6
- package/dist/es2019/ui/MediaCard.js +11 -5
- package/dist/es2019/ui/Renderer/index.js +4 -4
- package/dist/es2019/ui/Renderer/style.js +48 -82
- package/dist/es2019/ui/SortingIcon.js +1 -1
- package/dist/es2019/ui/annotations/draft/component.js +6 -6
- package/dist/es2019/ui/annotations/hooks/use-events.js +3 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/react/index.js +39 -12
- package/dist/esm/react/marks/code.js +15 -3
- package/dist/esm/react/marks/fragment.js +10 -0
- package/dist/esm/react/marks/index.js +4 -2
- package/dist/esm/react/nodes/codeBlock.js +13 -3
- package/dist/esm/react/nodes/heading-anchor.js +1 -2
- package/dist/esm/react/nodes/heading.js +5 -8
- package/dist/esm/react/nodes/index.js +14 -1
- package/dist/esm/react/nodes/media.js +4 -2
- package/dist/esm/react/nodes/mediaInline.js +80 -0
- package/dist/esm/react/nodes/panel.js +6 -7
- package/dist/esm/react/nodes/text-wrapper.js +7 -6
- package/dist/esm/ui/MediaCard.js +11 -5
- package/dist/esm/ui/Renderer/index.js +4 -4
- package/dist/esm/ui/Renderer/style.js +5 -6
- package/dist/esm/ui/SortingIcon.js +1 -1
- package/dist/esm/ui/annotations/draft/component.js +6 -6
- package/dist/esm/ui/annotations/hooks/use-events.js +3 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/react/index.d.ts +1 -0
- package/dist/types/react/marks/code.d.ts +15 -1
- package/dist/types/react/marks/fragment.d.ts +3 -0
- package/dist/types/react/marks/index.d.ts +2 -1
- package/dist/types/react/nodes/codeBlock.d.ts +4 -3
- package/dist/types/react/nodes/index.d.ts +8 -7
- package/dist/types/react/nodes/mediaInline.d.ts +17 -0
- package/dist/types/react/nodes/text-wrapper.d.ts +2 -3
- package/dist/types/renderer-context.d.ts +3 -1
- package/dist/types/types/mediaOptions.d.ts +7 -1
- package/dist/types/ui/MediaCard.d.ts +2 -0
- package/dist/types/ui/annotations/draft/component.d.ts +1 -1
- package/dist/types/ui/renderer-props.d.ts +1 -1
- package/package.json +22 -23
package/dist/cjs/ui/MediaCard.js
CHANGED
|
@@ -290,7 +290,8 @@ var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
290
290
|
imageStatus = _this$props4.imageStatus,
|
|
291
291
|
disableOverlay = _this$props4.disableOverlay,
|
|
292
292
|
alt = _this$props4.alt,
|
|
293
|
-
featureFlags = _this$props4.featureFlags
|
|
293
|
+
featureFlags = _this$props4.featureFlags,
|
|
294
|
+
ssr = _this$props4.ssr;
|
|
294
295
|
|
|
295
296
|
if (imageStatus === 'loading' || !url) {
|
|
296
297
|
return this.renderLoadingCard();
|
|
@@ -315,7 +316,8 @@ var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
315
316
|
mediaViewerDataSource: {
|
|
316
317
|
list: Array.from(mediaIdentifierMap.values())
|
|
317
318
|
},
|
|
318
|
-
featureFlags: featureFlags
|
|
319
|
+
featureFlags: featureFlags,
|
|
320
|
+
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
|
|
319
321
|
});
|
|
320
322
|
}
|
|
321
323
|
/**
|
|
@@ -330,7 +332,7 @@ var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
330
332
|
value: function render() {
|
|
331
333
|
var _this$state = this.state,
|
|
332
334
|
contextIdentifierProvider = _this$state.contextIdentifierProvider,
|
|
333
|
-
|
|
335
|
+
mediaClientConfigInState = _this$state.mediaClientConfig,
|
|
334
336
|
fileState = _this$state.fileState;
|
|
335
337
|
var _this$props5 = this.props,
|
|
336
338
|
id = _this$props5.id,
|
|
@@ -346,7 +348,8 @@ var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
346
348
|
originalDimensions = _this$props5.originalDimensions,
|
|
347
349
|
forceOpenMediaViewer = _this$props5.shouldOpenMediaViewer,
|
|
348
350
|
featureFlags = _this$props5.featureFlags,
|
|
349
|
-
shouldEnableDownloadButton = _this$props5.shouldEnableDownloadButton
|
|
351
|
+
shouldEnableDownloadButton = _this$props5.shouldEnableDownloadButton,
|
|
352
|
+
ssr = _this$props5.ssr;
|
|
350
353
|
var isMobile = rendererAppearance === 'mobile';
|
|
351
354
|
var shouldPlayInline = useInlinePlayer !== undefined ? useInlinePlayer : true;
|
|
352
355
|
var isInlinePlayer = isMobile ? false : shouldPlayInline;
|
|
@@ -361,6 +364,8 @@ var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
361
364
|
return null;
|
|
362
365
|
}
|
|
363
366
|
|
|
367
|
+
var mediaClientConfig = !!ssr ? ssr.config : mediaClientConfigInState;
|
|
368
|
+
|
|
364
369
|
if (!mediaClientConfig || !id) {
|
|
365
370
|
return this.renderLoadingCard();
|
|
366
371
|
}
|
|
@@ -402,7 +407,8 @@ var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
402
407
|
list: Array.from(mediaIdentifierMap.values())
|
|
403
408
|
},
|
|
404
409
|
featureFlags: featureFlags,
|
|
405
|
-
shouldEnableDownloadButton: shouldEnableDownloadButton
|
|
410
|
+
shouldEnableDownloadButton: shouldEnableDownloadButton,
|
|
411
|
+
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
|
|
406
412
|
}));
|
|
407
413
|
}
|
|
408
414
|
}]);
|
|
@@ -223,7 +223,7 @@ var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
223
223
|
var nextMedia = nextProps.media || {};
|
|
224
224
|
var media = this.props.media || {};
|
|
225
225
|
|
|
226
|
-
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) {
|
|
226
|
+
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) {
|
|
227
227
|
this.serializer = new _.ReactSerializer(this.deriveSerializerProps(nextProps));
|
|
228
228
|
}
|
|
229
229
|
}
|
|
@@ -257,7 +257,7 @@ var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
257
257
|
surroundTextNodesWithTextWrapper: allowAnnotationsDraftMode,
|
|
258
258
|
media: props.media,
|
|
259
259
|
allowCopyToClipboard: props.allowCopyToClipboard,
|
|
260
|
-
allowCustomPanels: props.
|
|
260
|
+
allowCustomPanels: props.allowCustomPanels,
|
|
261
261
|
allowAnnotations: props.allowAnnotations,
|
|
262
262
|
allowSelectAllTrap: props.allowSelectAllTrap,
|
|
263
263
|
allowPlaceholderText: props.allowPlaceholderText
|
|
@@ -283,7 +283,7 @@ var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
283
283
|
allowPlaceholderText = _this$props2.allowPlaceholderText,
|
|
284
284
|
allowColumnSorting = _this$props2.allowColumnSorting,
|
|
285
285
|
allowCopyToClipboard = _this$props2.allowCopyToClipboard,
|
|
286
|
-
|
|
286
|
+
allowCustomPanels = _this$props2.allowCustomPanels;
|
|
287
287
|
var allowNestedHeaderLinks = (0, _links.isNestedHeaderLinksEnabled)(allowHeadingAnchorLinks);
|
|
288
288
|
/**
|
|
289
289
|
* Handle clicks inside renderer. If the click isn't on media, in the media picker, or on a
|
|
@@ -358,7 +358,7 @@ var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
358
358
|
allowNestedHeaderLinks: allowNestedHeaderLinks,
|
|
359
359
|
allowColumnSorting: allowColumnSorting,
|
|
360
360
|
allowCopyToClipboard: allowCopyToClipboard,
|
|
361
|
-
allowCustomPanels:
|
|
361
|
+
allowCustomPanels: allowCustomPanels,
|
|
362
362
|
allowPlaceholderText: allowPlaceholderText,
|
|
363
363
|
innerRef: this.editorRef,
|
|
364
364
|
onClick: handleWrapperOnClick,
|
|
@@ -65,7 +65,7 @@ var headingSizes = {
|
|
|
65
65
|
exports.headingSizes = headingSizes;
|
|
66
66
|
|
|
67
67
|
var headingAnchorStyle = function headingAnchorStyle(headingTag) {
|
|
68
|
-
return (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /**\n * The copy link button doesn't reserve space in the DOM so that\n * the text alignment isn't impacted by the button/icon's space.\n */\n
|
|
68
|
+
return (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /**\n * The copy link button doesn't reserve space in the DOM so that\n * the text alignment isn't impacted by the button/icon's space.\n */\n .", " {\n position: absolute;\n height: ", "em;\n\n margin-left: 6px;\n\n button {\n padding-left: 0;\n padding-right: 0;\n }\n }\n\n /**\n * Applies hover effects to the heading anchor link button\n * to fade in when the user rolls over the heading.\n *\n * The link is persistent on mobile, so we use feature detection\n * to enable hover effects for systems that support it (desktop).\n *\n * @see https://caniuse.com/mdn-css_at-rules_media_hover\n */\n @media (hover: hover) and (pointer: fine) {\n .", " {\n > button {\n opacity: 0;\n transform: translate(-8px, 0px);\n transition: opacity 0.2s ease 0s, transform 0.2s ease 0s;\n }\n }\n\n &:hover {\n .", " > button {\n opacity: 1;\n transform: none !important;\n }\n }\n }\n "])), _headingAnchor.HeadingAnchorWrapperClassName, headingSizes[headingTag].lineHeight, _headingAnchor.HeadingAnchorWrapperClassName, _headingAnchor.HeadingAnchorWrapperClassName);
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
var alignedHeadingAnchorStyle = function alignedHeadingAnchorStyle(_ref) {
|
|
@@ -75,7 +75,7 @@ var alignedHeadingAnchorStyle = function alignedHeadingAnchorStyle(_ref) {
|
|
|
75
75
|
return '';
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
return "\n .fabric-editor-block-mark[data-align] > {\n h1, h2, h3, h4, h5, h6 {\n position: relative;\n }\n }\n\n /**\n * For right-alignment we flip the link to be before the heading\n * text so that the text is flush up against the edge of the editor's\n * container edge.\n */\n .fabric-editor-block-mark:not([data-align='center'])[data-align] {\n
|
|
78
|
+
return "\n .fabric-editor-block-mark[data-align] > {\n h1, h2, h3, h4, h5, h6 {\n position: relative;\n }\n }\n\n /**\n * For right-alignment we flip the link to be before the heading\n * text so that the text is flush up against the edge of the editor's\n * container edge.\n */\n .fabric-editor-block-mark:not([data-align='center'])[data-align] {\n > {\n h1, h2, h3, h4, h5, h6 {\n // Using right to left text to achieve the inverse effect\n // of where the copy link button icon sits for left/center\n // alignment.\n // Although this is unorthodox it's the only approach which\n // allows the button to sit flush against the left edge of\n // bottom line of text.\n direction: rtl;\n\n // By default RTL will negatively impact the layout of special\n // characters within the heading text, and potentially other\n // nested inline nodes. To prevent this we insert pseudo elements\n // containing HTML entities to retain LTR for all heading content\n // except for the copy link button.\n > *:not(.".concat(_headingAnchor.HeadingAnchorWrapperClassName, "):not(br) {\n ::before {\n // Open LTR: https://www.fileformat.info/info/unicode/char/202a/index.htm\n content: '\u202A';\n }\n ::after {\n // Close LTR: https://www.fileformat.info/info/unicode/char/202c/index.htm\n content: '\u202C';\n }\n }\n }\n }\n .").concat(_headingAnchor.HeadingAnchorWrapperClassName, " {\n margin: 0 6px 0 0;\n }\n\n @media (hover: hover) and (pointer: fine) {\n .").concat(_headingAnchor.HeadingAnchorWrapperClassName, " > button {\n transform: translate(8px, 0px);\n }\n }\n }\n }\n ");
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
var tableSortableColumnStyle = function tableSortableColumnStyle(_ref2) {
|
|
@@ -89,7 +89,7 @@ var tableSortableColumnStyle = function tableSortableColumnStyle(_ref2) {
|
|
|
89
89
|
var headingsCss = '';
|
|
90
90
|
|
|
91
91
|
if (allowNestedHeaderLinks) {
|
|
92
|
-
headingsCss = "\n /**\n * When the sort button is enabled we want the heading's copy link button\n * to reserve space so that it can prematurely wrap to avoid the button\n * being displayed underneath the sort button (hidden or obscured).\n *\n * The two buttons fight each other since the sort button is displayed\n * on hover of the <th /> and the copy link button is displayed on hover\n * of the heading.\n *\n * Note that this can break the WYSIWYG experience in the case where\n * a heading fills the width of the table cell and the only thing which\n * wraps is the copy link button. This is hopefully a rare fringe case.\n */\n .".concat(_headingAnchor.HeadingAnchorWrapperClassName, " {\n position: unset;\n }\n
|
|
92
|
+
headingsCss = "\n /**\n * When the sort button is enabled we want the heading's copy link button\n * to reserve space so that it can prematurely wrap to avoid the button\n * being displayed underneath the sort button (hidden or obscured).\n *\n * The two buttons fight each other since the sort button is displayed\n * on hover of the <th /> and the copy link button is displayed on hover\n * of the heading.\n *\n * Note that this can break the WYSIWYG experience in the case where\n * a heading fills the width of the table cell and the only thing which\n * wraps is the copy link button. This is hopefully a rare fringe case.\n */\n .".concat(_headingAnchor.HeadingAnchorWrapperClassName, " {\n position: unset;\n }\n > {\n h1, h2, h3, h4, h5, h6 {\n margin-right: 30px;\n }\n }\n ");
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
return "\n .".concat(_consts.RendererCssClassName.SORTABLE_COLUMN, " {\n padding: 0;\n\n .").concat(_consts.RendererCssClassName.SORTABLE_COLUMN_BUTTON, " {\n width: 100%;\n height: 100%;\n cursor: pointer;\n padding: ").concat(_editorCommon.tableCellPadding, "px;\n border-width: 1.5px;\n border-style: solid;\n border-color: transparent;\n\n > *:first-child {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + * {\n margin-top: 0;\n }\n\n @supports selector(:focus-visible) {\n &:focus {\n outline: unset;\n }\n &:focus-visible {\n border-color: ").concat(colors.B300, ";\n }\n }\n\n ").concat(headingsCss, "\n }\n\n &.").concat(_consts.RendererCssClassName.SORTABLE_COLUMN_NOT_ALLOWED, " .").concat(_consts.RendererCssClassName.SORTABLE_COLUMN_BUTTON, " {\n cursor: default;\n }\n\n .").concat(_consts.RendererCssClassName.SORTABLE_COLUMN_ICON, " {\n margin: 0;\n opacity: 1;\n transition: opacity 0.2s ease-in-out;\n }\n\n .").concat(_consts.RendererCssClassName.SORTABLE_COLUMN_NO_ORDER, " {\n opacity: 0;\n }\n\n &:hover {\n .").concat(_consts.RendererCssClassName.SORTABLE_COLUMN_NO_ORDER, " {\n opacity: 1;\n }\n }\n }\n ");
|
|
@@ -117,10 +117,10 @@ var fullWidthStyles = function fullWidthStyles(_ref4) {
|
|
|
117
117
|
}; // prettier-ignore
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
var Wrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n font-size: ", "px;\n line-height: 1.5rem;\n color: ", ";\n\n ", "\n ", "\n\n
|
|
120
|
+
var Wrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n font-size: ", "px;\n line-height: 1.5rem;\n color: ", ";\n\n ", "\n ", "\n\n & h1 {\n ", "\n }\n\n & h2 {\n ", "\n }\n\n & h3 {\n ", "\n }\n\n & h4 {\n ", "\n }\n\n & h5 {\n ", "\n }\n\n & h6 {\n ", "\n }\n\n & span.akActionMark {\n color: ", ";\n text-decoration: none;\n\n &:hover {\n color: ", ";\n text-decoration: underline;\n }\n }\n\n & span.akActionMark {\n cursor: pointer;\n }\n\n & span[data-placeholder] {\n color: ", ";\n }\n\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", "\n\n & .UnknownBlock {\n font-family: ", ";\n font-size: ", ";\n font-weight: 400;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n\n & span.date-node {\n background: ", ";\n border-radius: ", "px;\n color: ", ";\n padding: 2px 4px;\n margin: 0 1px;\n transition: background 0.3s;\n }\n\n & span.date-node-highlighted {\n background: ", ";\n color: ", ";\n }\n\n & .renderer-image {\n max-width: 100%;\n display: block;\n margin: ", "px 0;\n }\n\n .", ".rich-media-wrapped + .", ":not(.rich-media-wrapped) {\n clear: both;\n }\n\n & .code-block,\n & blockquote,\n & hr,\n & > div > div:not(.rich-media-wrapped),\n .", ".rich-media-wrapped + .rich-media-wrapped + *:not(.rich-media-wrapped),\n .", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n .", ".image-align-start,\n .", ".image-center,\n .", ".image-align-end {\n clear: both;\n }\n\n & .rich-media-wrapped {\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n margin-top: 8px;\n }\n }\n\n ", "\n\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n margin-left: 0;\n margin-right: 0;\n }\n\n /* Breakout for tables and extensions */\n .", " > {\n * .", " {\n width: 100% !important;\n left: 0 !important;\n }\n\n * .", " {\n overflow-x: auto;\n }\n\n & .", ":first-child {\n margin-top: 0;\n }\n }\n\n .", " {\n margin-top: ", ";\n }\n\n .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n .", " {\n overflow-x: auto;\n }\n\n ", "\n\n .", " {\n z-index: 0;\n transition: all 0.1s linear;\n display: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n /** Shadow overrides */\n &.", "::after, &.", "::before {\n top: ", "px;\n height: calc(100% - ", "px);\n z-index: ", ";\n }\n\n /**\n * A hack for making all the <th /> heights equal in case some have shorter\n * content than others.\n *\n * This is done to make sort buttons fill entire <th />.\n */\n table {\n height: 1px; /* will be ignored */\n ", ";\n margin-left: 0;\n margin-right: 0;\n }\n\n table tr:first-child {\n height: 100%;\n\n td, th {\n position: relative;\n }\n }\n\n table[data-number-column='true'] {\n .", " {\n background-color: ", ";\n border-right: 1px solid ", ";\n width: ", "px;\n text-align: center;\n color: ", ";\n font-size: ", ";\n }\n\n .fixed .", " {\n border-right: 0px none;\n }\n }\n }\n\n tr[data-header-row].fixed {\n position: fixed !important;\n display: flex;\n overflow: hidden;\n z-index: ", ";\n\n border-right: 1px solid ", ";\n border-bottom: 1px solid ", ";\n\n /* this is to compensate for the table border */\n transform: translateX(-1px);\n }\n\n .sticky > th {\n z-index: ", ";\n position: sticky !important;\n top: 0;\n }\n\n /* Make the number column header sticky */\n .sticky > td {\n position: sticky !important;\n top: 0;\n }\n\n /* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n .sticky th, .sticky td {\n box-shadow: 0px 1px ", ", 0px -0.5px ", ", inset -1px 0px ", ", 0px -1px ", ";\n }\n\n /* this will remove jumpiness caused in Chrome for sticky headers */\n .fixed + tr {\n min-height: 0px;\n }\n\n /*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n & .code-block {\n max-width: 100%;\n /* -ms- properties are necessary until MS supports the latest version of the grid spec */\n /* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n display: -ms-grid;\n display: grid;\n -ms-grid-columns: auto 1fr;\n /* stylelint-enable */\n\n grid-template-columns: minmax(0, 1fr);\n position: relative;\n border-radius: ", "px;\n\n /*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n word-wrap: normal;\n\n & > span {\n /* stylelint-disable value-no-vendor-prefix */\n -ms-grid-row: 1;\n -ms-grid-column: 2;\n /* stylelint-enable */\n grid-column: 1;\n }\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n\n &:hover button.copy-to-clipboard, .copy-to-clipboard:focus{\n opacity: 1;\n position: absolute;\n height: 32px;\n width: 32px;\n right: 6px;\n top: 4px;\n padding: 2px;\n }\n }\n\n ", ";\n & [data-layout-section] {\n margin-top: ", "px;\n & > div + div {\n margin-left: ", "px;\n }\n\n @media screen and (max-width: ", "px) {\n & > div + div {\n margin-left: 0;\n }\n }\n }\n"])), _editorSharedStyles.editorFontSize, (0, _components.themed)({
|
|
121
121
|
light: colors.N800,
|
|
122
122
|
dark: '#B8C7E0'
|
|
123
|
-
}), fullPageStyles, fullWidthStyles,
|
|
123
|
+
}), fullPageStyles, fullWidthStyles, headingAnchorStyle('h1'), headingAnchorStyle('h2'), headingAnchorStyle('h3'), headingAnchorStyle('h4'), headingAnchorStyle('h5'), headingAnchorStyle('h6'), colors.B400, colors.B300, colors.placeholderText, _editorCommon.whitespaceSharedStyles, _editorCommon.blockquoteSharedStyles, _editorCommon.headingsSharedStyles, _editorCommon.panelSharedStyles, _editorCommon.ruleSharedStyles, _editorCommon.paragraphSharedStyles, _editorCommon.listsSharedStyles, _editorCommon.indentationSharedStyles, _editorCommon.blockMarksSharedStyles, _editorCommon.codeMarkSharedStyles, _editorCommon.shadowSharedStyle, _editorCommon.dateSharedStyle, _editorCommon.tasksAndDecisionsStyles, _editorCommon.smartCardSharedStyles, (0, _constants.fontFamily)(), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), (0, _components.themed)({
|
|
124
124
|
light: colors.N30A,
|
|
125
125
|
dark: colors.DN70
|
|
126
126
|
}), (0, _constants.borderRadius)(), (0, _components.themed)({
|
|
@@ -41,7 +41,7 @@ exports.StatusClassNames = StatusClassNames;
|
|
|
41
41
|
|
|
42
42
|
var Wrapper = _styledComponents.default.figure(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n display: flex;\n height: 28px;\n width: 28px;\n margin: 6px;\n right: 0;\n top: 0;\n border: 2px solid #fff;\n border-radius: ", "px;\n background-color: ", ";\n justify-content: center;\n align-items: center;\n\n &:hover {\n background-color: ", ";\n }\n\n &.", " {\n cursor: not-allowed;\n }\n"])), (0, _constants.gridSize)() / 2, _colors.N20, _colors.N30, StatusClassNames.SORTING_NOT_ALLOWED);
|
|
43
43
|
|
|
44
|
-
var TableSortingIcon = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n width: 8px;\n height: 12px;\n transition: transform 0.3s cubic-bezier(0.15, 1, 0.3, 1);\n transform-origin: 50% 50%;\n background-image: url(", ");\n\n &.", " {\n transform: rotate(-180deg);\n }\n\n &.", "-inactive {\n opacity: 0.
|
|
44
|
+
var TableSortingIcon = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n width: 8px;\n height: 12px;\n transition: transform 0.3s cubic-bezier(0.15, 1, 0.3, 1);\n transform-origin: 50% 50%;\n background-image: url(", ");\n\n &.", " {\n transform: rotate(-180deg);\n }\n\n &.", "-inactive {\n opacity: 0.7;\n }\n"])), TableSortIconDataUrl, StatusClassNames.DESC, TABLE_SORTING_ICON_CLASS);
|
|
45
45
|
|
|
46
46
|
var getClassName = function getClassName(status) {
|
|
47
47
|
switch (status) {
|
|
@@ -83,7 +83,7 @@ exports.applyAnnotationOnText = applyAnnotationOnText;
|
|
|
83
83
|
var TextWithAnnotationDraft = function TextWithAnnotationDraft(_ref3) {
|
|
84
84
|
var startPos = _ref3.startPos,
|
|
85
85
|
endPos = _ref3.endPos,
|
|
86
|
-
|
|
86
|
+
children = _ref3.children;
|
|
87
87
|
|
|
88
88
|
var textPosition = _react.default.useMemo(function () {
|
|
89
89
|
return {
|
|
@@ -103,21 +103,21 @@ var TextWithAnnotationDraft = function TextWithAnnotationDraft(_ref3) {
|
|
|
103
103
|
}, [nextDraftPosition, textPosition]);
|
|
104
104
|
|
|
105
105
|
if (shouldApplyAnnotationAt === false || !nextDraftPosition) {
|
|
106
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null,
|
|
106
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
if (shouldApplyAnnotationAt === _types.InsertDraftPosition.AROUND_TEXT) {
|
|
110
110
|
return /*#__PURE__*/_react.default.createElement(AnnotationDraft, {
|
|
111
111
|
key: 0,
|
|
112
112
|
draftPosition: nextDraftPosition
|
|
113
|
-
},
|
|
113
|
+
}, children);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
var offsets = (0, _text.calcTextSplitOffset)(nextDraftPosition, textPosition,
|
|
117
|
-
var texts = (0, _text.splitText)(
|
|
116
|
+
var offsets = (0, _text.calcTextSplitOffset)(nextDraftPosition, textPosition, children);
|
|
117
|
+
var texts = (0, _text.splitText)(children, offsets);
|
|
118
118
|
|
|
119
119
|
if (!texts) {
|
|
120
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null,
|
|
120
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
var components = applyAnnotationOnText({
|
|
@@ -46,7 +46,9 @@ var useAnnotationStateByTypeEvent = function useAnnotationStateByTypeEvent(_ref)
|
|
|
46
46
|
|
|
47
47
|
var nextStates = Object.values(payload).reduce(function (acc, curr) {
|
|
48
48
|
if (curr.annotationType === type) {
|
|
49
|
-
|
|
49
|
+
// Check for empty state to prevent additional renders
|
|
50
|
+
var isEmpty = curr.state === null || curr.state === undefined;
|
|
51
|
+
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, curr.id, !isEmpty ? curr.state : states[curr.id]));
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
return acc;
|
package/dist/cjs/version.json
CHANGED
|
@@ -10,6 +10,7 @@ import { getMarksByOrder, isSameMark, calcTableColumnWidths } from '@atlaskit/ed
|
|
|
10
10
|
import { getText } from '../utils';
|
|
11
11
|
import { findChildrenByType } from 'prosemirror-utils';
|
|
12
12
|
import { insideBreakoutLayout } from './renderer-node';
|
|
13
|
+
import { isCodeMark } from './marks/code';
|
|
13
14
|
|
|
14
15
|
function mergeMarks(marksAndNodes) {
|
|
15
16
|
return marksAndNodes.reduce((acc, markOrNode) => {
|
|
@@ -128,13 +129,23 @@ export default class ReactSerializer {
|
|
|
128
129
|
} = mark.attrs;
|
|
129
130
|
const extraProps = {
|
|
130
131
|
isInline: node === null || node === void 0 ? void 0 : node.isInline
|
|
131
|
-
};
|
|
132
|
+
}; // currently the only mark which has custom props is the code mark
|
|
133
|
+
|
|
134
|
+
const markSpecificProps = isCodeMark(mark) ? {
|
|
135
|
+
// The appearance being mobile indicates we are in an renderer being
|
|
136
|
+
// rendered by mobile bridge in a web view.
|
|
137
|
+
// The tooltip is likely to have unexpected behaviour there, with being cut
|
|
138
|
+
// off, so we disable it. This is also to keep the behaviour consistent with
|
|
139
|
+
// the rendering in the mobile Native Renderer.
|
|
140
|
+
codeBidiWarningTooltipEnabled: this.appearance !== 'mobile'
|
|
141
|
+
} : {};
|
|
132
142
|
const props = {
|
|
133
143
|
eventHandlers: this.eventHandlers,
|
|
134
144
|
fireAnalyticsEvent: this.fireAnalyticsEvent,
|
|
135
145
|
markKey: key,
|
|
136
146
|
...otherAttrs,
|
|
137
147
|
...extraProps,
|
|
148
|
+
...markSpecificProps,
|
|
138
149
|
dataAttributes: {
|
|
139
150
|
'data-renderer-mark': true
|
|
140
151
|
}
|
|
@@ -192,6 +203,9 @@ export default class ReactSerializer {
|
|
|
192
203
|
case 'mediaGroup':
|
|
193
204
|
return this.getMediaGroupProps(node);
|
|
194
205
|
|
|
206
|
+
case 'mediaInline':
|
|
207
|
+
return this.getMediaInlineProps(node);
|
|
208
|
+
|
|
195
209
|
case 'mediaSingle':
|
|
196
210
|
return this.getMediaSingleProps(node, path);
|
|
197
211
|
|
|
@@ -296,9 +310,8 @@ export default class ReactSerializer {
|
|
|
296
310
|
return /*#__PURE__*/React.createElement(TextWrapperComponent, {
|
|
297
311
|
key: textKey,
|
|
298
312
|
startPos: startPos + parentDepth,
|
|
299
|
-
endPos: endPos + parentDepth
|
|
300
|
-
|
|
301
|
-
});
|
|
313
|
+
endPos: endPos + parentDepth
|
|
314
|
+
}, mark.text);
|
|
302
315
|
}
|
|
303
316
|
|
|
304
317
|
return mark.text || '';
|
|
@@ -366,6 +379,8 @@ export default class ReactSerializer {
|
|
|
366
379
|
}
|
|
367
380
|
|
|
368
381
|
getMediaProps(node, path = []) {
|
|
382
|
+
var _this$media;
|
|
383
|
+
|
|
369
384
|
const {
|
|
370
385
|
marks: {
|
|
371
386
|
link
|
|
@@ -379,7 +394,8 @@ export default class ReactSerializer {
|
|
|
379
394
|
isLinkMark,
|
|
380
395
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
381
396
|
featureFlags: this.media && this.media.featureFlags,
|
|
382
|
-
shouldOpenMediaViewer: this.shouldOpenMediaViewer
|
|
397
|
+
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
398
|
+
ssr: (_this$media = this.media) === null || _this$media === void 0 ? void 0 : _this$media.ssr
|
|
383
399
|
};
|
|
384
400
|
}
|
|
385
401
|
|
|
@@ -400,13 +416,19 @@ export default class ReactSerializer {
|
|
|
400
416
|
}
|
|
401
417
|
|
|
402
418
|
getMediaGroupProps(node) {
|
|
403
|
-
var _this$
|
|
419
|
+
var _this$media2, _this$media3;
|
|
404
420
|
|
|
405
421
|
return { ...this.getProps(node),
|
|
406
422
|
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
407
423
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
408
424
|
featureFlags: this.media && this.media.featureFlags,
|
|
409
|
-
enableDownloadButton: (_this$
|
|
425
|
+
enableDownloadButton: (_this$media2 = this.media) === null || _this$media2 === void 0 ? void 0 : _this$media2.enableDownloadButton,
|
|
426
|
+
ssr: (_this$media3 = this.media) === null || _this$media3 === void 0 ? void 0 : _this$media3.ssr
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
getMediaInlineProps(node) {
|
|
431
|
+
return { ...this.getProps(node)
|
|
410
432
|
};
|
|
411
433
|
}
|
|
412
434
|
|
|
@@ -430,8 +452,15 @@ export default class ReactSerializer {
|
|
|
430
452
|
}
|
|
431
453
|
|
|
432
454
|
getCodeBlockProps(node) {
|
|
455
|
+
// The appearance being mobile indicates we are in an renderer being
|
|
456
|
+
// rendered by mobile bridge in a web view.
|
|
457
|
+
// The tooltip is likely to have unexpected behaviour there, with being cut
|
|
458
|
+
// off, so we disable it. This is also to keep the behaviour consistent with
|
|
459
|
+
// the rendering in the mobile Native Renderer.
|
|
460
|
+
const codeBidiWarningTooltipEnabled = this.appearance !== 'mobile';
|
|
433
461
|
return { ...this.getProps(node),
|
|
434
|
-
text: node.textContent
|
|
462
|
+
text: node.textContent,
|
|
463
|
+
codeBidiWarningTooltipEnabled
|
|
435
464
|
};
|
|
436
465
|
}
|
|
437
466
|
|
|
@@ -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
|
-
|
|
5
|
+
import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { useFeatureFlags } from '../../use-feature-flags';
|
|
7
|
+
export const isCodeMark = mark => {
|
|
8
|
+
return mark && mark.type && mark.type.name === 'code';
|
|
9
|
+
};
|
|
10
|
+
export function CodeWithIntl(props) {
|
|
11
|
+
const featureFlags = useFeatureFlags();
|
|
12
|
+
const 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
|
+
const 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 const 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 const toReact = mark => {
|
|
38
40
|
return markToReact[mark.type.name];
|
|
39
41
|
};
|
|
40
|
-
export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer };
|
|
42
|
+
export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark };
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { injectIntl } from 'react-intl';
|
|
2
3
|
import styled from 'styled-components';
|
|
3
4
|
import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
|
|
4
5
|
import { overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
5
6
|
import { N20, DN50 } from '@atlaskit/theme/colors';
|
|
6
7
|
import { themed } from '@atlaskit/theme/components';
|
|
7
8
|
import { fontSize, gridSize } from '@atlaskit/theme/constants';
|
|
9
|
+
import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
|
|
10
|
+
import { useFeatureFlags } from '../../use-feature-flags';
|
|
8
11
|
import CopyButton from './codeBlockCopyButton';
|
|
9
12
|
|
|
10
13
|
function CodeBlock(props) {
|
|
11
14
|
const {
|
|
12
15
|
text,
|
|
13
16
|
language,
|
|
14
|
-
allowCopyToClipboard = false
|
|
17
|
+
allowCopyToClipboard = false,
|
|
18
|
+
codeBidiWarningTooltipEnabled
|
|
15
19
|
} = props;
|
|
20
|
+
const featureFlags = useFeatureFlags();
|
|
21
|
+
const codeBidiWarningLabel = props.intl.formatMessage(codeBidiWarningMessages.label);
|
|
16
22
|
const className = ['code-block', props.className].join(' ');
|
|
17
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
24
|
className: className
|
|
@@ -20,11 +26,15 @@ function CodeBlock(props) {
|
|
|
20
26
|
content: text
|
|
21
27
|
}) : null, /*#__PURE__*/React.createElement(AkCodeBlock, {
|
|
22
28
|
language: language,
|
|
23
|
-
text: text
|
|
29
|
+
text: text,
|
|
30
|
+
codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
|
|
31
|
+
codeBidiWarningLabel: codeBidiWarningLabel,
|
|
32
|
+
codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
|
|
24
33
|
}));
|
|
25
34
|
}
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
const IntlCodeBlock = injectIntl(CodeBlock);
|
|
37
|
+
export default styled(IntlCodeBlock)`
|
|
28
38
|
tab-size: 4;
|
|
29
39
|
[data-ds--code--code-block] {
|
|
30
40
|
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
@@ -66,8 +66,7 @@ class HeadingAnchor extends React.PureComponent {
|
|
|
66
66
|
_defineProperty(this, "renderAnchorButton", () => {
|
|
67
67
|
return /*#__PURE__*/React.createElement(CopyAnchorButton, {
|
|
68
68
|
onMouseLeave: this.resetMessage,
|
|
69
|
-
onClick: this.copyToClipboard
|
|
70
|
-
"aria-label": this.state.tooltipMessage
|
|
69
|
+
onClick: this.copyToClipboard
|
|
71
70
|
}, /*#__PURE__*/React.createElement(LinkIcon, {
|
|
72
71
|
label: "copy",
|
|
73
72
|
size: this.props.level > 3 ? 'small' : 'medium',
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import HeadingAnchor from './heading-anchor';
|
|
4
|
-
import Url from 'url-parse';
|
|
5
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics/enums';
|
|
6
5
|
import AnalyticsContext from '../../analytics/analyticsContext';
|
|
7
6
|
import { CopyTextConsumer } from './copy-text-provider';
|
|
8
7
|
|
|
9
8
|
const getCurrentUrlWithHash = (hash = '') => {
|
|
10
|
-
const url = new
|
|
11
|
-
url.
|
|
9
|
+
const url = new URL(window.location.href);
|
|
10
|
+
url.hash = encodeURIComponent(hash);
|
|
12
11
|
return url.href;
|
|
13
12
|
};
|
|
14
13
|
|
|
@@ -39,11 +38,9 @@ function Heading(props) {
|
|
|
39
38
|
const showAnchorLink = !!props.showAnchorLink;
|
|
40
39
|
const isRightAligned = hasRightAlignmentMark(marks);
|
|
41
40
|
const enableNestedHeaderLinks = allowHeadingAnchorLinks && allowHeadingAnchorLinks.allowNestedHeaderLinks;
|
|
42
|
-
return /*#__PURE__*/React.createElement(
|
|
43
|
-
className: `heading-wrapper ${HX}`
|
|
44
|
-
}, /*#__PURE__*/React.createElement(HX, _extends({
|
|
41
|
+
return /*#__PURE__*/React.createElement(HX, _extends({
|
|
45
42
|
id: headingId
|
|
46
|
-
}, dataAttributes), /*#__PURE__*/React.createElement(React.Fragment, null, showAnchorLink && isRightAligned ? WrapChildTextInSpan(props.children) : props.children
|
|
43
|
+
}, dataAttributes), /*#__PURE__*/React.createElement(React.Fragment, null, showAnchorLink && isRightAligned ? WrapChildTextInSpan(props.children) : props.children, showAnchorLink && /*#__PURE__*/React.createElement(CopyTextConsumer, null, ({
|
|
47
44
|
copyTextToClipboard
|
|
48
45
|
}) => {
|
|
49
46
|
return headingId && /*#__PURE__*/React.createElement(AnalyticsContext.Consumer, null, ({
|
|
@@ -61,7 +58,7 @@ function Heading(props) {
|
|
|
61
58
|
return copyTextToClipboard(getCurrentUrlWithHash(headingId));
|
|
62
59
|
}
|
|
63
60
|
}));
|
|
64
|
-
}));
|
|
61
|
+
})));
|
|
65
62
|
}
|
|
66
63
|
|
|
67
64
|
export default Heading;
|
|
@@ -85,6 +85,12 @@ const MediaGroup = Loadable({
|
|
|
85
85
|
'./mediaGroup').then(mod => mod.default),
|
|
86
86
|
loading: () => null
|
|
87
87
|
});
|
|
88
|
+
const MediaInline = Loadable({
|
|
89
|
+
loader: () => import(
|
|
90
|
+
/* webpackChunkName: "@atlaskit-internal_renderer-node_MediaInline" */
|
|
91
|
+
'./mediaInline').then(mod => mod.default),
|
|
92
|
+
loading: () => null
|
|
93
|
+
});
|
|
88
94
|
const Mention = Loadable({
|
|
89
95
|
loader: () => import(
|
|
90
96
|
/* webpackChunkName: "@atlaskit-internal_renderer-node_Mention" */
|
|
@@ -119,6 +125,7 @@ export const nodeToReact = {
|
|
|
119
125
|
listItem: ListItem,
|
|
120
126
|
media: Media,
|
|
121
127
|
mediaGroup: MediaGroup,
|
|
128
|
+
mediaInline: MediaInline,
|
|
122
129
|
mediaSingle: MediaSingle,
|
|
123
130
|
mention: Mention,
|
|
124
131
|
orderedList: OrderedList,
|
|
@@ -278,4 +285,4 @@ const isEmojiBlock = pnode => {
|
|
|
278
285
|
return emojiCount > 0;
|
|
279
286
|
};
|
|
280
287
|
|
|
281
|
-
export { Blockquote, BodiedExtension, BulletList, BlockCard, Caption, CodeBlock, Date, DecisionItem, DecisionList, Doc, DocWithSelectAllTrap, Emoji, Extension, Expand, HardBreak, Heading, ListItem, InlineCard, InlineExtension, LayoutSection, LayoutColumn, Media, MediaGroup, MediaSingle, Mention, OrderedList, Panel, Paragraph, Placeholder, Rule, Status, TaskItem, TaskList, Table, TableCell, TableRow, UnknownBlock, EmbedCard };
|
|
288
|
+
export { Blockquote, BodiedExtension, BulletList, BlockCard, Caption, CodeBlock, Date, DecisionItem, DecisionList, Doc, DocWithSelectAllTrap, Emoji, Extension, Expand, HardBreak, Heading, ListItem, InlineCard, InlineExtension, LayoutSection, LayoutColumn, Media, MediaGroup, MediaInline, MediaSingle, Mention, OrderedList, Panel, Paragraph, Placeholder, Rule, Status, TaskItem, TaskList, Table, TableCell, TableRow, UnknownBlock, EmbedCard };
|
|
@@ -21,7 +21,8 @@ export default class Media extends PureComponent {
|
|
|
21
21
|
alt,
|
|
22
22
|
featureFlags,
|
|
23
23
|
shouldOpenMediaViewer: allowMediaViewer,
|
|
24
|
-
enableDownloadButton
|
|
24
|
+
enableDownloadButton,
|
|
25
|
+
ssr
|
|
25
26
|
} = this.props;
|
|
26
27
|
const linkMark = this.props.marks.find(this.props.isLinkMark);
|
|
27
28
|
const linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
|
|
@@ -35,7 +36,8 @@ export default class Media extends PureComponent {
|
|
|
35
36
|
eventHandlers: eventHandlers,
|
|
36
37
|
alt: allowAltTextOnImages ? alt : undefined,
|
|
37
38
|
featureFlags: featureFlags,
|
|
38
|
-
shouldEnableDownloadButton: enableDownloadButton
|
|
39
|
+
shouldEnableDownloadButton: enableDownloadButton,
|
|
40
|
+
ssr: ssr
|
|
39
41
|
}));
|
|
40
42
|
return linkHref ? /*#__PURE__*/React.createElement(MediaLink, {
|
|
41
43
|
href: linkHref,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
3
|
+
import { WithProviders } from '@atlaskit/editor-common';
|
|
4
|
+
export const RenderMediaInline = props => {
|
|
5
|
+
const {
|
|
6
|
+
mediaProvider
|
|
7
|
+
} = props;
|
|
8
|
+
const [viewMediaClientConfigState, setViewMediaClientConfigState] = useState({});
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
updateViewMediaClientConfigState(mediaProvider);
|
|
11
|
+
}, [mediaProvider]);
|
|
12
|
+
|
|
13
|
+
const updateViewMediaClientConfigState = async mediaProvider => {
|
|
14
|
+
if (mediaProvider) {
|
|
15
|
+
const mediaClientConfig = await mediaProvider;
|
|
16
|
+
setViewMediaClientConfigState(mediaClientConfig.viewMediaClientConfig);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return /*#__PURE__*/React.createElement(MediaInlineCard, {
|
|
21
|
+
identifier: props.identifier,
|
|
22
|
+
shouldOpenMediaViewer: true,
|
|
23
|
+
mediaClientConfig: viewMediaClientConfigState
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const MediaInline = props => {
|
|
28
|
+
const {
|
|
29
|
+
collection,
|
|
30
|
+
id,
|
|
31
|
+
providers
|
|
32
|
+
} = props;
|
|
33
|
+
const identifier = {
|
|
34
|
+
id,
|
|
35
|
+
mediaItemType: 'file',
|
|
36
|
+
collectionName: collection
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(WithProviders, {
|
|
39
|
+
providers: ['mediaProvider'],
|
|
40
|
+
providerFactory: providers,
|
|
41
|
+
renderNode: providers => {
|
|
42
|
+
const {
|
|
43
|
+
mediaProvider
|
|
44
|
+
} = providers;
|
|
45
|
+
return /*#__PURE__*/React.createElement(RenderMediaInline, {
|
|
46
|
+
identifier: identifier,
|
|
47
|
+
mediaProvider: mediaProvider
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default MediaInline;
|