@atlaskit/renderer 114.2.0 → 114.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/cjs/react/nodes/extensionFrame.js +8 -6
- package/dist/cjs/react/nodes/index.js +4 -1
- package/dist/cjs/react/nodes/multiBodiedExtension/actions.js +43 -0
- package/dist/cjs/react/nodes/multiBodiedExtension/context.js +71 -0
- package/dist/cjs/react/nodes/multiBodiedExtension.js +109 -102
- package/dist/cjs/react/nodes/multiBodiedExtensionOld.js +157 -0
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +8 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/Renderer/style.js +1 -1
- package/dist/es2019/react/nodes/extensionFrame.js +8 -6
- package/dist/es2019/react/nodes/index.js +4 -1
- package/dist/es2019/react/nodes/multiBodiedExtension/actions.js +37 -0
- package/dist/es2019/react/nodes/multiBodiedExtension/context.js +56 -0
- package/dist/es2019/react/nodes/multiBodiedExtension.js +127 -118
- package/dist/es2019/react/nodes/multiBodiedExtensionOld.js +168 -0
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +10 -1
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/Renderer/style.js +2 -2
- package/dist/esm/react/nodes/extensionFrame.js +8 -6
- package/dist/esm/react/nodes/index.js +4 -1
- package/dist/esm/react/nodes/multiBodiedExtension/actions.js +36 -0
- package/dist/esm/react/nodes/multiBodiedExtension/context.js +64 -0
- package/dist/esm/react/nodes/multiBodiedExtension.js +108 -101
- package/dist/esm/react/nodes/multiBodiedExtensionOld.js +148 -0
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +8 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/Renderer/style.js +2 -2
- package/dist/types/react/nodes/multiBodiedExtension/actions.d.ts +10 -0
- package/dist/types/react/nodes/multiBodiedExtension/context.d.ts +17 -0
- package/dist/types/react/nodes/multiBodiedExtension.d.ts +1 -0
- package/dist/types/react/nodes/multiBodiedExtensionOld.d.ts +29 -0
- package/dist/types-ts4.5/react/nodes/multiBodiedExtension/actions.d.ts +10 -0
- package/dist/types-ts4.5/react/nodes/multiBodiedExtension/context.d.ts +17 -0
- package/dist/types-ts4.5/react/nodes/multiBodiedExtension.d.ts +1 -0
- package/dist/types-ts4.5/react/nodes/multiBodiedExtensionOld.d.ts +29 -0
- package/package.json +12 -5
|
@@ -698,6 +698,13 @@ var smartCardStyles = (0, _react.css)((0, _defineProperty2.default)({}, ".".conc
|
|
|
698
698
|
margin: "".concat(_editorSharedStyles.blockNodesVerticalMargin, " 0 0"),
|
|
699
699
|
maxWidth: "".concat(8 * 95, "px")
|
|
700
700
|
}));
|
|
701
|
+
var smartCardStylesAvatarFix = (0, _react.css)((0, _defineProperty2.default)({}, ".".concat(_styles.SmartCardSharedCssClassName.LOADER_WRAPPER), {
|
|
702
|
+
/* EDM-11991: Fix list plugin adding padding to ADS AvatarGroup start */
|
|
703
|
+
'ul, ol': {
|
|
704
|
+
paddingLeft: 'inherit'
|
|
705
|
+
}
|
|
706
|
+
/* EDM-11991: Fix list plugin add padding to ADS AvatarGroup end */
|
|
707
|
+
}));
|
|
701
708
|
var baseOtherStyles = (0, _react.css)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
|
|
702
709
|
'& .UnknownBlock': {
|
|
703
710
|
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
@@ -1348,7 +1355,7 @@ var RendererStyleContainer = exports.RendererStyleContainer = function RendererS
|
|
|
1348
1355
|
style: {
|
|
1349
1356
|
'--ak-renderer-base-font-size': "".concat((0, _getBaseFontSize.getBaseFontSize)(appearance), "px")
|
|
1350
1357
|
},
|
|
1351
|
-
css: [baseStyles, appearance === 'full-page' && rendererFullPageStyles, appearance === 'full-width' && rendererFullWidthStyles, !(0, _table.isTableResizingEnabled)(appearance) && rendererFullWidthStylesForTableResizing, telepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, (0, _platformFeatureFlags.fg)('platform_editor_typography_ugc') ? headingsSharedStylesWithEditorUGC : headingsSharedStyles, (0, _platformFeatureFlags.fg)('platform_editor_heading_margin_fix') && headingWithAlignmentStyles, ruleSharedStyles, (0, _platformFeatureFlags.fg)('platform_editor_typography_ugc') ? paragraphSharedStylesWithEditorUGC : paragraphSharedStyles, listsSharedStyles, _browser.browser.gecko && listsSharedStylesForGekko, indentationSharedStyles, blockMarksSharedStyles, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, tasksAndDecisionsStyles, smartCardStyles,
|
|
1358
|
+
css: [baseStyles, appearance === 'full-page' && rendererFullPageStyles, appearance === 'full-width' && rendererFullWidthStyles, !(0, _table.isTableResizingEnabled)(appearance) && rendererFullWidthStylesForTableResizing, telepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, (0, _platformFeatureFlags.fg)('platform_editor_typography_ugc') ? headingsSharedStylesWithEditorUGC : headingsSharedStyles, (0, _platformFeatureFlags.fg)('platform_editor_heading_margin_fix') && headingWithAlignmentStyles, ruleSharedStyles, (0, _platformFeatureFlags.fg)('platform_editor_typography_ugc') ? paragraphSharedStylesWithEditorUGC : paragraphSharedStyles, listsSharedStyles, _browser.browser.gecko && listsSharedStylesForGekko, indentationSharedStyles, blockMarksSharedStyles, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, tasksAndDecisionsStyles, smartCardStyles, (0, _platformFeatureFlags.fg)('platform-linking-visual-refresh-v1') && smartCardStylesAvatarFix,
|
|
1352
1359
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
1353
1360
|
(0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') && rendererAnnotationStyles,
|
|
1354
1361
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning, @atlaskit/platform/ensure-feature-flag-prefix
|
|
@@ -67,7 +67,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
67
67
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
68
68
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
69
69
|
var packageName = "@atlaskit/renderer";
|
|
70
|
-
var packageVersion = "114.
|
|
70
|
+
var packageVersion = "114.3.0";
|
|
71
71
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
72
72
|
containerName: 'ak-renderer-wrapper',
|
|
73
73
|
containerType: 'inline-size',
|
|
@@ -203,7 +203,7 @@ var rendererStyles = exports.rendererStyles = function rendererStyles(wrapperPro
|
|
|
203
203
|
var isAdvancedLayoutsOn = (0, _experiments.editorExperiment)('advanced_layouts', true);
|
|
204
204
|
|
|
205
205
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/design-system/no-css-tagged-template-expression
|
|
206
|
-
return (0, _react.css)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n\t\tfont-size: ", "px;\n\t\tline-height: 1.5rem;\n\t\tcolor: ", ";\n\n\t\t.", "::after {\n\t\t\t// we add a clearfix after ak-renderer-document in order to\n\t\t\t// contain internal floats (such as media images that are \"wrap-left\")\n\t\t\t// to just the renderer (and not spill outside of it)\n\t\t\tcontent: '';\n\t\t\tvisibility: hidden;\n\t\t\tdisplay: block;\n\t\t\theight: 0;\n\t\t\tclear: both;\n\t\t}\n\n\t\t", "\n\t\t", "\n\n .", " {\n\t\t\t", "\n\t\t}\n\n\t\t& h1 {\n\t\t\t", "\n\t\t}\n\n\t\t& h2 {\n\t\t\t", "\n\t\t}\n\n\t\t& h3 {\n\t\t\t", "\n\t\t}\n\n\t\t& h4 {\n\t\t\t", "\n\t\t}\n\n\t\t& h5 {\n\t\t\t", "\n\t\t}\n\n\t\t& h6 {\n\t\t\t", "\n\t\t}\n\n\t\t& span.akActionMark {\n\t\t\tcolor: ", ";\n\t\t\ttext-decoration: none;\n\n\t\t\t&:hover {\n\t\t\t\tcolor: ", ";\n\t\t\t\ttext-decoration: underline;\n\t\t\t}\n\n\t\t\t&:active {\n\t\t\t\tcolor: ", ";\n\t\t\t}\n\t\t}\n\n\t\t& span.akActionMark {\n\t\t\tcursor: pointer;\n\t\t}\n\n\t\t& span[data-placeholder] {\n\t\t\tcolor: ", ";\n\t\t}\n\n\t\t", "\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", "\n\t\t", "\n\n\t\t& .UnknownBlock {\n\t\t\tfont-family: ", ";\n\t\t\tfont-size: ", ";\n\t\t\tfont-weight: ", ";\n\t\t\twhite-space: pre-wrap;\n\t\t\tword-wrap: break-word;\n\t\t}\n\n\t\t& span.date-node {\n\t\t\tbackground: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tcolor: ", ";\n\t\t\tpadding: ", " ", ";\n\t\t\tmargin: 0 1px;\n\t\t\ttransition: background 0.3s;\n\t\t}\n\n\t\t& span.date-node-highlighted {\n\t\t\tbackground: ", ";\n\t\t\tcolor: ", ";\n\t\t}\n\n\t\t& .renderer-image {\n\t\t\tmax-width: 100%;\n\t\t\tdisplay: block;\n\t\t\tmargin: ", " 0;\n\t\t}\n\n\t\t.", ".rich-media-wrapped + .", ":not(.rich-media-wrapped) {\n\t\t\tclear: both;\n\t\t}\n\n\t\t& .code-block,\n\t\t& blockquote,\n\t\t& hr,\n\t\t& > div > div:not(.rich-media-wrapped),\n\t\t.", ".rich-media-wrapped + .rich-media-wrapped + *:not(.rich-media-wrapped),\n\t\t.", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n\t\t.", ".image-align-start,\n\t\t\t.", ".image-center,\n\t\t\t.", ".image-align-end {\n\t\t\tclear: both;\n\t\t}\n\n\t\t& .rich-media-wrapped {\n\t\t\t& + h1,\n\t\t\t& + h2,\n\t\t\t& + h3,\n\t\t\t& + h4,\n\t\t\t& + h5,\n\t\t\t& + h6 {\n\t\t\t\tmargin-top: ", ";\n\t\t\t}\n\t\t}\n\n\t\t", "\n\t\t/* plugin styles */\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n\t\t\tmargin-left: 0;\n\t\t\tmargin-right: 0;\n\t\t}\n\n\t\t/* Breakout for tables and extensions */\n\t\t.", " > {\n\t\t\t", "\n\n\t\t\t* .", " {\n\t\t\t\toverflow-x: auto;\n\t\t\t}\n\n\t\t\t& .", ":first-child {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t}\n\n\t\t.", " {\n\t\t\t.", " {\n\t\t\t\tmargin-top: ", ";\n\t\t\t}\n\n\t\t\t.", " {\n\t\t\t\tmargin-left: 50%;\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t}\n\n\t\t\t.", " {\n\t\t\t\toverflow-x: auto;\n\t\t\t}\n\n\t\t\t.", " .", " {\n\t\t\t\tdisplay: flex;\n\t\t\t}\n\t\t}\n\n\t\t", "\n\n\t\t.", " .", " {\n\t\t\tz-index: 0;\n\t\t\ttransition: all 0.1s linear;\n\t\t\tdisplay: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n\t\t\t/** Shadow overrides */\n\t\t\t&.", "::after, &.", "::before {\n\t\t\t\ttop: ", "px;\n\t\t\t\theight: calc(100% - ", "px);\n\t\t\t\tz-index: ", ";\n\t\t\t}\n\n\t\t\t", "\n\n\t\t\t", "\n\n\t\t\t&\n .", ",\n &\n .", " {\n\t\t\t\theight: calc(100% - ", "px);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * A hack for making all the <th /> heights equal in case some have shorter\n\t\t\t * content than others.\n\t\t\t *\n\t\t\t * This is done to make sort buttons fill entire <th />.\n\t\t\t*/\n\t\t\t", " {\n\t\t\t\theight: 1px; /* will be ignored */\n\t\t\t\t", ";\n\t\t\t\tmargin-left: 0;\n\t\t\t\tmargin-right: 0;\n\t\t\t}\n\n\t\t\t", " {\n\t\t\t\theight: 100%;\n\n\t\t\t\ttd,\n\t\t\t\tth {\n\t\t\t\t\tposition: relative;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttable[data-number-column='true'] {\n\t\t\t\t.", " {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\tborder-right: 1px solid\n\t\t\t\t\t\t", ";\n\t\t\t\t\twidth: ", "px;\n\t\t\t\t\ttext-align: center;\n\t\t\t\t\tcolor: ", ";\n\t\t\t\t\tfont-size: ", ";\n\t\t\t\t}\n\n\t\t\t\t.fixed .", " {\n\t\t\t\t\tborder-right: 0px none;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttr[data-header-row].fixed {\n\t\t\tposition: fixed !important;\n\t\t\tdisplay: flex;\n\t\t\toverflow: hidden;\n\t\t\tz-index: ", ";\n\n\t\t\tborder-right: 1px solid ", ";\n\t\t\tborder-bottom: 1px solid ", ";\n\n\t\t\t/* this is to compensate for the table border */\n\t\t\ttransform: translateX(-1px);\n\t\t}\n\n\t\t.sticky > th {\n\t\t\tz-index: ", ";\n\t\t\tposition: sticky !important;\n\t\t\ttop: 0;\n\t\t}\n\n\t\t/* Make the number column header sticky */\n\t\t.sticky > td {\n\t\t\tposition: sticky !important;\n\t\t\ttop: 0;\n\t\t}\n\n\t\t/* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n\t\t.sticky th,\n\t\t.sticky td {\n\t\t\tbox-shadow:\n\t\t\t\t0px 1px ", ",\n\t\t\t\t0px -0.5px ", ",\n\t\t\t\tinset -1px 0px ", ",\n\t\t\t\t0px -1px ", ";\n\t\t}\n\n\t\t/* this will remove jumpiness caused in Chrome for sticky headers */\n\t\t.fixed + tr {\n\t\t\tmin-height: 0px;\n\t\t}\n\n\t\t/*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n\t\t& .code-block {\n\t\t\tmax-width: 100%;\n\t\t\t/* -ms- properties are necessary until MS supports the latest version of the grid spec */\n\t\t\t/* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n\t\t\tdisplay: block;\n\t\t\t/* stylelint-enable */\n\n\t\t\tposition: relative;\n\t\t\tborder-radius: ", ";\n\n\t\t\t/*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n\t\t\tword-wrap: normal;\n\t\t}\n\n\t\t& .MediaGroup,\n\t\t& .code-block {\n\t\t\tmargin-top: ", ";\n\n\t\t\t&:first-child {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t}\n\n\t\t", "\n\n\t\t", "\n\n ", ";\n\t\t", ";\n\t\t& [data-layout-section] {\n\t\t\tmargin-top: ", ";\n\t\t\t& > div + div {\n\t\t\t\tmargin-left: ", ";\n\t\t\t}\n\n\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t& > div + div {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t& .MediaGroup,\n\t\t\t& .code-block {\n\t\t\t\tmargin-top: ", ";\n\n\t\t\t\t&:first-child {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t& li {\n\t\t\t> .code-block {\n\t\t\t\tmargin: ", " 0 0 0;\n\t\t\t}\n\t\t\t> .code-block:first-child {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\n\t\t\t> div:last-of-type.code-block {\n\t\t\t\tmargin-bottom: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&:not([data-node-type='decisionList']) > li,\n // This prevents https://product-fabric.atlassian.net/browse/ED-20924\n &:not(.", ") > li {\n\t\t\t", "\n\t\t}\n\t"])), (0, _editorSharedStyles.editorFontSize)(themeProps), "var(--ds-text, ".concat(colors.N800, ")"), _consts.RendererCssClassName.DOCUMENT, fullPageStyles(wrapperProps, themeProps), fullWidthStyles(wrapperProps), _consts.RendererCssClassName.DOCUMENT, _mediaInline.mediaInlineImageStyles, headingAnchorStyle('h1'), headingAnchorStyle('h2'), headingAnchorStyle('h3'), headingAnchorStyle('h4'), headingAnchorStyle('h5'), headingAnchorStyle('h6'), "var(--ds-link, ".concat(colors.B400, ")"), "var(--ds-link, ".concat(colors.B300, ")"), "var(--ds-link-pressed, ".concat(colors.B500, ")"), "var(--ds-text-subtlest, ".concat(colors.N200, ")"), telepointerStyles, _styles.whitespaceSharedStyles, _styles.blockquoteSharedStyles, (0, _styles.headingsSharedStyles)(typography), (0, _styles.ruleSharedStyles)(), (0, _styles.paragraphSharedStyles)(typography), _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.blockMarksSharedStyles, (0, _styles.codeMarkSharedStyles)(), _styles.shadowSharedStyle, _styles.dateSharedStyle, _styles.textColorStyles, (0, _styles.backgroundColorStyles)(), _styles.tasksAndDecisionsStyles, _styles.smartCardSharedStyles, getAnnotationStyles(wrapperProps), "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)", (0, _editorSharedStyles.relativeFontSizeToBase16)(14), "var(--ds-font-weight-regular, 400)", "var(--ds-background-neutral, ".concat(colors.N30A, ")"), "var(--ds-border-radius-100, 3px)", "var(--ds-text, ".concat(colors.N800, ")"), "var(--ds-space-025, 2px)", "var(--ds-space-050, 4px)", "var(--ds-background-danger, ".concat(colors.R50, ")"), "var(--ds-text-danger, ".concat(colors.R500, ")"), "var(--ds-space-300, 24px)", _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, "var(--ds-space-100, 8px)", alignedHeadingAnchorStyle(wrapperProps), _styles.mediaSingleSharedStyle, _consts.RendererCssClassName.DOCUMENT, breakoutWidthStyle(), _consts.RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER, _consts.RendererCssClassName.EXTENSION, _consts.RendererCssClassName.DOCUMENT, _consts.RendererCssClassName.EXTENSION, _editorSharedStyles.blockNodesVerticalMargin, _consts.RendererCssClassName.EXTENSION_CENTER_ALIGN, _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, _ui.shadowObserverClassNames.SHADOW_CONTAINER, _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, (0, _styles.tableSharedStyle)(), _consts.RendererCssClassName.DOCUMENT, _styles.TableSharedCssClassName.TABLE_CONTAINER, _ui.shadowClassNames.RIGHT_SHADOW, _ui.shadowClassNames.LEFT_SHADOW, _styles.tableMarginTop - 1, _styles.tableMarginTop, _editorSharedStyles.akEditorStickyHeaderZIndex, getShadowOverrides(), (0, _table.isStickyScrollbarEnabled)(appearance) ? stickyScrollbarStyles : '', _ui.shadowObserverClassNames.SENTINEL_LEFT, _ui.shadowObserverClassNames.SENTINEL_RIGHT, _styles.tableMarginTop, (0, _platformFeatureFlags.fg)('platform_editor_renderer_table_header_styles') ? ".".concat(_styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, " > table, .").concat(_styles.TableSharedCssClassName.TABLE_STICKY_WRAPPER, " > table") : 'table', tableSortableColumnStyle(wrapperProps), (0, _platformFeatureFlags.fg)('platform_editor_renderer_table_header_styles') ? ".".concat(_styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, " > table > tbody > tr:first-of-type, .").concat(_styles.TableSharedCssClassName.TABLE_STICKY_WRAPPER, " > table > tbody > tr:first-of-type") : 'table tr:first-of-type', _consts.RendererCssClassName.NUMBER_COLUMN, "var(--ds-background-neutral, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), _editorSharedStyles.akEditorTableNumberColumnWidth, "var(--ds-text-subtlest, ".concat(colors.N200, ")"), (0, _editorSharedStyles.relativeFontSizeToBase16)(14), _consts.RendererCssClassName.NUMBER_COLUMN, _editorSharedStyles.akEditorStickyHeaderZIndex, "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), _editorSharedStyles.akEditorStickyHeaderZIndex, "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"), "var(--ds-border-radius-100, 3px)", _editorSharedStyles.blockNodesVerticalMargin, useGridRenderForCodeBlock(useBlockRenderForCodeBlock), (0, _lightWeightCodeBlock.getLightWeightCodeBlockStylesForRootRendererStyleSheet)(), isAdvancedLayoutsOn ? _styles.columnLayoutResponsiveSharedStyle : _styles.columnLayoutSharedStyle, isAdvancedLayoutsOn && _styles.columnLayoutResponsiveRendererStyles, "var(--ds-space-250, 20px)", isAdvancedLayoutsOn ? 0 : "var(--ds-space-400, 32px)", _editorSharedStyles.gridMediumMaxWidth, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _browser.browser.safari ? _styles.codeBlockInListSafariFix : '');
|
|
206
|
+
return (0, _react.css)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n\t\tfont-size: ", "px;\n\t\tline-height: 1.5rem;\n\t\tcolor: ", ";\n\n\t\t.", "::after {\n\t\t\t// we add a clearfix after ak-renderer-document in order to\n\t\t\t// contain internal floats (such as media images that are \"wrap-left\")\n\t\t\t// to just the renderer (and not spill outside of it)\n\t\t\tcontent: '';\n\t\t\tvisibility: hidden;\n\t\t\tdisplay: block;\n\t\t\theight: 0;\n\t\t\tclear: both;\n\t\t}\n\n\t\t", "\n\t\t", "\n\n .", " {\n\t\t\t", "\n\t\t}\n\n\t\t& h1 {\n\t\t\t", "\n\t\t}\n\n\t\t& h2 {\n\t\t\t", "\n\t\t}\n\n\t\t& h3 {\n\t\t\t", "\n\t\t}\n\n\t\t& h4 {\n\t\t\t", "\n\t\t}\n\n\t\t& h5 {\n\t\t\t", "\n\t\t}\n\n\t\t& h6 {\n\t\t\t", "\n\t\t}\n\n\t\t& span.akActionMark {\n\t\t\tcolor: ", ";\n\t\t\ttext-decoration: none;\n\n\t\t\t&:hover {\n\t\t\t\tcolor: ", ";\n\t\t\t\ttext-decoration: underline;\n\t\t\t}\n\n\t\t\t&:active {\n\t\t\t\tcolor: ", ";\n\t\t\t}\n\t\t}\n\n\t\t& span.akActionMark {\n\t\t\tcursor: pointer;\n\t\t}\n\n\t\t& span[data-placeholder] {\n\t\t\tcolor: ", ";\n\t\t}\n\n\t\t", "\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", "\n\t\t", "\n\n\t\t& .UnknownBlock {\n\t\t\tfont-family: ", ";\n\t\t\tfont-size: ", ";\n\t\t\tfont-weight: ", ";\n\t\t\twhite-space: pre-wrap;\n\t\t\tword-wrap: break-word;\n\t\t}\n\n\t\t& span.date-node {\n\t\t\tbackground: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tcolor: ", ";\n\t\t\tpadding: ", " ", ";\n\t\t\tmargin: 0 1px;\n\t\t\ttransition: background 0.3s;\n\t\t}\n\n\t\t& span.date-node-highlighted {\n\t\t\tbackground: ", ";\n\t\t\tcolor: ", ";\n\t\t}\n\n\t\t& .renderer-image {\n\t\t\tmax-width: 100%;\n\t\t\tdisplay: block;\n\t\t\tmargin: ", " 0;\n\t\t}\n\n\t\t.", ".rich-media-wrapped + .", ":not(.rich-media-wrapped) {\n\t\t\tclear: both;\n\t\t}\n\n\t\t& .code-block,\n\t\t& blockquote,\n\t\t& hr,\n\t\t& > div > div:not(.rich-media-wrapped),\n\t\t.", ".rich-media-wrapped + .rich-media-wrapped + *:not(.rich-media-wrapped),\n\t\t.", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n\t\t.", ".image-align-start,\n\t\t\t.", ".image-center,\n\t\t\t.", ".image-align-end {\n\t\t\tclear: both;\n\t\t}\n\n\t\t& .rich-media-wrapped {\n\t\t\t& + h1,\n\t\t\t& + h2,\n\t\t\t& + h3,\n\t\t\t& + h4,\n\t\t\t& + h5,\n\t\t\t& + h6 {\n\t\t\t\tmargin-top: ", ";\n\t\t\t}\n\t\t}\n\n\t\t", "\n\t\t/* plugin styles */\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n\t\t\tmargin-left: 0;\n\t\t\tmargin-right: 0;\n\t\t}\n\n\t\t/* Breakout for tables and extensions */\n\t\t.", " > {\n\t\t\t", "\n\n\t\t\t* .", " {\n\t\t\t\toverflow-x: auto;\n\t\t\t}\n\n\t\t\t& .", ":first-child {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t}\n\n\t\t.", " {\n\t\t\t.", " {\n\t\t\t\tmargin-top: ", ";\n\t\t\t}\n\n\t\t\t.", " {\n\t\t\t\tmargin-left: 50%;\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t}\n\n\t\t\t.", " {\n\t\t\t\toverflow-x: auto;\n\t\t\t}\n\n\t\t\t.", " .", " {\n\t\t\t\tdisplay: flex;\n\t\t\t}\n\t\t}\n\n\t\t", "\n\n\t\t.", " .", " {\n\t\t\tz-index: 0;\n\t\t\ttransition: all 0.1s linear;\n\t\t\tdisplay: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n\t\t\t/** Shadow overrides */\n\t\t\t&.", "::after, &.", "::before {\n\t\t\t\ttop: ", "px;\n\t\t\t\theight: calc(100% - ", "px);\n\t\t\t\tz-index: ", ";\n\t\t\t}\n\n\t\t\t", "\n\n\t\t\t", "\n\n\t\t\t&\n .", ",\n &\n .", " {\n\t\t\t\theight: calc(100% - ", "px);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * A hack for making all the <th /> heights equal in case some have shorter\n\t\t\t * content than others.\n\t\t\t *\n\t\t\t * This is done to make sort buttons fill entire <th />.\n\t\t\t*/\n\t\t\t", " {\n\t\t\t\theight: 1px; /* will be ignored */\n\t\t\t\t", ";\n\t\t\t\tmargin-left: 0;\n\t\t\t\tmargin-right: 0;\n\t\t\t}\n\n\t\t\t", " {\n\t\t\t\theight: 100%;\n\n\t\t\t\ttd,\n\t\t\t\tth {\n\t\t\t\t\tposition: relative;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttable[data-number-column='true'] {\n\t\t\t\t.", " {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\tborder-right: 1px solid\n\t\t\t\t\t\t", ";\n\t\t\t\t\twidth: ", "px;\n\t\t\t\t\ttext-align: center;\n\t\t\t\t\tcolor: ", ";\n\t\t\t\t\tfont-size: ", ";\n\t\t\t\t}\n\n\t\t\t\t.fixed .", " {\n\t\t\t\t\tborder-right: 0px none;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttr[data-header-row].fixed {\n\t\t\tposition: fixed !important;\n\t\t\tdisplay: flex;\n\t\t\toverflow: hidden;\n\t\t\tz-index: ", ";\n\n\t\t\tborder-right: 1px solid ", ";\n\t\t\tborder-bottom: 1px solid ", ";\n\n\t\t\t/* this is to compensate for the table border */\n\t\t\ttransform: translateX(-1px);\n\t\t}\n\n\t\t.sticky > th {\n\t\t\tz-index: ", ";\n\t\t\tposition: sticky !important;\n\t\t\ttop: 0;\n\t\t}\n\n\t\t/* Make the number column header sticky */\n\t\t.sticky > td {\n\t\t\tposition: sticky !important;\n\t\t\ttop: 0;\n\t\t}\n\n\t\t/* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n\t\t.sticky th,\n\t\t.sticky td {\n\t\t\tbox-shadow:\n\t\t\t\t0px 1px ", ",\n\t\t\t\t0px -0.5px ", ",\n\t\t\t\tinset -1px 0px ", ",\n\t\t\t\t0px -1px ", ";\n\t\t}\n\n\t\t/* this will remove jumpiness caused in Chrome for sticky headers */\n\t\t.fixed + tr {\n\t\t\tmin-height: 0px;\n\t\t}\n\n\t\t/*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n\t\t& .code-block {\n\t\t\tmax-width: 100%;\n\t\t\t/* -ms- properties are necessary until MS supports the latest version of the grid spec */\n\t\t\t/* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n\t\t\tdisplay: block;\n\t\t\t/* stylelint-enable */\n\n\t\t\tposition: relative;\n\t\t\tborder-radius: ", ";\n\n\t\t\t/*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n\t\t\tword-wrap: normal;\n\t\t}\n\n\t\t& .MediaGroup,\n\t\t& .code-block {\n\t\t\tmargin-top: ", ";\n\n\t\t\t&:first-child {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t}\n\n\t\t", "\n\n\t\t", "\n\n ", ";\n\t\t", ";\n\t\t& [data-layout-section] {\n\t\t\tmargin-top: ", ";\n\t\t\t& > div + div {\n\t\t\t\tmargin-left: ", ";\n\t\t\t}\n\n\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t& > div + div {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t& .MediaGroup,\n\t\t\t& .code-block {\n\t\t\t\tmargin-top: ", ";\n\n\t\t\t\t&:first-child {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t& li {\n\t\t\t> .code-block {\n\t\t\t\tmargin: ", " 0 0 0;\n\t\t\t}\n\t\t\t> .code-block:first-child {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\n\t\t\t> div:last-of-type.code-block {\n\t\t\t\tmargin-bottom: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&:not([data-node-type='decisionList']) > li,\n // This prevents https://product-fabric.atlassian.net/browse/ED-20924\n &:not(.", ") > li {\n\t\t\t", "\n\t\t}\n\t"])), (0, _editorSharedStyles.editorFontSize)(themeProps), "var(--ds-text, ".concat(colors.N800, ")"), _consts.RendererCssClassName.DOCUMENT, fullPageStyles(wrapperProps, themeProps), fullWidthStyles(wrapperProps), _consts.RendererCssClassName.DOCUMENT, _mediaInline.mediaInlineImageStyles, headingAnchorStyle('h1'), headingAnchorStyle('h2'), headingAnchorStyle('h3'), headingAnchorStyle('h4'), headingAnchorStyle('h5'), headingAnchorStyle('h6'), "var(--ds-link, ".concat(colors.B400, ")"), "var(--ds-link, ".concat(colors.B300, ")"), "var(--ds-link-pressed, ".concat(colors.B500, ")"), "var(--ds-text-subtlest, ".concat(colors.N200, ")"), telepointerStyles, _styles.whitespaceSharedStyles, _styles.blockquoteSharedStyles, (0, _styles.headingsSharedStyles)(typography), (0, _styles.ruleSharedStyles)(), (0, _styles.paragraphSharedStyles)(typography), _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.blockMarksSharedStyles, (0, _styles.codeMarkSharedStyles)(), _styles.shadowSharedStyle, _styles.dateSharedStyle, _styles.textColorStyles, (0, _styles.backgroundColorStyles)(), _styles.tasksAndDecisionsStyles, (0, _platformFeatureFlags.fg)('platform-linking-visual-refresh-v1') ? (0, _styles.getSmartCardSharedStyles)() : _styles.smartCardSharedStyles, getAnnotationStyles(wrapperProps), "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)", (0, _editorSharedStyles.relativeFontSizeToBase16)(14), "var(--ds-font-weight-regular, 400)", "var(--ds-background-neutral, ".concat(colors.N30A, ")"), "var(--ds-border-radius-100, 3px)", "var(--ds-text, ".concat(colors.N800, ")"), "var(--ds-space-025, 2px)", "var(--ds-space-050, 4px)", "var(--ds-background-danger, ".concat(colors.R50, ")"), "var(--ds-text-danger, ".concat(colors.R500, ")"), "var(--ds-space-300, 24px)", _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, "var(--ds-space-100, 8px)", alignedHeadingAnchorStyle(wrapperProps), _styles.mediaSingleSharedStyle, _consts.RendererCssClassName.DOCUMENT, breakoutWidthStyle(), _consts.RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER, _consts.RendererCssClassName.EXTENSION, _consts.RendererCssClassName.DOCUMENT, _consts.RendererCssClassName.EXTENSION, _editorSharedStyles.blockNodesVerticalMargin, _consts.RendererCssClassName.EXTENSION_CENTER_ALIGN, _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, _ui.shadowObserverClassNames.SHADOW_CONTAINER, _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, (0, _styles.tableSharedStyle)(), _consts.RendererCssClassName.DOCUMENT, _styles.TableSharedCssClassName.TABLE_CONTAINER, _ui.shadowClassNames.RIGHT_SHADOW, _ui.shadowClassNames.LEFT_SHADOW, _styles.tableMarginTop - 1, _styles.tableMarginTop, _editorSharedStyles.akEditorStickyHeaderZIndex, getShadowOverrides(), (0, _table.isStickyScrollbarEnabled)(appearance) ? stickyScrollbarStyles : '', _ui.shadowObserverClassNames.SENTINEL_LEFT, _ui.shadowObserverClassNames.SENTINEL_RIGHT, _styles.tableMarginTop, (0, _platformFeatureFlags.fg)('platform_editor_renderer_table_header_styles') ? ".".concat(_styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, " > table, .").concat(_styles.TableSharedCssClassName.TABLE_STICKY_WRAPPER, " > table") : 'table', tableSortableColumnStyle(wrapperProps), (0, _platformFeatureFlags.fg)('platform_editor_renderer_table_header_styles') ? ".".concat(_styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, " > table > tbody > tr:first-of-type, .").concat(_styles.TableSharedCssClassName.TABLE_STICKY_WRAPPER, " > table > tbody > tr:first-of-type") : 'table tr:first-of-type', _consts.RendererCssClassName.NUMBER_COLUMN, "var(--ds-background-neutral, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), _editorSharedStyles.akEditorTableNumberColumnWidth, "var(--ds-text-subtlest, ".concat(colors.N200, ")"), (0, _editorSharedStyles.relativeFontSizeToBase16)(14), _consts.RendererCssClassName.NUMBER_COLUMN, _editorSharedStyles.akEditorStickyHeaderZIndex, "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), _editorSharedStyles.akEditorStickyHeaderZIndex, "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"), "var(--ds-border-radius-100, 3px)", _editorSharedStyles.blockNodesVerticalMargin, useGridRenderForCodeBlock(useBlockRenderForCodeBlock), (0, _lightWeightCodeBlock.getLightWeightCodeBlockStylesForRootRendererStyleSheet)(), isAdvancedLayoutsOn ? _styles.columnLayoutResponsiveSharedStyle : _styles.columnLayoutSharedStyle, isAdvancedLayoutsOn && _styles.columnLayoutResponsiveRendererStyles, "var(--ds-space-250, 20px)", isAdvancedLayoutsOn ? 0 : "var(--ds-space-400, 32px)", _editorSharedStyles.gridMediumMaxWidth, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _browser.browser.safari ? _styles.codeBlockInListSafariFix : '');
|
|
207
207
|
};
|
|
208
208
|
};
|
|
209
209
|
var useGridRenderForCodeBlock = function useGridRenderForCodeBlock(codeBlockRenderAsBlock) {
|
|
@@ -5,16 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
7
|
import { jsx, css } from '@emotion/react';
|
|
8
|
+
import { sharedMultiBodiedExtensionStyles } from '@atlaskit/editor-common/ui';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
10
|
const containerCSS = css({
|
|
9
|
-
minHeight: '100px'
|
|
11
|
+
minHeight: '100px',
|
|
12
|
+
flexBasis: '100%'
|
|
10
13
|
});
|
|
11
14
|
const ExtensionFrame = props => {
|
|
12
15
|
return jsx("div", {
|
|
13
|
-
css: containerCSS,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
16
|
+
css: [containerCSS, fg('platform_editor_multi_body_extension_extensibility') &&
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
18
|
+
sharedMultiBodiedExtensionStyles.extensionFrameContent],
|
|
19
|
+
"data-extension-frame": "true"
|
|
18
20
|
}, props.children);
|
|
19
21
|
};
|
|
20
22
|
export default ExtensionFrame;
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
// Mapping file
|
|
3
3
|
|
|
4
4
|
import Loadable from 'react-loadable';
|
|
5
|
+
import { UnsupportedBlock, UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
7
|
import Blockquote from './blockquote';
|
|
6
8
|
import BodiedExtension from './bodiedExtension';
|
|
9
|
+
import MultiBodiedExtensionOld from './multiBodiedExtensionOld';
|
|
7
10
|
import MultiBodiedExtension from './multiBodiedExtension';
|
|
8
11
|
import ExtensionFrame from './extensionFrame';
|
|
9
12
|
import BulletList from './bulletList';
|
|
@@ -24,7 +27,6 @@ import Table from './table';
|
|
|
24
27
|
import { TableCell, TableHeader } from './tableCell';
|
|
25
28
|
import TableRow from './tableRow';
|
|
26
29
|
import UnknownBlock from './unknownBlock';
|
|
27
|
-
import { UnsupportedBlock, UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
28
30
|
|
|
29
31
|
// Ignored via go/ees005
|
|
30
32
|
// eslint-disable-next-line import/no-named-as-default
|
|
@@ -188,6 +190,7 @@ export const toReact = (node, flags, nodeComponents
|
|
|
188
190
|
...nodeToReact,
|
|
189
191
|
...nodeComponents
|
|
190
192
|
};
|
|
193
|
+
nodes['multiBodiedExtension'] = fg('platform_editor_multi_body_extension_extensibility') ? MultiBodiedExtension : MultiBodiedExtensionOld;
|
|
191
194
|
return nodes[node.type.name];
|
|
192
195
|
};
|
|
193
196
|
/*
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const useMultiBodiedExtensionActions = ({
|
|
3
|
+
updateActiveChild,
|
|
4
|
+
children,
|
|
5
|
+
allowBodiedOverride,
|
|
6
|
+
childrenContainer
|
|
7
|
+
}) => {
|
|
8
|
+
return React.useMemo(() => {
|
|
9
|
+
return {
|
|
10
|
+
changeActive(index) {
|
|
11
|
+
if (!Number.isInteger(index)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
updateActiveChild(index);
|
|
15
|
+
return true;
|
|
16
|
+
},
|
|
17
|
+
addChild() {
|
|
18
|
+
return false;
|
|
19
|
+
},
|
|
20
|
+
getChildrenCount() {
|
|
21
|
+
return children && Array.isArray(children) ? children.length : 0;
|
|
22
|
+
},
|
|
23
|
+
removeChild(_index) {
|
|
24
|
+
return false;
|
|
25
|
+
},
|
|
26
|
+
updateParameters(_parameters) {
|
|
27
|
+
return false;
|
|
28
|
+
},
|
|
29
|
+
getChildren() {
|
|
30
|
+
return [];
|
|
31
|
+
},
|
|
32
|
+
getChildrenContainer() {
|
|
33
|
+
return allowBodiedOverride ? childrenContainer : null;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}, [updateActiveChild, children, allowBodiedOverride, childrenContainer]);
|
|
37
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import memoizeOne from 'memoize-one';
|
|
3
|
+
import { getExtensionModuleNodePrivateProps, getNodeRenderer } from '@atlaskit/editor-common/extensions';
|
|
4
|
+
import { useProvider } from '@atlaskit/editor-common/provider-factory';
|
|
5
|
+
export const useMultiBodiedExtensionContext = ({
|
|
6
|
+
extensionType,
|
|
7
|
+
extensionKey
|
|
8
|
+
}) => {
|
|
9
|
+
const isMounted = React.useRef(true);
|
|
10
|
+
const localGetNodeRenderer = React.useMemo(() => memoizeOne(getNodeRenderer), []);
|
|
11
|
+
const [provider, setProvider] = React.useState();
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
const [privateProps, setPrivateProps] = React.useState();
|
|
14
|
+
const providerPromise = useProvider('extensionProvider');
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (providerPromise) {
|
|
17
|
+
providerPromise.then(p => {
|
|
18
|
+
if (isMounted.current) {
|
|
19
|
+
setProvider(p);
|
|
20
|
+
}
|
|
21
|
+
return getExtensionModuleNodePrivateProps(p, extensionType, extensionKey);
|
|
22
|
+
}).then(pr => {
|
|
23
|
+
if (isMounted.current) {
|
|
24
|
+
setPrivateProps(pr);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}, [providerPromise, extensionType, extensionKey]);
|
|
29
|
+
const NodeRenderer = React.useMemo(() => {
|
|
30
|
+
if (!provider) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return localGetNodeRenderer(provider, extensionType, extensionKey);
|
|
34
|
+
}, [provider, extensionType, extensionKey, localGetNodeRenderer]);
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
isMounted.current = true;
|
|
37
|
+
return () => {
|
|
38
|
+
isMounted.current = false;
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
return React.useMemo(() => {
|
|
42
|
+
if (!provider || !NodeRenderer || !privateProps) {
|
|
43
|
+
return {
|
|
44
|
+
extensionContext: null,
|
|
45
|
+
loading: true
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
extensionContext: {
|
|
50
|
+
NodeRenderer,
|
|
51
|
+
privateProps
|
|
52
|
+
},
|
|
53
|
+
loading: false
|
|
54
|
+
};
|
|
55
|
+
}, [provider, NodeRenderer, privateProps]);
|
|
56
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
1
|
+
/* eslint-disable @atlaskit/design-system/prefer-primitives, @atlaskit/design-system/consistent-css-prop-usage */
|
|
3
2
|
/**
|
|
4
3
|
* @jsxRuntime classic
|
|
5
4
|
* @jsx jsx
|
|
5
|
+
* @jsxFrag
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
@@ -10,46 +10,13 @@ import { jsx, css } from '@emotion/react';
|
|
|
10
10
|
import { N40 } from '@atlaskit/theme/colors';
|
|
11
11
|
import React, { useState } from 'react';
|
|
12
12
|
import { renderExtension } from './extension';
|
|
13
|
-
import ExtensionRenderer from '../../ui/ExtensionRenderer';
|
|
14
13
|
import { WidthConsumer, sharedMultiBodiedExtensionStyles } from '@atlaskit/editor-common/ui';
|
|
15
14
|
import { RendererCssClassName } from '../../consts';
|
|
16
15
|
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const actions = React.useMemo(() => {
|
|
22
|
-
return {
|
|
23
|
-
changeActive(index) {
|
|
24
|
-
return updateActiveChild(index);
|
|
25
|
-
},
|
|
26
|
-
addChild() {
|
|
27
|
-
return false;
|
|
28
|
-
},
|
|
29
|
-
getChildrenCount() {
|
|
30
|
-
return children ? children === null || children === void 0 ? void 0 : children.length : 0;
|
|
31
|
-
},
|
|
32
|
-
removeChild(index) {
|
|
33
|
-
return false;
|
|
34
|
-
},
|
|
35
|
-
updateParameters(parameters) {
|
|
36
|
-
return false;
|
|
37
|
-
},
|
|
38
|
-
// Ignored via go/ees005
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
-
getChildren() {
|
|
41
|
-
return [];
|
|
42
|
-
},
|
|
43
|
-
getChildrenContainer() {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}, [updateActiveChild, children]);
|
|
48
|
-
return actions;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
52
|
-
const navigationCssExtended = css`
|
|
16
|
+
import { useMultiBodiedExtensionActions } from './multiBodiedExtension/actions';
|
|
17
|
+
import { useMultiBodiedExtensionContext } from './multiBodiedExtension/context';
|
|
18
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Ignored via go/DSP-18766
|
|
19
|
+
const navigationStyles = css`
|
|
53
20
|
${sharedMultiBodiedExtensionStyles.mbeNavigation};
|
|
54
21
|
margin-left: 0 !important;
|
|
55
22
|
margin-right: 0 !important;
|
|
@@ -58,83 +25,115 @@ const navigationCssExtended = css`
|
|
|
58
25
|
display: none;
|
|
59
26
|
}
|
|
60
27
|
`;
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
30
|
+
const containerStyles = css`
|
|
31
|
+
${sharedMultiBodiedExtensionStyles.mbeExtensionContainer};
|
|
32
|
+
.ak-renderer-extension {
|
|
33
|
+
margin-top: 0 !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[data-layout='full-width'],
|
|
37
|
+
[data-layout='wide'] {
|
|
38
|
+
.multiBodiedExtension-navigation {
|
|
39
|
+
border-right: 3px solid ${`var(--ds-border, ${N40})`} !important;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
const MultiBodiedExtensionChildrenContainer = ({
|
|
44
|
+
children
|
|
45
|
+
}) => {
|
|
46
|
+
return jsx("article", {
|
|
47
|
+
"data-testid": "multiBodiedExtension--frames"
|
|
48
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
49
|
+
,
|
|
50
|
+
className: `multiBodiedExtension--frames`
|
|
51
|
+
}, children);
|
|
52
|
+
};
|
|
53
|
+
const MultiBodiedExtensionNavigation = ({
|
|
54
|
+
children
|
|
55
|
+
}) => {
|
|
56
|
+
return jsx("nav", {
|
|
57
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
58
|
+
className: "multiBodiedExtension-navigation",
|
|
59
|
+
css: navigationStyles,
|
|
60
|
+
"data-testid": "multiBodiedExtension-navigation"
|
|
61
|
+
}, children);
|
|
62
|
+
};
|
|
63
|
+
const MultiBodiedExtensionWrapper = ({
|
|
64
|
+
width,
|
|
65
|
+
path,
|
|
66
|
+
layout,
|
|
67
|
+
children
|
|
68
|
+
}) => {
|
|
69
|
+
const isTopLevel = path.length < 1;
|
|
70
|
+
const centerAlignClass = isTopLevel && ['wide', 'full-width'].includes(layout) ? RendererCssClassName.EXTENSION_CENTER_ALIGN : '';
|
|
71
|
+
return jsx("div", {
|
|
72
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
73
|
+
className: `${RendererCssClassName.EXTENSION} ${centerAlignClass} ${RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER}`,
|
|
74
|
+
style: {
|
|
75
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
76
|
+
width: isTopLevel ? calcBreakoutWidth(layout, width) : '100%'
|
|
77
|
+
},
|
|
78
|
+
"data-layout": layout,
|
|
79
|
+
"data-testid": "multiBodiedExtension--wrapper"
|
|
80
|
+
}, children);
|
|
81
|
+
};
|
|
61
82
|
const MultiBodiedExtension = props => {
|
|
83
|
+
var _extensionContext$pri;
|
|
62
84
|
const {
|
|
63
85
|
children,
|
|
64
86
|
layout = 'default',
|
|
65
|
-
path = []
|
|
87
|
+
path = [],
|
|
88
|
+
parameters,
|
|
89
|
+
extensionType,
|
|
90
|
+
extensionKey,
|
|
91
|
+
content,
|
|
92
|
+
marks,
|
|
93
|
+
localId
|
|
66
94
|
} = props;
|
|
67
95
|
const [activeChildIndex, setActiveChildIndex] = useState(0);
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// Ignored via go/ees007
|
|
76
|
-
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
77
|
-
// TODO: Make sure we log this somewhere if this happens
|
|
78
|
-
setActiveChildIndex(0);
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
setActiveChildIndex(index);
|
|
82
|
-
return true;
|
|
83
|
-
}, [setActiveChildIndex]);
|
|
96
|
+
const {
|
|
97
|
+
loading,
|
|
98
|
+
extensionContext
|
|
99
|
+
} = useMultiBodiedExtensionContext({
|
|
100
|
+
extensionType,
|
|
101
|
+
extensionKey
|
|
102
|
+
});
|
|
84
103
|
const actions = useMultiBodiedExtensionActions({
|
|
85
|
-
updateActiveChild,
|
|
86
|
-
children
|
|
104
|
+
updateActiveChild: setActiveChildIndex,
|
|
105
|
+
children,
|
|
106
|
+
childrenContainer: jsx(MultiBodiedExtensionChildrenContainer, null, children),
|
|
107
|
+
allowBodiedOverride: extensionContext === null || extensionContext === void 0 ? void 0 : (_extensionContext$pri = extensionContext.privateProps) === null || _extensionContext$pri === void 0 ? void 0 : _extensionContext$pri.__allowBodiedOverride
|
|
87
108
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return jsx("div", {
|
|
113
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
114
|
-
className: `${RendererCssClassName.EXTENSION} ${centerAlignClass} ${overflowContainerClass}`,
|
|
115
|
-
style: {
|
|
116
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
117
|
-
width: isTopLevel ? calcBreakoutWidth(layout, width) : '100%'
|
|
118
|
-
},
|
|
119
|
-
"data-layout": layout
|
|
120
|
-
}, jsx("nav", {
|
|
121
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
122
|
-
className: "multiBodiedExtension-navigation",
|
|
123
|
-
css: navigationCssExtended,
|
|
124
|
-
"data-testid": "multiBodiedExtension-navigation"
|
|
125
|
-
}, jsx(ExtensionRenderer
|
|
126
|
-
// Ignored via go/ees005
|
|
127
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
128
|
-
, _extends({}, props, {
|
|
129
|
-
actions: actions,
|
|
130
|
-
type: "multiBodiedExtension"
|
|
131
|
-
}), ({
|
|
132
|
-
result
|
|
133
|
-
}) => {
|
|
109
|
+
const renderContent = React.useCallback(() => {
|
|
110
|
+
var _marks$find, _marks$find$attrs;
|
|
111
|
+
if (loading || !extensionContext) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const {
|
|
115
|
+
NodeRenderer,
|
|
116
|
+
privateProps
|
|
117
|
+
} = extensionContext;
|
|
118
|
+
const fragmentLocalId = marks === null || marks === void 0 ? void 0 : (_marks$find = marks.find(m => m.type.name === 'fragment')) === null || _marks$find === void 0 ? void 0 : (_marks$find$attrs = _marks$find.attrs) === null || _marks$find$attrs === void 0 ? void 0 : _marks$find$attrs.localId;
|
|
119
|
+
const node = {
|
|
120
|
+
type: 'multiBodiedExtension',
|
|
121
|
+
extensionKey,
|
|
122
|
+
extensionType,
|
|
123
|
+
parameters,
|
|
124
|
+
content,
|
|
125
|
+
localId,
|
|
126
|
+
fragmentLocalId
|
|
127
|
+
};
|
|
128
|
+
const renderMultiBodiedExtension = () => {
|
|
129
|
+
const MultiBodiedExtensionNodeRenderer = jsx(NodeRenderer, {
|
|
130
|
+
node: node,
|
|
131
|
+
actions: actions
|
|
132
|
+
});
|
|
134
133
|
try {
|
|
135
|
-
if (
|
|
134
|
+
if ( /*#__PURE__*/React.isValidElement(MultiBodiedExtensionNodeRenderer)) {
|
|
136
135
|
// Return the content directly if it's a valid JSX.Element
|
|
137
|
-
return renderExtension(
|
|
136
|
+
return renderExtension(MultiBodiedExtensionNodeRenderer, layout, {
|
|
138
137
|
isTopLevel: path.length < 1
|
|
139
138
|
});
|
|
140
139
|
}
|
|
@@ -147,24 +146,34 @@ const MultiBodiedExtension = props => {
|
|
|
147
146
|
return renderExtension(children, layout, {
|
|
148
147
|
isTopLevel: path.length < 1
|
|
149
148
|
});
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
}
|
|
149
|
+
};
|
|
150
|
+
if (privateProps.__allowBodiedOverride) {
|
|
151
|
+
return renderMultiBodiedExtension();
|
|
152
|
+
} else {
|
|
153
|
+
return jsx(React.Fragment, null, jsx(MultiBodiedExtensionNavigation, null, renderMultiBodiedExtension()), jsx(MultiBodiedExtensionChildrenContainer, null, children));
|
|
154
|
+
}
|
|
155
|
+
}, [loading, extensionContext, layout, path, marks, extensionKey, extensionType, parameters, content, localId, actions, children]);
|
|
156
|
+
|
|
157
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
158
|
+
const containerActiveFrameStyles = css`
|
|
159
|
+
.multiBodiedExtension--frames
|
|
160
|
+
> [data-extension-frame='true']:nth-of-type(${activeChildIndex + 1}) {
|
|
161
|
+
display: block;
|
|
162
|
+
}
|
|
163
|
+
`;
|
|
157
164
|
return jsx("section", {
|
|
158
165
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
159
|
-
className: "multiBodiedExtension--container"
|
|
160
|
-
|
|
161
|
-
,
|
|
162
|
-
css: containerCssExtended,
|
|
166
|
+
className: "multiBodiedExtension--container",
|
|
167
|
+
css: [containerStyles, containerActiveFrameStyles],
|
|
163
168
|
"data-testid": "multiBodiedExtension--container",
|
|
164
169
|
"data-active-child-index": activeChildIndex,
|
|
165
170
|
"data-layout": layout
|
|
166
171
|
}, jsx(WidthConsumer, null, ({
|
|
167
172
|
width
|
|
168
|
-
}) =>
|
|
173
|
+
}) => jsx(MultiBodiedExtensionWrapper, {
|
|
174
|
+
layout: layout,
|
|
175
|
+
width: width,
|
|
176
|
+
path: path
|
|
177
|
+
}, renderContent())));
|
|
169
178
|
};
|
|
170
179
|
export default MultiBodiedExtension;
|