@atlaskit/renderer 150.0.7 → 151.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 +24 -0
- package/dist/cjs/react/index.js +19 -0
- package/dist/cjs/react/nodes/emoji.js +0 -1
- package/dist/cjs/react/nodes/heading.compiled.css +3 -0
- package/dist/cjs/react/nodes/heading.js +12 -2
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +1 -27
- package/dist/cjs/ui/Renderer/index.js +2 -1
- package/dist/es2019/react/index.js +19 -0
- package/dist/es2019/react/nodes/emoji.js +0 -1
- package/dist/es2019/react/nodes/heading.compiled.css +3 -0
- package/dist/es2019/react/nodes/heading.js +12 -2
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +1 -41
- package/dist/es2019/ui/Renderer/index.js +2 -1
- package/dist/esm/react/index.js +19 -0
- package/dist/esm/react/nodes/emoji.js +0 -1
- package/dist/esm/react/nodes/heading.compiled.css +3 -0
- package/dist/esm/react/nodes/heading.js +12 -2
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +1 -27
- package/dist/esm/ui/Renderer/index.js +2 -1
- package/dist/types/react/index.d.ts +4 -0
- package/dist/types/react/nodes/heading.d.ts +2 -1
- package/dist/types/ui/renderer-props.d.ts +5 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 151.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`4bec56feedf8a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4bec56feedf8a) -
|
|
8
|
+
Add showHeadingNumbers to display heading outline numbers using shared editor numbering under
|
|
9
|
+
platform_editor_numbered_headings.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`4119d93011e41`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4119d93011e41) -
|
|
14
|
+
Remove `platform_use_unicode_emojis` experiment checks and retain Twemoji images and sprites.
|
|
15
|
+
Remove the experiment-only `denormaliseStandardRepresentation` export. Call
|
|
16
|
+
`denormaliseServiceRepresentation` with the service representation instead. Remove the
|
|
17
|
+
`emoji-id-to-emoji` entrypoint and its `emojiIdToEmoji` utility. Use the existing provider image
|
|
18
|
+
or sprite representation for Twemoji rendering. Remove the Unicode representation type, renderer,
|
|
19
|
+
canvas utility, and public `unicode-emoji-image` entrypoint. Remove `renderUnicodeEmojiAsImage`
|
|
20
|
+
props and the Unicode type guard. Remove the editor Unicode node rendering and the `EMOJI_UNICODE`
|
|
21
|
+
shared CSS class. Use provider image and sprite representations instead of Unicode
|
|
22
|
+
representations. Remove the obsolete Unicode rendering props from consumers. Remove the
|
|
23
|
+
feature-only `getCachedEmojiType` provider API. Use the existing provider lookup methods for cache
|
|
24
|
+
or catalogue access.
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 150.0.7
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/cjs/react/index.js
CHANGED
|
@@ -12,12 +12,14 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
12
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _numberedHeadings = require("@atlaskit/editor-common/numbered-headings");
|
|
15
16
|
var _table = require("@atlaskit/editor-common/utils/table");
|
|
16
17
|
var _validator = require("@atlaskit/editor-common/utils/validator");
|
|
17
18
|
var _validator2 = require("@atlaskit/editor-common/validator");
|
|
18
19
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
19
20
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
20
21
|
var _expVal = require("@atlaskit/platform-feature-experiments/exp-val");
|
|
22
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
21
23
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
22
24
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
23
25
|
var _expandBody = require("../ui/utils/expand-body");
|
|
@@ -51,6 +53,8 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
51
53
|
var _this = this;
|
|
52
54
|
(0, _classCallCheck2.default)(this, ReactSerializer);
|
|
53
55
|
(0, _defineProperty2.default)(this, "headingIds", []);
|
|
56
|
+
(0, _defineProperty2.default)(this, "headingNumbers", []);
|
|
57
|
+
(0, _defineProperty2.default)(this, "headingNumberIndex", 0);
|
|
54
58
|
/**
|
|
55
59
|
* The reason we have this extra array here is because we need to generate the same unique
|
|
56
60
|
* heading id for 2 different nodes: headers and expands (check the implementation of
|
|
@@ -203,6 +207,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
203
207
|
this.headingIdPrefix = init.headingIdPrefix;
|
|
204
208
|
this.disableActions = init.disableActions;
|
|
205
209
|
this.allowHeadingAnchorLinks = init.allowHeadingAnchorLinks;
|
|
210
|
+
this.showHeadingNumbers = init.showHeadingNumbers === true && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_numbered_headings');
|
|
206
211
|
this.allowCopyToClipboard = init.allowCopyToClipboard;
|
|
207
212
|
this.allowDownloadCodeBlock = init.allowDownloadCodeBlock;
|
|
208
213
|
this.allowWrapCodeBlock = init.allowWrapCodeBlock;
|
|
@@ -243,6 +248,8 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
243
248
|
key: "resetState",
|
|
244
249
|
value: function resetState() {
|
|
245
250
|
this.headingIds = [];
|
|
251
|
+
this.headingNumbers = [];
|
|
252
|
+
this.headingNumberIndex = 0;
|
|
246
253
|
this.expandHeadingIds = [];
|
|
247
254
|
this.startPos = this.initStartPos;
|
|
248
255
|
}
|
|
@@ -321,6 +328,17 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
321
328
|
// This makes sure that we reset internal state on re-render.
|
|
322
329
|
if (key === 'root-0') {
|
|
323
330
|
this.resetState();
|
|
331
|
+
if (this.showHeadingNumbers) {
|
|
332
|
+
var levels = [];
|
|
333
|
+
fragment.descendants(function (node) {
|
|
334
|
+
if (node.type.name === 'heading') {
|
|
335
|
+
levels.push(Number(node.attrs.level));
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
return !node.isTextblock && !node.isLeaf;
|
|
339
|
+
});
|
|
340
|
+
this.headingNumbers = (0, _numberedHeadings.getHeadingNumbers)(levels);
|
|
341
|
+
}
|
|
324
342
|
}
|
|
325
343
|
return this.renderNode(target, props, key, (0, _expandBody.mergeExpandBodyText)(this.getChildNodes(fragment, !(parentInfo !== null && parentInfo !== void 0 && parentInfo.path.length)).map(function (node, index) {
|
|
326
344
|
if ((0, _nodes.isTextWrapper)(node)) {
|
|
@@ -749,6 +767,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
749
767
|
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
750
768
|
return _objectSpread(_objectSpread({}, this.getProps(node, path)), {}, {
|
|
751
769
|
headingId: this.getHeadingId(node, this.headingIds),
|
|
770
|
+
headingNumber: this.showHeadingNumbers ? this.headingNumbers[this.headingNumberIndex++] : undefined,
|
|
752
771
|
showAnchorLink: this.appearance !== 'comment' && this.allowHeadingAnchorLinks && !this.disableHeadingIDs && this.headingAnchorSupported(path)
|
|
753
772
|
});
|
|
754
773
|
}
|
|
@@ -86,7 +86,6 @@ var EmojiNode = /*#__PURE__*/function (_PureComponent) {
|
|
|
86
86
|
shortName: shortName
|
|
87
87
|
}),
|
|
88
88
|
editorEmoji: true,
|
|
89
|
-
renderUnicodeEmojiAsImage: false,
|
|
90
89
|
onEmojiLoadSuccess: resourceConfig === null || resourceConfig === void 0 ? void 0 : resourceConfig.onEmojiLoadSuccess,
|
|
91
90
|
onEmojiLoadFail: resourceConfig === null || resourceConfig === void 0 ? void 0 : resourceConfig.onEmojiLoadFail
|
|
92
91
|
});
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
._152tidpf{inset-block-start:0}
|
|
3
3
|
._1e02idpf{inset-inline-start:0}
|
|
4
4
|
._1e0c1ule{display:block}
|
|
5
|
+
._1kt9j9bv:before{content:attr(data-heading-number) "."}
|
|
6
|
+
._1mbqu2gc:before{margin-inline-end:var(--ds-space-100,8px)}
|
|
5
7
|
._1pbykb7n{z-index:1}
|
|
8
|
+
._1wqoglyw:before{-webkit-user-select:none;-ms-user-select:none;user-select:none}
|
|
6
9
|
._ahbqukr8{margin-inline-start:var(--ds-space-negative-400,-2pc)}
|
|
7
10
|
._bozgxy5q{padding-inline-start:var(--ds-space-400,2pc)}
|
|
8
11
|
._kqswh2mm{position:relative}
|
|
@@ -41,6 +41,9 @@ function hasRightAlignmentMark(marks) {
|
|
|
41
41
|
return mark.type.name === 'alignment' && mark.attrs.align === 'end';
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
// Matches the editor's decoration-based number prefix without changing heading text or IDs.
|
|
46
|
+
var numberedHeadingStyles = null;
|
|
44
47
|
var wrapperStyles = null;
|
|
45
48
|
var collapsibleHeadingWrapperStyles = null;
|
|
46
49
|
var collapsibleHeadingButtonStyles = null;
|
|
@@ -221,12 +224,14 @@ function HeadingWithDuplicateAnchor(props) {
|
|
|
221
224
|
}
|
|
222
225
|
};
|
|
223
226
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(HX, {
|
|
227
|
+
"data-heading-number": props.headingNumber,
|
|
224
228
|
id: headingIdToUse,
|
|
225
229
|
"data-local-id": localId,
|
|
226
230
|
"data-renderer-start-pos": dataAttributes['data-renderer-start-pos'],
|
|
227
231
|
"data-as-inline": asInline,
|
|
228
232
|
onMouseEnter: mouseEnterHandler,
|
|
229
|
-
tabIndex: -1
|
|
233
|
+
tabIndex: -1,
|
|
234
|
+
className: (0, _runtime.ax)([props.headingNumber && "_1kt9j9bv _1mbqu2gc _1wqoglyw"])
|
|
230
235
|
}, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showAnchorLink && headingId && isRightAligned && /*#__PURE__*/_react.default.createElement(WrappedHeadingAnchor, {
|
|
231
236
|
level: props.level,
|
|
232
237
|
enableNestedHeaderLinks: enableNestedHeaderLinks,
|
|
@@ -322,12 +327,14 @@ function HeadingWithWrapper(props) {
|
|
|
322
327
|
headingId: headingId,
|
|
323
328
|
hideFromScreenReader: false
|
|
324
329
|
}), /*#__PURE__*/_react.default.createElement(HX, {
|
|
330
|
+
"data-heading-number": props.headingNumber,
|
|
325
331
|
id: headingIdToUse,
|
|
326
332
|
"data-local-id": localId,
|
|
327
333
|
"data-renderer-start-pos": dataAttributes['data-renderer-start-pos'],
|
|
328
334
|
"data-as-inline": asInline,
|
|
329
335
|
onMouseEnter: collapsibleHeading ? undefined : mouseEnterHandler,
|
|
330
|
-
tabIndex: -1
|
|
336
|
+
tabIndex: -1,
|
|
337
|
+
className: (0, _runtime.ax)([props.headingNumber && "_1kt9j9bv _1mbqu2gc _1wqoglyw"])
|
|
331
338
|
}, props.children), showAnchorLink && headingId && !isRightAligned && /*#__PURE__*/_react.default.createElement(WrappedHeadingAnchor, {
|
|
332
339
|
level: props.level,
|
|
333
340
|
enableNestedHeaderLinks: enableNestedHeaderLinks,
|
|
@@ -349,6 +356,7 @@ function Heading(_ref5) {
|
|
|
349
356
|
children = _ref5.children,
|
|
350
357
|
dataAttributes = _ref5.dataAttributes,
|
|
351
358
|
headingId = _ref5.headingId,
|
|
359
|
+
headingNumber = _ref5.headingNumber,
|
|
352
360
|
invisible = _ref5.invisible,
|
|
353
361
|
level = _ref5.level,
|
|
354
362
|
localId = _ref5.localId,
|
|
@@ -364,6 +372,7 @@ function Heading(_ref5) {
|
|
|
364
372
|
allowHeadingAnchorLinks: allowHeadingAnchorLinks,
|
|
365
373
|
dataAttributes: dataAttributes,
|
|
366
374
|
headingId: headingId,
|
|
375
|
+
headingNumber: headingNumber,
|
|
367
376
|
invisible: invisible,
|
|
368
377
|
level: level,
|
|
369
378
|
localId: localId,
|
|
@@ -379,6 +388,7 @@ function Heading(_ref5) {
|
|
|
379
388
|
allowHeadingAnchorLinks: allowHeadingAnchorLinks,
|
|
380
389
|
dataAttributes: dataAttributes,
|
|
381
390
|
headingId: headingId,
|
|
391
|
+
headingNumber: headingNumber,
|
|
382
392
|
invisible: invisible,
|
|
383
393
|
level: level,
|
|
384
394
|
localId: localId,
|
|
@@ -2135,19 +2135,6 @@ var scaledDenseEmojiStyles = (0, _react.css)((0, _defineProperty2.default)((0, _
|
|
|
2135
2135
|
height: "".concat(_constants2.defaultInlineEmojiHeight, "px"),
|
|
2136
2136
|
width: "".concat(_constants2.defaultInlineEmojiHeight, "px")
|
|
2137
2137
|
}));
|
|
2138
|
-
var scaledDenseUnicodeEmojiStylesNew = (0, _react.css)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "[data-emoji-type=\"unicode\"]", {
|
|
2139
|
-
'--emoji-common-unicode-size': "".concat(_constants2.defaultDenseEmojiHeight, "px")
|
|
2140
|
-
}), "h1 [data-emoji-type=\"unicode\"]", {
|
|
2141
|
-
'--emoji-common-unicode-size': "".concat(_constants2.denseEmojiHeightH1, "px")
|
|
2142
|
-
}), "h2 [data-emoji-type=\"unicode\"]", {
|
|
2143
|
-
'--emoji-common-unicode-size': "".concat(_constants2.denseEmojiHeightH2, "px")
|
|
2144
|
-
}), "h3 [data-emoji-type=\"unicode\"]", {
|
|
2145
|
-
'--emoji-common-unicode-size': "".concat(_constants2.denseEmojiHeightH3, "px")
|
|
2146
|
-
}), "h4 [data-emoji-type=\"unicode\"]", {
|
|
2147
|
-
'--emoji-common-unicode-size': "".concat(_constants2.denseEmojiHeightH4, "px")
|
|
2148
|
-
}), ":is(h5, h6, p) [data-emoji-type=\"unicode\"]", {
|
|
2149
|
-
'--emoji-common-unicode-size': "".concat(_constants2.defaultDenseEmojiHeight, "px")
|
|
2150
|
-
}));
|
|
2151
2138
|
var scaledEmojiStyles = (0, _react.css)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, ".".concat(_emoji.EmojiSharedCssClassName.EMOJI_IMAGE), {
|
|
2152
2139
|
height: "".concat(_constants2.defaultEmojiHeight, "px"),
|
|
2153
2140
|
minHeight: "".concat(_constants2.defaultEmojiHeight, "px"),
|
|
@@ -2181,19 +2168,6 @@ var scaledEmojiStyles = (0, _react.css)((0, _defineProperty2.default)((0, _defin
|
|
|
2181
2168
|
height: "".concat(_constants2.defaultInlineEmojiHeight, "px"),
|
|
2182
2169
|
width: "".concat(_constants2.defaultInlineEmojiHeight, "px")
|
|
2183
2170
|
}));
|
|
2184
|
-
var scaledUnicodeEmojiStylesNew = (0, _react.css)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "[data-emoji-type=\"unicode\"]", {
|
|
2185
|
-
'--emoji-common-unicode-size': "".concat(_constants2.defaultEmojiHeight, "px")
|
|
2186
|
-
}), "h1 [data-emoji-type=\"unicode\"]", {
|
|
2187
|
-
'--emoji-common-unicode-size': "".concat(_constants2.scaledEmojiHeightH1, "px")
|
|
2188
|
-
}), "h2 [data-emoji-type=\"unicode\"]", {
|
|
2189
|
-
'--emoji-common-unicode-size': "".concat(_constants2.scaledEmojiHeightH2, "px")
|
|
2190
|
-
}), "h3 [data-emoji-type=\"unicode\"]", {
|
|
2191
|
-
'--emoji-common-unicode-size': "".concat(_constants2.scaledEmojiHeightH3, "px")
|
|
2192
|
-
}), "h4 [data-emoji-type=\"unicode\"]", {
|
|
2193
|
-
'--emoji-common-unicode-size': "".concat(_constants2.scaledEmojiHeightH4, "px")
|
|
2194
|
-
}), ":is(h5, h6, p) [data-emoji-type=\"unicode\"]", {
|
|
2195
|
-
'--emoji-common-unicode-size': "".concat(_constants2.defaultEmojiHeight, "px")
|
|
2196
|
-
}));
|
|
2197
2171
|
var denseStyles = (0, _react.css)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, ".".concat(_emoji.EmojiSharedCssClassName.EMOJI_IMAGE), {
|
|
2198
2172
|
height: "calc(".concat(_constants2.defaultEmojiHeight, " * var(--ak-renderer-base-font-size) / ").concat(_constants.akEditorFullPageDefaultFontSize, ")"),
|
|
2199
2173
|
width: "calc(".concat(_constants2.defaultEmojiHeight, " * var(--ak-renderer-base-font-size) / ").concat(_constants.akEditorFullPageDefaultFontSize, ")"),
|
|
@@ -2340,7 +2314,7 @@ var RendererStyleContainer = exports.RendererStyleContainer = function RendererS
|
|
|
2340
2314
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
2341
2315
|
(0, _fg.fg)('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor, expandSsrMarginStyles,
|
|
2342
2316
|
// this should be placed after baseOtherStyles
|
|
2343
|
-
(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_remove_important_in_render_ext') ? extensionAsInlineStyle : oldExtensionAsInlineStyle, (0, _fg.fg)('platform_forge_inline_bodied_macro') && [migratedInlineBodiedFlowStyle, forgeInlineBodiedSpacingStyle], inlineExtensionRendererMarginFix, allowNestedHeaderLinks && ((0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle, firstWrappedMediaStyles, tableSharedStyle, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, tableContentModeScopedStyles, tableContentModeExtensionContainmentStyles, tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, (0, _fg.fg)('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_table_css_overflow_shadow') && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && ((0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, blockSsrMarginStyles, layoutBlockSsrMarginStyles, browser.safari && codeBlockInListSsrMarginSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max') && responsiveBreakoutWidthFullWidth, (0, _expValEquals.expValEquals)('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined,
|
|
2317
|
+
(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_remove_important_in_render_ext') ? extensionAsInlineStyle : oldExtensionAsInlineStyle, (0, _fg.fg)('platform_forge_inline_bodied_macro') && [migratedInlineBodiedFlowStyle, forgeInlineBodiedSpacingStyle], inlineExtensionRendererMarginFix, allowNestedHeaderLinks && ((0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle, firstWrappedMediaStyles, tableSharedStyle, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, tableContentModeScopedStyles, tableContentModeExtensionContainmentStyles, tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, (0, _fg.fg)('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_table_css_overflow_shadow') && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && ((0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, blockSsrMarginStyles, layoutBlockSsrMarginStyles, browser.safari && codeBlockInListSsrMarginSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max') && responsiveBreakoutWidthFullWidth, (0, _expValEquals.expValEquals)('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined, syncBlockStyles, centerWrapperStyles, isInsideSyncBlock ? syncBlockRendererStyles : null, isInsideSyncBlock && tableFakeBorderStyles, isInsideSyncBlock && (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? roundedTableFakeBorderOverlayStyles : null, hideExtensionStyles],
|
|
2344
2318
|
"data-testid": testId
|
|
2345
2319
|
}, children);
|
|
2346
2320
|
};
|
|
@@ -79,7 +79,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
79
79
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
80
80
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
81
81
|
var packageName = "@atlaskit/renderer";
|
|
82
|
-
var packageVersion = "150.0.
|
|
82
|
+
var packageVersion = "150.0.7";
|
|
83
83
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
84
84
|
containerName: 'ak-renderer-wrapper',
|
|
85
85
|
containerType: 'inline-size'
|
|
@@ -259,6 +259,7 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
259
259
|
headingIdPrefix: props.headingIdPrefix,
|
|
260
260
|
disableActions: props.disableActions,
|
|
261
261
|
allowHeadingAnchorLinks: props.allowHeadingAnchorLinks,
|
|
262
|
+
showHeadingNumbers: props.showHeadingNumbers,
|
|
262
263
|
allowColumnSorting: props.allowColumnSorting,
|
|
263
264
|
fireAnalyticsEvent: _fireAnalyticsEvent,
|
|
264
265
|
shouldOpenMediaViewer: props.shouldOpenMediaViewer,
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { getHeadingNumbers } from '@atlaskit/editor-common/numbered-headings';
|
|
4
5
|
import { getColumnWidths } from '@atlaskit/editor-common/utils/table';
|
|
5
6
|
import { getMarksByOrder } from '@atlaskit/editor-common/utils/validator';
|
|
6
7
|
import { isSameMark } from '@atlaskit/editor-common/validator';
|
|
7
8
|
import { MarkType } from '@atlaskit/editor-prosemirror/model';
|
|
8
9
|
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
9
10
|
import { expVal } from '@atlaskit/platform-feature-experiments/exp-val';
|
|
11
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
10
12
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
14
|
import { mergeExpandBodyText, withExpandBodyBlock } from '../ui/utils/expand-body';
|
|
@@ -35,6 +37,8 @@ function mergeMarks(marksAndNodes) {
|
|
|
35
37
|
export default class ReactSerializer {
|
|
36
38
|
constructor(init) {
|
|
37
39
|
_defineProperty(this, "headingIds", []);
|
|
40
|
+
_defineProperty(this, "headingNumbers", []);
|
|
41
|
+
_defineProperty(this, "headingNumberIndex", 0);
|
|
38
42
|
/**
|
|
39
43
|
* The reason we have this extra array here is because we need to generate the same unique
|
|
40
44
|
* heading id for 2 different nodes: headers and expands (check the implementation of
|
|
@@ -190,6 +194,7 @@ export default class ReactSerializer {
|
|
|
190
194
|
this.headingIdPrefix = init.headingIdPrefix;
|
|
191
195
|
this.disableActions = init.disableActions;
|
|
192
196
|
this.allowHeadingAnchorLinks = init.allowHeadingAnchorLinks;
|
|
197
|
+
this.showHeadingNumbers = init.showHeadingNumbers === true && isExperimentEnabled('platform_editor_numbered_headings');
|
|
193
198
|
this.allowCopyToClipboard = init.allowCopyToClipboard;
|
|
194
199
|
this.allowDownloadCodeBlock = init.allowDownloadCodeBlock;
|
|
195
200
|
this.allowWrapCodeBlock = init.allowWrapCodeBlock;
|
|
@@ -228,6 +233,8 @@ export default class ReactSerializer {
|
|
|
228
233
|
}
|
|
229
234
|
resetState() {
|
|
230
235
|
this.headingIds = [];
|
|
236
|
+
this.headingNumbers = [];
|
|
237
|
+
this.headingNumberIndex = 0;
|
|
231
238
|
this.expandHeadingIds = [];
|
|
232
239
|
this.startPos = this.initStartPos;
|
|
233
240
|
}
|
|
@@ -303,6 +310,17 @@ export default class ReactSerializer {
|
|
|
303
310
|
// This makes sure that we reset internal state on re-render.
|
|
304
311
|
if (key === 'root-0') {
|
|
305
312
|
this.resetState();
|
|
313
|
+
if (this.showHeadingNumbers) {
|
|
314
|
+
const levels = [];
|
|
315
|
+
fragment.descendants(node => {
|
|
316
|
+
if (node.type.name === 'heading') {
|
|
317
|
+
levels.push(Number(node.attrs.level));
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
return !node.isTextblock && !node.isLeaf;
|
|
321
|
+
});
|
|
322
|
+
this.headingNumbers = getHeadingNumbers(levels);
|
|
323
|
+
}
|
|
306
324
|
}
|
|
307
325
|
return this.renderNode(target, props, key, mergeExpandBodyText(this.getChildNodes(fragment, !(parentInfo !== null && parentInfo !== void 0 && parentInfo.path.length)).map((node, index) => {
|
|
308
326
|
if (isTextWrapper(node)) {
|
|
@@ -669,6 +687,7 @@ export default class ReactSerializer {
|
|
|
669
687
|
return {
|
|
670
688
|
...this.getProps(node, path),
|
|
671
689
|
headingId: this.getHeadingId(node, this.headingIds),
|
|
690
|
+
headingNumber: this.showHeadingNumbers ? this.headingNumbers[this.headingNumberIndex++] : undefined,
|
|
672
691
|
showAnchorLink: this.appearance !== 'comment' && this.allowHeadingAnchorLinks && !this.disableHeadingIDs && this.headingAnchorSupported(path)
|
|
673
692
|
};
|
|
674
693
|
}
|
|
@@ -74,7 +74,6 @@ class EmojiNode extends PureComponent {
|
|
|
74
74
|
shortName
|
|
75
75
|
}),
|
|
76
76
|
editorEmoji: true,
|
|
77
|
-
renderUnicodeEmojiAsImage: false,
|
|
78
77
|
onEmojiLoadSuccess: resourceConfig === null || resourceConfig === void 0 ? void 0 : resourceConfig.onEmojiLoadSuccess,
|
|
79
78
|
onEmojiLoadFail: resourceConfig === null || resourceConfig === void 0 ? void 0 : resourceConfig.onEmojiLoadFail
|
|
80
79
|
});
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
._152tidpf{inset-block-start:0}
|
|
3
3
|
._1e02idpf{inset-inline-start:0}
|
|
4
4
|
._1e0c1ule{display:block}
|
|
5
|
+
._1kt9j9bv:before{content:attr(data-heading-number) "."}
|
|
6
|
+
._1mbqu2gc:before{margin-inline-end:var(--ds-space-100,8px)}
|
|
5
7
|
._1pbykb7n{z-index:1}
|
|
8
|
+
._1wqoglyw:before{-webkit-user-select:none;-ms-user-select:none;user-select:none}
|
|
6
9
|
._ahbqukr8{margin-inline-start:var(--ds-space-negative-400,-2pc)}
|
|
7
10
|
._bozgxy5q{padding-inline-start:var(--ds-space-400,2pc)}
|
|
8
11
|
._kqswh2mm{position:relative}
|
|
@@ -29,6 +29,9 @@ function hasRightAlignmentMark(marks) {
|
|
|
29
29
|
}
|
|
30
30
|
return marks.some(mark => mark.type.name === 'alignment' && mark.attrs.align === 'end');
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
// Matches the editor's decoration-based number prefix without changing heading text or IDs.
|
|
34
|
+
const numberedHeadingStyles = null;
|
|
32
35
|
const wrapperStyles = null;
|
|
33
36
|
const collapsibleHeadingWrapperStyles = null;
|
|
34
37
|
const collapsibleHeadingButtonStyles = null;
|
|
@@ -190,12 +193,14 @@ function HeadingWithDuplicateAnchor(props) {
|
|
|
190
193
|
}
|
|
191
194
|
};
|
|
192
195
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HX, {
|
|
196
|
+
"data-heading-number": props.headingNumber,
|
|
193
197
|
id: headingIdToUse,
|
|
194
198
|
"data-local-id": localId,
|
|
195
199
|
"data-renderer-start-pos": dataAttributes['data-renderer-start-pos'],
|
|
196
200
|
"data-as-inline": asInline,
|
|
197
201
|
onMouseEnter: mouseEnterHandler,
|
|
198
|
-
tabIndex: -1
|
|
202
|
+
tabIndex: -1,
|
|
203
|
+
className: ax([props.headingNumber && "_1kt9j9bv _1mbqu2gc _1wqoglyw"])
|
|
199
204
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, showAnchorLink && headingId && isRightAligned && /*#__PURE__*/React.createElement(WrappedHeadingAnchor, {
|
|
200
205
|
level: props.level,
|
|
201
206
|
enableNestedHeaderLinks: enableNestedHeaderLinks,
|
|
@@ -281,12 +286,14 @@ function HeadingWithWrapper(props) {
|
|
|
281
286
|
headingId: headingId,
|
|
282
287
|
hideFromScreenReader: false
|
|
283
288
|
}), /*#__PURE__*/React.createElement(HX, {
|
|
289
|
+
"data-heading-number": props.headingNumber,
|
|
284
290
|
id: headingIdToUse,
|
|
285
291
|
"data-local-id": localId,
|
|
286
292
|
"data-renderer-start-pos": dataAttributes['data-renderer-start-pos'],
|
|
287
293
|
"data-as-inline": asInline,
|
|
288
294
|
onMouseEnter: collapsibleHeading ? undefined : mouseEnterHandler,
|
|
289
|
-
tabIndex: -1
|
|
295
|
+
tabIndex: -1,
|
|
296
|
+
className: ax([props.headingNumber && "_1kt9j9bv _1mbqu2gc _1wqoglyw"])
|
|
290
297
|
}, props.children), showAnchorLink && headingId && !isRightAligned && /*#__PURE__*/React.createElement(WrappedHeadingAnchor, {
|
|
291
298
|
level: props.level,
|
|
292
299
|
enableNestedHeaderLinks: enableNestedHeaderLinks,
|
|
@@ -308,6 +315,7 @@ function Heading({
|
|
|
308
315
|
children,
|
|
309
316
|
dataAttributes,
|
|
310
317
|
headingId,
|
|
318
|
+
headingNumber,
|
|
311
319
|
invisible,
|
|
312
320
|
level,
|
|
313
321
|
localId,
|
|
@@ -324,6 +332,7 @@ function Heading({
|
|
|
324
332
|
allowHeadingAnchorLinks: allowHeadingAnchorLinks,
|
|
325
333
|
dataAttributes: dataAttributes,
|
|
326
334
|
headingId: headingId,
|
|
335
|
+
headingNumber: headingNumber,
|
|
327
336
|
invisible: invisible,
|
|
328
337
|
level: level,
|
|
329
338
|
localId: localId,
|
|
@@ -339,6 +348,7 @@ function Heading({
|
|
|
339
348
|
allowHeadingAnchorLinks: allowHeadingAnchorLinks,
|
|
340
349
|
dataAttributes: dataAttributes,
|
|
341
350
|
headingId: headingId,
|
|
351
|
+
headingNumber: headingNumber,
|
|
342
352
|
invisible: invisible,
|
|
343
353
|
level: level,
|
|
344
354
|
localId: localId,
|
|
@@ -2706,26 +2706,6 @@ const scaledDenseEmojiStyles = css({
|
|
|
2706
2706
|
width: `${defaultInlineEmojiHeight}px`
|
|
2707
2707
|
}
|
|
2708
2708
|
});
|
|
2709
|
-
const scaledDenseUnicodeEmojiStylesNew = css({
|
|
2710
|
-
[`[data-emoji-type="unicode"]`]: {
|
|
2711
|
-
'--emoji-common-unicode-size': `${defaultDenseEmojiHeight}px`
|
|
2712
|
-
},
|
|
2713
|
-
[`h1 [data-emoji-type="unicode"]`]: {
|
|
2714
|
-
'--emoji-common-unicode-size': `${denseEmojiHeightH1}px`
|
|
2715
|
-
},
|
|
2716
|
-
[`h2 [data-emoji-type="unicode"]`]: {
|
|
2717
|
-
'--emoji-common-unicode-size': `${denseEmojiHeightH2}px`
|
|
2718
|
-
},
|
|
2719
|
-
[`h3 [data-emoji-type="unicode"]`]: {
|
|
2720
|
-
'--emoji-common-unicode-size': `${denseEmojiHeightH3}px`
|
|
2721
|
-
},
|
|
2722
|
-
[`h4 [data-emoji-type="unicode"]`]: {
|
|
2723
|
-
'--emoji-common-unicode-size': `${denseEmojiHeightH4}px`
|
|
2724
|
-
},
|
|
2725
|
-
[`:is(h5, h6, p) [data-emoji-type="unicode"]`]: {
|
|
2726
|
-
'--emoji-common-unicode-size': `${defaultDenseEmojiHeight}px`
|
|
2727
|
-
}
|
|
2728
|
-
});
|
|
2729
2709
|
const scaledEmojiStyles = css({
|
|
2730
2710
|
[`.${EmojiSharedCssClassName.EMOJI_IMAGE}`]: {
|
|
2731
2711
|
height: `${defaultEmojiHeight}px`,
|
|
@@ -2768,26 +2748,6 @@ const scaledEmojiStyles = css({
|
|
|
2768
2748
|
width: `${defaultInlineEmojiHeight}px`
|
|
2769
2749
|
}
|
|
2770
2750
|
});
|
|
2771
|
-
const scaledUnicodeEmojiStylesNew = css({
|
|
2772
|
-
[`[data-emoji-type="unicode"]`]: {
|
|
2773
|
-
'--emoji-common-unicode-size': `${defaultEmojiHeight}px`
|
|
2774
|
-
},
|
|
2775
|
-
[`h1 [data-emoji-type="unicode"]`]: {
|
|
2776
|
-
'--emoji-common-unicode-size': `${scaledEmojiHeightH1}px`
|
|
2777
|
-
},
|
|
2778
|
-
[`h2 [data-emoji-type="unicode"]`]: {
|
|
2779
|
-
'--emoji-common-unicode-size': `${scaledEmojiHeightH2}px`
|
|
2780
|
-
},
|
|
2781
|
-
[`h3 [data-emoji-type="unicode"]`]: {
|
|
2782
|
-
'--emoji-common-unicode-size': `${scaledEmojiHeightH3}px`
|
|
2783
|
-
},
|
|
2784
|
-
[`h4 [data-emoji-type="unicode"]`]: {
|
|
2785
|
-
'--emoji-common-unicode-size': `${scaledEmojiHeightH4}px`
|
|
2786
|
-
},
|
|
2787
|
-
[`:is(h5, h6, p) [data-emoji-type="unicode"]`]: {
|
|
2788
|
-
'--emoji-common-unicode-size': `${defaultEmojiHeight}px`
|
|
2789
|
-
}
|
|
2790
|
-
});
|
|
2791
2751
|
const denseStyles = css({
|
|
2792
2752
|
// Scale emoji size based on base font size
|
|
2793
2753
|
// Default: 20px emoji at 16px base font
|
|
@@ -2976,7 +2936,7 @@ export const RendererStyleContainer = props => {
|
|
|
2976
2936
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
2977
2937
|
fg('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor, expandSsrMarginStyles,
|
|
2978
2938
|
// this should be placed after baseOtherStyles
|
|
2979
|
-
isExperimentEnabled('platform_editor_remove_important_in_render_ext') ? extensionAsInlineStyle : oldExtensionAsInlineStyle, fg('platform_forge_inline_bodied_macro') && [migratedInlineBodiedFlowStyle, forgeInlineBodiedSpacingStyle], inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle, firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, tableContentModeScopedStyles, tableContentModeExtensionContainmentStyles, tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && isExperimentEnabled('platform_editor_table_css_overflow_shadow') && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, blockSsrMarginStyles, layoutBlockSsrMarginStyles, browser.safari && codeBlockInListSsrMarginSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max') && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined,
|
|
2939
|
+
isExperimentEnabled('platform_editor_remove_important_in_render_ext') ? extensionAsInlineStyle : oldExtensionAsInlineStyle, fg('platform_forge_inline_bodied_macro') && [migratedInlineBodiedFlowStyle, forgeInlineBodiedSpacingStyle], inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle, firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, tableContentModeScopedStyles, tableContentModeExtensionContainmentStyles, tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && isExperimentEnabled('platform_editor_table_css_overflow_shadow') && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, blockSsrMarginStyles, layoutBlockSsrMarginStyles, browser.safari && codeBlockInListSsrMarginSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max') && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined, syncBlockStyles, centerWrapperStyles, isInsideSyncBlock ? syncBlockRendererStyles : null, isInsideSyncBlock && tableFakeBorderStyles, isInsideSyncBlock && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? roundedTableFakeBorderOverlayStyles : null, hideExtensionStyles],
|
|
2980
2940
|
"data-testid": testId
|
|
2981
2941
|
}, children);
|
|
2982
2942
|
};
|
|
@@ -64,7 +64,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
64
64
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
65
65
|
const RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
66
66
|
const packageName = "@atlaskit/renderer";
|
|
67
|
-
const packageVersion = "150.0.
|
|
67
|
+
const packageVersion = "150.0.7";
|
|
68
68
|
const setAsQueryContainerStyles = css({
|
|
69
69
|
containerName: 'ak-renderer-wrapper',
|
|
70
70
|
containerType: 'inline-size'
|
|
@@ -250,6 +250,7 @@ export const RendererFunctionalComponent = props => {
|
|
|
250
250
|
headingIdPrefix: props.headingIdPrefix,
|
|
251
251
|
disableActions: props.disableActions,
|
|
252
252
|
allowHeadingAnchorLinks: props.allowHeadingAnchorLinks,
|
|
253
|
+
showHeadingNumbers: props.showHeadingNumbers,
|
|
253
254
|
allowColumnSorting: props.allowColumnSorting,
|
|
254
255
|
fireAnalyticsEvent: fireAnalyticsEvent,
|
|
255
256
|
shouldOpenMediaViewer: props.shouldOpenMediaViewer,
|
package/dist/esm/react/index.js
CHANGED
|
@@ -8,12 +8,14 @@ var _excluded = ["key"];
|
|
|
8
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
10
|
import React from 'react';
|
|
11
|
+
import { getHeadingNumbers } from '@atlaskit/editor-common/numbered-headings';
|
|
11
12
|
import { getColumnWidths } from '@atlaskit/editor-common/utils/table';
|
|
12
13
|
import { getMarksByOrder } from '@atlaskit/editor-common/utils/validator';
|
|
13
14
|
import { isSameMark } from '@atlaskit/editor-common/validator';
|
|
14
15
|
import { MarkType } from '@atlaskit/editor-prosemirror/model';
|
|
15
16
|
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
16
17
|
import { expVal } from '@atlaskit/platform-feature-experiments/exp-val';
|
|
18
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
17
19
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
18
20
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
19
21
|
import { mergeExpandBodyText, withExpandBodyBlock } from '../ui/utils/expand-body';
|
|
@@ -44,6 +46,8 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
44
46
|
var _this = this;
|
|
45
47
|
_classCallCheck(this, ReactSerializer);
|
|
46
48
|
_defineProperty(this, "headingIds", []);
|
|
49
|
+
_defineProperty(this, "headingNumbers", []);
|
|
50
|
+
_defineProperty(this, "headingNumberIndex", 0);
|
|
47
51
|
/**
|
|
48
52
|
* The reason we have this extra array here is because we need to generate the same unique
|
|
49
53
|
* heading id for 2 different nodes: headers and expands (check the implementation of
|
|
@@ -196,6 +200,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
196
200
|
this.headingIdPrefix = init.headingIdPrefix;
|
|
197
201
|
this.disableActions = init.disableActions;
|
|
198
202
|
this.allowHeadingAnchorLinks = init.allowHeadingAnchorLinks;
|
|
203
|
+
this.showHeadingNumbers = init.showHeadingNumbers === true && isExperimentEnabled('platform_editor_numbered_headings');
|
|
199
204
|
this.allowCopyToClipboard = init.allowCopyToClipboard;
|
|
200
205
|
this.allowDownloadCodeBlock = init.allowDownloadCodeBlock;
|
|
201
206
|
this.allowWrapCodeBlock = init.allowWrapCodeBlock;
|
|
@@ -236,6 +241,8 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
236
241
|
key: "resetState",
|
|
237
242
|
value: function resetState() {
|
|
238
243
|
this.headingIds = [];
|
|
244
|
+
this.headingNumbers = [];
|
|
245
|
+
this.headingNumberIndex = 0;
|
|
239
246
|
this.expandHeadingIds = [];
|
|
240
247
|
this.startPos = this.initStartPos;
|
|
241
248
|
}
|
|
@@ -314,6 +321,17 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
314
321
|
// This makes sure that we reset internal state on re-render.
|
|
315
322
|
if (key === 'root-0') {
|
|
316
323
|
this.resetState();
|
|
324
|
+
if (this.showHeadingNumbers) {
|
|
325
|
+
var levels = [];
|
|
326
|
+
fragment.descendants(function (node) {
|
|
327
|
+
if (node.type.name === 'heading') {
|
|
328
|
+
levels.push(Number(node.attrs.level));
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
return !node.isTextblock && !node.isLeaf;
|
|
332
|
+
});
|
|
333
|
+
this.headingNumbers = getHeadingNumbers(levels);
|
|
334
|
+
}
|
|
317
335
|
}
|
|
318
336
|
return this.renderNode(target, props, key, mergeExpandBodyText(this.getChildNodes(fragment, !(parentInfo !== null && parentInfo !== void 0 && parentInfo.path.length)).map(function (node, index) {
|
|
319
337
|
if (isTextWrapper(node)) {
|
|
@@ -742,6 +760,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
742
760
|
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
743
761
|
return _objectSpread(_objectSpread({}, this.getProps(node, path)), {}, {
|
|
744
762
|
headingId: this.getHeadingId(node, this.headingIds),
|
|
763
|
+
headingNumber: this.showHeadingNumbers ? this.headingNumbers[this.headingNumberIndex++] : undefined,
|
|
745
764
|
showAnchorLink: this.appearance !== 'comment' && this.allowHeadingAnchorLinks && !this.disableHeadingIDs && this.headingAnchorSupported(path)
|
|
746
765
|
});
|
|
747
766
|
}
|
|
@@ -82,7 +82,6 @@ var EmojiNode = /*#__PURE__*/function (_PureComponent) {
|
|
|
82
82
|
shortName: shortName
|
|
83
83
|
}),
|
|
84
84
|
editorEmoji: true,
|
|
85
|
-
renderUnicodeEmojiAsImage: false,
|
|
86
85
|
onEmojiLoadSuccess: resourceConfig === null || resourceConfig === void 0 ? void 0 : resourceConfig.onEmojiLoadSuccess,
|
|
87
86
|
onEmojiLoadFail: resourceConfig === null || resourceConfig === void 0 ? void 0 : resourceConfig.onEmojiLoadFail
|
|
88
87
|
});
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
._152tidpf{inset-block-start:0}
|
|
3
3
|
._1e02idpf{inset-inline-start:0}
|
|
4
4
|
._1e0c1ule{display:block}
|
|
5
|
+
._1kt9j9bv:before{content:attr(data-heading-number) "."}
|
|
6
|
+
._1mbqu2gc:before{margin-inline-end:var(--ds-space-100,8px)}
|
|
5
7
|
._1pbykb7n{z-index:1}
|
|
8
|
+
._1wqoglyw:before{-webkit-user-select:none;-ms-user-select:none;user-select:none}
|
|
6
9
|
._ahbqukr8{margin-inline-start:var(--ds-space-negative-400,-2pc)}
|
|
7
10
|
._bozgxy5q{padding-inline-start:var(--ds-space-400,2pc)}
|
|
8
11
|
._kqswh2mm{position:relative}
|
|
@@ -34,6 +34,9 @@ function hasRightAlignmentMark(marks) {
|
|
|
34
34
|
return mark.type.name === 'alignment' && mark.attrs.align === 'end';
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
// Matches the editor's decoration-based number prefix without changing heading text or IDs.
|
|
39
|
+
var numberedHeadingStyles = null;
|
|
37
40
|
var wrapperStyles = null;
|
|
38
41
|
var collapsibleHeadingWrapperStyles = null;
|
|
39
42
|
var collapsibleHeadingButtonStyles = null;
|
|
@@ -214,12 +217,14 @@ function HeadingWithDuplicateAnchor(props) {
|
|
|
214
217
|
}
|
|
215
218
|
};
|
|
216
219
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HX, {
|
|
220
|
+
"data-heading-number": props.headingNumber,
|
|
217
221
|
id: headingIdToUse,
|
|
218
222
|
"data-local-id": localId,
|
|
219
223
|
"data-renderer-start-pos": dataAttributes['data-renderer-start-pos'],
|
|
220
224
|
"data-as-inline": asInline,
|
|
221
225
|
onMouseEnter: mouseEnterHandler,
|
|
222
|
-
tabIndex: -1
|
|
226
|
+
tabIndex: -1,
|
|
227
|
+
className: ax([props.headingNumber && "_1kt9j9bv _1mbqu2gc _1wqoglyw"])
|
|
223
228
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, showAnchorLink && headingId && isRightAligned && /*#__PURE__*/React.createElement(WrappedHeadingAnchor, {
|
|
224
229
|
level: props.level,
|
|
225
230
|
enableNestedHeaderLinks: enableNestedHeaderLinks,
|
|
@@ -315,12 +320,14 @@ function HeadingWithWrapper(props) {
|
|
|
315
320
|
headingId: headingId,
|
|
316
321
|
hideFromScreenReader: false
|
|
317
322
|
}), /*#__PURE__*/React.createElement(HX, {
|
|
323
|
+
"data-heading-number": props.headingNumber,
|
|
318
324
|
id: headingIdToUse,
|
|
319
325
|
"data-local-id": localId,
|
|
320
326
|
"data-renderer-start-pos": dataAttributes['data-renderer-start-pos'],
|
|
321
327
|
"data-as-inline": asInline,
|
|
322
328
|
onMouseEnter: collapsibleHeading ? undefined : mouseEnterHandler,
|
|
323
|
-
tabIndex: -1
|
|
329
|
+
tabIndex: -1,
|
|
330
|
+
className: ax([props.headingNumber && "_1kt9j9bv _1mbqu2gc _1wqoglyw"])
|
|
324
331
|
}, props.children), showAnchorLink && headingId && !isRightAligned && /*#__PURE__*/React.createElement(WrappedHeadingAnchor, {
|
|
325
332
|
level: props.level,
|
|
326
333
|
enableNestedHeaderLinks: enableNestedHeaderLinks,
|
|
@@ -342,6 +349,7 @@ function Heading(_ref5) {
|
|
|
342
349
|
children = _ref5.children,
|
|
343
350
|
dataAttributes = _ref5.dataAttributes,
|
|
344
351
|
headingId = _ref5.headingId,
|
|
352
|
+
headingNumber = _ref5.headingNumber,
|
|
345
353
|
invisible = _ref5.invisible,
|
|
346
354
|
level = _ref5.level,
|
|
347
355
|
localId = _ref5.localId,
|
|
@@ -357,6 +365,7 @@ function Heading(_ref5) {
|
|
|
357
365
|
allowHeadingAnchorLinks: allowHeadingAnchorLinks,
|
|
358
366
|
dataAttributes: dataAttributes,
|
|
359
367
|
headingId: headingId,
|
|
368
|
+
headingNumber: headingNumber,
|
|
360
369
|
invisible: invisible,
|
|
361
370
|
level: level,
|
|
362
371
|
localId: localId,
|
|
@@ -372,6 +381,7 @@ function Heading(_ref5) {
|
|
|
372
381
|
allowHeadingAnchorLinks: allowHeadingAnchorLinks,
|
|
373
382
|
dataAttributes: dataAttributes,
|
|
374
383
|
headingId: headingId,
|
|
384
|
+
headingNumber: headingNumber,
|
|
375
385
|
invisible: invisible,
|
|
376
386
|
level: level,
|
|
377
387
|
localId: localId,
|
|
@@ -2128,19 +2128,6 @@ var scaledDenseEmojiStyles = css(_defineProperty(_defineProperty(_defineProperty
|
|
|
2128
2128
|
height: "".concat(defaultInlineEmojiHeight, "px"),
|
|
2129
2129
|
width: "".concat(defaultInlineEmojiHeight, "px")
|
|
2130
2130
|
}));
|
|
2131
|
-
var scaledDenseUnicodeEmojiStylesNew = css(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "[data-emoji-type=\"unicode\"]", {
|
|
2132
|
-
'--emoji-common-unicode-size': "".concat(defaultDenseEmojiHeight, "px")
|
|
2133
|
-
}), "h1 [data-emoji-type=\"unicode\"]", {
|
|
2134
|
-
'--emoji-common-unicode-size': "".concat(denseEmojiHeightH1, "px")
|
|
2135
|
-
}), "h2 [data-emoji-type=\"unicode\"]", {
|
|
2136
|
-
'--emoji-common-unicode-size': "".concat(denseEmojiHeightH2, "px")
|
|
2137
|
-
}), "h3 [data-emoji-type=\"unicode\"]", {
|
|
2138
|
-
'--emoji-common-unicode-size': "".concat(denseEmojiHeightH3, "px")
|
|
2139
|
-
}), "h4 [data-emoji-type=\"unicode\"]", {
|
|
2140
|
-
'--emoji-common-unicode-size': "".concat(denseEmojiHeightH4, "px")
|
|
2141
|
-
}), ":is(h5, h6, p) [data-emoji-type=\"unicode\"]", {
|
|
2142
|
-
'--emoji-common-unicode-size': "".concat(defaultDenseEmojiHeight, "px")
|
|
2143
|
-
}));
|
|
2144
2131
|
var scaledEmojiStyles = css(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ".".concat(EmojiSharedCssClassName.EMOJI_IMAGE), {
|
|
2145
2132
|
height: "".concat(defaultEmojiHeight, "px"),
|
|
2146
2133
|
minHeight: "".concat(defaultEmojiHeight, "px"),
|
|
@@ -2174,19 +2161,6 @@ var scaledEmojiStyles = css(_defineProperty(_defineProperty(_defineProperty(_def
|
|
|
2174
2161
|
height: "".concat(defaultInlineEmojiHeight, "px"),
|
|
2175
2162
|
width: "".concat(defaultInlineEmojiHeight, "px")
|
|
2176
2163
|
}));
|
|
2177
|
-
var scaledUnicodeEmojiStylesNew = css(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "[data-emoji-type=\"unicode\"]", {
|
|
2178
|
-
'--emoji-common-unicode-size': "".concat(defaultEmojiHeight, "px")
|
|
2179
|
-
}), "h1 [data-emoji-type=\"unicode\"]", {
|
|
2180
|
-
'--emoji-common-unicode-size': "".concat(scaledEmojiHeightH1, "px")
|
|
2181
|
-
}), "h2 [data-emoji-type=\"unicode\"]", {
|
|
2182
|
-
'--emoji-common-unicode-size': "".concat(scaledEmojiHeightH2, "px")
|
|
2183
|
-
}), "h3 [data-emoji-type=\"unicode\"]", {
|
|
2184
|
-
'--emoji-common-unicode-size': "".concat(scaledEmojiHeightH3, "px")
|
|
2185
|
-
}), "h4 [data-emoji-type=\"unicode\"]", {
|
|
2186
|
-
'--emoji-common-unicode-size': "".concat(scaledEmojiHeightH4, "px")
|
|
2187
|
-
}), ":is(h5, h6, p) [data-emoji-type=\"unicode\"]", {
|
|
2188
|
-
'--emoji-common-unicode-size': "".concat(defaultEmojiHeight, "px")
|
|
2189
|
-
}));
|
|
2190
2164
|
var denseStyles = css(_defineProperty(_defineProperty(_defineProperty({}, ".".concat(EmojiSharedCssClassName.EMOJI_IMAGE), {
|
|
2191
2165
|
height: "calc(".concat(defaultEmojiHeight, " * var(--ak-renderer-base-font-size) / ").concat(akEditorFullPageDefaultFontSize, ")"),
|
|
2192
2166
|
width: "calc(".concat(defaultEmojiHeight, " * var(--ak-renderer-base-font-size) / ").concat(akEditorFullPageDefaultFontSize, ")"),
|
|
@@ -2333,7 +2307,7 @@ export var RendererStyleContainer = function RendererStyleContainer(props) {
|
|
|
2333
2307
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
2334
2308
|
fg('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor, expandSsrMarginStyles,
|
|
2335
2309
|
// this should be placed after baseOtherStyles
|
|
2336
|
-
isExperimentEnabled('platform_editor_remove_important_in_render_ext') ? extensionAsInlineStyle : oldExtensionAsInlineStyle, fg('platform_forge_inline_bodied_macro') && [migratedInlineBodiedFlowStyle, forgeInlineBodiedSpacingStyle], inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle, firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, tableContentModeScopedStyles, tableContentModeExtensionContainmentStyles, tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && isExperimentEnabled('platform_editor_table_css_overflow_shadow') && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, blockSsrMarginStyles, layoutBlockSsrMarginStyles, browser.safari && codeBlockInListSsrMarginSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max') && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined,
|
|
2310
|
+
isExperimentEnabled('platform_editor_remove_important_in_render_ext') ? extensionAsInlineStyle : oldExtensionAsInlineStyle, fg('platform_forge_inline_bodied_macro') && [migratedInlineBodiedFlowStyle, forgeInlineBodiedSpacingStyle], inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle, firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, tableContentModeScopedStyles, tableContentModeExtensionContainmentStyles, tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && isExperimentEnabled('platform_editor_table_css_overflow_shadow') && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, blockSsrMarginStyles, layoutBlockSsrMarginStyles, browser.safari && codeBlockInListSsrMarginSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max') && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined, syncBlockStyles, centerWrapperStyles, isInsideSyncBlock ? syncBlockRendererStyles : null, isInsideSyncBlock && tableFakeBorderStyles, isInsideSyncBlock && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? roundedTableFakeBorderOverlayStyles : null, hideExtensionStyles],
|
|
2337
2311
|
"data-testid": testId
|
|
2338
2312
|
}, children);
|
|
2339
2313
|
};
|
|
@@ -69,7 +69,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
69
69
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
70
70
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
71
71
|
var packageName = "@atlaskit/renderer";
|
|
72
|
-
var packageVersion = "150.0.
|
|
72
|
+
var packageVersion = "150.0.7";
|
|
73
73
|
var setAsQueryContainerStyles = css({
|
|
74
74
|
containerName: 'ak-renderer-wrapper',
|
|
75
75
|
containerType: 'inline-size'
|
|
@@ -249,6 +249,7 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
249
249
|
headingIdPrefix: props.headingIdPrefix,
|
|
250
250
|
disableActions: props.disableActions,
|
|
251
251
|
allowHeadingAnchorLinks: props.allowHeadingAnchorLinks,
|
|
252
|
+
showHeadingNumbers: props.showHeadingNumbers,
|
|
252
253
|
allowColumnSorting: props.allowColumnSorting,
|
|
253
254
|
fireAnalyticsEvent: _fireAnalyticsEvent,
|
|
254
255
|
shouldOpenMediaViewer: props.shouldOpenMediaViewer,
|
|
@@ -53,6 +53,7 @@ export interface ReactSerializerInit {
|
|
|
53
53
|
providers?: ProviderFactory;
|
|
54
54
|
shouldDisplayExtensionAsInline?: (extensionParams: ExtensionParams<Parameters>) => boolean;
|
|
55
55
|
shouldOpenMediaViewer?: boolean;
|
|
56
|
+
showHeadingNumbers?: boolean;
|
|
56
57
|
smartLinks?: SmartLinksOptions;
|
|
57
58
|
/**
|
|
58
59
|
* Used for to set positions on nodes for annotations.
|
|
@@ -81,6 +82,9 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
|
|
|
81
82
|
private headingIdPrefix?;
|
|
82
83
|
private disableActions?;
|
|
83
84
|
private headingIds;
|
|
85
|
+
private showHeadingNumbers;
|
|
86
|
+
private headingNumbers;
|
|
87
|
+
private headingNumberIndex;
|
|
84
88
|
/**
|
|
85
89
|
* The reason we have this extra array here is because we need to generate the same unique
|
|
86
90
|
* heading id for 2 different nodes: headers and expands (check the implementation of
|
|
@@ -10,6 +10,7 @@ export type HeadingLevels = 1 | 2 | 3 | 4 | 5 | 6;
|
|
|
10
10
|
type HeadingProps = NodeProps<{
|
|
11
11
|
allowHeadingAnchorLinks?: HeadingAnchorLinksProps;
|
|
12
12
|
headingId?: string;
|
|
13
|
+
headingNumber?: string;
|
|
13
14
|
invisible?: boolean;
|
|
14
15
|
level: HeadingLevels;
|
|
15
16
|
localId?: string;
|
|
@@ -23,5 +24,5 @@ type HeadingProps = NodeProps<{
|
|
|
23
24
|
* - Otherwise preserves HeadingWithDuplicateAnchor (old structure), adding only the collapse
|
|
24
25
|
* container when the top-level heading is collapsible
|
|
25
26
|
*/
|
|
26
|
-
declare function Heading({ allowHeadingAnchorLinks, children, dataAttributes, headingId, invisible, level, localId, marks, nodeType, path, showAnchorLink, serializer, asInline, }: HeadingProps): React.JSX.Element;
|
|
27
|
+
declare function Heading({ allowHeadingAnchorLinks, children, dataAttributes, headingId, headingNumber, invisible, level, localId, marks, nodeType, path, showAnchorLink, serializer, asInline, }: HeadingProps): React.JSX.Element;
|
|
27
28
|
export default Heading;
|
|
@@ -215,6 +215,11 @@ export interface RendererProps {
|
|
|
215
215
|
shouldDisplayExtensionAsInline?: (extensionParams: ExtensionParams<Parameters>) => boolean;
|
|
216
216
|
shouldOpenMediaViewer?: boolean;
|
|
217
217
|
shouldRemoveEmptySpaceAroundContent?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Displays decimal outline numbers on headings when platform_editor_numbered_headings is enabled.
|
|
220
|
+
* Defaults to false. Numbering is local to this renderer and does not change the document.
|
|
221
|
+
*/
|
|
222
|
+
showHeadingNumbers?: boolean;
|
|
218
223
|
smartLinks?: SmartLinksOptions;
|
|
219
224
|
stickyHeaders?: StickyHeaderProps;
|
|
220
225
|
textHighlighter?: TextHighlighter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "151.0.0",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"@atlaskit/editor-json-transformer": "^10.0.0",
|
|
48
48
|
"@atlaskit/editor-palette": "^3.5.0",
|
|
49
49
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
50
|
-
"@atlaskit/editor-shared-styles": "^4.
|
|
50
|
+
"@atlaskit/editor-shared-styles": "^4.5.0",
|
|
51
51
|
"@atlaskit/editor-smart-link-draggable": "^1.2.0",
|
|
52
|
-
"@atlaskit/emoji": "^
|
|
52
|
+
"@atlaskit/emoji": "^73.0.0",
|
|
53
53
|
"@atlaskit/feature-gate-js-client": "^7.0.0",
|
|
54
54
|
"@atlaskit/icon": "^38.0.0",
|
|
55
55
|
"@atlaskit/link": "^5.1.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"uuid": "^11.1.1"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
|
-
"@atlaskit/editor-common": "^
|
|
91
|
+
"@atlaskit/editor-common": "^132.0.0",
|
|
92
92
|
"@atlaskit/link-provider": "^6.0.0",
|
|
93
93
|
"@atlaskit/media-core": "^39.0.0",
|
|
94
94
|
"react": "^18.2.0 || ^19.2.0",
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
"@af/visual-regression": "workspace:^",
|
|
101
101
|
"@atlaskit/analytics-gas-types": "^6.2.0",
|
|
102
102
|
"@atlaskit/checkbox": "^19.3.0",
|
|
103
|
-
"@atlaskit/editor-plugin-media": "^
|
|
103
|
+
"@atlaskit/editor-plugin-media": "^30.0.0",
|
|
104
104
|
"@atlaskit/editor-test-helpers": "workspace:^",
|
|
105
105
|
"@atlaskit/inline-edit": "^16.4.0",
|
|
106
|
-
"@atlaskit/json-ld-types": "^2.
|
|
106
|
+
"@atlaskit/json-ld-types": "^2.1.0",
|
|
107
107
|
"@atlaskit/link-client-extension": "^8.0.0",
|
|
108
108
|
"@atlaskit/link-provider": "^6.0.0",
|
|
109
109
|
"@atlaskit/link-test-helpers": "^11.2.0",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"@atlaskit/media-integration-test-helpers": "workspace:^",
|
|
112
112
|
"@atlaskit/media-state": "^4.0.0",
|
|
113
113
|
"@atlaskit/media-test-helpers": "^43.0.0",
|
|
114
|
-
"@atlaskit/mention": "^30.
|
|
114
|
+
"@atlaskit/mention": "^30.3.0",
|
|
115
115
|
"@atlaskit/modal-dialog": "^17.0.0",
|
|
116
116
|
"@atlaskit/navigation-system": "^11.3.0",
|
|
117
117
|
"@atlaskit/primitives": "^22.6.0",
|