@atlaskit/renderer 141.0.7 → 142.0.1
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 +30 -0
- package/dist/cjs/react/nodes/heading-anchor-button.compiled.css +16 -0
- package/dist/cjs/react/nodes/heading-anchor-button.js +24 -0
- package/dist/cjs/react/nodes/heading-anchor.js +37 -0
- package/dist/cjs/render-document.js +40 -50
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +15 -5
- package/dist/cjs/ui/Renderer/index.js +2 -2
- package/dist/es2019/react/nodes/heading-anchor-button.compiled.css +16 -0
- package/dist/es2019/react/nodes/heading-anchor-button.js +15 -0
- package/dist/es2019/react/nodes/heading-anchor.js +37 -0
- package/dist/es2019/render-document.js +31 -38
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +12 -1
- package/dist/es2019/ui/Renderer/index.js +2 -2
- package/dist/esm/react/nodes/heading-anchor-button.compiled.css +16 -0
- package/dist/esm/react/nodes/heading-anchor-button.js +15 -0
- package/dist/esm/react/nodes/heading-anchor.js +37 -0
- package/dist/esm/render-document.js +40 -50
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +15 -5
- package/dist/esm/ui/Renderer/index.js +2 -2
- package/dist/types/react/nodes/heading-anchor-button.d.ts +7 -0
- package/dist/types/render-document.d.ts +1 -1
- package/dist/types/ui/renderer-props.d.ts +0 -2
- package/package.json +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 142.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`da64bde78a78c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/da64bde78a78c) -
|
|
8
|
+
Increase heading link targets to at least 24 by 24 pixels when
|
|
9
|
+
platform_editor_heading_link_target_size is enabled.
|
|
10
|
+
|
|
11
|
+
## 142.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [`01047cd51f538`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/01047cd51f538) -
|
|
16
|
+
Clean up `platform_editor_renderer_rm_usespecbasedvalidator` and always use spec-based validation
|
|
17
|
+
in the renderer.
|
|
18
|
+
|
|
19
|
+
Remove the deprecated `useSpecBasedValidator` renderer prop and the fifth `renderDocument`
|
|
20
|
+
argument. Remove this prop from renderer usages and remove the fifth argument from direct
|
|
21
|
+
`renderDocument` calls, shifting any subsequent arguments one position to the left. The legacy
|
|
22
|
+
validator is no longer available through the renderer.
|
|
23
|
+
|
|
24
|
+
Update editor AI renderer consumers to use the permanent validation behavior.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- [`90cc9e3c7fc0c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/90cc9e3c7fc0c) -
|
|
29
|
+
Support gated dark-background styling for the configured Rovo Chat agent mention in editors and
|
|
30
|
+
the renderer.
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
|
|
3
33
|
## 141.0.7
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
._1dqoglyw{border-style:none}._12ji1r31{outline-color:currentColor}
|
|
2
|
+
._12y31o36{outline-width:medium}
|
|
3
|
+
._19bvidpf{padding-left:0}
|
|
4
|
+
._1bah1h6o{justify-content:center}
|
|
5
|
+
._1bsb1tcg{width:24px}
|
|
6
|
+
._1e0c116y{display:inline-flex}
|
|
7
|
+
._1qu2glyw{outline-style:none}
|
|
8
|
+
._4cvr1h6o{align-items:center}
|
|
9
|
+
._4t3i1tcg{height:24px}
|
|
10
|
+
._80omtlke{cursor:pointer}
|
|
11
|
+
._bfhk1j28{background-color:transparent}
|
|
12
|
+
._ca0qidpf{padding-top:0}
|
|
13
|
+
._n3tdidpf{padding-bottom:0}
|
|
14
|
+
._s7n4nkob{vertical-align:middle}
|
|
15
|
+
._u5f3idpf{padding-right:0}
|
|
16
|
+
._vchhusvi{box-sizing:border-box}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* heading-anchor-button.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.default = HeadingAnchorButton;
|
|
10
|
+
require("./heading-anchor-button.compiled.css");
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _runtime = require("@compiled/react/runtime");
|
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
|
+
var buttonStyles = null;
|
|
16
|
+
|
|
17
|
+
/** Heading link button with a minimum 24px pointer target. */
|
|
18
|
+
function HeadingAnchorButton(props) {
|
|
19
|
+
// eslint-disable-next-line react/jsx-props-no-spreading -- Forward the existing heading anchor's accessibility and event props.
|
|
20
|
+
return /*#__PURE__*/React.createElement("button", (0, _extends2.default)({}, props, {
|
|
21
|
+
type: "button",
|
|
22
|
+
className: (0, _runtime.ax)(["_12ji1r31 _1qu2glyw _12y31o36 _1dqoglyw _1e0c116y _vchhusvi _4cvr1h6o _1bah1h6o _1bsb1tcg _4t3i1tcg _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _s7n4nkob _bfhk1j28 _80omtlke"])
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
@@ -23,6 +23,7 @@ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-ex
|
|
|
23
23
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
24
24
|
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
25
25
|
var _messages = require("../../messages");
|
|
26
|
+
var _headingAnchorButton = _interopRequireDefault(require("./heading-anchor-button"));
|
|
26
27
|
var _excluded = ["children"];
|
|
27
28
|
/**
|
|
28
29
|
* @jsxRuntime classic
|
|
@@ -32,12 +33,22 @@ var _excluded = ["children"];
|
|
|
32
33
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
33
34
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
34
35
|
var HeadingAnchorWrapperClassName = exports.HeadingAnchorWrapperClassName = 'heading-anchor-wrapper';
|
|
36
|
+
var headingAnchorWrapperTargetSizeStyles = (0, _react2.css)({
|
|
37
|
+
display: 'inline-flex',
|
|
38
|
+
boxSizing: 'border-box',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
width: '24px',
|
|
42
|
+
height: '24px',
|
|
43
|
+
verticalAlign: 'middle'
|
|
44
|
+
});
|
|
35
45
|
var CopyAnchorWrapperWithRef = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
36
46
|
var children = props.children,
|
|
37
47
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
38
48
|
return (0, _react2.jsx)("span", (0, _extends2.default)({}, rest, {
|
|
39
49
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
40
50
|
className: HeadingAnchorWrapperClassName,
|
|
51
|
+
css: (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_heading_link_target_size') ? headingAnchorWrapperTargetSizeStyles : undefined,
|
|
41
52
|
ref: ref
|
|
42
53
|
}), children);
|
|
43
54
|
});
|
|
@@ -50,6 +61,11 @@ var copyAnchorButtonStyles = (0, _react2.css)({
|
|
|
50
61
|
cursor: 'pointer',
|
|
51
62
|
right: 0
|
|
52
63
|
});
|
|
64
|
+
var scaledLinkIconStyles = (0, _react2.css)({
|
|
65
|
+
display: 'inline-flex',
|
|
66
|
+
transform: 'scale(1.5)',
|
|
67
|
+
transformOrigin: 'center'
|
|
68
|
+
});
|
|
53
69
|
// Ignored via go/ees005
|
|
54
70
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
55
71
|
var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -128,6 +144,27 @@ var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
128
144
|
heading: headingId
|
|
129
145
|
}) : headingId;
|
|
130
146
|
var tabIndex = (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? 0 : hideFromScreenReader ? undefined : -1;
|
|
147
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_heading_link_target_size')) {
|
|
148
|
+
return (0, _react2.jsx)(_headingAnchorButton.default, {
|
|
149
|
+
"data-testid": "anchor-button",
|
|
150
|
+
id: _this.copyLinkId,
|
|
151
|
+
onMouseLeave: _this.resetMessage,
|
|
152
|
+
onBlur: _this.resetMessage,
|
|
153
|
+
onClick: _this.copyToClipboard,
|
|
154
|
+
"aria-hidden": hideFromScreenReader,
|
|
155
|
+
tabIndex: tabIndex,
|
|
156
|
+
"aria-label": hideFromScreenReader ? undefined : _this.state.tooltipMessage,
|
|
157
|
+
"aria-labelledby": hideFromScreenReader ? undefined : labelledBy,
|
|
158
|
+
type: "button"
|
|
159
|
+
}, (0, _react2.jsx)("span", {
|
|
160
|
+
css: scaledLinkIconStyles,
|
|
161
|
+
"data-testid": "scaled-link-icon"
|
|
162
|
+
}, (0, _react2.jsx)(_link.default, {
|
|
163
|
+
label: _this.getCopyAriaLabel(),
|
|
164
|
+
size: "medium",
|
|
165
|
+
color: _this.state.isClicked ? "var(--ds-icon-selected, #1868DB)" : "var(--ds-icon-subtle, #505258)"
|
|
166
|
+
})));
|
|
167
|
+
}
|
|
131
168
|
return (0, _react2.jsx)("button", {
|
|
132
169
|
"data-testid": "anchor-button",
|
|
133
170
|
id: _this.copyLinkId,
|
|
@@ -11,7 +11,6 @@ var _schemaDefault = require("@atlaskit/adf-schema/schema-default");
|
|
|
11
11
|
var _transforms = require("@atlaskit/adf-utils/transforms");
|
|
12
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
13
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
|
-
var _validator = require("@atlaskit/editor-common/validator");
|
|
15
14
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
16
15
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
17
16
|
var _events = require("./analytics/events");
|
|
@@ -34,37 +33,34 @@ var withStopwatch = function withStopwatch(cb) {
|
|
|
34
33
|
|
|
35
34
|
/** Schema-variant escape hatches handed to the ADF validator. */
|
|
36
35
|
|
|
37
|
-
var _validation = function _validation(doc, schema, adfStage,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Forward `adfStage` only when a caller names one. Omitting it keeps stage-0 specs acceptable,
|
|
54
|
-
// which is what a renderer wants: stored documents can contain them, and wrapping such content
|
|
55
|
-
// as unsupported is worse than rendering it. A caller that declares `final` asks for full-ADF
|
|
56
|
-
// strictness and gets it. The legacy branch below reads the same value as a schema selector and
|
|
57
|
-
// so keeps its own `final` default.
|
|
58
|
-
result = skipValidation ? transformedAdf || doc : (0, _utils.validateADFEntity)(schema, transformedAdf || doc, dispatchAnalyticsEvent, validationOverrides, adfStage);
|
|
59
|
-
} else {
|
|
60
|
-
result = (0, _validator.getValidDocument)(doc, schema, adfStage !== null && adfStage !== void 0 ? adfStage : 'final');
|
|
36
|
+
var _validation = function _validation(doc, schema, adfStage, dispatchAnalyticsEvent, skipValidation, validationOverrides) {
|
|
37
|
+
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
38
|
+
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
39
|
+
var _transformMediaLinkMa = (0, _transforms.transformMediaLinkMarks)(doc),
|
|
40
|
+
transformedAdf = _transformMediaLinkMa.transformedAdf,
|
|
41
|
+
isTransformed = _transformMediaLinkMa.isTransformed;
|
|
42
|
+
if (isTransformed && dispatchAnalyticsEvent) {
|
|
43
|
+
dispatchAnalyticsEvent({
|
|
44
|
+
action: _analytics.ACTION.MEDIA_LINK_TRANSFORMED,
|
|
45
|
+
actionSubject: _analytics.ACTION_SUBJECT.RENDERER,
|
|
46
|
+
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
47
|
+
});
|
|
61
48
|
}
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
|
|
50
|
+
// Forward `adfStage` only when a caller names one. Omitting it keeps stage-0 specs acceptable,
|
|
51
|
+
// which is what a renderer wants: stored documents can contain them, and wrapping such content
|
|
52
|
+
// as unsupported is worse than rendering it. A caller that declares `final` asks for full-ADF
|
|
53
|
+
// strictness and gets it.
|
|
54
|
+
var result = skipValidation ? transformedAdf || doc : (0, _utils.validateADFEntity)(schema, transformedAdf || doc, dispatchAnalyticsEvent, validationOverrides, adfStage);
|
|
55
|
+
|
|
56
|
+
// The spec validator can return the original root object when malformed JSON has no node type.
|
|
57
|
+
// Reject it here, matching the legacy validator, before ProseMirror attempts to deserialize it.
|
|
58
|
+
if (!result || typeof result.type !== 'string' || result.type.length === 0) {
|
|
59
|
+
return null;
|
|
64
60
|
}
|
|
65
61
|
|
|
66
62
|
// ProseMirror always require a child under doc
|
|
67
|
-
if (result.type === 'doc'
|
|
63
|
+
if (result.type === 'doc') {
|
|
68
64
|
if (Array.isArray(result.content) && result.content.length === 0) {
|
|
69
65
|
result.content.push({
|
|
70
66
|
type: 'paragraph',
|
|
@@ -149,24 +145,22 @@ var _validation = function _validation(doc, schema, adfStage, useSpecBasedValida
|
|
|
149
145
|
return result;
|
|
150
146
|
};
|
|
151
147
|
var memoValidation = (0, _memoizeOne.default)(_validation, function (newArgs, lastArgs) {
|
|
152
|
-
var _newArgs = (0, _slicedToArray2.default)(newArgs,
|
|
148
|
+
var _newArgs = (0, _slicedToArray2.default)(newArgs, 6),
|
|
153
149
|
newDoc = _newArgs[0],
|
|
154
150
|
newSchema = _newArgs[1],
|
|
155
151
|
newADFStage = _newArgs[2],
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
var _lastArgs = (0, _slicedToArray2.default)(lastArgs, 7),
|
|
152
|
+
/* ignoring dispatchAnalyticsEvent */newSkipValidation = _newArgs[4],
|
|
153
|
+
newValidationOverrides = _newArgs[5];
|
|
154
|
+
var _lastArgs = (0, _slicedToArray2.default)(lastArgs, 6),
|
|
160
155
|
oldDoc = _lastArgs[0],
|
|
161
156
|
oldSchema = _lastArgs[1],
|
|
162
157
|
oldADFStage = _lastArgs[2],
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
oldValidationOverrides = _lastArgs[6];
|
|
158
|
+
/* ignoring dispatchAnalyticsEvent */oldSkipValidation = _lastArgs[4],
|
|
159
|
+
oldValidationOverrides = _lastArgs[5];
|
|
166
160
|
|
|
167
161
|
// `areDocsEqual` may stringify the whole document, so it goes last and only runs once everything
|
|
168
162
|
// cheaper has matched.
|
|
169
|
-
return newSchema === oldSchema && newADFStage === oldADFStage &&
|
|
163
|
+
return newSchema === oldSchema && newADFStage === oldADFStage && newSkipValidation === oldSkipValidation && areValidationOverridesEqual(newValidationOverrides, oldValidationOverrides) && areDocsEqual(newDoc, oldDoc);
|
|
170
164
|
});
|
|
171
165
|
|
|
172
166
|
// Ignored via go/ees005
|
|
@@ -260,22 +254,18 @@ var memoCreateNodeAndCheck = (0, _memoizeOne.default)(_createNodeAndCheck, funct
|
|
|
260
254
|
var renderDocument = exports.renderDocument = function renderDocument(doc, serializer) {
|
|
261
255
|
var schema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _schemaDefault.defaultSchema;
|
|
262
256
|
var adfStage = arguments.length > 3 ? arguments[3] : undefined;
|
|
263
|
-
var
|
|
264
|
-
var
|
|
265
|
-
var
|
|
266
|
-
var
|
|
267
|
-
var
|
|
268
|
-
var
|
|
269
|
-
var
|
|
270
|
-
var validationOverrides = arguments.length > 11 ? arguments[11] : undefined;
|
|
257
|
+
var rendererId = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'noid';
|
|
258
|
+
var dispatchAnalyticsEvent = arguments.length > 5 ? arguments[5] : undefined;
|
|
259
|
+
var unsupportedContentLevelsTracking = arguments.length > 6 ? arguments[6] : undefined;
|
|
260
|
+
var appearance = arguments.length > 7 ? arguments[7] : undefined;
|
|
261
|
+
var includeNodesCountInStats = arguments.length > 8 ? arguments[8] : undefined;
|
|
262
|
+
var skipValidation = arguments.length > 9 ? arguments[9] : undefined;
|
|
263
|
+
var validationOverrides = arguments.length > 10 ? arguments[10] : undefined;
|
|
271
264
|
var stat = {
|
|
272
265
|
sanitizeTime: 0
|
|
273
266
|
};
|
|
274
|
-
if ((0, _fg.fg)('platform_editor_renderer_rm_usespecbasedvalidator')) {
|
|
275
|
-
useSpecBasedValidator = true;
|
|
276
|
-
}
|
|
277
267
|
var _withStopwatch = withStopwatch(function () {
|
|
278
|
-
return memoValidation(doc, schema, adfStage,
|
|
268
|
+
return memoValidation(doc, schema, adfStage, dispatchAnalyticsEvent, skipValidation, validationOverrides);
|
|
279
269
|
}),
|
|
280
270
|
validDoc = _withStopwatch.output,
|
|
281
271
|
sanitizeTime = _withStopwatch.time;
|
|
@@ -304,7 +294,7 @@ var renderDocument = exports.renderDocument = function renderDocument(doc, seria
|
|
|
304
294
|
|
|
305
295
|
// save serialize tree time to stats
|
|
306
296
|
stat.serializeTime = serializeTime;
|
|
307
|
-
if (dispatchAnalyticsEvent
|
|
297
|
+
if (dispatchAnalyticsEvent) {
|
|
308
298
|
(0, _utils.findAndTrackUnsupportedContentNodes)(node, schema, dispatchAnalyticsEvent);
|
|
309
299
|
if (unsupportedContentLevelsTracking !== null && unsupportedContentLevelsTracking !== void 0 && unsupportedContentLevelsTracking.enabled) {
|
|
310
300
|
var documentData = {
|
|
@@ -30,7 +30,7 @@ var _table2 = require("../../react/nodes/table");
|
|
|
30
30
|
var _collapsibleHeadingsDom = require("../collapsible-headings-dom");
|
|
31
31
|
var _getBaseFontSize = require("./get-base-font-size");
|
|
32
32
|
var _style = require("./style");
|
|
33
|
-
var
|
|
33
|
+
var _css0, _$concat3, _$concat5;
|
|
34
34
|
/* eslint-disable @atlaskit/ui-styling-standard/no-important-styles, @atlaskit/ui-styling-standard/no-unsafe-selectors */
|
|
35
35
|
/* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
|
|
36
36
|
/* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values */
|
|
@@ -554,6 +554,16 @@ var headingWrapperInlineFlowStyles = (0, _react.css)((0, _defineProperty2.defaul
|
|
|
554
554
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-space
|
|
555
555
|
marginTop: '1.59091em'
|
|
556
556
|
}));
|
|
557
|
+
var headingAnchorWrapperTargetSizeStyles = (0, _react.css)((0, _defineProperty2.default)({
|
|
558
|
+
'& .renderer-heading-wrapper > h1, & .renderer-heading-wrapper > h2, & .renderer-heading-wrapper > h3, & .renderer-heading-wrapper > h4, & .renderer-heading-wrapper > h5, & .renderer-heading-wrapper > h6': {
|
|
559
|
+
verticalAlign: 'middle'
|
|
560
|
+
}
|
|
561
|
+
}, "& .renderer-heading-wrapper > .".concat(_headingAnchor.HeadingAnchorWrapperClassName), {
|
|
562
|
+
display: 'inline-flex',
|
|
563
|
+
alignItems: 'center',
|
|
564
|
+
justifyContent: 'center',
|
|
565
|
+
verticalAlign: 'middle'
|
|
566
|
+
}));
|
|
557
567
|
var headingWithAlignmentStylesDuplicateAnchor = (0, _react.css)({
|
|
558
568
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
559
569
|
'.fabric-editor-block-mark.fabric-editor-alignment:not(:first-child)': {
|
|
@@ -644,13 +654,13 @@ var paragraphStylesUGCScaledMargin = (0, _react.css)({
|
|
|
644
654
|
marginBottom: 0
|
|
645
655
|
}
|
|
646
656
|
});
|
|
647
|
-
var listsSharedStyles = (0, _react.css)((
|
|
657
|
+
var listsSharedStyles = (0, _react.css)((_css0 = {
|
|
648
658
|
/* =============== INDENTATION SPACING ========= */
|
|
649
659
|
'ul, ol': {
|
|
650
660
|
boxSizing: 'border-box',
|
|
651
661
|
paddingLeft: "var(--ed--list--item-counter--padding, ".concat(_styles.listItemCounterPadding, "px)")
|
|
652
662
|
}
|
|
653
|
-
}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(
|
|
663
|
+
}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_css0, "".concat(_orderedList.orderedListSelector, ", ").concat(_bulletList.bulletListSelector), {
|
|
654
664
|
/*
|
|
655
665
|
Ensures list item content adheres to the list's margin instead
|
|
656
666
|
of filling the entire block row. This is important to allow
|
|
@@ -682,7 +692,7 @@ var listsSharedStyles = (0, _react.css)((_css9 = {
|
|
|
682
692
|
listStyleType: 'lower-alpha'
|
|
683
693
|
}), 'ol[data-indent-level="3"], ol[data-indent-level="6"]', {
|
|
684
694
|
listStyleType: 'lower-roman'
|
|
685
|
-
}), (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(
|
|
695
|
+
}), (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_css0, 'ul[data-indent-level="1"], ul[data-indent-level="4"]', {
|
|
686
696
|
listStyleType: 'disc'
|
|
687
697
|
}), 'ul[data-indent-level="2"], ul[data-indent-level="5"]', {
|
|
688
698
|
listStyleType: 'circle'
|
|
@@ -2313,7 +2323,7 @@ var RendererStyleContainer = exports.RendererStyleContainer = function RendererS
|
|
|
2313
2323
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- CSS custom properties for UGC font tokens
|
|
2314
2324
|
'--ak-renderer-editor-font-small-text': _ugcTokens.editorUGCTokensRefreshed['editor.font.body.small']
|
|
2315
2325
|
},
|
|
2316
|
-
css: [(0, _expValEquals.expValEquals)('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && ((0, _expValEquals.expValEquals)('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !(0, _table2.isTableResizingEnabled)(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && ((0, _expValEquals.expValEquals)('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !(0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
|
|
2326
|
+
css: [(0, _expValEquals.expValEquals)('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && ((0, _expValEquals.expValEquals)('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !(0, _table2.isTableResizingEnabled)(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && ((0, _expValEquals.expValEquals)('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_heading_link_target_size') && headingAnchorWrapperTargetSizeStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !(0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
|
|
2317
2327
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
2318
2328
|
textHighlightPaddingStyles, tasksAndDecisionsStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingPanelStyles, smartCardStyles, smartCardStylesAvatarFix, headerSmartCardStyles, smartCardStylesAvatarMarginFix, smartCardStylesAvatarListZeroMarginTop, (0, _fg.fg)('editor_inline_comments_on_inline_nodes') && ((0, _expValEquals.expValEquals)('confluence_fe_renderer_inline_node_mark_color_fix', 'isEnabled', true) ? rendererAnnotationStyles : rendererAnnotationStylesOld),
|
|
2319
2329
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
@@ -71,7 +71,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
71
71
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
72
72
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
73
73
|
var packageName = "@atlaskit/renderer";
|
|
74
|
-
var packageVersion = "
|
|
74
|
+
var packageVersion = "142.0.0";
|
|
75
75
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
76
76
|
containerName: 'ak-renderer-wrapper',
|
|
77
77
|
containerType: 'inline-size'
|
|
@@ -498,7 +498,7 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
498
498
|
try {
|
|
499
499
|
var _rendererContext$feat, _props$media;
|
|
500
500
|
var schema = getSchema(props.schema, props.adfStage);
|
|
501
|
-
var _renderDocument = (0, _.renderDocument)(props.shouldRemoveEmptySpaceAroundContent ? (0, _rendererHelper.removeEmptySpaceAroundContent)(props.document) : props.document, serializer, schema, props.adfStage,
|
|
501
|
+
var _renderDocument = (0, _.renderDocument)(props.shouldRemoveEmptySpaceAroundContent ? (0, _rendererHelper.removeEmptySpaceAroundContent)(props.document) : props.document, serializer, schema, props.adfStage, id, _fireAnalyticsEvent, props.unsupportedContentLevelsTracking, props.appearance, props.includeNodesCountInStats, props.skipValidation, validationOverrides),
|
|
502
502
|
result = _renderDocument.result,
|
|
503
503
|
stat = _renderDocument.stat,
|
|
504
504
|
pmDoc = _renderDocument.pmDoc;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
._1dqoglyw{border-style:none}._12ji1r31{outline-color:currentColor}
|
|
2
|
+
._12y31o36{outline-width:medium}
|
|
3
|
+
._19bvidpf{padding-left:0}
|
|
4
|
+
._1bah1h6o{justify-content:center}
|
|
5
|
+
._1bsb1tcg{width:24px}
|
|
6
|
+
._1e0c116y{display:inline-flex}
|
|
7
|
+
._1qu2glyw{outline-style:none}
|
|
8
|
+
._4cvr1h6o{align-items:center}
|
|
9
|
+
._4t3i1tcg{height:24px}
|
|
10
|
+
._80omtlke{cursor:pointer}
|
|
11
|
+
._bfhk1j28{background-color:transparent}
|
|
12
|
+
._ca0qidpf{padding-top:0}
|
|
13
|
+
._n3tdidpf{padding-bottom:0}
|
|
14
|
+
._s7n4nkob{vertical-align:middle}
|
|
15
|
+
._u5f3idpf{padding-right:0}
|
|
16
|
+
._vchhusvi{box-sizing:border-box}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* heading-anchor-button.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./heading-anchor-button.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
const buttonStyles = null;
|
|
7
|
+
|
|
8
|
+
/** Heading link button with a minimum 24px pointer target. */
|
|
9
|
+
export default function HeadingAnchorButton(props) {
|
|
10
|
+
// eslint-disable-next-line react/jsx-props-no-spreading -- Forward the existing heading anchor's accessibility and event props.
|
|
11
|
+
return /*#__PURE__*/React.createElement("button", _extends({}, props, {
|
|
12
|
+
type: "button",
|
|
13
|
+
className: ax(["_12ji1r31 _1qu2glyw _12y31o36 _1dqoglyw _1e0c116y _vchhusvi _4cvr1h6o _1bah1h6o _1bsb1tcg _4t3i1tcg _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _s7n4nkob _bfhk1j28 _80omtlke"])
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
@@ -15,7 +15,17 @@ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-e
|
|
|
15
15
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
16
16
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
17
17
|
import { headingAnchorLinkMessages } from '../../messages';
|
|
18
|
+
import HeadingAnchorButton from './heading-anchor-button';
|
|
18
19
|
export const HeadingAnchorWrapperClassName = 'heading-anchor-wrapper';
|
|
20
|
+
const headingAnchorWrapperTargetSizeStyles = css({
|
|
21
|
+
display: 'inline-flex',
|
|
22
|
+
boxSizing: 'border-box',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
width: '24px',
|
|
26
|
+
height: '24px',
|
|
27
|
+
verticalAlign: 'middle'
|
|
28
|
+
});
|
|
19
29
|
const CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
20
30
|
const {
|
|
21
31
|
children,
|
|
@@ -24,6 +34,7 @@ const CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
24
34
|
return jsx("span", _extends({}, rest, {
|
|
25
35
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
26
36
|
className: HeadingAnchorWrapperClassName,
|
|
37
|
+
css: isExperimentEnabled('platform_editor_heading_link_target_size') ? headingAnchorWrapperTargetSizeStyles : undefined,
|
|
27
38
|
ref: ref
|
|
28
39
|
}), children);
|
|
29
40
|
});
|
|
@@ -36,6 +47,11 @@ const copyAnchorButtonStyles = css({
|
|
|
36
47
|
cursor: 'pointer',
|
|
37
48
|
right: 0
|
|
38
49
|
});
|
|
50
|
+
const scaledLinkIconStyles = css({
|
|
51
|
+
display: 'inline-flex',
|
|
52
|
+
transform: 'scale(1.5)',
|
|
53
|
+
transformOrigin: 'center'
|
|
54
|
+
});
|
|
39
55
|
// Ignored via go/ees005
|
|
40
56
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
41
57
|
class HeadingAnchor extends React.PureComponent {
|
|
@@ -98,6 +114,27 @@ class HeadingAnchor extends React.PureComponent {
|
|
|
98
114
|
heading: headingId
|
|
99
115
|
}) : headingId;
|
|
100
116
|
const tabIndex = expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? 0 : hideFromScreenReader ? undefined : -1;
|
|
117
|
+
if (isExperimentEnabled('platform_editor_heading_link_target_size')) {
|
|
118
|
+
return jsx(HeadingAnchorButton, {
|
|
119
|
+
"data-testid": "anchor-button",
|
|
120
|
+
id: this.copyLinkId,
|
|
121
|
+
onMouseLeave: this.resetMessage,
|
|
122
|
+
onBlur: this.resetMessage,
|
|
123
|
+
onClick: this.copyToClipboard,
|
|
124
|
+
"aria-hidden": hideFromScreenReader,
|
|
125
|
+
tabIndex: tabIndex,
|
|
126
|
+
"aria-label": hideFromScreenReader ? undefined : this.state.tooltipMessage,
|
|
127
|
+
"aria-labelledby": hideFromScreenReader ? undefined : labelledBy,
|
|
128
|
+
type: "button"
|
|
129
|
+
}, jsx("span", {
|
|
130
|
+
css: scaledLinkIconStyles,
|
|
131
|
+
"data-testid": "scaled-link-icon"
|
|
132
|
+
}, jsx(LinkIcon, {
|
|
133
|
+
label: this.getCopyAriaLabel(),
|
|
134
|
+
size: "medium",
|
|
135
|
+
color: this.state.isClicked ? "var(--ds-icon-selected, #1868DB)" : "var(--ds-icon-subtle, #505258)"
|
|
136
|
+
})));
|
|
137
|
+
}
|
|
101
138
|
return jsx("button", {
|
|
102
139
|
"data-testid": "anchor-button",
|
|
103
140
|
id: this.copyLinkId,
|
|
@@ -6,7 +6,6 @@ import { defaultSchema } from '@atlaskit/adf-schema/schema-default';
|
|
|
6
6
|
import { nativeEmbedsFallbackTransform, transformContainerNodes, transformMediaLinkMarks, transformNestedTablesIncomingDocument } from '@atlaskit/adf-utils/transforms';
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { findAndTrackUnsupportedContentNodes, validateADFEntity } from '@atlaskit/editor-common/utils';
|
|
9
|
-
import { getValidDocument } from '@atlaskit/editor-common/validator';
|
|
10
9
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
10
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
11
|
import { PLATFORM } from './analytics/events';
|
|
@@ -26,38 +25,35 @@ const withStopwatch = cb => {
|
|
|
26
25
|
|
|
27
26
|
/** Schema-variant escape hatches handed to the ADF validator. */
|
|
28
27
|
|
|
29
|
-
const _validation = (doc, schema, adfStage,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Forward `adfStage` only when a caller names one. Omitting it keeps stage-0 specs acceptable,
|
|
47
|
-
// which is what a renderer wants: stored documents can contain them, and wrapping such content
|
|
48
|
-
// as unsupported is worse than rendering it. A caller that declares `final` asks for full-ADF
|
|
49
|
-
// strictness and gets it. The legacy branch below reads the same value as a schema selector and
|
|
50
|
-
// so keeps its own `final` default.
|
|
51
|
-
result = skipValidation ? transformedAdf || doc : validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent, validationOverrides, adfStage);
|
|
52
|
-
} else {
|
|
53
|
-
result = getValidDocument(doc, schema, adfStage !== null && adfStage !== void 0 ? adfStage : 'final');
|
|
28
|
+
const _validation = (doc, schema, adfStage, dispatchAnalyticsEvent, skipValidation, validationOverrides) => {
|
|
29
|
+
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
30
|
+
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
31
|
+
const {
|
|
32
|
+
transformedAdf,
|
|
33
|
+
isTransformed
|
|
34
|
+
} = transformMediaLinkMarks(doc);
|
|
35
|
+
if (isTransformed && dispatchAnalyticsEvent) {
|
|
36
|
+
dispatchAnalyticsEvent({
|
|
37
|
+
action: ACTION.MEDIA_LINK_TRANSFORMED,
|
|
38
|
+
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
39
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
40
|
+
});
|
|
54
41
|
}
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
|
|
43
|
+
// Forward `adfStage` only when a caller names one. Omitting it keeps stage-0 specs acceptable,
|
|
44
|
+
// which is what a renderer wants: stored documents can contain them, and wrapping such content
|
|
45
|
+
// as unsupported is worse than rendering it. A caller that declares `final` asks for full-ADF
|
|
46
|
+
// strictness and gets it.
|
|
47
|
+
let result = skipValidation ? transformedAdf || doc : validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent, validationOverrides, adfStage);
|
|
48
|
+
|
|
49
|
+
// The spec validator can return the original root object when malformed JSON has no node type.
|
|
50
|
+
// Reject it here, matching the legacy validator, before ProseMirror attempts to deserialize it.
|
|
51
|
+
if (!result || typeof result.type !== 'string' || result.type.length === 0) {
|
|
52
|
+
return null;
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
// ProseMirror always require a child under doc
|
|
60
|
-
if (result.type === 'doc'
|
|
56
|
+
if (result.type === 'doc') {
|
|
61
57
|
if (Array.isArray(result.content) && result.content.length === 0) {
|
|
62
58
|
result.content.push({
|
|
63
59
|
type: 'paragraph',
|
|
@@ -145,12 +141,12 @@ const _validation = (doc, schema, adfStage, useSpecBasedValidator, dispatchAnaly
|
|
|
145
141
|
return result;
|
|
146
142
|
};
|
|
147
143
|
const memoValidation = memoizeOne(_validation, (newArgs, lastArgs) => {
|
|
148
|
-
const [newDoc, newSchema, newADFStage
|
|
149
|
-
const [oldDoc, oldSchema, oldADFStage
|
|
144
|
+
const [newDoc, newSchema, newADFStage,, /* ignoring dispatchAnalyticsEvent */newSkipValidation, newValidationOverrides] = newArgs;
|
|
145
|
+
const [oldDoc, oldSchema, oldADFStage,, /* ignoring dispatchAnalyticsEvent */oldSkipValidation, oldValidationOverrides] = lastArgs;
|
|
150
146
|
|
|
151
147
|
// `areDocsEqual` may stringify the whole document, so it goes last and only runs once everything
|
|
152
148
|
// cheaper has matched.
|
|
153
|
-
return newSchema === oldSchema && newADFStage === oldADFStage &&
|
|
149
|
+
return newSchema === oldSchema && newADFStage === oldADFStage && newSkipValidation === oldSkipValidation && areValidationOverridesEqual(newValidationOverrides, oldValidationOverrides) && areDocsEqual(newDoc, oldDoc);
|
|
154
150
|
});
|
|
155
151
|
|
|
156
152
|
// Ignored via go/ees005
|
|
@@ -228,18 +224,15 @@ const memoCreateNodeAndCheck = memoizeOne(_createNodeAndCheck, (newArgs, lastArg
|
|
|
228
224
|
const [oldSchema, oldDoc] = lastArgs;
|
|
229
225
|
return newSchema === oldSchema && areDocsEqual(newDoc, oldDoc);
|
|
230
226
|
});
|
|
231
|
-
export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage,
|
|
227
|
+
export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage, rendererId = 'noid', dispatchAnalyticsEvent, unsupportedContentLevelsTracking, appearance, includeNodesCountInStats, skipValidation, validationOverrides) => {
|
|
232
228
|
const stat = {
|
|
233
229
|
sanitizeTime: 0
|
|
234
230
|
};
|
|
235
|
-
if (fg('platform_editor_renderer_rm_usespecbasedvalidator')) {
|
|
236
|
-
useSpecBasedValidator = true;
|
|
237
|
-
}
|
|
238
231
|
const {
|
|
239
232
|
output: validDoc,
|
|
240
233
|
time: sanitizeTime
|
|
241
234
|
} = withStopwatch(() => {
|
|
242
|
-
return memoValidation(doc, schema, adfStage,
|
|
235
|
+
return memoValidation(doc, schema, adfStage, dispatchAnalyticsEvent, skipValidation, validationOverrides);
|
|
243
236
|
});
|
|
244
237
|
|
|
245
238
|
// save sanitize time to stats
|
|
@@ -268,7 +261,7 @@ export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage
|
|
|
268
261
|
|
|
269
262
|
// save serialize tree time to stats
|
|
270
263
|
stat.serializeTime = serializeTime;
|
|
271
|
-
if (dispatchAnalyticsEvent
|
|
264
|
+
if (dispatchAnalyticsEvent) {
|
|
272
265
|
findAndTrackUnsupportedContentNodes(node, schema, dispatchAnalyticsEvent);
|
|
273
266
|
if (unsupportedContentLevelsTracking !== null && unsupportedContentLevelsTracking !== void 0 && unsupportedContentLevelsTracking.enabled) {
|
|
274
267
|
const documentData = {
|
|
@@ -661,6 +661,17 @@ const headingWrapperInlineFlowStyles = css({
|
|
|
661
661
|
marginTop: '1.59091em'
|
|
662
662
|
}
|
|
663
663
|
});
|
|
664
|
+
const headingAnchorWrapperTargetSizeStyles = css({
|
|
665
|
+
'& .renderer-heading-wrapper > h1, & .renderer-heading-wrapper > h2, & .renderer-heading-wrapper > h3, & .renderer-heading-wrapper > h4, & .renderer-heading-wrapper > h5, & .renderer-heading-wrapper > h6': {
|
|
666
|
+
verticalAlign: 'middle'
|
|
667
|
+
},
|
|
668
|
+
[`& .renderer-heading-wrapper > .${HeadingAnchorWrapperClassName}`]: {
|
|
669
|
+
display: 'inline-flex',
|
|
670
|
+
alignItems: 'center',
|
|
671
|
+
justifyContent: 'center',
|
|
672
|
+
verticalAlign: 'middle'
|
|
673
|
+
}
|
|
674
|
+
});
|
|
664
675
|
const headingWithAlignmentStylesDuplicateAnchor = css({
|
|
665
676
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
666
677
|
'.fabric-editor-block-mark.fabric-editor-alignment:not(:first-child)': {
|
|
@@ -2948,7 +2959,7 @@ export const RendererStyleContainer = props => {
|
|
|
2948
2959
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- CSS custom properties for UGC font tokens
|
|
2949
2960
|
'--ak-renderer-editor-font-small-text': editorUGCTokensRefreshed['editor.font.body.small']
|
|
2950
2961
|
},
|
|
2951
|
-
css: [expValEquals('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
|
|
2962
|
+
css: [expValEquals('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, isExperimentEnabled('platform_editor_heading_link_target_size') && headingAnchorWrapperTargetSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
|
|
2952
2963
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
2953
2964
|
textHighlightPaddingStyles, tasksAndDecisionsStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingPanelStyles, smartCardStyles, smartCardStylesAvatarFix, headerSmartCardStyles, smartCardStylesAvatarMarginFix, smartCardStylesAvatarListZeroMarginTop, fg('editor_inline_comments_on_inline_nodes') && (expValEquals('confluence_fe_renderer_inline_node_mark_color_fix', 'isEnabled', true) ? rendererAnnotationStyles : rendererAnnotationStylesOld),
|
|
2954
2965
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
@@ -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.1;
|
|
58
58
|
const packageName = "@atlaskit/renderer";
|
|
59
|
-
const packageVersion = "
|
|
59
|
+
const packageVersion = "142.0.0";
|
|
60
60
|
const setAsQueryContainerStyles = css({
|
|
61
61
|
containerName: 'ak-renderer-wrapper',
|
|
62
62
|
containerType: 'inline-size'
|
|
@@ -494,7 +494,7 @@ export const RendererFunctionalComponent = props => {
|
|
|
494
494
|
result,
|
|
495
495
|
stat,
|
|
496
496
|
pmDoc
|
|
497
|
-
} = renderDocument(props.shouldRemoveEmptySpaceAroundContent ? removeEmptySpaceAroundContent(props.document) : props.document, serializer, schema, props.adfStage,
|
|
497
|
+
} = renderDocument(props.shouldRemoveEmptySpaceAroundContent ? removeEmptySpaceAroundContent(props.document) : props.document, serializer, schema, props.adfStage, id, fireAnalyticsEvent, props.unsupportedContentLevelsTracking, props.appearance, props.includeNodesCountInStats, props.skipValidation, validationOverrides);
|
|
498
498
|
if (props.onComplete) {
|
|
499
499
|
pendingOnCompleteStatRef.current = stat;
|
|
500
500
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
._1dqoglyw{border-style:none}._12ji1r31{outline-color:currentColor}
|
|
2
|
+
._12y31o36{outline-width:medium}
|
|
3
|
+
._19bvidpf{padding-left:0}
|
|
4
|
+
._1bah1h6o{justify-content:center}
|
|
5
|
+
._1bsb1tcg{width:24px}
|
|
6
|
+
._1e0c116y{display:inline-flex}
|
|
7
|
+
._1qu2glyw{outline-style:none}
|
|
8
|
+
._4cvr1h6o{align-items:center}
|
|
9
|
+
._4t3i1tcg{height:24px}
|
|
10
|
+
._80omtlke{cursor:pointer}
|
|
11
|
+
._bfhk1j28{background-color:transparent}
|
|
12
|
+
._ca0qidpf{padding-top:0}
|
|
13
|
+
._n3tdidpf{padding-bottom:0}
|
|
14
|
+
._s7n4nkob{vertical-align:middle}
|
|
15
|
+
._u5f3idpf{padding-right:0}
|
|
16
|
+
._vchhusvi{box-sizing:border-box}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* heading-anchor-button.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./heading-anchor-button.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
var buttonStyles = null;
|
|
7
|
+
|
|
8
|
+
/** Heading link button with a minimum 24px pointer target. */
|
|
9
|
+
export default function HeadingAnchorButton(props) {
|
|
10
|
+
// eslint-disable-next-line react/jsx-props-no-spreading -- Forward the existing heading anchor's accessibility and event props.
|
|
11
|
+
return /*#__PURE__*/React.createElement("button", _extends({}, props, {
|
|
12
|
+
type: "button",
|
|
13
|
+
className: ax(["_12ji1r31 _1qu2glyw _12y31o36 _1dqoglyw _1e0c116y _vchhusvi _4cvr1h6o _1bah1h6o _1bsb1tcg _4t3i1tcg _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _s7n4nkob _bfhk1j28 _80omtlke"])
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
@@ -26,13 +26,24 @@ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-e
|
|
|
26
26
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
27
27
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
28
28
|
import { headingAnchorLinkMessages } from '../../messages';
|
|
29
|
+
import HeadingAnchorButton from './heading-anchor-button';
|
|
29
30
|
export var HeadingAnchorWrapperClassName = 'heading-anchor-wrapper';
|
|
31
|
+
var headingAnchorWrapperTargetSizeStyles = css({
|
|
32
|
+
display: 'inline-flex',
|
|
33
|
+
boxSizing: 'border-box',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
width: '24px',
|
|
37
|
+
height: '24px',
|
|
38
|
+
verticalAlign: 'middle'
|
|
39
|
+
});
|
|
30
40
|
var CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
31
41
|
var children = props.children,
|
|
32
42
|
rest = _objectWithoutProperties(props, _excluded);
|
|
33
43
|
return jsx("span", _extends({}, rest, {
|
|
34
44
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
35
45
|
className: HeadingAnchorWrapperClassName,
|
|
46
|
+
css: isExperimentEnabled('platform_editor_heading_link_target_size') ? headingAnchorWrapperTargetSizeStyles : undefined,
|
|
36
47
|
ref: ref
|
|
37
48
|
}), children);
|
|
38
49
|
});
|
|
@@ -45,6 +56,11 @@ var copyAnchorButtonStyles = css({
|
|
|
45
56
|
cursor: 'pointer',
|
|
46
57
|
right: 0
|
|
47
58
|
});
|
|
59
|
+
var scaledLinkIconStyles = css({
|
|
60
|
+
display: 'inline-flex',
|
|
61
|
+
transform: 'scale(1.5)',
|
|
62
|
+
transformOrigin: 'center'
|
|
63
|
+
});
|
|
48
64
|
// Ignored via go/ees005
|
|
49
65
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
50
66
|
var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -123,6 +139,27 @@ var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
123
139
|
heading: headingId
|
|
124
140
|
}) : headingId;
|
|
125
141
|
var tabIndex = expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? 0 : hideFromScreenReader ? undefined : -1;
|
|
142
|
+
if (isExperimentEnabled('platform_editor_heading_link_target_size')) {
|
|
143
|
+
return jsx(HeadingAnchorButton, {
|
|
144
|
+
"data-testid": "anchor-button",
|
|
145
|
+
id: _this.copyLinkId,
|
|
146
|
+
onMouseLeave: _this.resetMessage,
|
|
147
|
+
onBlur: _this.resetMessage,
|
|
148
|
+
onClick: _this.copyToClipboard,
|
|
149
|
+
"aria-hidden": hideFromScreenReader,
|
|
150
|
+
tabIndex: tabIndex,
|
|
151
|
+
"aria-label": hideFromScreenReader ? undefined : _this.state.tooltipMessage,
|
|
152
|
+
"aria-labelledby": hideFromScreenReader ? undefined : labelledBy,
|
|
153
|
+
type: "button"
|
|
154
|
+
}, jsx("span", {
|
|
155
|
+
css: scaledLinkIconStyles,
|
|
156
|
+
"data-testid": "scaled-link-icon"
|
|
157
|
+
}, jsx(LinkIcon, {
|
|
158
|
+
label: _this.getCopyAriaLabel(),
|
|
159
|
+
size: "medium",
|
|
160
|
+
color: _this.state.isClicked ? "var(--ds-icon-selected, #1868DB)" : "var(--ds-icon-subtle, #505258)"
|
|
161
|
+
})));
|
|
162
|
+
}
|
|
126
163
|
return jsx("button", {
|
|
127
164
|
"data-testid": "anchor-button",
|
|
128
165
|
id: _this.copyLinkId,
|
|
@@ -7,7 +7,6 @@ import { defaultSchema } from '@atlaskit/adf-schema/schema-default';
|
|
|
7
7
|
import { nativeEmbedsFallbackTransform, transformContainerNodes, transformMediaLinkMarks, transformNestedTablesIncomingDocument } from '@atlaskit/adf-utils/transforms';
|
|
8
8
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import { findAndTrackUnsupportedContentNodes, validateADFEntity } from '@atlaskit/editor-common/utils';
|
|
10
|
-
import { getValidDocument } from '@atlaskit/editor-common/validator';
|
|
11
10
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
12
|
import { PLATFORM } from './analytics/events';
|
|
@@ -27,37 +26,34 @@ var withStopwatch = function withStopwatch(cb) {
|
|
|
27
26
|
|
|
28
27
|
/** Schema-variant escape hatches handed to the ADF validator. */
|
|
29
28
|
|
|
30
|
-
var _validation = function _validation(doc, schema, adfStage,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Forward `adfStage` only when a caller names one. Omitting it keeps stage-0 specs acceptable,
|
|
47
|
-
// which is what a renderer wants: stored documents can contain them, and wrapping such content
|
|
48
|
-
// as unsupported is worse than rendering it. A caller that declares `final` asks for full-ADF
|
|
49
|
-
// strictness and gets it. The legacy branch below reads the same value as a schema selector and
|
|
50
|
-
// so keeps its own `final` default.
|
|
51
|
-
result = skipValidation ? transformedAdf || doc : validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent, validationOverrides, adfStage);
|
|
52
|
-
} else {
|
|
53
|
-
result = getValidDocument(doc, schema, adfStage !== null && adfStage !== void 0 ? adfStage : 'final');
|
|
29
|
+
var _validation = function _validation(doc, schema, adfStage, dispatchAnalyticsEvent, skipValidation, validationOverrides) {
|
|
30
|
+
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
31
|
+
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
32
|
+
var _transformMediaLinkMa = transformMediaLinkMarks(doc),
|
|
33
|
+
transformedAdf = _transformMediaLinkMa.transformedAdf,
|
|
34
|
+
isTransformed = _transformMediaLinkMa.isTransformed;
|
|
35
|
+
if (isTransformed && dispatchAnalyticsEvent) {
|
|
36
|
+
dispatchAnalyticsEvent({
|
|
37
|
+
action: ACTION.MEDIA_LINK_TRANSFORMED,
|
|
38
|
+
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
39
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
40
|
+
});
|
|
54
41
|
}
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
|
|
43
|
+
// Forward `adfStage` only when a caller names one. Omitting it keeps stage-0 specs acceptable,
|
|
44
|
+
// which is what a renderer wants: stored documents can contain them, and wrapping such content
|
|
45
|
+
// as unsupported is worse than rendering it. A caller that declares `final` asks for full-ADF
|
|
46
|
+
// strictness and gets it.
|
|
47
|
+
var result = skipValidation ? transformedAdf || doc : validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent, validationOverrides, adfStage);
|
|
48
|
+
|
|
49
|
+
// The spec validator can return the original root object when malformed JSON has no node type.
|
|
50
|
+
// Reject it here, matching the legacy validator, before ProseMirror attempts to deserialize it.
|
|
51
|
+
if (!result || typeof result.type !== 'string' || result.type.length === 0) {
|
|
52
|
+
return null;
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
// ProseMirror always require a child under doc
|
|
60
|
-
if (result.type === 'doc'
|
|
56
|
+
if (result.type === 'doc') {
|
|
61
57
|
if (Array.isArray(result.content) && result.content.length === 0) {
|
|
62
58
|
result.content.push({
|
|
63
59
|
type: 'paragraph',
|
|
@@ -142,24 +138,22 @@ var _validation = function _validation(doc, schema, adfStage, useSpecBasedValida
|
|
|
142
138
|
return result;
|
|
143
139
|
};
|
|
144
140
|
var memoValidation = memoizeOne(_validation, function (newArgs, lastArgs) {
|
|
145
|
-
var _newArgs = _slicedToArray(newArgs,
|
|
141
|
+
var _newArgs = _slicedToArray(newArgs, 6),
|
|
146
142
|
newDoc = _newArgs[0],
|
|
147
143
|
newSchema = _newArgs[1],
|
|
148
144
|
newADFStage = _newArgs[2],
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
var _lastArgs = _slicedToArray(lastArgs, 7),
|
|
145
|
+
/* ignoring dispatchAnalyticsEvent */newSkipValidation = _newArgs[4],
|
|
146
|
+
newValidationOverrides = _newArgs[5];
|
|
147
|
+
var _lastArgs = _slicedToArray(lastArgs, 6),
|
|
153
148
|
oldDoc = _lastArgs[0],
|
|
154
149
|
oldSchema = _lastArgs[1],
|
|
155
150
|
oldADFStage = _lastArgs[2],
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
oldValidationOverrides = _lastArgs[6];
|
|
151
|
+
/* ignoring dispatchAnalyticsEvent */oldSkipValidation = _lastArgs[4],
|
|
152
|
+
oldValidationOverrides = _lastArgs[5];
|
|
159
153
|
|
|
160
154
|
// `areDocsEqual` may stringify the whole document, so it goes last and only runs once everything
|
|
161
155
|
// cheaper has matched.
|
|
162
|
-
return newSchema === oldSchema && newADFStage === oldADFStage &&
|
|
156
|
+
return newSchema === oldSchema && newADFStage === oldADFStage && newSkipValidation === oldSkipValidation && areValidationOverridesEqual(newValidationOverrides, oldValidationOverrides) && areDocsEqual(newDoc, oldDoc);
|
|
163
157
|
});
|
|
164
158
|
|
|
165
159
|
// Ignored via go/ees005
|
|
@@ -253,22 +247,18 @@ var memoCreateNodeAndCheck = memoizeOne(_createNodeAndCheck, function (newArgs,
|
|
|
253
247
|
export var renderDocument = function renderDocument(doc, serializer) {
|
|
254
248
|
var schema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultSchema;
|
|
255
249
|
var adfStage = arguments.length > 3 ? arguments[3] : undefined;
|
|
256
|
-
var
|
|
257
|
-
var
|
|
258
|
-
var
|
|
259
|
-
var
|
|
260
|
-
var
|
|
261
|
-
var
|
|
262
|
-
var
|
|
263
|
-
var validationOverrides = arguments.length > 11 ? arguments[11] : undefined;
|
|
250
|
+
var rendererId = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'noid';
|
|
251
|
+
var dispatchAnalyticsEvent = arguments.length > 5 ? arguments[5] : undefined;
|
|
252
|
+
var unsupportedContentLevelsTracking = arguments.length > 6 ? arguments[6] : undefined;
|
|
253
|
+
var appearance = arguments.length > 7 ? arguments[7] : undefined;
|
|
254
|
+
var includeNodesCountInStats = arguments.length > 8 ? arguments[8] : undefined;
|
|
255
|
+
var skipValidation = arguments.length > 9 ? arguments[9] : undefined;
|
|
256
|
+
var validationOverrides = arguments.length > 10 ? arguments[10] : undefined;
|
|
264
257
|
var stat = {
|
|
265
258
|
sanitizeTime: 0
|
|
266
259
|
};
|
|
267
|
-
if (fg('platform_editor_renderer_rm_usespecbasedvalidator')) {
|
|
268
|
-
useSpecBasedValidator = true;
|
|
269
|
-
}
|
|
270
260
|
var _withStopwatch = withStopwatch(function () {
|
|
271
|
-
return memoValidation(doc, schema, adfStage,
|
|
261
|
+
return memoValidation(doc, schema, adfStage, dispatchAnalyticsEvent, skipValidation, validationOverrides);
|
|
272
262
|
}),
|
|
273
263
|
validDoc = _withStopwatch.output,
|
|
274
264
|
sanitizeTime = _withStopwatch.time;
|
|
@@ -297,7 +287,7 @@ export var renderDocument = function renderDocument(doc, serializer) {
|
|
|
297
287
|
|
|
298
288
|
// save serialize tree time to stats
|
|
299
289
|
stat.serializeTime = serializeTime;
|
|
300
|
-
if (dispatchAnalyticsEvent
|
|
290
|
+
if (dispatchAnalyticsEvent) {
|
|
301
291
|
findAndTrackUnsupportedContentNodes(node, schema, dispatchAnalyticsEvent);
|
|
302
292
|
if (unsupportedContentLevelsTracking !== null && unsupportedContentLevelsTracking !== void 0 && unsupportedContentLevelsTracking.enabled) {
|
|
303
293
|
var documentData = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
var
|
|
2
|
+
var _css0, _$concat3, _$concat5;
|
|
3
3
|
/* eslint-disable @atlaskit/ui-styling-standard/no-important-styles, @atlaskit/ui-styling-standard/no-unsafe-selectors */
|
|
4
4
|
/* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
|
|
5
5
|
/* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values */
|
|
@@ -547,6 +547,16 @@ var headingWrapperInlineFlowStyles = css(_defineProperty(_defineProperty(_define
|
|
|
547
547
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-space
|
|
548
548
|
marginTop: '1.59091em'
|
|
549
549
|
}));
|
|
550
|
+
var headingAnchorWrapperTargetSizeStyles = css(_defineProperty({
|
|
551
|
+
'& .renderer-heading-wrapper > h1, & .renderer-heading-wrapper > h2, & .renderer-heading-wrapper > h3, & .renderer-heading-wrapper > h4, & .renderer-heading-wrapper > h5, & .renderer-heading-wrapper > h6': {
|
|
552
|
+
verticalAlign: 'middle'
|
|
553
|
+
}
|
|
554
|
+
}, "& .renderer-heading-wrapper > .".concat(HeadingAnchorWrapperClassName), {
|
|
555
|
+
display: 'inline-flex',
|
|
556
|
+
alignItems: 'center',
|
|
557
|
+
justifyContent: 'center',
|
|
558
|
+
verticalAlign: 'middle'
|
|
559
|
+
}));
|
|
550
560
|
var headingWithAlignmentStylesDuplicateAnchor = css({
|
|
551
561
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
552
562
|
'.fabric-editor-block-mark.fabric-editor-alignment:not(:first-child)': {
|
|
@@ -637,13 +647,13 @@ var paragraphStylesUGCScaledMargin = css({
|
|
|
637
647
|
marginBottom: 0
|
|
638
648
|
}
|
|
639
649
|
});
|
|
640
|
-
var listsSharedStyles = css((
|
|
650
|
+
var listsSharedStyles = css((_css0 = {
|
|
641
651
|
/* =============== INDENTATION SPACING ========= */
|
|
642
652
|
'ul, ol': {
|
|
643
653
|
boxSizing: 'border-box',
|
|
644
654
|
paddingLeft: "var(--ed--list--item-counter--padding, ".concat(listItemCounterPadding, "px)")
|
|
645
655
|
}
|
|
646
|
-
}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(
|
|
656
|
+
}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_css0, "".concat(orderedListSelector, ", ").concat(bulletListSelector), {
|
|
647
657
|
/*
|
|
648
658
|
Ensures list item content adheres to the list's margin instead
|
|
649
659
|
of filling the entire block row. This is important to allow
|
|
@@ -675,7 +685,7 @@ var listsSharedStyles = css((_css9 = {
|
|
|
675
685
|
listStyleType: 'lower-alpha'
|
|
676
686
|
}), 'ol[data-indent-level="3"], ol[data-indent-level="6"]', {
|
|
677
687
|
listStyleType: 'lower-roman'
|
|
678
|
-
}), _defineProperty(_defineProperty(_defineProperty(
|
|
688
|
+
}), _defineProperty(_defineProperty(_defineProperty(_css0, 'ul[data-indent-level="1"], ul[data-indent-level="4"]', {
|
|
679
689
|
listStyleType: 'disc'
|
|
680
690
|
}), 'ul[data-indent-level="2"], ul[data-indent-level="5"]', {
|
|
681
691
|
listStyleType: 'circle'
|
|
@@ -2306,7 +2316,7 @@ export var RendererStyleContainer = function RendererStyleContainer(props) {
|
|
|
2306
2316
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- CSS custom properties for UGC font tokens
|
|
2307
2317
|
'--ak-renderer-editor-font-small-text': editorUGCTokensRefreshed['editor.font.body.small']
|
|
2308
2318
|
},
|
|
2309
|
-
css: [expValEquals('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
|
|
2319
|
+
css: [expValEquals('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, isExperimentEnabled('platform_editor_heading_link_target_size') && headingAnchorWrapperTargetSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
|
|
2310
2320
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
2311
2321
|
textHighlightPaddingStyles, tasksAndDecisionsStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingPanelStyles, smartCardStyles, smartCardStylesAvatarFix, headerSmartCardStyles, smartCardStylesAvatarMarginFix, smartCardStylesAvatarListZeroMarginTop, fg('editor_inline_comments_on_inline_nodes') && (expValEquals('confluence_fe_renderer_inline_node_mark_color_fix', 'isEnabled', true) ? rendererAnnotationStyles : rendererAnnotationStylesOld),
|
|
2312
2322
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
@@ -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.1;
|
|
63
63
|
var packageName = "@atlaskit/renderer";
|
|
64
|
-
var packageVersion = "
|
|
64
|
+
var packageVersion = "142.0.0";
|
|
65
65
|
var setAsQueryContainerStyles = css({
|
|
66
66
|
containerName: 'ak-renderer-wrapper',
|
|
67
67
|
containerType: 'inline-size'
|
|
@@ -488,7 +488,7 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
488
488
|
try {
|
|
489
489
|
var _rendererContext$feat, _props$media;
|
|
490
490
|
var schema = getSchema(props.schema, props.adfStage);
|
|
491
|
-
var _renderDocument = renderDocument(props.shouldRemoveEmptySpaceAroundContent ? removeEmptySpaceAroundContent(props.document) : props.document, serializer, schema, props.adfStage,
|
|
491
|
+
var _renderDocument = renderDocument(props.shouldRemoveEmptySpaceAroundContent ? removeEmptySpaceAroundContent(props.document) : props.document, serializer, schema, props.adfStage, id, _fireAnalyticsEvent, props.unsupportedContentLevelsTracking, props.appearance, props.includeNodesCountInStats, props.skipValidation, validationOverrides),
|
|
492
492
|
result = _renderDocument.result,
|
|
493
493
|
stat = _renderDocument.stat,
|
|
494
494
|
pmDoc = _renderDocument.pmDoc;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import type { ButtonHTMLAttributes, JSX } from 'react';
|
|
6
|
+
/** Heading link button with a minimum 24px pointer target. */
|
|
7
|
+
export default function HeadingAnchorButton(props: ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
|
|
@@ -25,5 +25,5 @@ type ValidationOverrides = {
|
|
|
25
25
|
allowNestedTables?: boolean;
|
|
26
26
|
allowTableInPanel?: boolean;
|
|
27
27
|
};
|
|
28
|
-
export declare const renderDocument: <T>(doc: any, serializer: Serializer<T>, schema?: Schema, adfStage?: ADFStage,
|
|
28
|
+
export declare const renderDocument: <T>(doc: any, serializer: Serializer<T>, schema?: Schema, adfStage?: ADFStage, rendererId?: string, dispatchAnalyticsEvent?: DispatchAnalyticsEvent, unsupportedContentLevelsTracking?: UnsupportedContentLevelsTracking, appearance?: RendererAppearance, includeNodesCountInStats?: boolean, skipValidation?: boolean, validationOverrides?: ValidationOverrides) => RenderOutput<T | null>;
|
|
29
29
|
export {};
|
|
@@ -230,7 +230,5 @@ export interface RendererProps {
|
|
|
230
230
|
/** @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-26490 Internal documentation for deprecation (no external access)} This prop has been marked stable and therefore replaced by the `textHighlighter` prop. Please use `textHighlighter` prop instead. */
|
|
231
231
|
UNSTABLE_textHighlighter?: TextHighlighter;
|
|
232
232
|
unsupportedContentLevelsTracking?: UnsupportedContentLevelsTracking;
|
|
233
|
-
/** @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-3649 Internal documentation for deprecation (no external access)} This prop will be removed and set as default enabled, as the same flag on the Editor is also now default enabled. */
|
|
234
|
-
useSpecBasedValidator?: boolean;
|
|
235
233
|
}
|
|
236
234
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "142.0.1",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@atlaskit/pragmatic-drag-and-drop": "^3.1.0",
|
|
70
70
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
71
71
|
"@atlaskit/react-ufo": "^7.13.0",
|
|
72
|
-
"@atlaskit/smart-card": "^45.
|
|
72
|
+
"@atlaskit/smart-card": "^45.26.0",
|
|
73
73
|
"@atlaskit/status": "^5.12.0",
|
|
74
74
|
"@atlaskit/task-decision": "^21.10.0",
|
|
75
75
|
"@atlaskit/theme": "^28.2.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"uuid": "^11.1.1"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
|
-
"@atlaskit/editor-common": "^123.
|
|
91
|
+
"@atlaskit/editor-common": "^123.7.0",
|
|
92
92
|
"@atlaskit/link-provider": "^5.7.0",
|
|
93
93
|
"@atlaskit/media-core": "^38.2.0",
|
|
94
94
|
"react": "^18.2.0 || ^19.2.0",
|
|
@@ -194,9 +194,6 @@
|
|
|
194
194
|
"type": "boolean",
|
|
195
195
|
"referenceOnly": true
|
|
196
196
|
},
|
|
197
|
-
"platform_editor_renderer_rm_usespecbasedvalidator": {
|
|
198
|
-
"type": "boolean"
|
|
199
|
-
},
|
|
200
197
|
"platform_editor_bordered_panel_nested_in_table": {
|
|
201
198
|
"type": "boolean"
|
|
202
199
|
},
|