@atlaskit/renderer 109.1.5 → 109.2.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 +20 -0
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +4 -13
- package/dist/cjs/react/nodes/mediaInline.js +77 -114
- package/dist/cjs/react/nodes/multiBodiedExtension.js +14 -9
- package/dist/cjs/react/nodes/panel.js +2 -16
- package/dist/cjs/react/nodes/table/colgroup.js +5 -12
- package/dist/cjs/react/nodes/table.js +1 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/Renderer/style.js +7 -58
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +22 -29
- package/dist/es2019/react/nodes/mediaInline.js +66 -88
- package/dist/es2019/react/nodes/multiBodiedExtension.js +43 -37
- package/dist/es2019/react/nodes/panel.js +11 -23
- package/dist/es2019/react/nodes/table/colgroup.js +5 -12
- package/dist/es2019/react/nodes/table.js +1 -1
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/Renderer/style.js +27 -79
- package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +5 -14
- package/dist/esm/react/nodes/mediaInline.js +82 -119
- package/dist/esm/react/nodes/multiBodiedExtension.js +16 -10
- package/dist/esm/react/nodes/panel.js +3 -17
- package/dist/esm/react/nodes/table/colgroup.js +5 -12
- package/dist/esm/react/nodes/table.js +1 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/Renderer/style.js +9 -59
- package/dist/types/react/nodes/mediaInline.d.ts +5 -8
- package/dist/types-ts4.5/react/nodes/mediaInline.d.ts +5 -8
- package/package.json +5 -8
|
@@ -8,11 +8,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.rendererStyles = exports.headingSizes = exports.TELEPOINTER_ID = exports.FullPagePadding = void 0;
|
|
9
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
10
|
var _react = require("@emotion/react");
|
|
11
|
-
var _components = require("@atlaskit/theme/components");
|
|
12
11
|
var _constants = require("@atlaskit/theme/constants");
|
|
13
12
|
var _colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
|
|
14
13
|
var colors = _colors;
|
|
15
14
|
var _typography = require("@atlaskit/theme/typography");
|
|
15
|
+
var _tokens = require("@atlaskit/tokens");
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
17
|
var _mediaInline = require("@atlaskit/editor-common/media-inline");
|
|
18
18
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
@@ -24,28 +24,16 @@ var _headingAnchor = require("../../react/nodes/heading-anchor");
|
|
|
24
24
|
var _lightWeightCodeBlock = require("../../react/nodes/codeBlock/components/lightWeightCodeBlock");
|
|
25
25
|
var _table = require("../../react/nodes/table");
|
|
26
26
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
27
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
27
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
29
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
30
|
var FullPagePadding = exports.FullPagePadding = 32;
|
|
30
31
|
var tableShadowWidth = 32;
|
|
31
32
|
var TELEPOINTER_ID = exports.TELEPOINTER_ID = 'ai-streaming-telepointer';
|
|
32
|
-
var telepointerStyles = function telepointerStyles(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
dark: '#
|
|
36
|
-
})(themeProps), (0, _components.themed)({
|
|
37
|
-
light: '#8BDBE5',
|
|
38
|
-
dark: '#60C6D2'
|
|
39
|
-
})(themeProps), (0, _components.themed)({
|
|
40
|
-
light: '#0C66E4',
|
|
41
|
-
dark: '#388BFF'
|
|
42
|
-
})(themeProps), "var(--ds-space-025, 2px)", "var(--ds-text-inverse, white)", (0, _components.themed)({
|
|
43
|
-
light: '#8BDBE5',
|
|
44
|
-
dark: '#60C6D2'
|
|
45
|
-
})(themeProps), (0, _components.themed)({
|
|
46
|
-
light: '#0C66E4',
|
|
47
|
-
dark: '#388BFF'
|
|
48
|
-
})(themeProps));
|
|
33
|
+
var telepointerStyles = function telepointerStyles() {
|
|
34
|
+
var _getGlobalTheme = (0, _tokens.getGlobalTheme)(),
|
|
35
|
+
colorMode = _getGlobalTheme.colorMode;
|
|
36
|
+
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n #", " {\n display: inline-block;\n position: relative;\n width: 1.5px;\n height: 25px;\n background: linear-gradient(\n 45deg,\n ", " -12.02%,\n ", " 19.18%,\n ", " 71.87%\n );\n margin-left: ", ";\n\n &::after {\n content: 'AI';\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n font-size: 10px;\n font-weight: 700;\n width: 12.5px;\n height: 13px;\n padding-top: 1px;\n padding-left: 1.5px;\n line-height: initial;\n border-radius: 0px 2px 2px 0px;\n color: ", ";\n background: linear-gradient(\n 45deg,\n ", " -57%,\n ", " 71.87%\n );\n }\n }\n "])), TELEPOINTER_ID, colorMode === 'dark' ? '#f5cd47' : '#f8e6a0', colorMode === 'dark' ? '#60c6d2' : '#8bdbe5', colorMode === 'dark' ? '#388bff' : '#0c66e4', "var(--ds-space-025, 2px)", "var(--ds-text-inverse, white)", colorMode === 'dark' ? '#60c6d2' : '#8bdbe5', colorMode === 'dark' ? '#388bff' : '#0c66e4');
|
|
49
37
|
};
|
|
50
38
|
var getLineHeight = function getLineHeight(fontCode) {
|
|
51
39
|
return _typography.headingSizes[fontCode].lineHeight / _typography.headingSizes[fontCode].size;
|
|
@@ -123,46 +111,7 @@ var rendererStyles = exports.rendererStyles = function rendererStyles(wrapperPro
|
|
|
123
111
|
theme: theme
|
|
124
112
|
};
|
|
125
113
|
var useBlockRenderForCodeBlock = wrapperProps.useBlockRenderForCodeBlock;
|
|
126
|
-
return (0, _react.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n font-size: ", "px;\n line-height: 1.5rem;\n color: ", ";\n\n .", "::after {\n // we add a clearfix after ak-renderer-document in order to\n // contain internal floats (such as media images that are \"wrap-left\")\n // to just the renderer (and not spill outside of it)\n content: '';\n visibility: hidden;\n display: block;\n height: 0;\n clear: both;\n }\n\n ", "\n ", "\n\n .", " {\n ", "\n }\n\n & h1 {\n ", "\n }\n\n & h2 {\n ", "\n }\n\n & h3 {\n ", "\n }\n\n & h4 {\n ", "\n }\n\n & h5 {\n ", "\n }\n\n & h6 {\n ", "\n }\n\n & span.akActionMark {\n color: ", ";\n text-decoration: none;\n\n &:hover {\n color: ", ";\n text-decoration: underline;\n }\n\n &:active {\n color: ", ";\n }\n }\n\n & span.akActionMark {\n cursor: pointer;\n }\n\n & span[data-placeholder] {\n color: ", ";\n }\n\n ", "\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", "\n\n & .UnknownBlock {\n font-family: ", ";\n font-size: ", ";\n font-weight: 400;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n\n & span.date-node {\n background: ", ";\n border-radius: ", ";\n color: ", ";\n padding: ", " ", ";\n margin: 0 1px;\n transition: background 0.3s;\n }\n\n & span.date-node-highlighted {\n background: ", ";\n color: ", ";\n }\n\n & .renderer-image {\n max-width: 100%;\n display: block;\n margin: ", " 0;\n }\n\n .", ".rich-media-wrapped\n + .", ":not(.rich-media-wrapped) {\n clear: both;\n }\n\n & .code-block,\n & blockquote,\n & hr,\n & > div > div:not(.rich-media-wrapped),\n .", ".rich-media-wrapped\n + .rich-media-wrapped\n + *:not(.rich-media-wrapped),\n .", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n .", ".image-align-start,\n .", ".image-center,\n .", ".image-align-end {\n clear: both;\n }\n\n & .rich-media-wrapped {\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n margin-top: ", ";\n }\n }\n\n ", "\n /* plugin styles */\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n margin-left: 0;\n margin-right: 0;\n }\n\n /* Breakout for tables and extensions */\n .", " > {\n ", "\n\n * .", " {\n overflow-x: auto;\n }\n\n & .", ":first-child {\n margin-top: 0;\n }\n }\n\n .", " {\n .", " {\n margin-top: ", ";\n }\n\n .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n .", " {\n overflow-x: auto;\n }\n\n .", "\n .", " {\n display: flex;\n }\n }\n\n ", "\n\n .", " .", " {\n z-index: 0;\n transition: all 0.1s linear;\n display: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n /** Shadow overrides */\n &.", "::after,\n &.", "::before {\n top: ", "px;\n height: calc(100% - ", "px);\n z-index: ", ";\n }\n\n ", "\n\n &\n .", ",\n &\n .", " {\n height: calc(100% - ", "px);\n }\n\n /**\n * A hack for making all the <th /> heights equal in case some have shorter\n * content than others.\n *\n * This is done to make sort buttons fill entire <th />.\n */\n table {\n height: 1px; /* will be ignored */\n ", ";\n margin-left: 0;\n margin-right: 0;\n }\n\n table tr:first-of-type {\n height: 100%;\n\n td,\n th {\n position: relative;\n }\n }\n\n table[data-number-column='true'] {\n .", " {\n background-color: ", ";\n border-right: 1px solid\n ", ";\n width: ", "px;\n text-align: center;\n color: ", ";\n font-size: ", ";\n }\n\n .fixed .", " {\n border-right: 0px none;\n }\n }\n }\n\n tr[data-header-row].fixed {\n position: fixed !important;\n display: flex;\n overflow: hidden;\n z-index: ", ";\n\n border-right: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n\n /* this is to compensate for the table border */\n transform: translateX(-1px);\n }\n\n .sticky > th {\n z-index: ", ";\n position: sticky !important;\n top: 0;\n }\n\n /* Make the number column header sticky */\n .sticky > td {\n position: sticky !important;\n top: 0;\n }\n\n /* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n .sticky th,\n .sticky td {\n box-shadow: 0px 1px\n ", ",\n 0px -0.5px ", ",\n inset -1px 0px ", ",\n 0px -1px ", ";\n }\n\n /* this will remove jumpiness caused in Chrome for sticky headers */\n .fixed + tr {\n min-height: 0px;\n }\n\n /*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n & .code-block {\n max-width: 100%;\n /* -ms- properties are necessary until MS supports the latest version of the grid spec */\n /* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n display: block;\n /* stylelint-enable */\n\n position: relative;\n border-radius: ", ";\n\n /*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n word-wrap: normal;\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n\n ", "\n\n ", "\n\n ", ";\n & [data-layout-section] {\n margin-top: ", ";\n & > div + div {\n margin-left: ", ";\n }\n\n @media screen and (max-width: ", "px) {\n & > div + div {\n margin-left: 0;\n }\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n }\n\n & li {\n > .code-block {\n margin: ", " 0 0 0;\n }\n > .code-block:first-child {\n margin-top: 0;\n }\n\n > div:last-of-type.code-block {\n margin-bottom: ", ";\n }\n }\n\n &:not([data-node-type='decisionList']) > li,\n // This prevents https://product-fabric.atlassian.net/browse/ED-20924\n &:not(.", ") > li {\n ", "\n }\n "])), (0, _editorSharedStyles.editorFontSize)(themeProps), (0, _components.themed)({
|
|
127
|
-
light: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
128
|
-
dark: "var(--ds-text, #B8C7E0)"
|
|
129
|
-
})(themeProps), _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, ")"), (0, _components.themed)({
|
|
130
|
-
light: "var(--ds-text-subtlest, ".concat(colors.N200, ")"),
|
|
131
|
-
dark: "var(--ds-text-subtlest, ".concat(colors.DN200, ")")
|
|
132
|
-
})(themeProps), telepointerStyles(themeProps), _styles.whitespaceSharedStyles, _styles.blockquoteSharedStyles, (0, _styles.headingsSharedStyles)(), (0, _styles.ruleSharedStyles)(), _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.blockMarksSharedStyles, (0, _styles.codeMarkSharedStyles)(), _styles.shadowSharedStyle, _styles.dateSharedStyle, _styles.textColorStyles, _styles.tasksAndDecisionsStyles, _styles.smartCardSharedStyles, (0, _constants.fontFamily)(), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), (0, _components.themed)({
|
|
133
|
-
light: "var(--ds-background-neutral, ".concat(colors.N30A, ")"),
|
|
134
|
-
dark: "var(--ds-background-neutral, ".concat(colors.DN70, ")")
|
|
135
|
-
})(themeProps), "var(--ds-border-radius-100, 3px)", (0, _components.themed)({
|
|
136
|
-
light: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
137
|
-
dark: "var(--ds-text, ".concat(colors.DN600, ")")
|
|
138
|
-
})(themeProps), "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(), _ui.shadowObserverClassNames.SENTINEL_LEFT, _ui.shadowObserverClassNames.SENTINEL_RIGHT, _styles.tableMarginTop, tableSortableColumnStyle(wrapperProps), _consts.RendererCssClassName.NUMBER_COLUMN, (0, _components.themed)({
|
|
139
|
-
light: "var(--ds-background-neutral, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"),
|
|
140
|
-
dark: "var(--ds-background-neutral, ".concat(_editorSharedStyles.akEditorTableToolbarDark, ")")
|
|
141
|
-
})(themeProps), (0, _components.themed)({
|
|
142
|
-
light: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"),
|
|
143
|
-
dark: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorderDark, ")")
|
|
144
|
-
})(themeProps), _editorSharedStyles.akEditorTableNumberColumnWidth, (0, _components.themed)({
|
|
145
|
-
light: "var(--ds-text-subtlest, ".concat(colors.N200, ")"),
|
|
146
|
-
dark: "var(--ds-text-subtlest, ".concat(colors.DN400, ")")
|
|
147
|
-
})(themeProps), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), _consts.RendererCssClassName.NUMBER_COLUMN, _editorSharedStyles.akEditorStickyHeaderZIndex, (0, _components.themed)({
|
|
148
|
-
light: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"),
|
|
149
|
-
dark: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorderDark, ")")
|
|
150
|
-
})(themeProps), (0, _components.themed)({
|
|
151
|
-
light: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"),
|
|
152
|
-
dark: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorderDark, ")")
|
|
153
|
-
})(themeProps), _editorSharedStyles.akEditorStickyHeaderZIndex, (0, _components.themed)({
|
|
154
|
-
light: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"),
|
|
155
|
-
dark: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorderDark, ")")
|
|
156
|
-
})(themeProps), (0, _components.themed)({
|
|
157
|
-
light: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"),
|
|
158
|
-
dark: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorderDark, ")")
|
|
159
|
-
})(themeProps), (0, _components.themed)({
|
|
160
|
-
light: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"),
|
|
161
|
-
dark: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableToolbarDark, ")")
|
|
162
|
-
})(themeProps), (0, _components.themed)({
|
|
163
|
-
light: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"),
|
|
164
|
-
dark: "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableToolbarDark, ")")
|
|
165
|
-
})(themeProps), "var(--ds-border-radius-100, 3px)", _editorSharedStyles.blockNodesVerticalMargin, useGridRenderForCodeBlock(useBlockRenderForCodeBlock), (0, _lightWeightCodeBlock.getLightWeightCodeBlockStylesForRootRendererStyleSheet)(), _styles.columnLayoutSharedStyle, "var(--ds-space-250, 20px)", "var(--ds-space-400, 32px)", _editorSharedStyles.gridMediumMaxWidth, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _utils.browser.safari ? _styles.codeBlockInListSafariFix : '');
|
|
114
|
+
return (0, _react.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n font-size: ", "px;\n line-height: 1.5rem;\n color: ", ";\n\n .", "::after {\n // we add a clearfix after ak-renderer-document in order to\n // contain internal floats (such as media images that are \"wrap-left\")\n // to just the renderer (and not spill outside of it)\n content: '';\n visibility: hidden;\n display: block;\n height: 0;\n clear: both;\n }\n\n ", "\n ", "\n\n .", " {\n ", "\n }\n\n & h1 {\n ", "\n }\n\n & h2 {\n ", "\n }\n\n & h3 {\n ", "\n }\n\n & h4 {\n ", "\n }\n\n & h5 {\n ", "\n }\n\n & h6 {\n ", "\n }\n\n & span.akActionMark {\n color: ", ";\n text-decoration: none;\n\n &:hover {\n color: ", ";\n text-decoration: underline;\n }\n\n &:active {\n color: ", ";\n }\n }\n\n & span.akActionMark {\n cursor: pointer;\n }\n\n & span[data-placeholder] {\n color: ", ";\n }\n\n ", "\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", "\n\n & .UnknownBlock {\n font-family: ", ";\n font-size: ", ";\n font-weight: 400;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n\n & span.date-node {\n background: ", ";\n border-radius: ", ";\n color: ", ";\n padding: ", " ", ";\n margin: 0 1px;\n transition: background 0.3s;\n }\n\n & span.date-node-highlighted {\n background: ", ";\n color: ", ";\n }\n\n & .renderer-image {\n max-width: 100%;\n display: block;\n margin: ", " 0;\n }\n\n .", ".rich-media-wrapped\n + .", ":not(.rich-media-wrapped) {\n clear: both;\n }\n\n & .code-block,\n & blockquote,\n & hr,\n & > div > div:not(.rich-media-wrapped),\n .", ".rich-media-wrapped\n + .rich-media-wrapped\n + *:not(.rich-media-wrapped),\n .", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n .", ".image-align-start,\n .", ".image-center,\n .", ".image-align-end {\n clear: both;\n }\n\n & .rich-media-wrapped {\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n margin-top: ", ";\n }\n }\n\n ", "\n /* plugin styles */\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n margin-left: 0;\n margin-right: 0;\n }\n\n /* Breakout for tables and extensions */\n .", " > {\n ", "\n\n * .", " {\n overflow-x: auto;\n }\n\n & .", ":first-child {\n margin-top: 0;\n }\n }\n\n .", " {\n .", " {\n margin-top: ", ";\n }\n\n .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n .", " {\n overflow-x: auto;\n }\n\n .", "\n .", " {\n display: flex;\n }\n }\n\n ", "\n\n .", " .", " {\n z-index: 0;\n transition: all 0.1s linear;\n display: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n /** Shadow overrides */\n &.", "::after,\n &.", "::before {\n top: ", "px;\n height: calc(100% - ", "px);\n z-index: ", ";\n }\n\n ", "\n\n &\n .", ",\n &\n .", " {\n height: calc(100% - ", "px);\n }\n\n /**\n * A hack for making all the <th /> heights equal in case some have shorter\n * content than others.\n *\n * This is done to make sort buttons fill entire <th />.\n */\n table {\n height: 1px; /* will be ignored */\n ", ";\n margin-left: 0;\n margin-right: 0;\n }\n\n table tr:first-of-type {\n height: 100%;\n\n td,\n th {\n position: relative;\n }\n }\n\n table[data-number-column='true'] {\n .", " {\n background-color: ", ";\n border-right: 1px solid\n ", ";\n width: ", "px;\n text-align: center;\n color: ", ";\n font-size: ", ";\n }\n\n .fixed .", " {\n border-right: 0px none;\n }\n }\n }\n\n tr[data-header-row].fixed {\n position: fixed !important;\n display: flex;\n overflow: hidden;\n z-index: ", ";\n\n border-right: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n\n /* this is to compensate for the table border */\n transform: translateX(-1px);\n }\n\n .sticky > th {\n z-index: ", ";\n position: sticky !important;\n top: 0;\n }\n\n /* Make the number column header sticky */\n .sticky > td {\n position: sticky !important;\n top: 0;\n }\n\n /* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n .sticky th,\n .sticky td {\n box-shadow: 0px 1px\n ", ",\n 0px -0.5px ", ",\n inset -1px 0px ", ",\n 0px -1px ", ";\n }\n\n /* this will remove jumpiness caused in Chrome for sticky headers */\n .fixed + tr {\n min-height: 0px;\n }\n\n /*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n & .code-block {\n max-width: 100%;\n /* -ms- properties are necessary until MS supports the latest version of the grid spec */\n /* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n display: block;\n /* stylelint-enable */\n\n position: relative;\n border-radius: ", ";\n\n /*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n word-wrap: normal;\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n\n ", "\n\n ", "\n\n ", ";\n & [data-layout-section] {\n margin-top: ", ";\n & > div + div {\n margin-left: ", ";\n }\n\n @media screen and (max-width: ", "px) {\n & > div + div {\n margin-left: 0;\n }\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n }\n\n & li {\n > .code-block {\n margin: ", " 0 0 0;\n }\n > .code-block:first-child {\n margin-top: 0;\n }\n\n > div:last-of-type.code-block {\n margin-bottom: ", ";\n }\n }\n\n &:not([data-node-type='decisionList']) > li,\n // This prevents https://product-fabric.atlassian.net/browse/ED-20924\n &:not(.", ") > li {\n ", "\n }\n "])), (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)(), (0, _styles.ruleSharedStyles)(), _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.blockMarksSharedStyles, (0, _styles.codeMarkSharedStyles)(), _styles.shadowSharedStyle, _styles.dateSharedStyle, _styles.textColorStyles, _styles.tasksAndDecisionsStyles, _styles.smartCardSharedStyles, (0, _constants.fontFamily)(), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), "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(), _ui.shadowObserverClassNames.SENTINEL_LEFT, _ui.shadowObserverClassNames.SENTINEL_RIGHT, _styles.tableMarginTop, tableSortableColumnStyle(wrapperProps), _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)((0, _constants.fontSize)()), _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)(), _styles.columnLayoutSharedStyle, "var(--ds-space-250, 20px)", "var(--ds-space-400, 32px)", _editorSharedStyles.gridMediumMaxWidth, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _utils.browser.safari ? _styles.codeBlockInListSafariFix : '');
|
|
166
115
|
};
|
|
167
116
|
};
|
|
168
117
|
var useGridRenderForCodeBlock = function useGridRenderForCodeBlock(codeBlockRenderAsBlock) {
|
|
@@ -1,44 +1,37 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx, css } from '@emotion/react';
|
|
3
3
|
import { overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import { N20
|
|
5
|
-
import { themed } from '@atlaskit/theme/components';
|
|
4
|
+
import { N20 } from '@atlaskit/theme/colors';
|
|
6
5
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
7
6
|
import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
8
7
|
import CodeBlockButtonContainer from './codeBlockButtonContainer';
|
|
9
|
-
const codeBlockStyleOverrides =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
light: `var(--ds-surface-raised, ${N20})`,
|
|
13
|
-
dark: `var(--ds-surface-raised, ${DN50})`
|
|
14
|
-
})(props)};
|
|
15
|
-
|
|
16
|
-
&:hover {
|
|
17
|
-
button {
|
|
18
|
-
opacity: 1;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
8
|
+
const codeBlockStyleOverrides = css`
|
|
9
|
+
tab-size: 4;
|
|
10
|
+
background-color: ${`var(--ds-surface-raised, ${N20})`};
|
|
21
11
|
|
|
12
|
+
&:hover {
|
|
22
13
|
button {
|
|
23
|
-
opacity:
|
|
24
|
-
transition: opacity 0.2s ease 0s;
|
|
14
|
+
opacity: 1;
|
|
25
15
|
}
|
|
16
|
+
}
|
|
26
17
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
button {
|
|
19
|
+
opacity: 0;
|
|
20
|
+
transition: opacity 0.2s ease 0s;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
${CodeBlockSharedCssClassName.DS_CODEBLOCK} {
|
|
24
|
+
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
25
|
+
line-height: 1.5rem;
|
|
26
|
+
background-image: ${overflowShadow({
|
|
27
|
+
background: `var(--ds-background-neutral, ${N20})`,
|
|
35
28
|
leftCoverWidth: "var(--ds-space-300, 24px)"
|
|
36
29
|
})};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
background-attachment: local, local, local, local, scroll, scroll, scroll,
|
|
31
|
+
scroll;
|
|
32
|
+
background-position: 0 0, 0 0, 100% 0, 100% 0, 100% 0, 100% 0, 0 0, 0 0;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
42
35
|
const CodeBlockContainer = ({
|
|
43
36
|
allowCopyToClipboard,
|
|
44
37
|
allowWrapCodeBlock,
|
|
@@ -1,36 +1,32 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import { MediaInlineImageCard
|
|
3
|
-
import {
|
|
2
|
+
import { MediaInlineImageCard } from '@atlaskit/editor-common/media-inline';
|
|
3
|
+
import { useProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
4
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
5
5
|
import { MediaClientContext } from '@atlaskit/media-client-react';
|
|
6
|
-
import {
|
|
7
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
8
|
-
import {
|
|
6
|
+
import { MediaInlineCardLoadingView } from '@atlaskit/media-ui';
|
|
7
|
+
import React, { useCallback, useEffect, useState, useContext } from 'react';
|
|
8
|
+
import { injectIntl } from 'react-intl-next';
|
|
9
9
|
import { getClipboardAttrs, mediaIdentifierMap } from '../../ui/MediaCard';
|
|
10
10
|
export const RenderMediaInline = ({
|
|
11
11
|
rendererAppearance,
|
|
12
|
-
intl,
|
|
13
12
|
clipboardAttrs,
|
|
14
|
-
mediaInlineProviders,
|
|
15
13
|
collection: collectionName,
|
|
16
14
|
eventHandlers,
|
|
17
|
-
identifier
|
|
18
|
-
alt,
|
|
19
|
-
width,
|
|
20
|
-
height,
|
|
21
|
-
type,
|
|
22
|
-
borderSize,
|
|
23
|
-
borderColor
|
|
15
|
+
identifier
|
|
24
16
|
}) => {
|
|
25
|
-
const [
|
|
17
|
+
const [contextIdentifier, setContextIdentifier] = useState();
|
|
26
18
|
const [fileState, setFileState] = useState();
|
|
27
|
-
const mediaClient =
|
|
28
|
-
const
|
|
19
|
+
const mediaClient = useContext(MediaClientContext);
|
|
20
|
+
const contextIdentifierProvider = useProvider('contextIdentifierProvider');
|
|
21
|
+
useEffect(() => {
|
|
29
22
|
if (contextIdentifierProvider) {
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
contextIdentifierProvider.then(resolvedContextID => {
|
|
24
|
+
if (contextIdentifier !== resolvedContextID) {
|
|
25
|
+
setContextIdentifier(resolvedContextID);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
32
28
|
}
|
|
33
|
-
};
|
|
29
|
+
}, [contextIdentifier, contextIdentifierProvider]);
|
|
34
30
|
const updateFileState = useCallback(async id => {
|
|
35
31
|
const options = {
|
|
36
32
|
collectionName
|
|
@@ -60,18 +56,14 @@ export const RenderMediaInline = ({
|
|
|
60
56
|
};
|
|
61
57
|
}, [identifier, collectionName]);
|
|
62
58
|
useEffect(() => {
|
|
63
|
-
const {
|
|
64
|
-
contextIdentifierProvider
|
|
65
|
-
} = mediaInlineProviders;
|
|
66
59
|
const {
|
|
67
60
|
id
|
|
68
61
|
} = clipboardAttrs;
|
|
69
|
-
updateContext(contextIdentifierProvider);
|
|
70
62
|
id && updateFileState(id);
|
|
71
|
-
}, [
|
|
63
|
+
}, [contextIdentifier, clipboardAttrs, updateFileState]);
|
|
72
64
|
|
|
73
65
|
/*
|
|
74
|
-
* Only show the loading view if the media
|
|
66
|
+
* Only show the loading view if the media client is not ready
|
|
75
67
|
* prevents calling the media API before the provider is ready
|
|
76
68
|
*/
|
|
77
69
|
if (!mediaClient) {
|
|
@@ -80,19 +72,6 @@ export const RenderMediaInline = ({
|
|
|
80
72
|
isSelected: false
|
|
81
73
|
});
|
|
82
74
|
}
|
|
83
|
-
if (type && shouldShowInlineImage(type)) {
|
|
84
|
-
return /*#__PURE__*/React.createElement(MediaInlineImageCard, {
|
|
85
|
-
mediaClient: mediaClient,
|
|
86
|
-
identifier: identifier,
|
|
87
|
-
alt: alt,
|
|
88
|
-
width: width,
|
|
89
|
-
height: height,
|
|
90
|
-
border: {
|
|
91
|
-
borderSize,
|
|
92
|
-
borderColor
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
75
|
const handleMediaInlineClick = result => {
|
|
97
76
|
var _eventHandlers$media;
|
|
98
77
|
if (eventHandlers !== null && eventHandlers !== void 0 && (_eventHandlers$media = eventHandlers.media) !== null && _eventHandlers$media !== void 0 && _eventHandlers$media.onClick) {
|
|
@@ -102,39 +81,34 @@ export const RenderMediaInline = ({
|
|
|
102
81
|
};
|
|
103
82
|
const shouldOpenMediaViewer = rendererAppearance !== 'mobile';
|
|
104
83
|
const shouldDisplayToolTip = rendererAppearance !== 'mobile';
|
|
105
|
-
const {
|
|
106
|
-
mediaProvider
|
|
107
|
-
} = mediaInlineProviders;
|
|
108
84
|
const {
|
|
109
85
|
id,
|
|
110
86
|
collection
|
|
111
87
|
} = clipboardAttrs;
|
|
112
|
-
return
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}))
|
|
130
|
-
|
|
88
|
+
return (
|
|
89
|
+
/*#__PURE__*/
|
|
90
|
+
// eslint-disable-next-line @atlaskit/design-system/prefer-primitives
|
|
91
|
+
React.createElement("span", _extends({}, getClipboardAttrs({
|
|
92
|
+
id,
|
|
93
|
+
collection,
|
|
94
|
+
contextIdentifierProvider: contextIdentifier,
|
|
95
|
+
fileState
|
|
96
|
+
}), {
|
|
97
|
+
"data-node-type": "mediaInline"
|
|
98
|
+
}), /*#__PURE__*/React.createElement(MediaInlineCard, {
|
|
99
|
+
identifier: identifier,
|
|
100
|
+
onClick: handleMediaInlineClick,
|
|
101
|
+
shouldOpenMediaViewer: shouldOpenMediaViewer,
|
|
102
|
+
shouldDisplayToolTip: shouldDisplayToolTip,
|
|
103
|
+
mediaClientConfig: mediaClient.mediaClientConfig,
|
|
104
|
+
mediaViewerItems: Array.from(mediaIdentifierMap.values())
|
|
105
|
+
}))
|
|
106
|
+
);
|
|
131
107
|
};
|
|
132
108
|
const MediaInline = props => {
|
|
133
|
-
var _borderMark$attrs$col, _borderMark$attrs$siz;
|
|
134
109
|
const {
|
|
135
110
|
collection,
|
|
136
111
|
id,
|
|
137
|
-
providers: providerFactory,
|
|
138
112
|
intl,
|
|
139
113
|
rendererAppearance,
|
|
140
114
|
featureFlags,
|
|
@@ -142,7 +116,8 @@ const MediaInline = props => {
|
|
|
142
116
|
alt,
|
|
143
117
|
width,
|
|
144
118
|
height,
|
|
145
|
-
marks
|
|
119
|
+
marks,
|
|
120
|
+
ssr
|
|
146
121
|
} = props;
|
|
147
122
|
const clipboardAttrs = {
|
|
148
123
|
id,
|
|
@@ -153,30 +128,33 @@ const MediaInline = props => {
|
|
|
153
128
|
mediaItemType: 'file',
|
|
154
129
|
collectionName: collection
|
|
155
130
|
};
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
131
|
+
const mediaClient = useContext(MediaClientContext);
|
|
132
|
+
if (fileType === 'image') {
|
|
133
|
+
var _borderMark$attrs$col, _borderMark$attrs$siz;
|
|
134
|
+
const borderMark = marks === null || marks === void 0 ? void 0 : marks.find(mark => (mark === null || mark === void 0 ? void 0 : mark.type.name) === 'border');
|
|
135
|
+
const borderColor = (_borderMark$attrs$col = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.color) !== null && _borderMark$attrs$col !== void 0 ? _borderMark$attrs$col : '';
|
|
136
|
+
const borderSize = (_borderMark$attrs$siz = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.size) !== null && _borderMark$attrs$siz !== void 0 ? _borderMark$attrs$siz : 0;
|
|
137
|
+
return /*#__PURE__*/React.createElement(MediaInlineImageCard, {
|
|
138
|
+
mediaClient: mediaClient,
|
|
139
|
+
identifier: identifier,
|
|
140
|
+
alt: alt,
|
|
141
|
+
width: width,
|
|
142
|
+
height: height,
|
|
143
|
+
ssr: ssr,
|
|
144
|
+
border: {
|
|
145
|
+
borderSize,
|
|
146
|
+
borderColor
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return /*#__PURE__*/React.createElement(RenderMediaInline, {
|
|
151
|
+
identifier: identifier,
|
|
152
|
+
clipboardAttrs: clipboardAttrs,
|
|
153
|
+
eventHandlers: props.eventHandlers,
|
|
154
|
+
rendererAppearance: rendererAppearance,
|
|
155
|
+
intl: intl,
|
|
156
|
+
collection: collection,
|
|
157
|
+
featureFlags: featureFlags
|
|
180
158
|
});
|
|
181
159
|
};
|
|
182
160
|
export default injectIntl(MediaInline);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
2
3
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage/preview */
|
|
3
4
|
/** @jsx jsx */
|
|
4
5
|
|
|
5
|
-
import { jsx
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-imports
|
|
8
|
+
import { css } from '@emotion/react';
|
|
6
9
|
import { N40, N50 } from '@atlaskit/theme/colors';
|
|
7
10
|
import React, { useState } from 'react';
|
|
8
11
|
import { renderExtension } from './extension';
|
|
@@ -87,6 +90,44 @@ const MultiBodiedExtension = props => {
|
|
|
87
90
|
`;
|
|
88
91
|
const isTopLevel = path.length < 1;
|
|
89
92
|
const centerAlignClass = isTopLevel && ['wide', 'full-width'].includes(layout) ? RendererCssClassName.EXTENSION_CENTER_ALIGN : '';
|
|
93
|
+
function renderMbeContent(width) {
|
|
94
|
+
return jsx("div", {
|
|
95
|
+
className: `${RendererCssClassName.EXTENSION} ${centerAlignClass}`,
|
|
96
|
+
style: {
|
|
97
|
+
width: isTopLevel ? calcBreakoutWidth(layout, width) : '100%'
|
|
98
|
+
},
|
|
99
|
+
"data-layout": layout
|
|
100
|
+
}, jsx("nav", {
|
|
101
|
+
className: "multiBodiedExtension-navigation",
|
|
102
|
+
css: navigationCSS,
|
|
103
|
+
"data-testid": "multiBodiedExtension-navigation"
|
|
104
|
+
}, jsx(ExtensionRenderer, _extends({}, props, {
|
|
105
|
+
actions: actions,
|
|
106
|
+
type: "multiBodiedExtension"
|
|
107
|
+
}), ({
|
|
108
|
+
result
|
|
109
|
+
}) => {
|
|
110
|
+
try {
|
|
111
|
+
if (result && /*#__PURE__*/React.isValidElement(result)) {
|
|
112
|
+
// Return the content directly if it's a valid JSX.Element
|
|
113
|
+
return renderExtension(result, layout, {
|
|
114
|
+
isTopLevel: path.length < 1
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
} catch (e) {
|
|
118
|
+
/** We don't want this error to block renderer */
|
|
119
|
+
/** We keep rendering the default content */
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Always return default content if anything goes wrong
|
|
123
|
+
return renderExtension(children, layout, {
|
|
124
|
+
isTopLevel: path.length < 1
|
|
125
|
+
});
|
|
126
|
+
})), jsx("article", {
|
|
127
|
+
className: "multiBodiedExtension--frames",
|
|
128
|
+
"data-testid": "multiBodiedExtension--frames"
|
|
129
|
+
}, children));
|
|
130
|
+
}
|
|
90
131
|
return jsx("section", {
|
|
91
132
|
className: "multiBodiedExtension--container",
|
|
92
133
|
css: containerCSS,
|
|
@@ -94,41 +135,6 @@ const MultiBodiedExtension = props => {
|
|
|
94
135
|
"data-active-child-index": activeChildIndex
|
|
95
136
|
}, jsx(WidthConsumer, null, ({
|
|
96
137
|
width
|
|
97
|
-
}) =>
|
|
98
|
-
className: `${RendererCssClassName.EXTENSION} ${centerAlignClass}`,
|
|
99
|
-
style: {
|
|
100
|
-
width: isTopLevel ? calcBreakoutWidth(layout, width) : '100%'
|
|
101
|
-
},
|
|
102
|
-
"data-layout": layout
|
|
103
|
-
}, jsx("nav", {
|
|
104
|
-
className: "multiBodiedExtension-navigation",
|
|
105
|
-
css: navigationCSS,
|
|
106
|
-
"data-testid": "multiBodiedExtension-navigation"
|
|
107
|
-
}, jsx(ExtensionRenderer, _extends({}, props, {
|
|
108
|
-
actions: actions,
|
|
109
|
-
type: "multiBodiedExtension"
|
|
110
|
-
}), ({
|
|
111
|
-
result
|
|
112
|
-
}) => {
|
|
113
|
-
try {
|
|
114
|
-
if (result && /*#__PURE__*/React.isValidElement(result)) {
|
|
115
|
-
// Return the content directly if it's a valid JSX.Element
|
|
116
|
-
return renderExtension(result, layout, {
|
|
117
|
-
isTopLevel: path.length < 1
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
} catch (e) {
|
|
121
|
-
/** We don't want this error to block renderer */
|
|
122
|
-
/** We keep rendering the default content */
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Always return default content if anything goes wrong
|
|
126
|
-
return renderExtension(children, layout, {
|
|
127
|
-
isTopLevel: path.length < 1
|
|
128
|
-
});
|
|
129
|
-
})), jsx("article", {
|
|
130
|
-
className: "multiBodiedExtension--frames",
|
|
131
|
-
"data-testid": "multiBodiedExtension--frames"
|
|
132
|
-
}, children))));
|
|
138
|
+
}) => renderMbeContent(width)));
|
|
133
139
|
};
|
|
134
140
|
export default MultiBodiedExtension;
|
|
@@ -4,20 +4,17 @@ import React from 'react';
|
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import TipIcon from '@atlaskit/icon/glyph/editor/hint';
|
|
6
6
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
7
|
-
import {
|
|
7
|
+
import { panelSharedStylesWithoutPrefix, PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
|
|
8
8
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
9
9
|
import EmojiIcon from '@atlaskit/icon/glyph/editor/emoji';
|
|
10
10
|
import EmojiItem from './emoji';
|
|
11
|
-
// AFP-2532 TODO: Fix automatic suppressions below
|
|
12
|
-
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
13
|
-
import { themed } from '@atlaskit/theme';
|
|
14
11
|
import { PanelInfoIcon, PanelSuccessIcon, PanelNoteIcon, PanelWarningIcon, PanelErrorIcon } from '@atlaskit/editor-common/icons';
|
|
15
12
|
const PanelStyled = ({
|
|
16
13
|
backgroundColor,
|
|
17
14
|
hasIcon,
|
|
18
15
|
...props
|
|
19
16
|
}) => {
|
|
20
|
-
let styles =
|
|
17
|
+
let styles = css`
|
|
21
18
|
&.${PanelSharedCssClassName.prefix} {
|
|
22
19
|
${panelSharedStylesWithoutPrefix()}
|
|
23
20
|
|
|
@@ -27,25 +24,16 @@ const PanelStyled = ({
|
|
|
27
24
|
}
|
|
28
25
|
`;
|
|
29
26
|
if (props['data-panel-type'] === PanelType.CUSTOM && backgroundColor) {
|
|
30
|
-
styles =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
light: `background-color: ${tokenColor || backgroundColor};`
|
|
35
|
-
})({
|
|
36
|
-
theme
|
|
37
|
-
});
|
|
38
|
-
return css`
|
|
39
|
-
&.${PanelSharedCssClassName.prefix} {
|
|
40
|
-
${panelSharedStylesWithoutPrefix()}
|
|
41
|
-
}
|
|
27
|
+
styles = css`
|
|
28
|
+
&.${PanelSharedCssClassName.prefix} {
|
|
29
|
+
${panelSharedStylesWithoutPrefix()}
|
|
30
|
+
}
|
|
42
31
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
32
|
+
&[data-panel-type=${PanelType.CUSTOM}] {
|
|
33
|
+
background-color: ${hexToEditorBackgroundPaletteColor(backgroundColor) || backgroundColor};
|
|
34
|
+
${hasIcon ? '' : 'padding-left: 12px;'}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
49
37
|
}
|
|
50
38
|
return jsx("div", _extends({
|
|
51
39
|
css: styles
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorTableNumberColumnWidth, akEditorWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorTableLegacyCellMinWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { isTableResizingEnabled } from '../table';
|
|
7
6
|
|
|
8
7
|
// we allow scaling down column widths by no more than 30%
|
|
@@ -69,17 +68,11 @@ const renderScaleDownColgroup = props => {
|
|
|
69
68
|
tableContainerWidth = getTableLayoutWidth(layout);
|
|
70
69
|
}
|
|
71
70
|
if (isTableResizingEnabled(rendererAppearance) && !isInsideOfBlockNode && !tableResized) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
targetWidths = new Array(noOfColumns).fill(defaultColumnWidth);
|
|
78
|
-
} else {
|
|
79
|
-
return new Array(noOfColumns).fill({
|
|
80
|
-
minWidth: `${tableCellMinWidth}px`
|
|
81
|
-
});
|
|
82
|
-
}
|
|
71
|
+
// for tables with no column widths defined, assume that the real table width
|
|
72
|
+
// is defined by node.attrs.width
|
|
73
|
+
const tableWidth = (isNumberColumnEnabled ? tableContainerWidth - akEditorTableNumberColumnWidth : tableContainerWidth) - 1;
|
|
74
|
+
const defaultColumnWidth = tableWidth / noOfColumns;
|
|
75
|
+
targetWidths = new Array(noOfColumns).fill(defaultColumnWidth);
|
|
83
76
|
} else if (!tableResized) {
|
|
84
77
|
return null;
|
|
85
78
|
}
|
|
@@ -406,7 +406,7 @@ React.createElement(WidthConsumer, null, ({
|
|
|
406
406
|
var _props$columnWidths;
|
|
407
407
|
const renderWidth = props.rendererAppearance === 'full-page' ? width - FullPagePadding * 2 : width;
|
|
408
408
|
const colWidthsSum = ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce((total, val) => total + val, 0)) || 0;
|
|
409
|
-
if (colWidthsSum ||
|
|
409
|
+
if (colWidthsSum || isTableResizingEnabled(props.rendererAppearance)) {
|
|
410
410
|
return /*#__PURE__*/React.createElement(TableWithShadows, _extends({
|
|
411
411
|
renderWidth: renderWidth
|
|
412
412
|
}, props));
|