@atlaskit/renderer 96.0.2 → 98.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/cjs/react/hooks/use-bidi-warnings.js +45 -0
- package/dist/cjs/react/hooks/use-in-viewport.js +63 -0
- package/dist/cjs/react/index.js +5 -2
- package/dist/cjs/react/nodes/codeBlock/codeBlock.js +49 -0
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +55 -0
- package/dist/cjs/react/nodes/codeBlock/components/lightWeightCodeBlock.js +82 -0
- package/dist/cjs/react/nodes/codeBlock/windowedCodeBlock.js +103 -0
- package/dist/cjs/react/nodes/codeBlockCopyButton.js +24 -27
- package/dist/cjs/react/nodes/heading.js +15 -18
- package/dist/cjs/react/nodes/index.js +34 -5
- package/dist/cjs/react/nodes/layoutColumn.js +7 -2
- package/dist/cjs/react/utils/clipboard.js +24 -0
- package/dist/cjs/ui/Renderer/index.js +12 -7
- package/dist/cjs/ui/Renderer/style.js +4 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/react/hooks/use-bidi-warnings.js +28 -0
- package/dist/es2019/react/hooks/use-in-viewport.js +25 -0
- package/dist/es2019/react/index.js +5 -2
- package/dist/es2019/react/nodes/codeBlock/codeBlock.js +33 -0
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +44 -0
- package/dist/es2019/react/nodes/codeBlock/components/lightWeightCodeBlock.js +58 -0
- package/dist/es2019/react/nodes/codeBlock/windowedCodeBlock.js +58 -0
- package/dist/es2019/react/nodes/codeBlockCopyButton.js +24 -28
- package/dist/es2019/react/nodes/heading.js +16 -20
- package/dist/es2019/react/nodes/index.js +22 -5
- package/dist/es2019/react/nodes/layoutColumn.js +7 -3
- package/dist/es2019/react/utils/clipboard.js +9 -0
- package/dist/es2019/ui/Renderer/index.js +9 -4
- package/dist/es2019/ui/Renderer/style.js +3 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/react/hooks/use-bidi-warnings.js +29 -0
- package/dist/esm/react/hooks/use-in-viewport.js +51 -0
- package/dist/esm/react/index.js +5 -2
- package/dist/esm/react/nodes/codeBlock/codeBlock.js +32 -0
- package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +40 -0
- package/dist/esm/react/nodes/codeBlock/components/lightWeightCodeBlock.js +57 -0
- package/dist/esm/react/nodes/codeBlock/windowedCodeBlock.js +80 -0
- package/dist/esm/react/nodes/codeBlockCopyButton.js +24 -27
- package/dist/esm/react/nodes/heading.js +15 -18
- package/dist/esm/react/nodes/index.js +33 -5
- package/dist/esm/react/nodes/layoutColumn.js +8 -3
- package/dist/esm/react/utils/clipboard.js +15 -0
- package/dist/esm/ui/Renderer/index.js +12 -6
- package/dist/esm/ui/Renderer/style.js +3 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/react/hooks/use-bidi-warnings.d.ts +10 -0
- package/dist/types/react/hooks/use-in-viewport.d.ts +5 -0
- package/dist/types/react/index.d.ts +5 -1
- package/dist/types/react/nodes/{codeBlock.d.ts → codeBlock/codeBlock.d.ts} +1 -1
- package/dist/types/react/nodes/codeBlock/components/codeBlockContainer.d.ts +12 -0
- package/dist/types/react/nodes/codeBlock/components/lightWeightCodeBlock.d.ts +9 -0
- package/dist/types/react/nodes/codeBlock/windowedCodeBlock.d.ts +4 -0
- package/dist/types/react/nodes/index.d.ts +8 -5
- package/dist/types/react/utils/clipboard.d.ts +1 -0
- package/dist/types/ui/Renderer/types.d.ts +4 -0
- package/dist/types/ui/renderer-props.d.ts +2 -1
- package/package.json +18 -17
- package/report.api.md +590 -119
- package/dist/cjs/react/nodes/codeBlock.js +0 -74
- package/dist/cjs/react/nodes/copy-text-provider.js +0 -174
- package/dist/es2019/react/nodes/codeBlock.js +0 -59
- package/dist/es2019/react/nodes/copy-text-provider.js +0 -93
- package/dist/esm/react/nodes/codeBlock.js +0 -55
- package/dist/esm/react/nodes/copy-text-provider.js +0 -140
- package/dist/types/react/nodes/copy-text-provider.d.ts +0 -20
|
@@ -35,7 +35,6 @@ import { TruncatedWrapper } from './truncated-wrapper';
|
|
|
35
35
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics/enums';
|
|
36
36
|
import { PLATFORM, MODE } from '../../analytics/events';
|
|
37
37
|
import AnalyticsContext from '../../analytics/analyticsContext';
|
|
38
|
-
import { CopyTextProvider } from '../../react/nodes/copy-text-provider';
|
|
39
38
|
import { Provider as SmartCardStorageProvider } from '../SmartCardStorage';
|
|
40
39
|
import { name, version } from '../../version.json';
|
|
41
40
|
import { BreakoutSSRInlineScript } from './breakout-ssr';
|
|
@@ -205,6 +204,10 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
205
204
|
var stickyHeaders = props.stickyHeaders ? props.stickyHeaders === true ? {} : props.stickyHeaders : undefined;
|
|
206
205
|
var annotationProvider = props.annotationProvider;
|
|
207
206
|
var allowAnnotationsDraftMode = Boolean(annotationProvider && annotationProvider.inlineComment && annotationProvider.inlineComment.allowDraftMode);
|
|
207
|
+
|
|
208
|
+
var _this$featureFlags = this.featureFlags(props.featureFlags),
|
|
209
|
+
featureFlags = _this$featureFlags.featureFlags;
|
|
210
|
+
|
|
208
211
|
return {
|
|
209
212
|
providers: this.providerFactory,
|
|
210
213
|
eventHandlers: props.eventHandlers,
|
|
@@ -231,7 +234,10 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
231
234
|
allowCustomPanels: props.allowCustomPanels,
|
|
232
235
|
allowAnnotations: props.allowAnnotations,
|
|
233
236
|
allowSelectAllTrap: props.allowSelectAllTrap,
|
|
234
|
-
allowPlaceholderText: props.allowPlaceholderText
|
|
237
|
+
allowPlaceholderText: props.allowPlaceholderText,
|
|
238
|
+
nodeComponents: props.nodeComponents,
|
|
239
|
+
// does not currently support SSR, should not be enabled in environments where Renderer is SSR-ed
|
|
240
|
+
allowWindowedCodeBlock: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.allowWindowedCodeBlock
|
|
235
241
|
};
|
|
236
242
|
}
|
|
237
243
|
}, {
|
|
@@ -301,7 +307,7 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
301
307
|
};
|
|
302
308
|
|
|
303
309
|
try {
|
|
304
|
-
var _this$
|
|
310
|
+
var _this$featureFlags2, _this$featureFlags2$f, _this$featureFlags2$f2;
|
|
305
311
|
|
|
306
312
|
var schema = this.getSchema(this.props.schema, this.props.adfStage);
|
|
307
313
|
|
|
@@ -316,7 +322,7 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
316
322
|
|
|
317
323
|
var rendererOutput = jsx(RendererContextProvider, {
|
|
318
324
|
value: this.featureFlags(this.props.featureFlags)
|
|
319
|
-
}, jsx(
|
|
325
|
+
}, jsx(ActiveHeaderIdProvider, {
|
|
320
326
|
value: getActiveHeadingId(allowHeadingAnchorLinks)
|
|
321
327
|
}, jsx(AnalyticsContext.Provider, {
|
|
322
328
|
value: {
|
|
@@ -338,12 +344,12 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
338
344
|
doc: pmDoc,
|
|
339
345
|
schema: schema,
|
|
340
346
|
onAnalyticsEvent: this.fireAnalyticsEvent
|
|
341
|
-
}, result))))))
|
|
347
|
+
}, result))))));
|
|
342
348
|
var rendererResult = truncated ? jsx(TruncatedWrapper, {
|
|
343
349
|
height: maxHeight,
|
|
344
350
|
fadeHeight: fadeOutHeight
|
|
345
351
|
}, rendererOutput) : rendererOutput;
|
|
346
|
-
var rendererRenderTracking = (_this$
|
|
352
|
+
var rendererRenderTracking = (_this$featureFlags2 = this.featureFlags(this.props.featureFlags)) === null || _this$featureFlags2 === void 0 ? void 0 : (_this$featureFlags2$f = _this$featureFlags2.featureFlags) === null || _this$featureFlags2$f === void 0 ? void 0 : (_this$featureFlags2$f2 = _this$featureFlags2$f.rendererRenderTracking) === null || _this$featureFlags2$f2 === void 0 ? void 0 : _this$featureFlags2$f2[ACTION_SUBJECT.RENDERER];
|
|
347
353
|
var reRenderTracking = (rendererRenderTracking === null || rendererRenderTracking === void 0 ? void 0 : rendererRenderTracking.enabled) && jsx(RenderTracking, {
|
|
348
354
|
componentProps: this.props,
|
|
349
355
|
action: ACTION.RE_RENDERED,
|
|
@@ -14,6 +14,7 @@ import { editorFontSize, blockNodesVerticalMargin, akEditorTableToolbar, akEdito
|
|
|
14
14
|
import { RendererCssClassName } from '../../consts';
|
|
15
15
|
import { HeadingAnchorWrapperClassName } from '../../react/nodes/heading-anchor';
|
|
16
16
|
import { shadowObserverClassNames } from '@atlaskit/editor-common/ui';
|
|
17
|
+
import { getLightWeightCodeBlockStylesForRootRendererStyleSheet } from '../../react/nodes/codeBlock/components/lightWeightCodeBlock';
|
|
17
18
|
export var FullPagePadding = 32;
|
|
18
19
|
|
|
19
20
|
var getLineHeight = function getLineHeight(fontCode) {
|
|
@@ -99,7 +100,7 @@ export var rendererStyles = function rendererStyles(wrapperProps) {
|
|
|
99
100
|
var themeProps = {
|
|
100
101
|
theme: theme
|
|
101
102
|
};
|
|
102
|
-
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: 1.5rem;\n color: ", ";\n\n .", "::after {\n // we add a clearfix after ak-renderer-document in order to\n // contain internal floats (such as media images that are \"wrap-left\")\n // to just the renderer (and not spill outside of it)\n content: '';\n visibility: hidden;\n display: block;\n height: 0;\n clear: both;\n }\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 &:active {\n color: ", ";\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\n + .", ":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\n + .rich-media-wrapped\n + *: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 /* plugin styles */\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 .", " {\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 display: flex;\n }\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,\n &.", "::before {\n top: ", "px;\n height: calc(100% - ", "px);\n z-index: ", ";\n }\n\n &\n .", ",\n &\n .", " {\n height: calc(100% - ", "px);\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-of-type {\n height: 100%;\n\n td,\n th {\n position: relative;\n }\n }\n\n table[data-number-column='true'] {\n .", " {\n background-color: ", ";\n border-right: 1px solid\n ", ";\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 ", ";\n border-bottom: 1px solid\n ", ";\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,\n .sticky td {\n box-shadow: 0px 1px\n ", ",\n 0px -0.5px ", ",\n inset -1px 0px ", ",\n 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,\n .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 "])), editorFontSize(themeProps), themed({
|
|
103
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: 1.5rem;\n color: ", ";\n\n .", "::after {\n // we add a clearfix after ak-renderer-document in order to\n // contain internal floats (such as media images that are \"wrap-left\")\n // to just the renderer (and not spill outside of it)\n content: '';\n visibility: hidden;\n display: block;\n height: 0;\n clear: both;\n }\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 &:active {\n color: ", ";\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\n + .", ":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\n + .rich-media-wrapped\n + *: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 /* plugin styles */\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 .", " {\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 display: flex;\n }\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,\n &.", "::before {\n top: ", "px;\n height: calc(100% - ", "px);\n z-index: ", ";\n }\n\n &\n .", ",\n &\n .", " {\n height: calc(100% - ", "px);\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-of-type {\n height: 100%;\n\n td,\n th {\n position: relative;\n }\n }\n\n table[data-number-column='true'] {\n .", " {\n background-color: ", ";\n border-right: 1px solid\n ", ";\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 ", ";\n border-bottom: 1px solid\n ", ";\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,\n .sticky td {\n box-shadow: 0px 1px\n ", ",\n 0px -0.5px ", ",\n inset -1px 0px ", ",\n 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,\n .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\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 "])), editorFontSize(themeProps), themed({
|
|
103
104
|
light: token('color.text', colors.N800),
|
|
104
105
|
dark: token('color.text', '#B8C7E0')
|
|
105
106
|
})(themeProps), RendererCssClassName.DOCUMENT, fullPageStyles(wrapperProps, themeProps), fullWidthStyles(wrapperProps), headingAnchorStyle('h1'), headingAnchorStyle('h2'), headingAnchorStyle('h3'), headingAnchorStyle('h4'), headingAnchorStyle('h5'), headingAnchorStyle('h6'), token('color.link', colors.B400), token('color.link', colors.B300), token('color.link.pressed', colors.B500), colors.placeholderText(themeProps), whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles(themeProps), ruleSharedStyles(themeProps), paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, codeMarkSharedStyles(themeProps), shadowSharedStyle, dateSharedStyle, textColorStyles, tasksAndDecisionsStyles, smartCardSharedStyles, fontFamily(), relativeFontSizeToBase16(fontSize()), themed({
|
|
@@ -135,6 +136,6 @@ export var rendererStyles = function rendererStyles(wrapperProps) {
|
|
|
135
136
|
})(themeProps), themed({
|
|
136
137
|
light: token('color.border', akEditorTableToolbar),
|
|
137
138
|
dark: token('color.border', akEditorTableToolbarDark)
|
|
138
|
-
})(themeProps), borderRadius(), blockNodesVerticalMargin, columnLayoutSharedStyle, gridSize() * 2.5, gridSize() * 4, gridMediumMaxWidth);
|
|
139
|
+
})(themeProps), borderRadius(), blockNodesVerticalMargin, getLightWeightCodeBlockStylesForRootRendererStyleSheet(), columnLayoutSharedStyle, gridSize() * 2.5, gridSize() * 4, gridMediumMaxWidth);
|
|
139
140
|
};
|
|
140
141
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface Config {
|
|
3
|
+
enableWarningTooltip: boolean;
|
|
4
|
+
}
|
|
5
|
+
interface Result {
|
|
6
|
+
renderBidiWarnings: (text: string) => ReactNode;
|
|
7
|
+
warningLabel: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const useBidiWarnings: ({ enableWarningTooltip, }: Config) => Result;
|
|
10
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Fragment, Mark, Node } from 'prosemirror-model';
|
|
3
3
|
import { Serializer } from '../';
|
|
4
|
-
import { RendererAppearance, StickyHeaderConfig, HeadingAnchorLinksProps } from '../ui/Renderer/types';
|
|
4
|
+
import { RendererAppearance, StickyHeaderConfig, HeadingAnchorLinksProps, NodeComponentsProps } from '../ui/Renderer/types';
|
|
5
5
|
import { AnalyticsEventPayload } from '../analytics/events';
|
|
6
6
|
import { TextWrapper } from './nodes';
|
|
7
7
|
import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
@@ -34,6 +34,8 @@ export interface ReactSerializerInit {
|
|
|
34
34
|
allowCustomPanels?: boolean;
|
|
35
35
|
allowAnnotations?: boolean;
|
|
36
36
|
allowSelectAllTrap?: boolean;
|
|
37
|
+
nodeComponents?: NodeComponentsProps;
|
|
38
|
+
allowWindowedCodeBlock?: boolean;
|
|
37
39
|
}
|
|
38
40
|
interface ParentInfo {
|
|
39
41
|
parentIsIncompleteTask: boolean;
|
|
@@ -75,6 +77,8 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
|
|
|
75
77
|
private smartLinks?;
|
|
76
78
|
private allowAnnotations;
|
|
77
79
|
private allowSelectAllTrap?;
|
|
80
|
+
private nodeComponents?;
|
|
81
|
+
private allowWindowedCodeBlock?;
|
|
78
82
|
constructor(init: ReactSerializerInit);
|
|
79
83
|
private resetState;
|
|
80
84
|
private getNodeProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
-
import { SupportedLanguages } from '@atlaskit/code';
|
|
3
|
+
import type { SupportedLanguages } from '@atlaskit/code';
|
|
4
4
|
export interface Props {
|
|
5
5
|
text: string;
|
|
6
6
|
language: SupportedLanguages;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import { Props as CodeBlockProps } from '../codeBlock';
|
|
5
|
+
interface ContainerProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
text: CodeBlockProps['text'];
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
allowCopyToClipboard?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const CodeBlockContainer: ({ text, className, allowCopyToClipboard, children, }: ContainerProps) => jsx.JSX.Element;
|
|
12
|
+
export default CodeBlockContainer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { Props as CodeBlockProps } from '../codeBlock';
|
|
4
|
+
export declare const LightWeightCodeBlockCssClassName: {
|
|
5
|
+
CONTAINER: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const getLightWeightCodeBlockStylesForRootRendererStyleSheet: () => import("@emotion/react").SerializedStyles;
|
|
8
|
+
declare const LightWeightCodeBlock: React.ForwardRefExoticComponent<Pick<CodeBlockProps, "text" | "className" | "codeBidiWarningTooltipEnabled"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export default LightWeightCodeBlock;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import type { Props as CodeBlockProps } from './codeBlock';
|
|
3
|
+
declare const WindowedCodeBlock: ({ text, language, allowCopyToClipboard, codeBidiWarningTooltipEnabled, className: rootClassName, }: CodeBlockProps) => jsx.JSX.Element;
|
|
4
|
+
export default WindowedCodeBlock;
|
|
@@ -21,7 +21,9 @@ import Table from './table';
|
|
|
21
21
|
import { TableCell } from './tableCell';
|
|
22
22
|
import TableRow from './tableRow';
|
|
23
23
|
import UnknownBlock from './unknownBlock';
|
|
24
|
-
|
|
24
|
+
import { NodeComponentsProps } from '../../ui/Renderer/types';
|
|
25
|
+
declare const WindowedCodeBlock: React.ComponentType<import("./codeBlock/codeBlock").Props> & Loadable.LoadableComponent;
|
|
26
|
+
declare const CodeBlock: React.ComponentType<import("react-intl-next").WithIntlProps<import("./codeBlock/codeBlock").Props & import("react-intl-next").WrappedComponentProps<"intl">>> & Loadable.LoadableComponent;
|
|
25
27
|
declare const TaskList: React.ComponentType<import("./taskList").Props> & Loadable.LoadableComponent;
|
|
26
28
|
declare const TaskItem: React.ComponentType<import("../types").NodeProps<import("./taskItem").Props>> & Loadable.LoadableComponent;
|
|
27
29
|
declare const DecisionList: React.ComponentType<import("./decisionList").Props> & Loadable.LoadableComponent;
|
|
@@ -39,7 +41,7 @@ declare const EmbedCard: React.ComponentType<{
|
|
|
39
41
|
originalWidth?: number | undefined;
|
|
40
42
|
width?: number | undefined;
|
|
41
43
|
layout: import("@atlaskit/adf-schema").RichMediaLayout;
|
|
42
|
-
rendererAppearance?: import("
|
|
44
|
+
rendererAppearance?: import("../../ui/Renderer/types").RendererAppearance;
|
|
43
45
|
isInsideOfBlockNode?: boolean | undefined;
|
|
44
46
|
}> & Loadable.LoadableComponent;
|
|
45
47
|
declare const InlineCard: React.ComponentType<import("@atlaskit/editor-common/utils").Diff<import("./inlineCard").InlineCardProps & import("../../ui/SmartCardStorage").WithSmartCardStorageProps, import("../../ui/SmartCardStorage").WithSmartCardStorageProps>> & Loadable.LoadableComponent;
|
|
@@ -48,7 +50,7 @@ declare const BlockCard: React.ComponentType<{
|
|
|
48
50
|
data?: object | undefined;
|
|
49
51
|
eventHandlers?: import("@atlaskit/editor-common/ui").EventHandlers | undefined;
|
|
50
52
|
portal?: HTMLElement | undefined;
|
|
51
|
-
rendererAppearance?: import("
|
|
53
|
+
rendererAppearance?: import("../../ui/Renderer/types").RendererAppearance;
|
|
52
54
|
}> & Loadable.LoadableComponent;
|
|
53
55
|
declare const Media: React.ComponentType<import("./media").MediaProps> & Loadable.LoadableComponent;
|
|
54
56
|
declare const MediaGroup: React.ComponentType<import("./mediaGroup").MediaGroupProps> & Loadable.LoadableComponent;
|
|
@@ -61,8 +63,9 @@ export declare const nodeToReact: {
|
|
|
61
63
|
};
|
|
62
64
|
export interface ToReactFlags {
|
|
63
65
|
allowSelectAllTrap?: boolean;
|
|
66
|
+
allowWindowedCodeBlock?: boolean;
|
|
64
67
|
}
|
|
65
|
-
export declare const toReact: (node: Node, flags?: ToReactFlags | undefined) => React.ComponentType<any>;
|
|
68
|
+
export declare const toReact: (node: Node, flags?: ToReactFlags | undefined, nodeComponents?: NodeComponentsProps | undefined) => React.ComponentType<any>;
|
|
66
69
|
export interface TextWrapper {
|
|
67
70
|
type: {
|
|
68
71
|
name: 'textWrapper';
|
|
@@ -87,5 +90,5 @@ export declare function isTextNode(node: Node | Mark): node is Node;
|
|
|
87
90
|
* whose content satisfies the condition for an emoji block
|
|
88
91
|
*/
|
|
89
92
|
export declare const isEmojiDoc: (doc: Fragment) => boolean;
|
|
90
|
-
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, };
|
|
93
|
+
export { Blockquote, BodiedExtension, BulletList, BlockCard, Caption, CodeBlock, WindowedCodeBlock, 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, };
|
|
91
94
|
export type { BodiedExtensionProps, ExtensionProps, InlineExtensionProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const copyTextToClipboard: (text: string) => Promise<void>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare type RendererAppearance = 'comment' | 'full-page' | 'full-width' | 'mobile' | undefined;
|
|
2
3
|
export declare type StickyHeaderConfig = {
|
|
3
4
|
offsetTop?: number;
|
|
@@ -9,4 +10,7 @@ export declare type HeadingAnchorLinksConfig = {
|
|
|
9
10
|
activeHeadingId?: string;
|
|
10
11
|
allowNestedHeaderLinks?: boolean;
|
|
11
12
|
};
|
|
13
|
+
export declare type NodeComponentsProps = {
|
|
14
|
+
[key: string]: React.ComponentType<any>;
|
|
15
|
+
};
|
|
12
16
|
export declare type HeadingAnchorLinksProps = boolean | HeadingAnchorLinksConfig;
|
|
@@ -9,7 +9,7 @@ import type { UnsupportedContentLevelsTracking } from '@atlaskit/editor-common/u
|
|
|
9
9
|
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
10
10
|
import { RendererContext } from '../';
|
|
11
11
|
import { RenderOutputStat } from '../render-document';
|
|
12
|
-
import { RendererAppearance, StickyHeaderProps, HeadingAnchorLinksProps } from './Renderer/types';
|
|
12
|
+
import { RendererAppearance, StickyHeaderProps, HeadingAnchorLinksProps, NodeComponentsProps } from './Renderer/types';
|
|
13
13
|
import { MediaOptions } from '../types/mediaOptions';
|
|
14
14
|
import { SmartLinksOptions } from '../types/smartLinksOptions';
|
|
15
15
|
import { ACTION_SUBJECT } from '../analytics/enums';
|
|
@@ -67,6 +67,7 @@ export interface RendererProps {
|
|
|
67
67
|
allowUgcScrubber?: boolean;
|
|
68
68
|
allowSelectAllTrap?: boolean;
|
|
69
69
|
unsupportedContentLevelsTracking?: UnsupportedContentLevelsTracking;
|
|
70
|
+
nodeComponents?: NodeComponentsProps;
|
|
70
71
|
/**
|
|
71
72
|
* @default undefined
|
|
72
73
|
* @description
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "98.1.0",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,23 +24,23 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@atlaskit/adf-schema": "^23.
|
|
28
|
-
"@atlaskit/adf-utils": "^17.
|
|
27
|
+
"@atlaskit/adf-schema": "^23.2.0",
|
|
28
|
+
"@atlaskit/adf-utils": "^17.1.0",
|
|
29
29
|
"@atlaskit/analytics-listeners": "^8.3.0",
|
|
30
30
|
"@atlaskit/analytics-namespaced-context": "^6.5.0",
|
|
31
31
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
32
32
|
"@atlaskit/button": "^16.3.0",
|
|
33
33
|
"@atlaskit/code": "^14.3.0",
|
|
34
|
-
"@atlaskit/editor-common": "^
|
|
34
|
+
"@atlaskit/editor-common": "^69.0.0",
|
|
35
35
|
"@atlaskit/editor-json-transformer": "^8.7.0",
|
|
36
36
|
"@atlaskit/editor-shared-styles": "^2.1.0",
|
|
37
37
|
"@atlaskit/icon": "^21.10.0",
|
|
38
|
-
"@atlaskit/media-card": "^
|
|
39
|
-
"@atlaskit/media-client": "^17.
|
|
38
|
+
"@atlaskit/media-card": "^74.0.0",
|
|
39
|
+
"@atlaskit/media-client": "^17.1.0",
|
|
40
40
|
"@atlaskit/media-common": "^2.15.0",
|
|
41
|
-
"@atlaskit/media-filmstrip": "^
|
|
41
|
+
"@atlaskit/media-filmstrip": "^45.0.0",
|
|
42
42
|
"@atlaskit/media-ui": "^22.1.0",
|
|
43
|
-
"@atlaskit/media-viewer": "^
|
|
43
|
+
"@atlaskit/media-viewer": "^47.0.0",
|
|
44
44
|
"@atlaskit/status": "^1.1.0",
|
|
45
45
|
"@atlaskit/task-decision": "^17.4.0",
|
|
46
46
|
"@atlaskit/theme": "^12.1.0",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"uuid": "^3.1.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@atlaskit/media-core": "^33.0.
|
|
62
|
-
"@atlaskit/smart-card": "^
|
|
61
|
+
"@atlaskit/media-core": "^33.0.1",
|
|
62
|
+
"@atlaskit/smart-card": "^20.0.3",
|
|
63
63
|
"react": "^16.8.0",
|
|
64
64
|
"react-dom": "^16.8.0",
|
|
65
65
|
"styled-components": "^3.2.6"
|
|
@@ -69,20 +69,20 @@
|
|
|
69
69
|
"@atlaskit/avatar": "^21.0.0",
|
|
70
70
|
"@atlaskit/css-reset": "^6.3.0",
|
|
71
71
|
"@atlaskit/docs": "*",
|
|
72
|
-
"@atlaskit/editor-core": "^
|
|
73
|
-
"@atlaskit/editor-test-helpers": "^17.
|
|
74
|
-
"@atlaskit/logo": "^13.
|
|
72
|
+
"@atlaskit/editor-core": "^169.1.0",
|
|
73
|
+
"@atlaskit/editor-test-helpers": "^17.1.0",
|
|
74
|
+
"@atlaskit/logo": "^13.8.0",
|
|
75
75
|
"@atlaskit/media-core": "^33.0.0",
|
|
76
76
|
"@atlaskit/media-integration-test-helpers": "^2.6.0",
|
|
77
77
|
"@atlaskit/media-test-helpers": "^30.0.0",
|
|
78
78
|
"@atlaskit/mention": "^21.0.0",
|
|
79
79
|
"@atlaskit/navigation-next": "^9.0.0",
|
|
80
|
-
"@atlaskit/profilecard": "^16.
|
|
80
|
+
"@atlaskit/profilecard": "^16.10.0",
|
|
81
81
|
"@atlaskit/radio": "^5.3.0",
|
|
82
82
|
"@atlaskit/range": "^6.0.0",
|
|
83
|
-
"@atlaskit/smart-card": "^
|
|
83
|
+
"@atlaskit/smart-card": "^20.0.0",
|
|
84
84
|
"@atlaskit/ssr": "*",
|
|
85
|
-
"@atlaskit/util-data-test": "^17.
|
|
85
|
+
"@atlaskit/util-data-test": "^17.4.0",
|
|
86
86
|
"@atlaskit/visual-regression": "*",
|
|
87
87
|
"@atlaskit/webdriver-runner": "*",
|
|
88
88
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
@@ -97,7 +97,8 @@
|
|
|
97
97
|
"puppeteer": "13.7.0",
|
|
98
98
|
"react": "^16.8.0",
|
|
99
99
|
"react-dom": "^16.8.0",
|
|
100
|
-
"react-live-clock": "^
|
|
100
|
+
"react-live-clock": "^5.0.0",
|
|
101
|
+
"react-moment": "^1.1.2",
|
|
101
102
|
"react-test-renderer": "^16.8.0",
|
|
102
103
|
"rxjs": "^5.5.0",
|
|
103
104
|
"sinon": "^2.2.0",
|