@atlaskit/renderer 125.4.1 → 126.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 +11 -0
- package/afm-products/tsconfig.json +1 -1
- package/dist/cjs/react/index.js +15 -5
- package/dist/cjs/react/nodes/codeBlock/components/lightWeightCodeBlock.js +1 -1
- package/dist/cjs/react/nodes/tableNew.js +6 -2
- package/dist/cjs/react/utils/merge-inlined-extension.js +92 -0
- package/dist/cjs/ui/MediaCard.js +2 -3
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +11 -11
- package/dist/cjs/ui/Renderer/index.js +3 -2
- package/dist/es2019/react/index.js +15 -5
- package/dist/es2019/react/nodes/codeBlock/components/lightWeightCodeBlock.js +1 -1
- package/dist/es2019/react/nodes/tableNew.js +6 -2
- package/dist/es2019/react/utils/merge-inlined-extension.js +75 -0
- package/dist/es2019/ui/MediaCard.js +2 -3
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +11 -11
- package/dist/es2019/ui/Renderer/index.js +3 -2
- package/dist/esm/react/index.js +15 -5
- package/dist/esm/react/nodes/codeBlock/components/lightWeightCodeBlock.js +1 -1
- package/dist/esm/react/nodes/tableNew.js +6 -2
- package/dist/esm/react/utils/merge-inlined-extension.js +86 -0
- package/dist/esm/ui/MediaCard.js +2 -3
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +11 -11
- package/dist/esm/ui/Renderer/index.js +3 -2
- package/dist/types/react/index.d.ts +4 -3
- package/dist/types/react/utils/merge-inlined-extension.d.ts +25 -0
- package/dist/types/ui/renderer-props.d.ts +7 -1
- package/dist/types-ts4.5/react/index.d.ts +4 -3
- package/dist/types-ts4.5/react/utils/merge-inlined-extension.d.ts +25 -0
- package/dist/types-ts4.5/ui/renderer-props.d.ts +7 -1
- package/docs/0-intro.tsx +30 -28
- package/package.json +3 -3
- package/build/tsconfig.json +0 -23
|
@@ -56,7 +56,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
56
56
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
57
57
|
const RENDER_EVENT_SAMPLE_RATE = 0.2;
|
|
58
58
|
const packageName = "@atlaskit/renderer";
|
|
59
|
-
const packageVersion = "125.4.
|
|
59
|
+
const packageVersion = "125.4.1";
|
|
60
60
|
const setAsQueryContainerStyles = css({
|
|
61
61
|
containerName: 'ak-renderer-wrapper',
|
|
62
62
|
containerType: 'inline-size'
|
|
@@ -262,7 +262,8 @@ export const RendererFunctionalComponent = props => {
|
|
|
262
262
|
textHighlighter: props.textHighlighter || props.UNSTABLE_textHighlighter,
|
|
263
263
|
allowTableAlignment: props.UNSTABLE_allowTableAlignment,
|
|
264
264
|
allowTableResizing: props.UNSTABLE_allowTableResizing,
|
|
265
|
-
disableTableOverflowShadow: props.disableTableOverflowShadow
|
|
265
|
+
disableTableOverflowShadow: props.disableTableOverflowShadow,
|
|
266
|
+
shouldDisplayExtensionAsInline: props.shouldDisplayExtensionAsInline
|
|
266
267
|
};
|
|
267
268
|
}, [createRendererContext, providerFactory, fireAnalyticsEvent]);
|
|
268
269
|
const serializer = useMemoFromPropsDerivative(serializerProps => {
|
package/dist/esm/react/index.js
CHANGED
|
@@ -25,6 +25,7 @@ import { insideBlockNode, insideBreakoutExpand, insideBreakoutLayout, insideMult
|
|
|
25
25
|
import { renderTextSegments } from './utils/render-text-segments';
|
|
26
26
|
import { segmentText } from './utils/segment-text';
|
|
27
27
|
import { getStandaloneBackgroundColorMarks } from './utils/getStandaloneBackgroundColorMarks';
|
|
28
|
+
import { mergeInlinedExtension } from './utils/merge-inlined-extension';
|
|
28
29
|
function mergeMarks(marksAndNodes) {
|
|
29
30
|
return marksAndNodes.reduce(function (acc, markOrNode) {
|
|
30
31
|
var prev = acc.length && acc[acc.length - 1] || null;
|
|
@@ -214,6 +215,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
214
215
|
this.isPresentational = init.isPresentational;
|
|
215
216
|
this.disableTableOverflowShadow = init.disableTableOverflowShadow;
|
|
216
217
|
this.onSetLinkTarget = init.onSetLinkTarget;
|
|
218
|
+
this.shouldDisplayExtensionAsInline = init.shouldDisplayExtensionAsInline;
|
|
217
219
|
}
|
|
218
220
|
return _createClass(ReactSerializer, [{
|
|
219
221
|
key: "resetState",
|
|
@@ -289,7 +291,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
289
291
|
if (key === 'root-0') {
|
|
290
292
|
this.resetState();
|
|
291
293
|
}
|
|
292
|
-
return this.renderNode(target, props, key,
|
|
294
|
+
return this.renderNode(target, props, key, this.getChildNodes(fragment).map(function (node, index) {
|
|
293
295
|
if (isTextWrapper(node)) {
|
|
294
296
|
return _this2.serializeTextWrapper(node.content, {
|
|
295
297
|
index: index,
|
|
@@ -524,7 +526,8 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
524
526
|
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
525
527
|
return _objectSpread(_objectSpread({}, this.getProps(node, path)), {}, {
|
|
526
528
|
extensionViewportSizes: this.extensionViewportSizes,
|
|
527
|
-
nodeHeight: (_this$getExtensionHei = this.getExtensionHeight) === null || _this$getExtensionHei === void 0 ? void 0 : _this$getExtensionHei.call(this, node)
|
|
529
|
+
nodeHeight: (_this$getExtensionHei = this.getExtensionHeight) === null || _this$getExtensionHei === void 0 ? void 0 : _this$getExtensionHei.call(this, node),
|
|
530
|
+
shouldDisplayExtensionAsInline: this.shouldDisplayExtensionAsInline
|
|
528
531
|
});
|
|
529
532
|
}
|
|
530
533
|
}, {
|
|
@@ -753,16 +756,23 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
753
756
|
}
|
|
754
757
|
return this.getUniqueHeadingId(baseId, headingIds, ++counter);
|
|
755
758
|
}
|
|
756
|
-
}
|
|
759
|
+
}, {
|
|
757
760
|
key: "getChildNodes",
|
|
758
761
|
value: function getChildNodes(fragment) {
|
|
759
762
|
var children = [];
|
|
760
763
|
fragment.forEach(function (node) {
|
|
761
764
|
children.push(node);
|
|
762
765
|
});
|
|
763
|
-
|
|
766
|
+
children = mergeTextNodes(children);
|
|
767
|
+
if (!!this.shouldDisplayExtensionAsInline && expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true)) {
|
|
768
|
+
children = mergeInlinedExtension({
|
|
769
|
+
nodes: children,
|
|
770
|
+
shouldDisplayExtensionAsInline: this.shouldDisplayExtensionAsInline
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
return children;
|
|
764
774
|
}
|
|
765
|
-
}, {
|
|
775
|
+
}], [{
|
|
766
776
|
key: "getMarks",
|
|
767
777
|
value: function getMarks(node) {
|
|
768
778
|
if (!node.marks || node.marks.length === 0) {
|
|
@@ -34,7 +34,7 @@ var codeBlockSharedStyles = css(_defineProperty(_defineProperty(_defineProperty(
|
|
|
34
34
|
backgroundColor: "var(--ds-surface-raised, #FFFFFF)",
|
|
35
35
|
borderRadius: "var(--ds-radius-small, 3px)",
|
|
36
36
|
margin: "".concat(blockNodesVerticalMargin, " 0 0 0"),
|
|
37
|
-
fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
37
|
+
fontFamily: "var(--ds-font-family-code, \"Atlassian Mono\", ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
38
38
|
minWidth: "".concat(akEditorTableCellMinWidth, "px"),
|
|
39
39
|
cursor: 'pointer',
|
|
40
40
|
clear: 'both',
|
|
@@ -115,7 +115,9 @@ export var addSortableColumn = function addSortableColumn(rows, tableOrderStatus
|
|
|
115
115
|
return row;
|
|
116
116
|
});
|
|
117
117
|
};
|
|
118
|
-
export var isHeaderRowEnabled = function isHeaderRowEnabled(rows
|
|
118
|
+
export var isHeaderRowEnabled = function isHeaderRowEnabled(rows
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
120
|
+
) {
|
|
119
121
|
if (!rows.length) {
|
|
120
122
|
return false;
|
|
121
123
|
}
|
|
@@ -132,7 +134,9 @@ export var isHeaderRowEnabled = function isHeaderRowEnabled(rows) {
|
|
|
132
134
|
return node.type === TableHeader;
|
|
133
135
|
});
|
|
134
136
|
};
|
|
135
|
-
export var tableCanBeSticky = function tableCanBeSticky(node, children
|
|
137
|
+
export var tableCanBeSticky = function tableCanBeSticky(node, children
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
139
|
+
) {
|
|
136
140
|
return isHeaderRowEnabled(children) && node && node.firstChild && !hasRowspan(node.firstChild);
|
|
137
141
|
};
|
|
138
142
|
/**
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4
|
+
/**
|
|
5
|
+
* Merges extensions (displayed as inline) with adjacent textblocks
|
|
6
|
+
*
|
|
7
|
+
* Input:
|
|
8
|
+
* [
|
|
9
|
+
* { type: 'paragraph', content: [ { type: 'text', text: 'Hello' } ] },
|
|
10
|
+
* { type: 'bodiedExtension', content: [ { type: 'text', text: 'World' } ] },
|
|
11
|
+
* { type: 'paragraph', content: [ { type: 'text', text: '!' } ] },
|
|
12
|
+
* ]
|
|
13
|
+
*
|
|
14
|
+
* Output:
|
|
15
|
+
* [
|
|
16
|
+
* { type: 'paragraph', content: [
|
|
17
|
+
* { type: 'text', text: 'Hello' },
|
|
18
|
+
* { type: 'bodiedExtension', content: [ { type: 'text', text: 'World' } ] },
|
|
19
|
+
* { type: 'text', text: '!' }
|
|
20
|
+
* ] },
|
|
21
|
+
* ]
|
|
22
|
+
*/
|
|
23
|
+
export function mergeInlinedExtension(_ref) {
|
|
24
|
+
var nodes = _ref.nodes,
|
|
25
|
+
shouldDisplayExtensionAsInline = _ref.shouldDisplayExtensionAsInline;
|
|
26
|
+
function isInlineBodiedExtension(node) {
|
|
27
|
+
var _node$attrs, _node$attrs2, _node$attrs3, _node$attrs4;
|
|
28
|
+
return Boolean((node === null || node === void 0 ? void 0 : node.type.name) === 'bodiedExtension' && shouldDisplayExtensionAsInline({
|
|
29
|
+
type: node.type.name,
|
|
30
|
+
extensionKey: (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionKey,
|
|
31
|
+
extensionType: (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.extensionType,
|
|
32
|
+
parameters: (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.parameters,
|
|
33
|
+
content: node.content,
|
|
34
|
+
localId: (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.localId
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
// if it's [inlinedBodiedExtension], wrap it in a textblock
|
|
39
|
+
if (nodes.length === 1 && isInlineBodiedExtension(nodes[0])) {
|
|
40
|
+
return [nodes[0].type.schema.nodes.paragraph.create(null, nodes[0])];
|
|
41
|
+
}
|
|
42
|
+
var newNodes = [];
|
|
43
|
+
var _iterator = _createForOfIteratorHelper(nodes),
|
|
44
|
+
_step;
|
|
45
|
+
try {
|
|
46
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
47
|
+
var node = _step.value;
|
|
48
|
+
var previousNode = newNodes[newNodes.length - 1];
|
|
49
|
+
|
|
50
|
+
// first node
|
|
51
|
+
if (!previousNode) {
|
|
52
|
+
newNodes.push(node);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// textblock + inlinedBodiedExtension
|
|
57
|
+
if (isInlineBodiedExtension(node) && previousNode.isTextblock) {
|
|
58
|
+
newNodes[newNodes.length - 1] = previousNode.copy(previousNode.content.addToEnd(node));
|
|
59
|
+
}
|
|
60
|
+
// textblock(..., inlinedBodiedExtension) + textblock
|
|
61
|
+
else if (node.isTextblock && previousNode.isTextblock && isInlineBodiedExtension(previousNode.content.lastChild)) {
|
|
62
|
+
newNodes[newNodes.length - 1] = previousNode.copy(previousNode.content.append(node.content));
|
|
63
|
+
}
|
|
64
|
+
// inlinedBodiedExtension + textblock
|
|
65
|
+
else if (isInlineBodiedExtension(previousNode) && node.isTextblock) {
|
|
66
|
+
newNodes[newNodes.length - 1] = node.copy(node.content.addToStart(previousNode));
|
|
67
|
+
}
|
|
68
|
+
// inlinedBodiedExtension + non-textblock
|
|
69
|
+
else if (isInlineBodiedExtension(previousNode) && !node.isTextblock) {
|
|
70
|
+
newNodes[newNodes.length - 1] = node.type.schema.nodes.paragraph.create(null, previousNode);
|
|
71
|
+
newNodes.push(node);
|
|
72
|
+
}
|
|
73
|
+
// default case
|
|
74
|
+
else {
|
|
75
|
+
newNodes.push(node);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
} catch (err) {
|
|
79
|
+
_iterator.e(err);
|
|
80
|
+
} finally {
|
|
81
|
+
_iterator.f();
|
|
82
|
+
}
|
|
83
|
+
return newNodes;
|
|
84
|
+
} catch (_unused) {}
|
|
85
|
+
return nodes;
|
|
86
|
+
}
|
package/dist/esm/ui/MediaCard.js
CHANGED
|
@@ -13,7 +13,6 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
13
13
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
14
|
import React, { Component, useContext } from 'react';
|
|
15
15
|
import { filter } from '@atlaskit/adf-utils/traverse';
|
|
16
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
16
|
import { Card as CardAsync, CardSync, CardLoading, CardError } from '@atlaskit/media-card';
|
|
18
17
|
import { MediaClientContext } from '@atlaskit/media-client-react';
|
|
19
18
|
import { withImageLoader } from '@atlaskit/editor-common/utils';
|
|
@@ -238,7 +237,7 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
238
237
|
|
|
239
238
|
// we need this statement for the mandatory mediaClientConfig below
|
|
240
239
|
var mediaClientConfig = mediaClient === null || mediaClient === void 0 ? void 0 : mediaClient.mediaClientConfig;
|
|
241
|
-
var Card = enableSyncMediaCard
|
|
240
|
+
var Card = enableSyncMediaCard ? CardSync : CardAsync;
|
|
242
241
|
return (
|
|
243
242
|
/*#__PURE__*/
|
|
244
243
|
// Ignored via go/ees005
|
|
@@ -320,7 +319,7 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
320
319
|
collectionName: collection,
|
|
321
320
|
occurrenceKey: occurrenceKey
|
|
322
321
|
};
|
|
323
|
-
var Card = enableSyncMediaCard
|
|
322
|
+
var Card = enableSyncMediaCard ? CardSync : CardAsync;
|
|
324
323
|
|
|
325
324
|
// Quick solution to disable lazy loading of images on PDF export pages in Confluence to remedy an issue with images never loading
|
|
326
325
|
// More robust solution will be implemented as part of CCPDF-233 - Link: https://hello.jira.atlassian.cloud/browse/CCPDF-233
|
|
@@ -232,7 +232,7 @@ var telepointerStyles = css(_defineProperty({}, "#".concat(TELEPOINTER_ID), {
|
|
|
232
232
|
left: 0,
|
|
233
233
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
234
234
|
fontSize: '10px',
|
|
235
|
-
fontWeight: "var(--ds-font-weight-bold,
|
|
235
|
+
fontWeight: "var(--ds-font-weight-bold, 653)",
|
|
236
236
|
width: '12.5px',
|
|
237
237
|
height: '13px',
|
|
238
238
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-space
|
|
@@ -269,7 +269,7 @@ var rovoTelepointerStyles = css(_defineProperty({}, "#".concat(TELEPOINTER_ID),
|
|
|
269
269
|
'&::before': {
|
|
270
270
|
content: '"Rovo"',
|
|
271
271
|
position: 'absolute',
|
|
272
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
272
|
+
fontFamily: "var(--ds-font-family-body, \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
273
273
|
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
274
274
|
color: "var(--ds-text-inverse, white)",
|
|
275
275
|
background: "var(--ds-text, #292A2E)",
|
|
@@ -411,7 +411,7 @@ var headingsSharedStyles = css({
|
|
|
411
411
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
412
412
|
lineHeight: 16 / 11,
|
|
413
413
|
color: "var(--ds-text-subtlest, #6B6E76)",
|
|
414
|
-
fontWeight: "var(--ds-font-weight-bold,
|
|
414
|
+
fontWeight: "var(--ds-font-weight-bold, 653)",
|
|
415
415
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-space
|
|
416
416
|
marginTop: '1.455em',
|
|
417
417
|
textTransform: 'none'
|
|
@@ -426,7 +426,7 @@ var headingsSharedStylesWithEditorUGC = css({
|
|
|
426
426
|
marginTop: '1.45833em',
|
|
427
427
|
'& strong': {
|
|
428
428
|
// set all heading bold style to token font.weight.bold, as not matter what typography is used, the editorUGCToken will return the font weight 700
|
|
429
|
-
fontWeight: "var(--ds-font-weight-bold,
|
|
429
|
+
fontWeight: "var(--ds-font-weight-bold, 653)"
|
|
430
430
|
},
|
|
431
431
|
'&::before': {}
|
|
432
432
|
},
|
|
@@ -438,7 +438,7 @@ var headingsSharedStylesWithEditorUGC = css({
|
|
|
438
438
|
marginBottom: 0,
|
|
439
439
|
'& strong': {
|
|
440
440
|
// set all heading bold style to token font.weight.bold, as not matter what typography is used, the editorUGCToken will return the font weight 700
|
|
441
|
-
fontWeight: "var(--ds-font-weight-bold,
|
|
441
|
+
fontWeight: "var(--ds-font-weight-bold, 653)"
|
|
442
442
|
}
|
|
443
443
|
},
|
|
444
444
|
'& h3': {
|
|
@@ -449,7 +449,7 @@ var headingsSharedStylesWithEditorUGC = css({
|
|
|
449
449
|
marginBottom: 0,
|
|
450
450
|
'& strong': {
|
|
451
451
|
// set all heading bold style to token font.weight.bold, as not matter what typography is used, the editorUGCToken will return the font weight 700
|
|
452
|
-
fontWeight: "var(--ds-font-weight-bold,
|
|
452
|
+
fontWeight: "var(--ds-font-weight-bold, 653)"
|
|
453
453
|
}
|
|
454
454
|
},
|
|
455
455
|
'& h4': {
|
|
@@ -458,7 +458,7 @@ var headingsSharedStylesWithEditorUGC = css({
|
|
|
458
458
|
marginTop: "var(--ds-space-250, 1.25em)",
|
|
459
459
|
'& strong': {
|
|
460
460
|
// set all heading bold style to token font.weight.bold, as not matter what typography is used, the editorUGCToken will return the font weight 700
|
|
461
|
-
fontWeight: "var(--ds-font-weight-bold,
|
|
461
|
+
fontWeight: "var(--ds-font-weight-bold, 653)"
|
|
462
462
|
}
|
|
463
463
|
},
|
|
464
464
|
'& h5': {
|
|
@@ -469,7 +469,7 @@ var headingsSharedStylesWithEditorUGC = css({
|
|
|
469
469
|
textTransform: 'none',
|
|
470
470
|
'& strong': {
|
|
471
471
|
// set all heading bold style to token font.weight.bold, as not matter what typography is used, the editorUGCToken will return the font weight 700
|
|
472
|
-
fontWeight: "var(--ds-font-weight-bold,
|
|
472
|
+
fontWeight: "var(--ds-font-weight-bold, 653)"
|
|
473
473
|
}
|
|
474
474
|
},
|
|
475
475
|
'& h6': {
|
|
@@ -480,7 +480,7 @@ var headingsSharedStylesWithEditorUGC = css({
|
|
|
480
480
|
textTransform: 'none',
|
|
481
481
|
'& strong': {
|
|
482
482
|
// set all heading bold style to token font.weight.bold, as not matter what typography is used, the editorUGCToken will return the font weight 700
|
|
483
|
-
fontWeight: "var(--ds-font-weight-bold,
|
|
483
|
+
fontWeight: "var(--ds-font-weight-bold, 653)"
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
486
|
});
|
|
@@ -706,7 +706,7 @@ var codeMarkSharedStyles = css({
|
|
|
706
706
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
707
707
|
fontSize: '0.875em',
|
|
708
708
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
709
|
-
fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
709
|
+
fontFamily: "var(--ds-font-family-code, \"Atlassian Mono\", ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
710
710
|
fontWeight: "var(--ds-font-weight-regular, 400)",
|
|
711
711
|
backgroundColor: "var(--ds--code--bg-color,".concat("var(--ds-background-neutral, ".concat(N20, ")"), ")"),
|
|
712
712
|
color: "var(--ds-text, ".concat(N800, ")"),
|
|
@@ -889,7 +889,7 @@ var headerSmartCardStyles = css({
|
|
|
889
889
|
});
|
|
890
890
|
var baseOtherStyles = css(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
891
891
|
'& .UnknownBlock': {
|
|
892
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
892
|
+
fontFamily: "var(--ds-font-family-body, \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
893
893
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
894
894
|
fontSize: "".concat(14 / 16, "rem"),
|
|
895
895
|
fontWeight: "var(--ds-font-weight-regular, 400)",
|
|
@@ -61,7 +61,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
61
61
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
62
62
|
var RENDER_EVENT_SAMPLE_RATE = 0.2;
|
|
63
63
|
var packageName = "@atlaskit/renderer";
|
|
64
|
-
var packageVersion = "125.4.
|
|
64
|
+
var packageVersion = "125.4.1";
|
|
65
65
|
var setAsQueryContainerStyles = css({
|
|
66
66
|
containerName: 'ak-renderer-wrapper',
|
|
67
67
|
containerType: 'inline-size'
|
|
@@ -259,7 +259,8 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
259
259
|
textHighlighter: props.textHighlighter || props.UNSTABLE_textHighlighter,
|
|
260
260
|
allowTableAlignment: props.UNSTABLE_allowTableAlignment,
|
|
261
261
|
allowTableResizing: props.UNSTABLE_allowTableResizing,
|
|
262
|
-
disableTableOverflowShadow: props.disableTableOverflowShadow
|
|
262
|
+
disableTableOverflowShadow: props.disableTableOverflowShadow,
|
|
263
|
+
shouldDisplayExtensionAsInline: props.shouldDisplayExtensionAsInline
|
|
263
264
|
};
|
|
264
265
|
}, [createRendererContext, providerFactory, _fireAnalyticsEvent]);
|
|
265
266
|
var serializer = useMemoFromPropsDerivative(function (serializerProps) {
|
|
@@ -3,8 +3,7 @@ import type { Fragment, Mark, Node } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import type { AnalyticsEventPayload } from '../analytics/events';
|
|
4
4
|
import type { Serializer } from '../serializer';
|
|
5
5
|
import type { HeadingAnchorLinksProps, NodeComponentsProps, RendererAppearance, RendererContentMode, StickyHeaderConfig } from '../ui/Renderer/types';
|
|
6
|
-
import type {
|
|
7
|
-
import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
6
|
+
import type { ExtensionHandlers, ExtensionParams, Parameters } from '@atlaskit/editor-common/extensions';
|
|
8
7
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
9
8
|
import type { EventHandlers } from '@atlaskit/editor-common/ui';
|
|
10
9
|
import type { EmojiResourceConfig } from '@atlaskit/emoji/resource';
|
|
@@ -44,6 +43,7 @@ export interface ReactSerializerInit {
|
|
|
44
43
|
onSetLinkTarget?: (url: string) => '_blank' | undefined;
|
|
45
44
|
portal?: HTMLElement;
|
|
46
45
|
providers?: ProviderFactory;
|
|
46
|
+
shouldDisplayExtensionAsInline?: (extensionParams: ExtensionParams<Parameters>) => boolean;
|
|
47
47
|
shouldOpenMediaViewer?: boolean;
|
|
48
48
|
smartLinks?: SmartLinksOptions;
|
|
49
49
|
/**
|
|
@@ -112,6 +112,7 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
|
|
|
112
112
|
private disableTableOverflowShadow?;
|
|
113
113
|
private standaloneBackgroundColorMarks;
|
|
114
114
|
private onSetLinkTarget?;
|
|
115
|
+
private shouldDisplayExtensionAsInline?;
|
|
115
116
|
constructor(init: ReactSerializerInit);
|
|
116
117
|
private resetState;
|
|
117
118
|
private getNodeProps;
|
|
@@ -147,7 +148,7 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
|
|
|
147
148
|
private getUniqueHeadingId;
|
|
148
149
|
private getAnnotationMarkProps;
|
|
149
150
|
private getMarkProps;
|
|
150
|
-
|
|
151
|
+
private getChildNodes;
|
|
151
152
|
static getMarks(node: Node): Mark[];
|
|
152
153
|
static buildMarkStructure(content: Node[]): Mark[];
|
|
153
154
|
static fromSchema(_: unknown, init: ReactSerializerInit): ReactSerializer;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { ExtensionParams, Parameters } from '@atlaskit/editor-common/extensions';
|
|
3
|
+
/**
|
|
4
|
+
* Merges extensions (displayed as inline) with adjacent textblocks
|
|
5
|
+
*
|
|
6
|
+
* Input:
|
|
7
|
+
* [
|
|
8
|
+
* { type: 'paragraph', content: [ { type: 'text', text: 'Hello' } ] },
|
|
9
|
+
* { type: 'bodiedExtension', content: [ { type: 'text', text: 'World' } ] },
|
|
10
|
+
* { type: 'paragraph', content: [ { type: 'text', text: '!' } ] },
|
|
11
|
+
* ]
|
|
12
|
+
*
|
|
13
|
+
* Output:
|
|
14
|
+
* [
|
|
15
|
+
* { type: 'paragraph', content: [
|
|
16
|
+
* { type: 'text', text: 'Hello' },
|
|
17
|
+
* { type: 'bodiedExtension', content: [ { type: 'text', text: 'World' } ] },
|
|
18
|
+
* { type: 'text', text: '!' }
|
|
19
|
+
* ] },
|
|
20
|
+
* ]
|
|
21
|
+
*/
|
|
22
|
+
export declare function mergeInlinedExtension({ nodes, shouldDisplayExtensionAsInline, }: {
|
|
23
|
+
nodes: PMNode[];
|
|
24
|
+
shouldDisplayExtensionAsInline: (extensionParams: ExtensionParams<Parameters>) => boolean;
|
|
25
|
+
}): PMNode[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DocNode } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
|
-
import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
3
|
+
import type { ExtensionHandlers, ExtensionParams, Parameters } from '@atlaskit/editor-common/extensions';
|
|
4
4
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
5
5
|
import type { AnnotationProviders } from '@atlaskit/editor-common/types';
|
|
6
6
|
import type { EventHandlers } from '@atlaskit/editor-common/ui';
|
|
@@ -135,6 +135,12 @@ export interface RendererProps {
|
|
|
135
135
|
portal?: HTMLElement;
|
|
136
136
|
rendererContext?: RendererContext;
|
|
137
137
|
schema?: Schema;
|
|
138
|
+
/**
|
|
139
|
+
* Determines if the extension should be displayed as inline based on the extension parameters.
|
|
140
|
+
* @param extensionParams - The extension parameters.
|
|
141
|
+
* @returns True if the extension should be displayed as inline, false otherwise.
|
|
142
|
+
*/
|
|
143
|
+
shouldDisplayExtensionAsInline?: (extensionParams: ExtensionParams<Parameters>) => boolean;
|
|
138
144
|
shouldOpenMediaViewer?: boolean;
|
|
139
145
|
shouldRemoveEmptySpaceAroundContent?: boolean;
|
|
140
146
|
smartLinks?: SmartLinksOptions;
|
|
@@ -3,8 +3,7 @@ import type { Fragment, Mark, Node } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import type { AnalyticsEventPayload } from '../analytics/events';
|
|
4
4
|
import type { Serializer } from '../serializer';
|
|
5
5
|
import type { HeadingAnchorLinksProps, NodeComponentsProps, RendererAppearance, RendererContentMode, StickyHeaderConfig } from '../ui/Renderer/types';
|
|
6
|
-
import type {
|
|
7
|
-
import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
6
|
+
import type { ExtensionHandlers, ExtensionParams, Parameters } from '@atlaskit/editor-common/extensions';
|
|
8
7
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
9
8
|
import type { EventHandlers } from '@atlaskit/editor-common/ui';
|
|
10
9
|
import type { EmojiResourceConfig } from '@atlaskit/emoji/resource';
|
|
@@ -44,6 +43,7 @@ export interface ReactSerializerInit {
|
|
|
44
43
|
onSetLinkTarget?: (url: string) => '_blank' | undefined;
|
|
45
44
|
portal?: HTMLElement;
|
|
46
45
|
providers?: ProviderFactory;
|
|
46
|
+
shouldDisplayExtensionAsInline?: (extensionParams: ExtensionParams<Parameters>) => boolean;
|
|
47
47
|
shouldOpenMediaViewer?: boolean;
|
|
48
48
|
smartLinks?: SmartLinksOptions;
|
|
49
49
|
/**
|
|
@@ -112,6 +112,7 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
|
|
|
112
112
|
private disableTableOverflowShadow?;
|
|
113
113
|
private standaloneBackgroundColorMarks;
|
|
114
114
|
private onSetLinkTarget?;
|
|
115
|
+
private shouldDisplayExtensionAsInline?;
|
|
115
116
|
constructor(init: ReactSerializerInit);
|
|
116
117
|
private resetState;
|
|
117
118
|
private getNodeProps;
|
|
@@ -147,7 +148,7 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
|
|
|
147
148
|
private getUniqueHeadingId;
|
|
148
149
|
private getAnnotationMarkProps;
|
|
149
150
|
private getMarkProps;
|
|
150
|
-
|
|
151
|
+
private getChildNodes;
|
|
151
152
|
static getMarks(node: Node): Mark[];
|
|
152
153
|
static buildMarkStructure(content: Node[]): Mark[];
|
|
153
154
|
static fromSchema(_: unknown, init: ReactSerializerInit): ReactSerializer;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { ExtensionParams, Parameters } from '@atlaskit/editor-common/extensions';
|
|
3
|
+
/**
|
|
4
|
+
* Merges extensions (displayed as inline) with adjacent textblocks
|
|
5
|
+
*
|
|
6
|
+
* Input:
|
|
7
|
+
* [
|
|
8
|
+
* { type: 'paragraph', content: [ { type: 'text', text: 'Hello' } ] },
|
|
9
|
+
* { type: 'bodiedExtension', content: [ { type: 'text', text: 'World' } ] },
|
|
10
|
+
* { type: 'paragraph', content: [ { type: 'text', text: '!' } ] },
|
|
11
|
+
* ]
|
|
12
|
+
*
|
|
13
|
+
* Output:
|
|
14
|
+
* [
|
|
15
|
+
* { type: 'paragraph', content: [
|
|
16
|
+
* { type: 'text', text: 'Hello' },
|
|
17
|
+
* { type: 'bodiedExtension', content: [ { type: 'text', text: 'World' } ] },
|
|
18
|
+
* { type: 'text', text: '!' }
|
|
19
|
+
* ] },
|
|
20
|
+
* ]
|
|
21
|
+
*/
|
|
22
|
+
export declare function mergeInlinedExtension({ nodes, shouldDisplayExtensionAsInline, }: {
|
|
23
|
+
nodes: PMNode[];
|
|
24
|
+
shouldDisplayExtensionAsInline: (extensionParams: ExtensionParams<Parameters>) => boolean;
|
|
25
|
+
}): PMNode[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DocNode } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
|
-
import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
3
|
+
import type { ExtensionHandlers, ExtensionParams, Parameters } from '@atlaskit/editor-common/extensions';
|
|
4
4
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
5
5
|
import type { AnnotationProviders } from '@atlaskit/editor-common/types';
|
|
6
6
|
import type { EventHandlers } from '@atlaskit/editor-common/ui';
|
|
@@ -135,6 +135,12 @@ export interface RendererProps {
|
|
|
135
135
|
portal?: HTMLElement;
|
|
136
136
|
rendererContext?: RendererContext;
|
|
137
137
|
schema?: Schema;
|
|
138
|
+
/**
|
|
139
|
+
* Determines if the extension should be displayed as inline based on the extension parameters.
|
|
140
|
+
* @param extensionParams - The extension parameters.
|
|
141
|
+
* @returns True if the extension should be displayed as inline, false otherwise.
|
|
142
|
+
*/
|
|
143
|
+
shouldDisplayExtensionAsInline?: (extensionParams: ExtensionParams<Parameters>) => boolean;
|
|
138
144
|
shouldOpenMediaViewer?: boolean;
|
|
139
145
|
shouldRemoveEmptySpaceAroundContent?: boolean;
|
|
140
146
|
smartLinks?: SmartLinksOptions;
|
package/docs/0-intro.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { md, Example, Props, code, AtlassianInternalWarning } from '@atlaskit/docs';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
+
const _default_1: any = md`
|
|
5
6
|
${(<AtlassianInternalWarning />)}
|
|
6
7
|
|
|
7
8
|
This component provides a renderer for ADF documents.
|
|
@@ -18,16 +19,16 @@ ReactDOM.render(<ReactRenderer document={DOCUMENT} />, container);
|
|
|
18
19
|
## Example
|
|
19
20
|
|
|
20
21
|
${(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
)}
|
|
22
|
+
<Example
|
|
23
|
+
// Ignored via go/ees005
|
|
24
|
+
// eslint-disable-next-line import/no-commonjs
|
|
25
|
+
Component={require('../examples/1-with-providers').default}
|
|
26
|
+
title="With Providers"
|
|
27
|
+
// Ignored via go/ees005
|
|
28
|
+
// eslint-disable-next-line import/no-commonjs
|
|
29
|
+
source={require('!!raw-loader!../examples/1-with-providers')}
|
|
30
|
+
/>
|
|
31
|
+
)}
|
|
31
32
|
|
|
32
33
|
## Best practices to prevent performance issues
|
|
33
34
|
|
|
@@ -128,16 +129,16 @@ ReactDOM.render(<ReactRenderer document={DOCUMENT} truncated={true} maxHeight={7
|
|
|
128
129
|
`}
|
|
129
130
|
|
|
130
131
|
${(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
)}
|
|
132
|
+
<Example
|
|
133
|
+
// Ignored via go/ees005
|
|
134
|
+
// eslint-disable-next-line import/no-commonjs
|
|
135
|
+
Component={require('../examples/15-truncated').default}
|
|
136
|
+
title="Truncated"
|
|
137
|
+
// Ignored via go/ees005
|
|
138
|
+
// eslint-disable-next-line import/no-commonjs
|
|
139
|
+
source={require('!!raw-loader!../examples/15-truncated')}
|
|
140
|
+
/>
|
|
141
|
+
)}
|
|
141
142
|
|
|
142
143
|
## Theming and dark mode support
|
|
143
144
|
To render certain ADF content correctly in different color themes, such as light and dark mode, this package utilise
|
|
@@ -148,11 +149,12 @@ Full light and dark mode support for the Editor is a work in progress. Currently
|
|
|
148
149
|
- Custom table backgrounds
|
|
149
150
|
|
|
150
151
|
${(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
)}
|
|
152
|
+
<Props
|
|
153
|
+
heading="Props"
|
|
154
|
+
// Ignored via go/ees005
|
|
155
|
+
// eslint-disable-next-line import/no-commonjs
|
|
156
|
+
props={require('!!extract-react-types-loader!../src/ui/Renderer/index')}
|
|
157
|
+
/>
|
|
158
|
+
)}
|
|
158
159
|
`;
|
|
160
|
+
export default _default_1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "126.0.0",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"@atlaskit/status": "^3.1.0",
|
|
58
58
|
"@atlaskit/task-decision": "^19.2.0",
|
|
59
59
|
"@atlaskit/theme": "^21.0.0",
|
|
60
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
61
|
-
"@atlaskit/tokens": "^
|
|
60
|
+
"@atlaskit/tmp-editor-statsig": "^16.23.0",
|
|
61
|
+
"@atlaskit/tokens": "^10.0.0",
|
|
62
62
|
"@atlaskit/tooltip": "^20.14.0",
|
|
63
63
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
64
64
|
"@babel/runtime": "^7.0.0",
|
package/build/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"target": "es5",
|
|
6
|
-
"paths": {}
|
|
7
|
-
},
|
|
8
|
-
"include": [
|
|
9
|
-
"../src/**/*.ts",
|
|
10
|
-
"../src/**/*.tsx"
|
|
11
|
-
],
|
|
12
|
-
"exclude": [
|
|
13
|
-
"../src/**/__tests__/*",
|
|
14
|
-
"../src/**/*.test.*",
|
|
15
|
-
"../src/**/test.*",
|
|
16
|
-
"../src/**/examples.*",
|
|
17
|
-
"../src/**/examples/*",
|
|
18
|
-
"../src/**/examples/**/*",
|
|
19
|
-
"../src/**/*.stories.*",
|
|
20
|
-
"../src/**/stories/*",
|
|
21
|
-
"../src/**/stories/**/*"
|
|
22
|
-
]
|
|
23
|
-
}
|