@atlaskit/renderer 137.1.2 → 137.1.3

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 CHANGED
@@ -1,5 +1,35 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 137.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`28054f27e1549`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/28054f27e1549) -
8
+ Support inline-bodied Forge macros in view mode, behind `platform_forge_inline_bodied_macro`.
9
+
10
+ A macro with a rich body must declare `layout: bodied`, and `layout` is a single enum, so it
11
+ cannot also express "inline". Such a macro now declares display intent separately with
12
+ `outputType: inline`. The stored node remains a block `bodiedExtension` — only its presentation
13
+ changes, and only in view mode; the editor still shows a block.
14
+
15
+ `@atlassian/forge-ui-types`: adds `properties.outputType?: 'inline' | 'block'`.
16
+
17
+ `@atlassian/xen-editor-provider`: when a macro declares `layout: bodied` + `outputType: inline`,
18
+ the output type is seeded into `guestParams` at insert so the renderer's inline treatment applies
19
+ from the first render with no config edit, and it is re-applied as a default when a config panel
20
+ saves (config saves replace `guestParams` wholesale). The Forge app container is laid out inline
21
+ for these macros in view mode, Custom UI excluded.
22
+
23
+ `@atlaskit/renderer`: native Forge inline extensions are marked with `data-forge-inline` and their
24
+ nested body renderer's top-level paragraphs are collapsed inline, so the app's own block spacing
25
+ does not push the surrounding sentence away. Nested inline-bodied Forge macros are left as blocks,
26
+ because the pass that marks the sibling textblocks around an inline extension only resolves
27
+ positions correctly at the top level.
28
+
29
+ With the gate disabled every code path above evaluates to today's behaviour.
30
+
31
+ - Updated dependencies
32
+
3
33
  ## 137.1.2
4
34
 
5
35
  ### Patch Changes
@@ -26,6 +26,13 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
26
26
 
27
27
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
28
28
 
29
+ var FORGE_EXTENSION_TYPE = 'com.atlassian.ecosystem';
30
+ /**
31
+ * Mirrors `FORGE_INLINE_BODIED_PARAM` in `@atlassian/xen-editor-provider`. Duplicated rather than
32
+ * imported: the renderer must not depend on a Forge package, and this is a stored parameter name,
33
+ * so it is part of the document contract rather than that package's API.
34
+ */
35
+ var FORGE_INLINE_BODIED_PARAM = 'atlassianForgeInlineBodied';
29
36
  var viewportSizes = ['small', 'medium', 'default', 'large', 'xlarge'];
30
37
  // Mirrors sizes from https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/forge/xen-editor-provider/src/render/renderers/ForgeUIExtension.tsx
31
38
  var macroHeights = {
@@ -73,6 +80,7 @@ var FireExtensionAsInlineAnalytics = function FireExtensionAsInlineAnalytics(_re
73
80
  return null;
74
81
  };
75
82
  var renderExtension = exports.renderExtension = function renderExtension(content, layout) {
83
+ var _node$parameters;
76
84
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
77
85
  var removeOverflow = arguments.length > 3 ? arguments[3] : undefined;
78
86
  var extensionId = arguments.length > 4 ? arguments[4] : undefined;
@@ -105,8 +113,36 @@ var renderExtension = exports.renderExtension = function renderExtension(content
105
113
  */
106
114
  var viewportSize = getViewportSize(extensionId, extensionViewportSizes);
107
115
  var extensionHeight = nodeHeight || viewportSize;
108
- var isInline = (shouldDisplayExtensionAsInline === null || shouldDisplayExtensionAsInline === void 0 ? void 0 : shouldDisplayExtensionAsInline(node)) && (0, _expValEquals.expValEquals)('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true);
116
+ /**
117
+ * Scoped to nodes inserted by an app declaring `outputType: inline`, which is what writes
118
+ * `atlassianForgeInlineBodied`. The output-type marker alone would also match migrated Connect
119
+ * content — it carries the same marker, and after an upgrade plus a storage round trip in the
120
+ * same shape — so keying on it would change how existing content renders. The renderer only
121
+ * ever sees the stored node, never the manifest, so a parameter this code writes is the only
122
+ * available signal.
123
+ *
124
+ * Evaluated once and shared with `isNativeForgeInline` below, so the gate is read a single time
125
+ * per render, and the cheap checks stay in front of it so anything ineligible short-circuits
126
+ * without firing an exposure it can never act on.
127
+ */
128
+ var isForgeInlineBodiedEnabled = 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' && (0, _fg.fg)('platform_forge_inline_bodied_macro'));
129
+ /**
130
+ * The pass that marks the sibling textblocks around an inline extension resolves their
131
+ * positions without a depth term, so it only ever matches at the top level. Inlining a nested
132
+ * container without joining its neighbours leaves a shrink-wrapped box alone on its own line,
133
+ * which is worse than leaving it a block — so keep nested inline-bodied Forge macros as
134
+ * blocks until the sibling marking works at depth.
135
+ */
136
+ var isNestedForgeInlineBodied = !isTopLevel && isForgeInlineBodiedEnabled;
137
+ var isInline = (shouldDisplayExtensionAsInline === null || shouldDisplayExtensionAsInline === void 0 ? void 0 : shouldDisplayExtensionAsInline(node)) && (0, _expValEquals.expValEquals)('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && !isNestedForgeInlineBodied;
109
138
  var inlineClassName = isInline ? _consts.RendererCssClassName.EXTENSION_AS_INLINE : '';
139
+ /**
140
+ * A native Forge macro does not have its body rendered by the product — the body ADF is
141
+ * sent to the app over the bridge and the app renders it with its own nested renderer.
142
+ * The inline styling above stops at the outer wrapper, so mark these nodes to let the
143
+ * nested document's block spacing be collapsed too.
144
+ */
145
+ var isNativeForgeInline = Boolean(isInline && isForgeInlineBodiedEnabled);
110
146
  var asInlineAnalytics = isInline && fireAnalyticsEvent && node ? (0, _react.jsx)(FireExtensionAsInlineAnalytics, {
111
147
  fireAnalyticsEvent: fireAnalyticsEvent,
112
148
  node: node
@@ -128,7 +164,8 @@ var renderExtension = exports.renderExtension = function renderExtension(content
128
164
  "data-local-id": localId,
129
165
  "data-testid": "extension--wrapper",
130
166
  "data-node-type": "extension",
131
- "data-top-level": isTopLevel || undefined
167
+ "data-top-level": isTopLevel || undefined,
168
+ "data-forge-inline": isNativeForgeInline || undefined
132
169
  }, (0, _react.jsx)("div", {
133
170
  tabIndex: options.tabIndex
134
171
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
@@ -158,7 +195,8 @@ var renderExtension = exports.renderExtension = function renderExtension(content
158
195
  },
159
196
  "data-layout": layout,
160
197
  "data-local-id": localId,
161
- "data-top-level": isTopLevel || undefined
198
+ "data-top-level": isTopLevel || undefined,
199
+ "data-forge-inline": isNativeForgeInline || undefined
162
200
  }, (0, _react.jsx)("div", {
163
201
  tabIndex: options.tabIndex
164
202
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
@@ -867,6 +867,20 @@ var extensionAsInlineStyle = (0, _react.css)((0, _defineProperty2.default)((0, _
867
867
  }), ".".concat(_consts.RendererCssClassName.EXTENSION_AS_INLINE, " .").concat(_consts.RendererCssClassName.EXTENSION_INNER_WRAPPER), {
868
868
  display: 'inline-block'
869
869
  }));
870
+ var forgeInlineBodiedSpacingStyle = (0, _react.css)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, ".".concat(_consts.RendererCssClassName.DOCUMENT, " .").concat(_consts.RendererCssClassName.EXTENSION_AS_INLINE, "[data-forge-inline]"), {
871
+ marginBottom: 0,
872
+ verticalAlign: 'baseline',
873
+ maxWidth: '100%'
874
+ }), [".".concat(_consts.RendererCssClassName.DOCUMENT, " [data-forge-inline] + [data-as-inline=\"on\"]"), ".".concat(_consts.RendererCssClassName.DOCUMENT, " [data-as-inline=\"on\"]:has(+ [data-forge-inline])")].join(', '), {
875
+ display: 'inline'
876
+ }), ".".concat(_consts.RendererCssClassName.EXTENSION_AS_INLINE, "[data-forge-inline] *"), {
877
+ maxWidth: '100%'
878
+ }), ".".concat(_consts.RendererCssClassName.EXTENSION_AS_INLINE, "[data-forge-inline] .").concat(_consts.RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER), {
879
+ overflowX: 'auto'
880
+ }), ".".concat(_consts.RendererCssClassName.EXTENSION_AS_INLINE, "[data-forge-inline] .").concat(_consts.RendererCssClassName.DOCUMENT, " > p"), {
881
+ display: 'inline',
882
+ margin: 0
883
+ }));
870
884
 
871
885
  // Removes the blockNodesVerticalMargin styling for inline extensions, i.e. borderless excerpt-include
872
886
  var inlineExtensionRendererMarginFix = (0, _react.css)({
@@ -2293,7 +2307,7 @@ var RendererStyleContainer = exports.RendererStyleContainer = function RendererS
2293
2307
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
2294
2308
  (0, _fg.fg)('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor,
2295
2309
  // this should be placed after baseOtherStyles
2296
- (0, _expValEquals.expValEquals)('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && ((0, _expValEquals.expValEquals)('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), inlineExtensionRendererMarginFix, allowNestedHeaderLinks && ((0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle,
2310
+ (0, _expValEquals.expValEquals)('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && ((0, _expValEquals.expValEquals)('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), forgeInlineBodiedSpacingStyle, inlineExtensionRendererMarginFix, allowNestedHeaderLinks && ((0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle,
2297
2311
  // merge firstWrappedMediaStyles with mediaSingleSharedStyle when clean up platform_editor_fix_media_in_renderer
2298
2312
  (0, _fg.fg)('platform_editor_fix_media_in_renderer') && firstWrappedMediaStyles, tableSharedStyle, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && !(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_table_q4_patch_7') && roundedTableLegacyClipPathStyles, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeScopedStyles, (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, (0, _fg.fg)('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && (0, _expValEquals.expValEquals)('platform_editor_table_css_overflow_shadow', 'isEnabled', true) && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && ((0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, (0, _expValEquals.expValEquals)('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined, contentMode === 'compact' ? scaledDenseUnicodeEmojiStylesNew : scaledUnicodeEmojiStylesNew, syncBlockStyles, centerWrapperStyles, isInsideSyncBlock ? syncBlockRendererStyles : null, isInsideSyncBlock && tableFakeBorderStyles, isInsideSyncBlock && (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? roundedTableFakeBorderOverlayStyles : null, (0, _expValEquals.expValEquals)('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
2299
2313
  "data-testid": testId
@@ -74,7 +74,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
74
74
  var TABLE_INFO_TIMEOUT = 10000;
75
75
  var RENDER_EVENT_SAMPLE_RATE = 0.1;
76
76
  var packageName = "@atlaskit/renderer";
77
- var packageVersion = "137.1.1";
77
+ var packageVersion = "137.1.2";
78
78
  var setAsQueryContainerStyles = (0, _react2.css)({
79
79
  containerName: 'ak-renderer-wrapper',
80
80
  containerType: 'inline-size'
@@ -16,6 +16,13 @@ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-e
16
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
17
  import { calcBreakoutWidthCss } from '../utils/breakout';
18
18
  import { fg } from '@atlaskit/platform-feature-flags/fg';
19
+ const FORGE_EXTENSION_TYPE = 'com.atlassian.ecosystem';
20
+ /**
21
+ * Mirrors `FORGE_INLINE_BODIED_PARAM` in `@atlassian/xen-editor-provider`. Duplicated rather than
22
+ * imported: the renderer must not depend on a Forge package, and this is a stored parameter name,
23
+ * so it is part of the document contract rather than that package's API.
24
+ */
25
+ const FORGE_INLINE_BODIED_PARAM = 'atlassianForgeInlineBodied';
19
26
  const viewportSizes = ['small', 'medium', 'default', 'large', 'xlarge'];
20
27
  // Mirrors sizes from https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/forge/xen-editor-provider/src/render/renderers/ForgeUIExtension.tsx
21
28
  const macroHeights = {
@@ -62,6 +69,7 @@ const FireExtensionAsInlineAnalytics = ({
62
69
  return null;
63
70
  };
64
71
  export const renderExtension = (content, layout, options = {}, removeOverflow, extensionId, extensionViewportSizes, nodeHeight, localId, shouldDisplayExtensionAsInline, node, isInsideOfInlineExtension) => {
72
+ var _node$parameters, _node$parameters$gues;
65
73
  const overflowContainerClass = !removeOverflow ? RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER : '';
66
74
 
67
75
  // by default, we assume the extension is at top level, (direct child of doc node)
@@ -84,8 +92,36 @@ export const renderExtension = (content, layout, options = {}, removeOverflow, e
84
92
  */
85
93
  const viewportSize = getViewportSize(extensionId, extensionViewportSizes);
86
94
  const extensionHeight = nodeHeight || viewportSize;
87
- const isInline = (shouldDisplayExtensionAsInline === null || shouldDisplayExtensionAsInline === void 0 ? void 0 : shouldDisplayExtensionAsInline(node)) && expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true);
95
+ /**
96
+ * Scoped to nodes inserted by an app declaring `outputType: inline`, which is what writes
97
+ * `atlassianForgeInlineBodied`. The output-type marker alone would also match migrated Connect
98
+ * content — it carries the same marker, and after an upgrade plus a storage round trip in the
99
+ * same shape — so keying on it would change how existing content renders. The renderer only
100
+ * ever sees the stored node, never the manifest, so a parameter this code writes is the only
101
+ * available signal.
102
+ *
103
+ * Evaluated once and shared with `isNativeForgeInline` below, so the gate is read a single time
104
+ * per render, and the cheap checks stay in front of it so anything ineligible short-circuits
105
+ * without firing an exposure it can never act on.
106
+ */
107
+ const isForgeInlineBodiedEnabled = 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' && fg('platform_forge_inline_bodied_macro'));
108
+ /**
109
+ * The pass that marks the sibling textblocks around an inline extension resolves their
110
+ * positions without a depth term, so it only ever matches at the top level. Inlining a nested
111
+ * container without joining its neighbours leaves a shrink-wrapped box alone on its own line,
112
+ * which is worse than leaving it a block — so keep nested inline-bodied Forge macros as
113
+ * blocks until the sibling marking works at depth.
114
+ */
115
+ const isNestedForgeInlineBodied = !isTopLevel && isForgeInlineBodiedEnabled;
116
+ const isInline = (shouldDisplayExtensionAsInline === null || shouldDisplayExtensionAsInline === void 0 ? void 0 : shouldDisplayExtensionAsInline(node)) && expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && !isNestedForgeInlineBodied;
88
117
  const inlineClassName = isInline ? RendererCssClassName.EXTENSION_AS_INLINE : '';
118
+ /**
119
+ * A native Forge macro does not have its body rendered by the product — the body ADF is
120
+ * sent to the app over the bridge and the app renders it with its own nested renderer.
121
+ * The inline styling above stops at the outer wrapper, so mark these nodes to let the
122
+ * nested document's block spacing be collapsed too.
123
+ */
124
+ const isNativeForgeInline = Boolean(isInline && isForgeInlineBodiedEnabled);
89
125
  const asInlineAnalytics = isInline && fireAnalyticsEvent && node ? jsx(FireExtensionAsInlineAnalytics, {
90
126
  fireAnalyticsEvent: fireAnalyticsEvent,
91
127
  node: node
@@ -107,7 +143,8 @@ export const renderExtension = (content, layout, options = {}, removeOverflow, e
107
143
  "data-local-id": localId,
108
144
  "data-testid": "extension--wrapper",
109
145
  "data-node-type": "extension",
110
- "data-top-level": isTopLevel || undefined
146
+ "data-top-level": isTopLevel || undefined,
147
+ "data-forge-inline": isNativeForgeInline || undefined
111
148
  }, jsx("div", {
112
149
  tabIndex: options.tabIndex
113
150
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
@@ -138,7 +175,8 @@ export const renderExtension = (content, layout, options = {}, removeOverflow, e
138
175
  },
139
176
  "data-layout": layout,
140
177
  "data-local-id": localId,
141
- "data-top-level": isTopLevel || undefined
178
+ "data-top-level": isTopLevel || undefined,
179
+ "data-forge-inline": isNativeForgeInline || undefined
142
180
  }, jsx("div", {
143
181
  tabIndex: options.tabIndex
144
182
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
@@ -1027,6 +1027,26 @@ const extensionAsInlineStyle = css({
1027
1027
  display: 'inline-block'
1028
1028
  }
1029
1029
  });
1030
+ const forgeInlineBodiedSpacingStyle = css({
1031
+ [`.${RendererCssClassName.DOCUMENT} .${RendererCssClassName.EXTENSION_AS_INLINE}[data-forge-inline]`]: {
1032
+ marginBottom: 0,
1033
+ verticalAlign: 'baseline',
1034
+ maxWidth: '100%'
1035
+ },
1036
+ [[`.${RendererCssClassName.DOCUMENT} [data-forge-inline] + [data-as-inline="on"]`, `.${RendererCssClassName.DOCUMENT} [data-as-inline="on"]:has(+ [data-forge-inline])`].join(', ')]: {
1037
+ display: 'inline'
1038
+ },
1039
+ [`.${RendererCssClassName.EXTENSION_AS_INLINE}[data-forge-inline] *`]: {
1040
+ maxWidth: '100%'
1041
+ },
1042
+ [`.${RendererCssClassName.EXTENSION_AS_INLINE}[data-forge-inline] .${RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER}`]: {
1043
+ overflowX: 'auto'
1044
+ },
1045
+ [`.${RendererCssClassName.EXTENSION_AS_INLINE}[data-forge-inline] .${RendererCssClassName.DOCUMENT} > p`]: {
1046
+ display: 'inline',
1047
+ margin: 0
1048
+ }
1049
+ });
1030
1050
 
1031
1051
  // Removes the blockNodesVerticalMargin styling for inline extensions, i.e. borderless excerpt-include
1032
1052
  const inlineExtensionRendererMarginFix = css({
@@ -2915,7 +2935,7 @@ export const RendererStyleContainer = props => {
2915
2935
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
2916
2936
  fg('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor,
2917
2937
  // this should be placed after baseOtherStyles
2918
- expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle,
2938
+ expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), forgeInlineBodiedSpacingStyle, inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle,
2919
2939
  // merge firstWrappedMediaStyles with mediaSingleSharedStyle when clean up platform_editor_fix_media_in_renderer
2920
2940
  fg('platform_editor_fix_media_in_renderer') && firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && !isExperimentEnabled('platform_editor_table_q4_patch_7') && roundedTableLegacyClipPathStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeScopedStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && expValEquals('platform_editor_table_css_overflow_shadow', 'isEnabled', true) && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined, contentMode === 'compact' ? scaledDenseUnicodeEmojiStylesNew : scaledUnicodeEmojiStylesNew, syncBlockStyles, centerWrapperStyles, isInsideSyncBlock ? syncBlockRendererStyles : null, isInsideSyncBlock && tableFakeBorderStyles, isInsideSyncBlock && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? roundedTableFakeBorderOverlayStyles : null, expValEquals('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
2921
2941
  "data-testid": testId
@@ -60,7 +60,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
60
60
  const TABLE_INFO_TIMEOUT = 10000;
61
61
  const RENDER_EVENT_SAMPLE_RATE = 0.1;
62
62
  const packageName = "@atlaskit/renderer";
63
- const packageVersion = "137.1.1";
63
+ const packageVersion = "137.1.2";
64
64
  const setAsQueryContainerStyles = css({
65
65
  containerName: 'ak-renderer-wrapper',
66
66
  containerType: 'inline-size'
@@ -16,6 +16,13 @@ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-e
16
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
17
  import { calcBreakoutWidthCss } from '../utils/breakout';
18
18
  import { fg } from '@atlaskit/platform-feature-flags/fg';
19
+ var FORGE_EXTENSION_TYPE = 'com.atlassian.ecosystem';
20
+ /**
21
+ * Mirrors `FORGE_INLINE_BODIED_PARAM` in `@atlassian/xen-editor-provider`. Duplicated rather than
22
+ * imported: the renderer must not depend on a Forge package, and this is a stored parameter name,
23
+ * so it is part of the document contract rather than that package's API.
24
+ */
25
+ var FORGE_INLINE_BODIED_PARAM = 'atlassianForgeInlineBodied';
19
26
  var viewportSizes = ['small', 'medium', 'default', 'large', 'xlarge'];
20
27
  // Mirrors sizes from https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/forge/xen-editor-provider/src/render/renderers/ForgeUIExtension.tsx
21
28
  var macroHeights = {
@@ -63,6 +70,7 @@ var FireExtensionAsInlineAnalytics = function FireExtensionAsInlineAnalytics(_re
63
70
  return null;
64
71
  };
65
72
  export var renderExtension = function renderExtension(content, layout) {
73
+ var _node$parameters;
66
74
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
67
75
  var removeOverflow = arguments.length > 3 ? arguments[3] : undefined;
68
76
  var extensionId = arguments.length > 4 ? arguments[4] : undefined;
@@ -95,8 +103,36 @@ export var renderExtension = function renderExtension(content, layout) {
95
103
  */
96
104
  var viewportSize = getViewportSize(extensionId, extensionViewportSizes);
97
105
  var extensionHeight = nodeHeight || viewportSize;
98
- var isInline = (shouldDisplayExtensionAsInline === null || shouldDisplayExtensionAsInline === void 0 ? void 0 : shouldDisplayExtensionAsInline(node)) && expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true);
106
+ /**
107
+ * Scoped to nodes inserted by an app declaring `outputType: inline`, which is what writes
108
+ * `atlassianForgeInlineBodied`. The output-type marker alone would also match migrated Connect
109
+ * content — it carries the same marker, and after an upgrade plus a storage round trip in the
110
+ * same shape — so keying on it would change how existing content renders. The renderer only
111
+ * ever sees the stored node, never the manifest, so a parameter this code writes is the only
112
+ * available signal.
113
+ *
114
+ * Evaluated once and shared with `isNativeForgeInline` below, so the gate is read a single time
115
+ * per render, and the cheap checks stay in front of it so anything ineligible short-circuits
116
+ * without firing an exposure it can never act on.
117
+ */
118
+ var isForgeInlineBodiedEnabled = 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' && fg('platform_forge_inline_bodied_macro'));
119
+ /**
120
+ * The pass that marks the sibling textblocks around an inline extension resolves their
121
+ * positions without a depth term, so it only ever matches at the top level. Inlining a nested
122
+ * container without joining its neighbours leaves a shrink-wrapped box alone on its own line,
123
+ * which is worse than leaving it a block — so keep nested inline-bodied Forge macros as
124
+ * blocks until the sibling marking works at depth.
125
+ */
126
+ var isNestedForgeInlineBodied = !isTopLevel && isForgeInlineBodiedEnabled;
127
+ var isInline = (shouldDisplayExtensionAsInline === null || shouldDisplayExtensionAsInline === void 0 ? void 0 : shouldDisplayExtensionAsInline(node)) && expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && !isNestedForgeInlineBodied;
99
128
  var inlineClassName = isInline ? RendererCssClassName.EXTENSION_AS_INLINE : '';
129
+ /**
130
+ * A native Forge macro does not have its body rendered by the product — the body ADF is
131
+ * sent to the app over the bridge and the app renders it with its own nested renderer.
132
+ * The inline styling above stops at the outer wrapper, so mark these nodes to let the
133
+ * nested document's block spacing be collapsed too.
134
+ */
135
+ var isNativeForgeInline = Boolean(isInline && isForgeInlineBodiedEnabled);
100
136
  var asInlineAnalytics = isInline && fireAnalyticsEvent && node ? jsx(FireExtensionAsInlineAnalytics, {
101
137
  fireAnalyticsEvent: fireAnalyticsEvent,
102
138
  node: node
@@ -118,7 +154,8 @@ export var renderExtension = function renderExtension(content, layout) {
118
154
  "data-local-id": localId,
119
155
  "data-testid": "extension--wrapper",
120
156
  "data-node-type": "extension",
121
- "data-top-level": isTopLevel || undefined
157
+ "data-top-level": isTopLevel || undefined,
158
+ "data-forge-inline": isNativeForgeInline || undefined
122
159
  }, jsx("div", {
123
160
  tabIndex: options.tabIndex
124
161
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
@@ -148,7 +185,8 @@ export var renderExtension = function renderExtension(content, layout) {
148
185
  },
149
186
  "data-layout": layout,
150
187
  "data-local-id": localId,
151
- "data-top-level": isTopLevel || undefined
188
+ "data-top-level": isTopLevel || undefined,
189
+ "data-forge-inline": isNativeForgeInline || undefined
152
190
  }, jsx("div", {
153
191
  tabIndex: options.tabIndex
154
192
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
@@ -860,6 +860,20 @@ var extensionAsInlineStyle = css(_defineProperty(_defineProperty(_defineProperty
860
860
  }), ".".concat(RendererCssClassName.EXTENSION_AS_INLINE, " .").concat(RendererCssClassName.EXTENSION_INNER_WRAPPER), {
861
861
  display: 'inline-block'
862
862
  }));
863
+ var forgeInlineBodiedSpacingStyle = css(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ".".concat(RendererCssClassName.DOCUMENT, " .").concat(RendererCssClassName.EXTENSION_AS_INLINE, "[data-forge-inline]"), {
864
+ marginBottom: 0,
865
+ verticalAlign: 'baseline',
866
+ maxWidth: '100%'
867
+ }), [".".concat(RendererCssClassName.DOCUMENT, " [data-forge-inline] + [data-as-inline=\"on\"]"), ".".concat(RendererCssClassName.DOCUMENT, " [data-as-inline=\"on\"]:has(+ [data-forge-inline])")].join(', '), {
868
+ display: 'inline'
869
+ }), ".".concat(RendererCssClassName.EXTENSION_AS_INLINE, "[data-forge-inline] *"), {
870
+ maxWidth: '100%'
871
+ }), ".".concat(RendererCssClassName.EXTENSION_AS_INLINE, "[data-forge-inline] .").concat(RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER), {
872
+ overflowX: 'auto'
873
+ }), ".".concat(RendererCssClassName.EXTENSION_AS_INLINE, "[data-forge-inline] .").concat(RendererCssClassName.DOCUMENT, " > p"), {
874
+ display: 'inline',
875
+ margin: 0
876
+ }));
863
877
 
864
878
  // Removes the blockNodesVerticalMargin styling for inline extensions, i.e. borderless excerpt-include
865
879
  var inlineExtensionRendererMarginFix = css({
@@ -2286,7 +2300,7 @@ export var RendererStyleContainer = function RendererStyleContainer(props) {
2286
2300
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
2287
2301
  fg('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor,
2288
2302
  // this should be placed after baseOtherStyles
2289
- expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle,
2303
+ expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), forgeInlineBodiedSpacingStyle, inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle,
2290
2304
  // merge firstWrappedMediaStyles with mediaSingleSharedStyle when clean up platform_editor_fix_media_in_renderer
2291
2305
  fg('platform_editor_fix_media_in_renderer') && firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && !isExperimentEnabled('platform_editor_table_q4_patch_7') && roundedTableLegacyClipPathStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeScopedStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && expValEquals('platform_editor_table_css_overflow_shadow', 'isEnabled', true) && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined, contentMode === 'compact' ? scaledDenseUnicodeEmojiStylesNew : scaledUnicodeEmojiStylesNew, syncBlockStyles, centerWrapperStyles, isInsideSyncBlock ? syncBlockRendererStyles : null, isInsideSyncBlock && tableFakeBorderStyles, isInsideSyncBlock && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? roundedTableFakeBorderOverlayStyles : null, expValEquals('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
2292
2306
  "data-testid": testId
@@ -65,7 +65,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
65
65
  var TABLE_INFO_TIMEOUT = 10000;
66
66
  var RENDER_EVENT_SAMPLE_RATE = 0.1;
67
67
  var packageName = "@atlaskit/renderer";
68
- var packageVersion = "137.1.1";
68
+ var packageVersion = "137.1.2";
69
69
  var setAsQueryContainerStyles = css({
70
70
  containerName: 'ak-renderer-wrapper',
71
71
  containerType: 'inline-size'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "137.1.2",
3
+ "version": "137.1.3",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/afm-i18n-platform-editor-renderer": "2.200.0",
36
36
  "@atlaskit/analytics-listeners": "^11.1.0",
37
37
  "@atlaskit/analytics-namespaced-context": "^8.1.0",
38
- "@atlaskit/analytics-next": "^12.3.0",
38
+ "@atlaskit/analytics-next": "^12.4.0",
39
39
  "@atlaskit/browser-apis": "^1.2.0",
40
40
  "@atlaskit/button": "^25.2.0",
41
41
  "@atlaskit/code": "^19.1.0",
@@ -275,6 +275,10 @@
275
275
  "platform_editor_embed_height_only_fallback": {
276
276
  "type": "boolean",
277
277
  "referenceOnly": true
278
+ },
279
+ "platform_forge_inline_bodied_macro": {
280
+ "type": "boolean",
281
+ "referenceOnly": true
278
282
  }
279
283
  }
280
284
  }