@atlaskit/renderer 140.2.5 → 140.2.6
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 +16 -0
- package/dist/cjs/react/index.js +3 -1
- package/dist/cjs/react/nodes/extension.js +5 -3
- package/dist/cjs/react/utils/markBlockAsInline.js +12 -6
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/index.js +3 -2
- package/dist/es2019/react/nodes/extension.js +5 -3
- package/dist/es2019/react/utils/markBlockAsInline.js +11 -6
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/index.js +3 -1
- package/dist/esm/react/nodes/extension.js +5 -3
- package/dist/esm/react/utils/markBlockAsInline.js +12 -6
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/react/utils/markBlockAsInline.d.ts +2 -1
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 140.2.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5adb85a596691`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5adb85a596691) -
|
|
8
|
+
[ux] Replace native Forge outputType: inline with layout: inline-bodied. Consumers must use the
|
|
9
|
+
new layout declaration; stored nodes remain bodiedExtension with rich content. Preserve legacy
|
|
10
|
+
Connect parameters, native markers, and every existing feature gate, including
|
|
11
|
+
platform_forge_inline_bodied_macro. Align quick insertion, auto-conversion, configuration saves,
|
|
12
|
+
and view rendering with the new contract.
|
|
13
|
+
|
|
14
|
+
Persist Custom UI inline-bodied presentation in parameters.layout, separately from app
|
|
15
|
+
configuration, and use it for outer page composition behind
|
|
16
|
+
platform_forge_inline_bodied_layout_switch. Preserve Connect migration behaviour, keep unsupported
|
|
17
|
+
nested macros as blocks, and cover gate-off rendering.
|
|
18
|
+
|
|
3
19
|
## 140.2.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cjs/react/index.js
CHANGED
|
@@ -317,7 +317,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
317
317
|
if (key === 'root-0') {
|
|
318
318
|
this.resetState();
|
|
319
319
|
}
|
|
320
|
-
return this.renderNode(target, props, key, (0, _expandBody.mergeExpandBodyText)(this.getChildNodes(fragment).map(function (node, index) {
|
|
320
|
+
return this.renderNode(target, props, key, (0, _expandBody.mergeExpandBodyText)(this.getChildNodes(fragment, !(parentInfo !== null && parentInfo !== void 0 && parentInfo.path.length)).map(function (node, index) {
|
|
321
321
|
if ((0, _nodes.isTextWrapper)(node)) {
|
|
322
322
|
return _this2.serializeTextWrapper(node.content, {
|
|
323
323
|
index: index,
|
|
@@ -796,6 +796,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
796
796
|
key: "getChildNodes",
|
|
797
797
|
value: function getChildNodes(fragment) {
|
|
798
798
|
var _this8 = this;
|
|
799
|
+
var isTopLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
799
800
|
var children = [];
|
|
800
801
|
fragment.forEach(function (node) {
|
|
801
802
|
children.push(node);
|
|
@@ -809,6 +810,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
809
810
|
_this8.inlinePositions.add(pos);
|
|
810
811
|
},
|
|
811
812
|
parentPos: this.startPos,
|
|
813
|
+
isTopLevel: isTopLevel,
|
|
812
814
|
shouldDisplayExtensionAsInline: this.shouldDisplayExtensionAsInline
|
|
813
815
|
});
|
|
814
816
|
}
|
|
@@ -80,7 +80,7 @@ var FireExtensionAsInlineAnalytics = function FireExtensionAsInlineAnalytics(_re
|
|
|
80
80
|
return null;
|
|
81
81
|
};
|
|
82
82
|
var renderExtension = exports.renderExtension = function renderExtension(content, layout) {
|
|
83
|
-
var _node$parameters;
|
|
83
|
+
var _node$parameters, _node$parameters2;
|
|
84
84
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
85
85
|
var removeOverflow = arguments.length > 3 ? arguments[3] : undefined;
|
|
86
86
|
var extensionId = arguments.length > 4 ? arguments[4] : undefined;
|
|
@@ -114,7 +114,7 @@ var renderExtension = exports.renderExtension = function renderExtension(content
|
|
|
114
114
|
var viewportSize = getViewportSize(extensionId, extensionViewportSizes);
|
|
115
115
|
var extensionHeight = nodeHeight || viewportSize;
|
|
116
116
|
/**
|
|
117
|
-
* Scoped to nodes inserted by an app declaring `
|
|
117
|
+
* Scoped to nodes inserted by an app declaring `layout: inline-bodied`, which is what writes
|
|
118
118
|
* `atlassianForgeInlineBodied`. The output-type marker alone would also match migrated Connect
|
|
119
119
|
* content — it carries the same marker, and after an upgrade plus a storage round trip in the
|
|
120
120
|
* same shape — so keying on it would change how existing content renders. The renderer only
|
|
@@ -127,6 +127,7 @@ var renderExtension = exports.renderExtension = function renderExtension(content
|
|
|
127
127
|
*/
|
|
128
128
|
var hasForgeInlineBodiedMarker = Boolean((node === null || node === void 0 ? void 0 : node.extensionType) === FORGE_EXTENSION_TYPE && (node === null || node === void 0 ? void 0 : node.content) && (node === null || node === void 0 || (_node$parameters = node.parameters) === null || _node$parameters === void 0 || (_node$parameters = _node$parameters.guestParams) === null || _node$parameters === void 0 ? void 0 : _node$parameters[FORGE_INLINE_BODIED_PARAM]) === 'true');
|
|
129
129
|
var isForgeInlineBodiedEnabled = hasForgeInlineBodiedMarker && (0, _fg.fg)('platform_forge_inline_bodied_macro');
|
|
130
|
+
var isInlineBodiedLayoutEnabled = (node === null || node === void 0 ? void 0 : node.extensionType) === FORGE_EXTENSION_TYPE && (node === null || node === void 0 ? void 0 : node.type) === 'bodiedExtension' && (node === null || node === void 0 || (_node$parameters2 = node.parameters) === null || _node$parameters2 === void 0 ? void 0 : _node$parameters2.layout) === 'inline-bodied' && (0, _fg.fg)('platform_forge_inline_bodied_layout_switch') && (0, _fg.fg)('platform_forge_inline_bodied_macro');
|
|
130
131
|
/**
|
|
131
132
|
* The pass that marks the sibling textblocks around an inline extension resolves their
|
|
132
133
|
* positions without a depth term, so it only ever matches at the top level. Inlining a nested
|
|
@@ -134,7 +135,7 @@ var renderExtension = exports.renderExtension = function renderExtension(content
|
|
|
134
135
|
* which is worse than leaving it a block — so keep nested inline-bodied Forge macros as
|
|
135
136
|
* blocks until the sibling marking works at depth.
|
|
136
137
|
*/
|
|
137
|
-
var isNestedForgeInlineBodied = !isTopLevel && isForgeInlineBodiedEnabled;
|
|
138
|
+
var isNestedForgeInlineBodied = !isTopLevel && (isForgeInlineBodiedEnabled || isInlineBodiedLayoutEnabled);
|
|
138
139
|
var isInline = (shouldDisplayExtensionAsInline === null || shouldDisplayExtensionAsInline === void 0 ? void 0 : shouldDisplayExtensionAsInline(node)) && (0, _expValEquals.expValEquals)('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && !isNestedForgeInlineBodied;
|
|
139
140
|
var inlineClassName = isInline ? _consts.RendererCssClassName.EXTENSION_AS_INLINE : '';
|
|
140
141
|
/**
|
|
@@ -148,6 +149,7 @@ var renderExtension = exports.renderExtension = function renderExtension(content
|
|
|
148
149
|
* Migrated inline-bodied macros intentionally do not receive the native Forge marker. Mark the
|
|
149
150
|
* rendered wrapper instead so the stylesheet can fix only the surrounding text flow without
|
|
150
151
|
* applying the native nested-renderer, overflow or sizing rules to migrated content.
|
|
152
|
+
* Custom UI also uses this outer text-flow treatment, without styling inside its iframe.
|
|
151
153
|
*/
|
|
152
154
|
var isMigratedInlineBodied = Boolean(isInline && (node === null || node === void 0 ? void 0 : node.content) && !hasForgeInlineBodiedMarker && (0, _fg.fg)('platform_forge_inline_bodied_macro'));
|
|
153
155
|
var asInlineAnalytics = isInline && fireAnalyticsEvent && node ? (0, _react.jsx)(FireExtensionAsInlineAnalytics, {
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.markBlockAsInline = markBlockAsInline;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
9
10
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
10
11
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
12
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -13,19 +14,24 @@ function markBlockAsInline(_ref) {
|
|
|
13
14
|
var nodes = _ref.nodes,
|
|
14
15
|
onMark = _ref.onMark,
|
|
15
16
|
parentPos = _ref.parentPos,
|
|
16
|
-
shouldDisplayExtensionAsInline = _ref.shouldDisplayExtensionAsInline
|
|
17
|
+
shouldDisplayExtensionAsInline = _ref.shouldDisplayExtensionAsInline,
|
|
18
|
+
_ref$isTopLevel = _ref.isTopLevel,
|
|
19
|
+
isTopLevel = _ref$isTopLevel === void 0 ? true : _ref$isTopLevel;
|
|
17
20
|
if (!nodes || nodes.length === 0 || nodes[0].isInline) {
|
|
18
21
|
return;
|
|
19
22
|
}
|
|
20
23
|
function isInlineBodiedExtension(node) {
|
|
21
|
-
var _node$attrs, _node$attrs2, _node$attrs3, _node$attrs4;
|
|
24
|
+
var _node$attrs, _node$attrs2, _node$attrs3, _node$attrs4, _node$attrs5, _node$attrs6;
|
|
25
|
+
if (!isTopLevel && (node === null || node === void 0 ? void 0 : node.type.name) === 'bodiedExtension' && ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionType) === 'com.atlassian.ecosystem' && ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 || (_node$attrs2 = _node$attrs2.parameters) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) === 'inline-bodied' && (0, _fg.fg)('platform_forge_inline_bodied_layout_switch') && (0, _fg.fg)('platform_forge_inline_bodied_macro')) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
22
28
|
return Boolean((node === null || node === void 0 ? void 0 : node.type.name) === 'bodiedExtension' && shouldDisplayExtensionAsInline({
|
|
23
29
|
type: node.type.name,
|
|
24
|
-
extensionKey: (_node$
|
|
25
|
-
extensionType: (_node$
|
|
26
|
-
parameters: (_node$
|
|
30
|
+
extensionKey: (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.extensionKey,
|
|
31
|
+
extensionType: (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.extensionType,
|
|
32
|
+
parameters: (_node$attrs5 = node.attrs) === null || _node$attrs5 === void 0 ? void 0 : _node$attrs5.parameters,
|
|
27
33
|
content: node.content,
|
|
28
|
-
localId: (_node$
|
|
34
|
+
localId: (_node$attrs6 = node.attrs) === null || _node$attrs6 === void 0 ? void 0 : _node$attrs6.localId
|
|
29
35
|
}));
|
|
30
36
|
}
|
|
31
37
|
try {
|
|
@@ -73,7 +73,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
73
73
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
74
74
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
75
75
|
var packageName = "@atlaskit/renderer";
|
|
76
|
-
var packageVersion = "140.2.
|
|
76
|
+
var packageVersion = "140.2.5";
|
|
77
77
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
78
78
|
containerName: 'ak-renderer-wrapper',
|
|
79
79
|
containerType: 'inline-size'
|
|
@@ -299,7 +299,7 @@ export default class ReactSerializer {
|
|
|
299
299
|
if (key === 'root-0') {
|
|
300
300
|
this.resetState();
|
|
301
301
|
}
|
|
302
|
-
return this.renderNode(target, props, key, mergeExpandBodyText(this.getChildNodes(fragment).map((node, index) => {
|
|
302
|
+
return this.renderNode(target, props, key, mergeExpandBodyText(this.getChildNodes(fragment, !(parentInfo !== null && parentInfo !== void 0 && parentInfo.path.length)).map((node, index) => {
|
|
303
303
|
if (isTextWrapper(node)) {
|
|
304
304
|
return this.serializeTextWrapper(node.content, {
|
|
305
305
|
index,
|
|
@@ -704,7 +704,7 @@ export default class ReactSerializer {
|
|
|
704
704
|
}
|
|
705
705
|
return this.getUniqueHeadingId(baseId, headingIds, ++counter);
|
|
706
706
|
}
|
|
707
|
-
getChildNodes(fragment) {
|
|
707
|
+
getChildNodes(fragment, isTopLevel = true) {
|
|
708
708
|
let children = [];
|
|
709
709
|
fragment.forEach(node => {
|
|
710
710
|
children.push(node);
|
|
@@ -719,6 +719,7 @@ export default class ReactSerializer {
|
|
|
719
719
|
this.inlinePositions.add(pos);
|
|
720
720
|
},
|
|
721
721
|
parentPos: this.startPos,
|
|
722
|
+
isTopLevel,
|
|
722
723
|
shouldDisplayExtensionAsInline: this.shouldDisplayExtensionAsInline
|
|
723
724
|
});
|
|
724
725
|
}
|
|
@@ -69,7 +69,7 @@ const FireExtensionAsInlineAnalytics = ({
|
|
|
69
69
|
return null;
|
|
70
70
|
};
|
|
71
71
|
export const renderExtension = (content, layout, options = {}, removeOverflow, extensionId, extensionViewportSizes, nodeHeight, localId, shouldDisplayExtensionAsInline, node, isInsideOfInlineExtension) => {
|
|
72
|
-
var _node$parameters, _node$parameters$gues;
|
|
72
|
+
var _node$parameters, _node$parameters$gues, _node$parameters2;
|
|
73
73
|
const overflowContainerClass = !removeOverflow ? RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER : '';
|
|
74
74
|
|
|
75
75
|
// by default, we assume the extension is at top level, (direct child of doc node)
|
|
@@ -93,7 +93,7 @@ export const renderExtension = (content, layout, options = {}, removeOverflow, e
|
|
|
93
93
|
const viewportSize = getViewportSize(extensionId, extensionViewportSizes);
|
|
94
94
|
const extensionHeight = nodeHeight || viewportSize;
|
|
95
95
|
/**
|
|
96
|
-
* Scoped to nodes inserted by an app declaring `
|
|
96
|
+
* Scoped to nodes inserted by an app declaring `layout: inline-bodied`, which is what writes
|
|
97
97
|
* `atlassianForgeInlineBodied`. The output-type marker alone would also match migrated Connect
|
|
98
98
|
* content — it carries the same marker, and after an upgrade plus a storage round trip in the
|
|
99
99
|
* same shape — so keying on it would change how existing content renders. The renderer only
|
|
@@ -106,6 +106,7 @@ export const renderExtension = (content, layout, options = {}, removeOverflow, e
|
|
|
106
106
|
*/
|
|
107
107
|
const hasForgeInlineBodiedMarker = Boolean((node === null || node === void 0 ? void 0 : node.extensionType) === FORGE_EXTENSION_TYPE && (node === null || node === void 0 ? void 0 : node.content) && (node === null || node === void 0 ? void 0 : (_node$parameters = node.parameters) === null || _node$parameters === void 0 ? void 0 : (_node$parameters$gues = _node$parameters.guestParams) === null || _node$parameters$gues === void 0 ? void 0 : _node$parameters$gues[FORGE_INLINE_BODIED_PARAM]) === 'true');
|
|
108
108
|
const isForgeInlineBodiedEnabled = hasForgeInlineBodiedMarker && fg('platform_forge_inline_bodied_macro');
|
|
109
|
+
const isInlineBodiedLayoutEnabled = (node === null || node === void 0 ? void 0 : node.extensionType) === FORGE_EXTENSION_TYPE && (node === null || node === void 0 ? void 0 : node.type) === 'bodiedExtension' && (node === null || node === void 0 ? void 0 : (_node$parameters2 = node.parameters) === null || _node$parameters2 === void 0 ? void 0 : _node$parameters2.layout) === 'inline-bodied' && fg('platform_forge_inline_bodied_layout_switch') && fg('platform_forge_inline_bodied_macro');
|
|
109
110
|
/**
|
|
110
111
|
* The pass that marks the sibling textblocks around an inline extension resolves their
|
|
111
112
|
* positions without a depth term, so it only ever matches at the top level. Inlining a nested
|
|
@@ -113,7 +114,7 @@ export const renderExtension = (content, layout, options = {}, removeOverflow, e
|
|
|
113
114
|
* which is worse than leaving it a block — so keep nested inline-bodied Forge macros as
|
|
114
115
|
* blocks until the sibling marking works at depth.
|
|
115
116
|
*/
|
|
116
|
-
const isNestedForgeInlineBodied = !isTopLevel && isForgeInlineBodiedEnabled;
|
|
117
|
+
const isNestedForgeInlineBodied = !isTopLevel && (isForgeInlineBodiedEnabled || isInlineBodiedLayoutEnabled);
|
|
117
118
|
const isInline = (shouldDisplayExtensionAsInline === null || shouldDisplayExtensionAsInline === void 0 ? void 0 : shouldDisplayExtensionAsInline(node)) && expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && !isNestedForgeInlineBodied;
|
|
118
119
|
const inlineClassName = isInline ? RendererCssClassName.EXTENSION_AS_INLINE : '';
|
|
119
120
|
/**
|
|
@@ -127,6 +128,7 @@ export const renderExtension = (content, layout, options = {}, removeOverflow, e
|
|
|
127
128
|
* Migrated inline-bodied macros intentionally do not receive the native Forge marker. Mark the
|
|
128
129
|
* rendered wrapper instead so the stylesheet can fix only the surrounding text flow without
|
|
129
130
|
* applying the native nested-renderer, overflow or sizing rules to migrated content.
|
|
131
|
+
* Custom UI also uses this outer text-flow treatment, without styling inside its iframe.
|
|
130
132
|
*/
|
|
131
133
|
const isMigratedInlineBodied = Boolean(isInline && (node === null || node === void 0 ? void 0 : node.content) && !hasForgeInlineBodiedMarker && fg('platform_forge_inline_bodied_macro'));
|
|
132
134
|
const asInlineAnalytics = isInline && fireAnalyticsEvent && node ? jsx(FireExtensionAsInlineAnalytics, {
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
1
2
|
export function markBlockAsInline({
|
|
2
3
|
nodes,
|
|
3
4
|
onMark,
|
|
4
5
|
parentPos,
|
|
5
|
-
shouldDisplayExtensionAsInline
|
|
6
|
+
shouldDisplayExtensionAsInline,
|
|
7
|
+
isTopLevel = true
|
|
6
8
|
}) {
|
|
7
9
|
if (!nodes || nodes.length === 0 || nodes[0].isInline) {
|
|
8
10
|
return;
|
|
9
11
|
}
|
|
10
12
|
function isInlineBodiedExtension(node) {
|
|
11
|
-
var _node$attrs, _node$attrs2, _node$attrs3, _node$attrs4;
|
|
13
|
+
var _node$attrs, _node$attrs2, _node$attrs2$paramete, _node$attrs3, _node$attrs4, _node$attrs5, _node$attrs6;
|
|
14
|
+
if (!isTopLevel && (node === null || node === void 0 ? void 0 : node.type.name) === 'bodiedExtension' && ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionType) === 'com.atlassian.ecosystem' && ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$paramete = _node$attrs2.parameters) === null || _node$attrs2$paramete === void 0 ? void 0 : _node$attrs2$paramete.layout) === 'inline-bodied' && fg('platform_forge_inline_bodied_layout_switch') && fg('platform_forge_inline_bodied_macro')) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
12
17
|
return Boolean((node === null || node === void 0 ? void 0 : node.type.name) === 'bodiedExtension' && shouldDisplayExtensionAsInline({
|
|
13
18
|
type: node.type.name,
|
|
14
|
-
extensionKey: (_node$
|
|
15
|
-
extensionType: (_node$
|
|
16
|
-
parameters: (_node$
|
|
19
|
+
extensionKey: (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.extensionKey,
|
|
20
|
+
extensionType: (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.extensionType,
|
|
21
|
+
parameters: (_node$attrs5 = node.attrs) === null || _node$attrs5 === void 0 ? void 0 : _node$attrs5.parameters,
|
|
17
22
|
content: node.content,
|
|
18
|
-
localId: (_node$
|
|
23
|
+
localId: (_node$attrs6 = node.attrs) === null || _node$attrs6 === void 0 ? void 0 : _node$attrs6.localId
|
|
19
24
|
}));
|
|
20
25
|
}
|
|
21
26
|
try {
|
|
@@ -59,7 +59,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
59
59
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
60
60
|
const RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
61
61
|
const packageName = "@atlaskit/renderer";
|
|
62
|
-
const packageVersion = "140.2.
|
|
62
|
+
const packageVersion = "140.2.5";
|
|
63
63
|
const setAsQueryContainerStyles = css({
|
|
64
64
|
containerName: 'ak-renderer-wrapper',
|
|
65
65
|
containerType: 'inline-size'
|
package/dist/esm/react/index.js
CHANGED
|
@@ -310,7 +310,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
310
310
|
if (key === 'root-0') {
|
|
311
311
|
this.resetState();
|
|
312
312
|
}
|
|
313
|
-
return this.renderNode(target, props, key, mergeExpandBodyText(this.getChildNodes(fragment).map(function (node, index) {
|
|
313
|
+
return this.renderNode(target, props, key, mergeExpandBodyText(this.getChildNodes(fragment, !(parentInfo !== null && parentInfo !== void 0 && parentInfo.path.length)).map(function (node, index) {
|
|
314
314
|
if (isTextWrapper(node)) {
|
|
315
315
|
return _this2.serializeTextWrapper(node.content, {
|
|
316
316
|
index: index,
|
|
@@ -789,6 +789,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
789
789
|
key: "getChildNodes",
|
|
790
790
|
value: function getChildNodes(fragment) {
|
|
791
791
|
var _this8 = this;
|
|
792
|
+
var isTopLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
792
793
|
var children = [];
|
|
793
794
|
fragment.forEach(function (node) {
|
|
794
795
|
children.push(node);
|
|
@@ -802,6 +803,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
802
803
|
_this8.inlinePositions.add(pos);
|
|
803
804
|
},
|
|
804
805
|
parentPos: this.startPos,
|
|
806
|
+
isTopLevel: isTopLevel,
|
|
805
807
|
shouldDisplayExtensionAsInline: this.shouldDisplayExtensionAsInline
|
|
806
808
|
});
|
|
807
809
|
}
|
|
@@ -70,7 +70,7 @@ var FireExtensionAsInlineAnalytics = function FireExtensionAsInlineAnalytics(_re
|
|
|
70
70
|
return null;
|
|
71
71
|
};
|
|
72
72
|
export var renderExtension = function renderExtension(content, layout) {
|
|
73
|
-
var _node$parameters;
|
|
73
|
+
var _node$parameters, _node$parameters2;
|
|
74
74
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
75
75
|
var removeOverflow = arguments.length > 3 ? arguments[3] : undefined;
|
|
76
76
|
var extensionId = arguments.length > 4 ? arguments[4] : undefined;
|
|
@@ -104,7 +104,7 @@ export var renderExtension = function renderExtension(content, layout) {
|
|
|
104
104
|
var viewportSize = getViewportSize(extensionId, extensionViewportSizes);
|
|
105
105
|
var extensionHeight = nodeHeight || viewportSize;
|
|
106
106
|
/**
|
|
107
|
-
* Scoped to nodes inserted by an app declaring `
|
|
107
|
+
* Scoped to nodes inserted by an app declaring `layout: inline-bodied`, which is what writes
|
|
108
108
|
* `atlassianForgeInlineBodied`. The output-type marker alone would also match migrated Connect
|
|
109
109
|
* content — it carries the same marker, and after an upgrade plus a storage round trip in the
|
|
110
110
|
* same shape — so keying on it would change how existing content renders. The renderer only
|
|
@@ -117,6 +117,7 @@ export var renderExtension = function renderExtension(content, layout) {
|
|
|
117
117
|
*/
|
|
118
118
|
var hasForgeInlineBodiedMarker = Boolean((node === null || node === void 0 ? void 0 : node.extensionType) === FORGE_EXTENSION_TYPE && (node === null || node === void 0 ? void 0 : node.content) && (node === null || node === void 0 || (_node$parameters = node.parameters) === null || _node$parameters === void 0 || (_node$parameters = _node$parameters.guestParams) === null || _node$parameters === void 0 ? void 0 : _node$parameters[FORGE_INLINE_BODIED_PARAM]) === 'true');
|
|
119
119
|
var isForgeInlineBodiedEnabled = hasForgeInlineBodiedMarker && fg('platform_forge_inline_bodied_macro');
|
|
120
|
+
var isInlineBodiedLayoutEnabled = (node === null || node === void 0 ? void 0 : node.extensionType) === FORGE_EXTENSION_TYPE && (node === null || node === void 0 ? void 0 : node.type) === 'bodiedExtension' && (node === null || node === void 0 || (_node$parameters2 = node.parameters) === null || _node$parameters2 === void 0 ? void 0 : _node$parameters2.layout) === 'inline-bodied' && fg('platform_forge_inline_bodied_layout_switch') && fg('platform_forge_inline_bodied_macro');
|
|
120
121
|
/**
|
|
121
122
|
* The pass that marks the sibling textblocks around an inline extension resolves their
|
|
122
123
|
* positions without a depth term, so it only ever matches at the top level. Inlining a nested
|
|
@@ -124,7 +125,7 @@ export var renderExtension = function renderExtension(content, layout) {
|
|
|
124
125
|
* which is worse than leaving it a block — so keep nested inline-bodied Forge macros as
|
|
125
126
|
* blocks until the sibling marking works at depth.
|
|
126
127
|
*/
|
|
127
|
-
var isNestedForgeInlineBodied = !isTopLevel && isForgeInlineBodiedEnabled;
|
|
128
|
+
var isNestedForgeInlineBodied = !isTopLevel && (isForgeInlineBodiedEnabled || isInlineBodiedLayoutEnabled);
|
|
128
129
|
var isInline = (shouldDisplayExtensionAsInline === null || shouldDisplayExtensionAsInline === void 0 ? void 0 : shouldDisplayExtensionAsInline(node)) && expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && !isNestedForgeInlineBodied;
|
|
129
130
|
var inlineClassName = isInline ? RendererCssClassName.EXTENSION_AS_INLINE : '';
|
|
130
131
|
/**
|
|
@@ -138,6 +139,7 @@ export var renderExtension = function renderExtension(content, layout) {
|
|
|
138
139
|
* Migrated inline-bodied macros intentionally do not receive the native Forge marker. Mark the
|
|
139
140
|
* rendered wrapper instead so the stylesheet can fix only the surrounding text flow without
|
|
140
141
|
* applying the native nested-renderer, overflow or sizing rules to migrated content.
|
|
142
|
+
* Custom UI also uses this outer text-flow treatment, without styling inside its iframe.
|
|
141
143
|
*/
|
|
142
144
|
var isMigratedInlineBodied = Boolean(isInline && (node === null || node === void 0 ? void 0 : node.content) && !hasForgeInlineBodiedMarker && fg('platform_forge_inline_bodied_macro'));
|
|
143
145
|
var asInlineAnalytics = isInline && fireAnalyticsEvent && node ? jsx(FireExtensionAsInlineAnalytics, {
|
|
@@ -2,23 +2,29 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
3
3
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
4
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
6
|
export function markBlockAsInline(_ref) {
|
|
6
7
|
var nodes = _ref.nodes,
|
|
7
8
|
onMark = _ref.onMark,
|
|
8
9
|
parentPos = _ref.parentPos,
|
|
9
|
-
shouldDisplayExtensionAsInline = _ref.shouldDisplayExtensionAsInline
|
|
10
|
+
shouldDisplayExtensionAsInline = _ref.shouldDisplayExtensionAsInline,
|
|
11
|
+
_ref$isTopLevel = _ref.isTopLevel,
|
|
12
|
+
isTopLevel = _ref$isTopLevel === void 0 ? true : _ref$isTopLevel;
|
|
10
13
|
if (!nodes || nodes.length === 0 || nodes[0].isInline) {
|
|
11
14
|
return;
|
|
12
15
|
}
|
|
13
16
|
function isInlineBodiedExtension(node) {
|
|
14
|
-
var _node$attrs, _node$attrs2, _node$attrs3, _node$attrs4;
|
|
17
|
+
var _node$attrs, _node$attrs2, _node$attrs3, _node$attrs4, _node$attrs5, _node$attrs6;
|
|
18
|
+
if (!isTopLevel && (node === null || node === void 0 ? void 0 : node.type.name) === 'bodiedExtension' && ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionType) === 'com.atlassian.ecosystem' && ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 || (_node$attrs2 = _node$attrs2.parameters) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) === 'inline-bodied' && fg('platform_forge_inline_bodied_layout_switch') && fg('platform_forge_inline_bodied_macro')) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
15
21
|
return Boolean((node === null || node === void 0 ? void 0 : node.type.name) === 'bodiedExtension' && shouldDisplayExtensionAsInline({
|
|
16
22
|
type: node.type.name,
|
|
17
|
-
extensionKey: (_node$
|
|
18
|
-
extensionType: (_node$
|
|
19
|
-
parameters: (_node$
|
|
23
|
+
extensionKey: (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.extensionKey,
|
|
24
|
+
extensionType: (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.extensionType,
|
|
25
|
+
parameters: (_node$attrs5 = node.attrs) === null || _node$attrs5 === void 0 ? void 0 : _node$attrs5.parameters,
|
|
20
26
|
content: node.content,
|
|
21
|
-
localId: (_node$
|
|
27
|
+
localId: (_node$attrs6 = node.attrs) === null || _node$attrs6 === void 0 ? void 0 : _node$attrs6.localId
|
|
22
28
|
}));
|
|
23
29
|
}
|
|
24
30
|
try {
|
|
@@ -64,7 +64,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
64
64
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
65
65
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
66
66
|
var packageName = "@atlaskit/renderer";
|
|
67
|
-
var packageVersion = "140.2.
|
|
67
|
+
var packageVersion = "140.2.5";
|
|
68
68
|
var setAsQueryContainerStyles = css({
|
|
69
69
|
containerName: 'ak-renderer-wrapper',
|
|
70
70
|
containerType: 'inline-size'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { ExtensionParams, Parameters } from '@atlaskit/editor-common/extensions';
|
|
3
|
-
export declare function markBlockAsInline({ nodes, onMark, parentPos, shouldDisplayExtensionAsInline, }: {
|
|
3
|
+
export declare function markBlockAsInline({ nodes, onMark, parentPos, shouldDisplayExtensionAsInline, isTopLevel, }: {
|
|
4
|
+
isTopLevel?: boolean;
|
|
4
5
|
nodes: PMNode[];
|
|
5
6
|
onMark: ({ pos }: {
|
|
6
7
|
pos: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "140.2.
|
|
3
|
+
"version": "140.2.6",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -248,6 +248,10 @@
|
|
|
248
248
|
"platform_forge_inline_bodied_macro": {
|
|
249
249
|
"type": "boolean",
|
|
250
250
|
"referenceOnly": true
|
|
251
|
+
},
|
|
252
|
+
"platform_forge_inline_bodied_layout_switch": {
|
|
253
|
+
"type": "boolean",
|
|
254
|
+
"referenceOnly": true
|
|
251
255
|
}
|
|
252
256
|
}
|
|
253
257
|
}
|