@atlaskit/editor-common 78.10.0 → 78.11.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 +16 -0
- package/dist/cjs/extensibility/Extension/InlineExtension/index.js +40 -42
- package/dist/cjs/extensibility/Extension/InlineExtension/styles.js +32 -5
- package/dist/cjs/extensibility/ExtensionComponent.js +4 -2
- package/dist/cjs/extensibility/MultiBodiedExtension/index.js +21 -7
- package/dist/cjs/extensibility/MultiBodiedExtension/styles.js +17 -4
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/MediaSingle/index.js +5 -2
- package/dist/cjs/ui/MediaSingle/styled.js +44 -8
- package/dist/cjs/ui/MultiBodiedExtension/index.js +1 -8
- package/dist/cjs/ui/WidthProvider/index.js +35 -49
- package/dist/cjs/ui/index.js +6 -0
- package/dist/es2019/extensibility/Extension/InlineExtension/index.js +43 -28
- package/dist/es2019/extensibility/Extension/InlineExtension/styles.js +29 -22
- package/dist/es2019/extensibility/ExtensionComponent.js +4 -2
- package/dist/es2019/extensibility/MultiBodiedExtension/index.js +22 -8
- package/dist/es2019/extensibility/MultiBodiedExtension/styles.js +16 -14
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/MediaSingle/index.js +4 -2
- package/dist/es2019/ui/MediaSingle/styled.js +40 -10
- package/dist/es2019/ui/MultiBodiedExtension/index.js +1 -8
- package/dist/es2019/ui/WidthProvider/index.js +29 -35
- package/dist/es2019/ui/index.js +1 -1
- package/dist/esm/extensibility/Extension/InlineExtension/index.js +40 -45
- package/dist/esm/extensibility/Extension/InlineExtension/styles.js +31 -3
- package/dist/esm/extensibility/ExtensionComponent.js +4 -2
- package/dist/esm/extensibility/MultiBodiedExtension/index.js +22 -8
- package/dist/esm/extensibility/MultiBodiedExtension/styles.js +17 -3
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/MediaSingle/index.js +5 -2
- package/dist/esm/ui/MediaSingle/styled.js +44 -9
- package/dist/esm/ui/MultiBodiedExtension/index.js +1 -8
- package/dist/esm/ui/WidthProvider/index.js +31 -49
- package/dist/esm/ui/index.js +1 -1
- package/dist/types/extensibility/Extension/InlineExtension/index.d.ts +5 -4
- package/dist/types/extensibility/Extension/InlineExtension/styles.d.ts +1 -0
- package/dist/types/extensibility/MultiBodiedExtension/index.d.ts +1 -0
- package/dist/types/preset/plugin-injection-api.d.ts +1 -1
- package/dist/types/types/feature-flags.d.ts +16 -0
- package/dist/types/ui/MediaSingle/index.d.ts +2 -1
- package/dist/types/ui/MediaSingle/styled.d.ts +11 -2
- package/dist/types/ui/WidthProvider/index.d.ts +3 -10
- package/dist/types/ui/index.d.ts +1 -1
- package/dist/types-ts4.5/extensibility/Extension/InlineExtension/index.d.ts +5 -4
- package/dist/types-ts4.5/extensibility/Extension/InlineExtension/styles.d.ts +1 -0
- package/dist/types-ts4.5/extensibility/MultiBodiedExtension/index.d.ts +1 -0
- package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +2 -2
- package/dist/types-ts4.5/types/feature-flags.d.ts +16 -0
- package/dist/types-ts4.5/ui/MediaSingle/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/MediaSingle/styled.d.ts +11 -2
- package/dist/types-ts4.5/ui/WidthProvider/index.d.ts +3 -10
- package/dist/types-ts4.5/ui/index.d.ts +1 -1
- package/package.json +4 -1
- package/tsconfig.json +1 -4
|
@@ -1,33 +1,48 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { Fragment } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
+
import { akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
|
|
5
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { useSharedPluginState } from '../../../hooks';
|
|
7
|
+
import { createWidthContext, WidthContext } from '../../../ui';
|
|
4
8
|
import ExtensionLozenge from '../Lozenge';
|
|
5
9
|
import { overlay } from '../styles';
|
|
6
|
-
import { wrapperStyle } from './styles';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
10
|
+
import { inlineWrapperStyels, wrapperStyle } from './styles';
|
|
11
|
+
const InlineExtension = props => {
|
|
12
|
+
const {
|
|
13
|
+
node,
|
|
14
|
+
pluginInjectionApi,
|
|
15
|
+
showMacroInteractionDesignUpdates,
|
|
16
|
+
isNodeSelected,
|
|
17
|
+
children
|
|
18
|
+
} = props;
|
|
19
|
+
const {
|
|
20
|
+
widthState
|
|
21
|
+
} = useSharedPluginState(pluginInjectionApi, ['width']);
|
|
22
|
+
const hasChildren = !!children;
|
|
23
|
+
const className = hasChildren ? 'with-overlay with-children' : 'with-overlay';
|
|
24
|
+
const rendererContainerWidth = widthState ? widthState.width - akEditorGutterPadding * 2 : 0;
|
|
25
|
+
const extendedInlineExtension = getBooleanFF('platform.editor.inline_extension.extended_lcqdn') || false;
|
|
26
|
+
const inlineExtensionInternal = jsx(Fragment, null, showMacroInteractionDesignUpdates && jsx(ExtensionLozenge, {
|
|
27
|
+
node: node,
|
|
28
|
+
isNodeSelected: isNodeSelected,
|
|
29
|
+
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates
|
|
30
|
+
}), jsx("div", {
|
|
31
|
+
css: [wrapperStyle, extendedInlineExtension && inlineWrapperStyels],
|
|
32
|
+
className: `extension-container inline ${className}`
|
|
33
|
+
}, jsx("div", {
|
|
34
|
+
css: overlay,
|
|
35
|
+
className: "extension-overlay"
|
|
36
|
+
}), children ? children : jsx(ExtensionLozenge, {
|
|
37
|
+
node: node,
|
|
38
|
+
isNodeSelected: isNodeSelected,
|
|
39
|
+
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates
|
|
40
|
+
})));
|
|
41
|
+
if (extendedInlineExtension) {
|
|
42
|
+
return jsx(WidthContext.Provider, {
|
|
43
|
+
value: createWidthContext(rendererContainerWidth)
|
|
44
|
+
}, inlineExtensionInternal);
|
|
32
45
|
}
|
|
33
|
-
|
|
46
|
+
return inlineExtensionInternal;
|
|
47
|
+
};
|
|
48
|
+
export default InlineExtension;
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { wrapperDefault } from '../styles';
|
|
3
|
-
export const wrapperStyle = css
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
export const wrapperStyle = css(wrapperDefault, {
|
|
4
|
+
cursor: 'pointer',
|
|
5
|
+
display: 'inline-flex',
|
|
6
|
+
margin: `1px 1px ${"var(--ds-space-050, 4px)"}`,
|
|
7
|
+
'> img': {
|
|
8
|
+
borderRadius: "var(--ds-border-radius, 3px)"
|
|
9
|
+
},
|
|
10
|
+
'&::after, &::before': {
|
|
11
|
+
verticalAlign: 'text-top',
|
|
12
|
+
display: 'inline-block',
|
|
13
|
+
width: '1px',
|
|
14
|
+
content: "''"
|
|
15
|
+
},
|
|
16
|
+
'&.with-children': {
|
|
17
|
+
padding: 0,
|
|
18
|
+
background: "var(--ds-background-neutral-subtle, white)"
|
|
12
19
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
});
|
|
21
|
+
export const inlineWrapperStyels = css({
|
|
22
|
+
maxWidth: '100%',
|
|
23
|
+
display: 'inline-block',
|
|
24
|
+
'&::after, &::before': {
|
|
25
|
+
display: 'block'
|
|
26
|
+
},
|
|
27
|
+
'tr &': {
|
|
28
|
+
maxWidth: 'inherit'
|
|
29
|
+
},
|
|
30
|
+
'.rich-media-item': {
|
|
31
|
+
maxWidth: '100%'
|
|
20
32
|
}
|
|
21
|
-
|
|
22
|
-
&.with-children {
|
|
23
|
-
padding: 0;
|
|
24
|
-
background: ${"var(--ds-background-neutral-subtle, white)"};
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
33
|
+
});
|
|
@@ -163,7 +163,8 @@ export class ExtensionComponent extends Component {
|
|
|
163
163
|
eventDispatcher: eventDispatcher,
|
|
164
164
|
pluginInjectionApi: pluginInjectionApi,
|
|
165
165
|
editorAppearance: editorAppearance,
|
|
166
|
-
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates
|
|
166
|
+
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates,
|
|
167
|
+
isNodeSelected: selectedNode === node
|
|
167
168
|
});
|
|
168
169
|
}
|
|
169
170
|
const extensionHandlerResult = this.tryExtensionHandler(undefined);
|
|
@@ -187,7 +188,8 @@ export class ExtensionComponent extends Component {
|
|
|
187
188
|
return /*#__PURE__*/React.createElement(InlineExtension, {
|
|
188
189
|
node: node,
|
|
189
190
|
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates,
|
|
190
|
-
isNodeSelected: selectedNode === node
|
|
191
|
+
isNodeSelected: selectedNode === node,
|
|
192
|
+
pluginInjectionApi: pluginInjectionApi
|
|
191
193
|
}, extensionHandlerResult);
|
|
192
194
|
default:
|
|
193
195
|
return null;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
|
|
5
|
-
import React, { useState } from 'react';
|
|
5
|
+
import React, { Fragment, useState } from 'react';
|
|
6
6
|
import { css, jsx } from '@emotion/react';
|
|
7
7
|
import classnames from 'classnames';
|
|
8
8
|
import EditorFileIcon from '@atlaskit/icon/glyph/editor/file';
|
|
@@ -10,10 +10,14 @@ import { useSharedPluginState } from '../../hooks';
|
|
|
10
10
|
import { sharedMultiBodiedExtensionStyles } from '../../ui/MultiBodiedExtension';
|
|
11
11
|
import { calculateBreakoutStyles, getExtensionLozengeData } from '../../utils';
|
|
12
12
|
import { WithPluginState } from '../../with-plugin-state';
|
|
13
|
+
import ExtensionLozenge from '../Extension/Lozenge';
|
|
13
14
|
import { useMultiBodiedExtensionActions } from './action-api';
|
|
14
15
|
import { mbeExtensionWrapperCSS } from './styles';
|
|
15
16
|
// Similar to the one in platform/packages/editor/editor-common/src/extensibility/Extension/Lozenge.tsx
|
|
16
|
-
const getWrapperTitleContent = (imageData, title) => {
|
|
17
|
+
const getWrapperTitleContent = (imageData, title, showMacroInteractionDesignUpdates) => {
|
|
18
|
+
if (showMacroInteractionDesignUpdates) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
17
21
|
if (imageData) {
|
|
18
22
|
const {
|
|
19
23
|
url,
|
|
@@ -32,7 +36,8 @@ const getWrapperTitleContent = (imageData, title) => {
|
|
|
32
36
|
})), title);
|
|
33
37
|
}
|
|
34
38
|
return jsx("div", {
|
|
35
|
-
className: "extension-title"
|
|
39
|
+
className: "extension-title",
|
|
40
|
+
"data-testid": 'multiBodiedExtension-default-lozenge'
|
|
36
41
|
}, jsx(EditorFileIcon, {
|
|
37
42
|
label: title
|
|
38
43
|
}), title);
|
|
@@ -45,7 +50,9 @@ const MultiBodiedExtensionWithWidth = ({
|
|
|
45
50
|
editorView,
|
|
46
51
|
eventDispatcher,
|
|
47
52
|
widthState,
|
|
48
|
-
editorAppearance
|
|
53
|
+
editorAppearance,
|
|
54
|
+
showMacroInteractionDesignUpdates,
|
|
55
|
+
isNodeSelected
|
|
49
56
|
}) => {
|
|
50
57
|
const {
|
|
51
58
|
parameters,
|
|
@@ -98,13 +105,20 @@ const MultiBodiedExtensionWithWidth = ({
|
|
|
98
105
|
});
|
|
99
106
|
mbeWrapperStyles = breakoutStyles;
|
|
100
107
|
}
|
|
101
|
-
const wrapperClassNames = classnames('multiBodiedExtension--wrapper', 'extension-container', 'block'
|
|
102
|
-
|
|
108
|
+
const wrapperClassNames = classnames('multiBodiedExtension--wrapper', 'extension-container', 'block', {
|
|
109
|
+
'remove-margin-top': showMacroInteractionDesignUpdates
|
|
110
|
+
});
|
|
111
|
+
return jsx(Fragment, null, showMacroInteractionDesignUpdates && jsx(ExtensionLozenge, {
|
|
112
|
+
isNodeSelected: isNodeSelected,
|
|
113
|
+
node: node,
|
|
114
|
+
showMacroInteractionDesignUpdates: true,
|
|
115
|
+
customContainerStyles: mbeWrapperStyles
|
|
116
|
+
}), jsx("div", {
|
|
103
117
|
className: wrapperClassNames,
|
|
104
118
|
css: mbeExtensionWrapperCSS,
|
|
105
119
|
"data-testid": "multiBodiedExtension--wrapper",
|
|
106
120
|
style: mbeWrapperStyles
|
|
107
|
-
}, getWrapperTitleContent(imageData, title), jsx("div", {
|
|
121
|
+
}, getWrapperTitleContent(imageData, title, showMacroInteractionDesignUpdates), jsx("div", {
|
|
108
122
|
className: "multiBodiedExtension--container",
|
|
109
123
|
css: containerCssExtended,
|
|
110
124
|
"data-testid": "multiBodiedExtension--container",
|
|
@@ -117,7 +131,7 @@ const MultiBodiedExtensionWithWidth = ({
|
|
|
117
131
|
className: "multiBodiedExtension--frames",
|
|
118
132
|
"data-testid": "multiBodiedExtension--frames",
|
|
119
133
|
ref: articleRef
|
|
120
|
-
})));
|
|
134
|
+
}))));
|
|
121
135
|
};
|
|
122
136
|
const MultiBodiedExtensionWithSharedState = props => {
|
|
123
137
|
const {
|
|
@@ -2,18 +2,20 @@ import { css } from '@emotion/react';
|
|
|
2
2
|
import { wrapperDefault } from '../Extension/styles';
|
|
3
3
|
|
|
4
4
|
// Wrapper the extension title and extensionContainer
|
|
5
|
-
export const mbeExtensionWrapperCSS = css
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
export const mbeExtensionWrapperCSS = css(wrapperDefault, {
|
|
6
|
+
'&.remove-margin-top': {
|
|
7
|
+
marginTop: 0
|
|
8
|
+
},
|
|
9
|
+
cursor: 'pointer',
|
|
10
|
+
marginTop: "var(--ds-space-250, 24px)",
|
|
11
|
+
marginBottom: "var(--ds-space-200, 16px)",
|
|
12
|
+
'.extension-title': {
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
lineHeight: '16px !important',
|
|
16
|
+
marginBottom: "var(--ds-space-100, 8px)",
|
|
17
|
+
marginLeft: `${"var(--ds-space-050, 4px)"} !important`,
|
|
18
|
+
marginRight: "var(--ds-space-100, 8px)",
|
|
19
|
+
paddingTop: `${"var(--ds-space-100, 8px)"} !important`
|
|
18
20
|
}
|
|
19
|
-
|
|
21
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
2
2
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
3
|
-
const packageVersion = "78.
|
|
3
|
+
const packageVersion = "78.11.0";
|
|
4
4
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
5
5
|
// Remove URL as it has UGC
|
|
6
6
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
7
7
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
8
8
|
import Layer from '../Layer';
|
|
9
9
|
const packageName = "@atlaskit/editor-common";
|
|
10
|
-
const packageVersion = "78.
|
|
10
|
+
const packageVersion = "78.11.0";
|
|
11
11
|
const halfFocusRing = 1;
|
|
12
12
|
const dropOffset = '0, 8';
|
|
13
13
|
class DropList extends Component {
|
|
@@ -21,7 +21,8 @@ export default function MediaSingle({
|
|
|
21
21
|
fullWidthMode,
|
|
22
22
|
lineLength: editorWidth,
|
|
23
23
|
hasFallbackContainer = true,
|
|
24
|
-
handleMediaSingleRef
|
|
24
|
+
handleMediaSingleRef,
|
|
25
|
+
isInsideOfInlineExtension = false
|
|
25
26
|
}) {
|
|
26
27
|
const isPixelWidth = (size === null || size === void 0 ? void 0 : size.widthType) === 'pixel';
|
|
27
28
|
let mediaSingleWidth = (size === null || size === void 0 ? void 0 : size.width) || pctWidth;
|
|
@@ -79,7 +80,8 @@ export default function MediaSingle({
|
|
|
79
80
|
containerWidth,
|
|
80
81
|
mediaSingleWidth,
|
|
81
82
|
fullWidthMode,
|
|
82
|
-
isExtendedResizeExperienceOn: isPixelWidth
|
|
83
|
+
isExtendedResizeExperienceOn: isPixelWidth,
|
|
84
|
+
isInsideOfInlineExtension
|
|
83
85
|
}),
|
|
84
86
|
"data-layout": layout,
|
|
85
87
|
"data-width": mediaSingleWidth,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import { akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
5
|
+
import { akEditorDefaultLayoutWidth, akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { nonWrappedLayouts } from '../../utils';
|
|
7
7
|
import { calcBreakoutWidth, calcWideWidth } from '../../utils/breakout';
|
|
8
8
|
function float(layout) {
|
|
@@ -15,11 +15,17 @@ function float(layout) {
|
|
|
15
15
|
return 'none';
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
function getWidthIfFullWidthMode(
|
|
19
|
-
|
|
18
|
+
function getWidthIfFullWidthMode(originalWidth, containerWidth, isInsideOfInlineExtension) {
|
|
19
|
+
if (isInsideOfInlineExtension) {
|
|
20
|
+
return originalWidth > akEditorFullWidthLayoutWidth ? `${Math.min(containerWidth, akEditorFullWidthLayoutWidth)}px` : `${originalWidth}px`;
|
|
21
|
+
}
|
|
22
|
+
return originalWidth > akEditorFullWidthLayoutWidth ? '100%' : `${originalWidth}px`;
|
|
20
23
|
}
|
|
21
|
-
function getWidthIfDefaultMode(
|
|
22
|
-
|
|
24
|
+
function getWidthIfDefaultMode(originalWidth, containerWidth, isInsideOfInlineExtension) {
|
|
25
|
+
if (isInsideOfInlineExtension) {
|
|
26
|
+
return originalWidth > akEditorFullPageMaxWidth ? `${Math.min(containerWidth, akEditorDefaultLayoutWidth)}px` : `${originalWidth}px`;
|
|
27
|
+
}
|
|
28
|
+
return originalWidth > akEditorFullPageMaxWidth ? '100%' : `${originalWidth}px`;
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
/**
|
|
@@ -29,7 +35,7 @@ function getWidthIfDefaultMode(width) {
|
|
|
29
35
|
* then an image in wide or full-width can not be wider than the image's
|
|
30
36
|
* original width.
|
|
31
37
|
*/
|
|
32
|
-
export function calcLegacyWidth(layout, width, containerWidth = 0, fullWidthMode, isResized) {
|
|
38
|
+
export function calcLegacyWidth(layout, width, containerWidth = 0, fullWidthMode, isResized, isInsideOfInlineExtension) {
|
|
33
39
|
switch (layout) {
|
|
34
40
|
case 'align-start':
|
|
35
41
|
case 'align-end':
|
|
@@ -37,11 +43,34 @@ export function calcLegacyWidth(layout, width, containerWidth = 0, fullWidthMode
|
|
|
37
43
|
case 'wrap-left':
|
|
38
44
|
return width > containerWidth / 2 ? 'calc(50% - 12px)' : `${width}px`;
|
|
39
45
|
case 'wide':
|
|
40
|
-
return calcWideWidth(containerWidth);
|
|
46
|
+
return isInsideOfInlineExtension ? calcWideWidth(containerWidth, Infinity, `${containerWidth}px`) : calcWideWidth(containerWidth);
|
|
47
|
+
case 'full-width':
|
|
48
|
+
return calcBreakoutWidth(layout, containerWidth);
|
|
49
|
+
default:
|
|
50
|
+
return isResized ? `${width}px` : fullWidthMode ? getWidthIfFullWidthMode(width, containerWidth, isInsideOfInlineExtension) : getWidthIfDefaultMode(width, containerWidth, isInsideOfInlineExtension);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Calculates the image width for non-resized images.
|
|
56
|
+
*
|
|
57
|
+
* If an image has not been resized using the pctWidth attribute,
|
|
58
|
+
* then an image in wide or full-width can not be wider than the image's
|
|
59
|
+
* original width.
|
|
60
|
+
*/
|
|
61
|
+
export function calcLegacyWidthForInline(layout, width, containerWidth = 0, fullWidthMode, isResized) {
|
|
62
|
+
switch (layout) {
|
|
63
|
+
case 'align-start':
|
|
64
|
+
case 'align-end':
|
|
65
|
+
case 'wrap-right':
|
|
66
|
+
case 'wrap-left':
|
|
67
|
+
return width > containerWidth / 2 ? 'calc(50% - 12px)' : `${width}px`;
|
|
68
|
+
case 'wide':
|
|
69
|
+
return calcWideWidth(containerWidth, Infinity, `${containerWidth}px`);
|
|
41
70
|
case 'full-width':
|
|
42
71
|
return calcBreakoutWidth(layout, containerWidth);
|
|
43
72
|
default:
|
|
44
|
-
return isResized ? `${width}px` : fullWidthMode ? getWidthIfFullWidthMode(width) : getWidthIfDefaultMode(width);
|
|
73
|
+
return isResized ? `${width}px` : fullWidthMode ? getWidthIfFullWidthMode(width, containerWidth) : getWidthIfDefaultMode(width, containerWidth);
|
|
45
74
|
}
|
|
46
75
|
}
|
|
47
76
|
|
|
@@ -104,7 +133,8 @@ export const MediaSingleDimensionHelper = ({
|
|
|
104
133
|
width,
|
|
105
134
|
// original media width
|
|
106
135
|
isExtendedResizeExperienceOn,
|
|
107
|
-
isNestedNode = false
|
|
136
|
+
isNestedNode = false,
|
|
137
|
+
isInsideOfInlineExtension = false
|
|
108
138
|
}) => css`
|
|
109
139
|
/* For nested rich media items, set max-width to 100% */
|
|
110
140
|
tr &,
|
|
@@ -115,7 +145,7 @@ export const MediaSingleDimensionHelper = ({
|
|
|
115
145
|
max-width: 100%;
|
|
116
146
|
}
|
|
117
147
|
|
|
118
|
-
width: ${isExtendedResizeExperienceOn ? `${mediaSingleWidth || width}px` : mediaSingleWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized)};
|
|
148
|
+
width: ${isExtendedResizeExperienceOn ? `${mediaSingleWidth || width}px` : mediaSingleWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized, isInsideOfInlineExtension)};
|
|
119
149
|
${layout === 'full-width' &&
|
|
120
150
|
/* This causes issues for new experience where we don't strip layout attributes
|
|
121
151
|
when copying top-level node and pasting into a table/layout,
|
|
@@ -6,9 +6,8 @@ import { BODIED_EXT_MBE_MARGIN_TOP } from '../../styles';
|
|
|
6
6
|
|
|
7
7
|
// Wraps the navigation bar and extensionFrames
|
|
8
8
|
const mbeExtensionContainer = css({
|
|
9
|
-
background: '
|
|
9
|
+
background: 'transparent !important',
|
|
10
10
|
'padding:': {
|
|
11
|
-
bottom: `${"var(--ds-space-100, 8px)"} !important`,
|
|
12
11
|
left: `${"var(--ds-space-100, 8px)"} !important`,
|
|
13
12
|
right: `${"var(--ds-space-100, 8px)"} !important`
|
|
14
13
|
},
|
|
@@ -60,12 +59,6 @@ const extensionFrameContent = css({
|
|
|
60
59
|
},
|
|
61
60
|
'.extensionView-content-wrap': {
|
|
62
61
|
marginTop: `${"var(--ds-space-100, 8px)"} !important`
|
|
63
|
-
},
|
|
64
|
-
'.decisionItemView-content-wrap': {
|
|
65
|
-
marginTop: '0px !important'
|
|
66
|
-
},
|
|
67
|
-
'.decisionItemView-content-wrap > [data-decision-wrapper]': {
|
|
68
|
-
marginTop: '0px !important'
|
|
69
62
|
}
|
|
70
63
|
});
|
|
71
64
|
export const sharedMultiBodiedExtensionStyles = {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
/** @jsx jsx */
|
|
3
|
-
import React from 'react';
|
|
2
|
+
import React, { Fragment } from 'react';
|
|
4
3
|
import { css, jsx } from '@emotion/react';
|
|
5
4
|
import rafSchedule from 'raf-schd';
|
|
6
5
|
import { WidthObserver } from '@atlaskit/width-detector';
|
|
@@ -26,38 +25,33 @@ const {
|
|
|
26
25
|
Provider,
|
|
27
26
|
Consumer
|
|
28
27
|
} = WidthContext;
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
width
|
|
42
|
-
});
|
|
43
|
-
}));
|
|
44
|
-
if (typeof document !== 'undefined') {
|
|
45
|
-
this.state.width = document.body.offsetWidth;
|
|
28
|
+
export const WidthProvider = ({
|
|
29
|
+
className,
|
|
30
|
+
shouldCheckExistingValue,
|
|
31
|
+
children
|
|
32
|
+
}) => {
|
|
33
|
+
const existingContextValue = React.useContext(WidthContext);
|
|
34
|
+
const [width, setWidth] = React.useState(typeof document !== 'undefined' ? document.body.offsetWidth : 0);
|
|
35
|
+
const providerValue = React.useMemo(() => createWidthContext(width), [width]);
|
|
36
|
+
const updateWidth = rafSchedule(nextWidth => {
|
|
37
|
+
// Ignore changes that are less than SCROLLBAR_WIDTH, otherwise it can cause infinite re-scaling
|
|
38
|
+
if (Math.abs(width - nextWidth) < SCROLLBAR_WIDTH) {
|
|
39
|
+
return;
|
|
46
40
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
}
|
|
41
|
+
setWidth(nextWidth);
|
|
42
|
+
});
|
|
43
|
+
const skipWidthDetection = shouldCheckExistingValue && existingContextValue.width > 0;
|
|
44
|
+
return jsx("div", {
|
|
45
|
+
css: css`
|
|
46
|
+
position: relative;
|
|
47
|
+
width: 100%;
|
|
48
|
+
`,
|
|
49
|
+
className: className
|
|
50
|
+
}, !skipWidthDetection && jsx(Fragment, null, jsx(WidthObserver, {
|
|
51
|
+
setWidth: updateWidth,
|
|
52
|
+
offscreen: true
|
|
53
|
+
}), jsx(Provider, {
|
|
54
|
+
value: providerValue
|
|
55
|
+
}, children)), skipWidthDetection && children);
|
|
56
|
+
};
|
|
63
57
|
export { Consumer as WidthConsumer };
|
package/dist/es2019/ui/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export { default as UnsupportedBlock } from './UnsupportedBlock';
|
|
|
8
8
|
export { default as UnsupportedInline } from './UnsupportedInline';
|
|
9
9
|
export { BaseTheme, mapBreakpointToLayoutMaxWidth } from './BaseTheme';
|
|
10
10
|
export { default as withOuterListeners } from './with-outer-listeners';
|
|
11
|
-
export { WidthContext, WidthConsumer, WidthProvider, getBreakpoint } from './WidthProvider';
|
|
11
|
+
export { WidthContext, WidthConsumer, WidthProvider, createWidthContext, getBreakpoint } from './WidthProvider';
|
|
12
12
|
export { default as overflowShadow, shadowClassNames } from './OverflowShadow';
|
|
13
13
|
export { shadowObserverClassNames, ShadowObserver } from './OverflowShadow/shadowObserver';
|
|
14
14
|
export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
|
|
@@ -1,50 +1,45 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
7
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
8
1
|
/** @jsx jsx */
|
|
9
|
-
import React, {
|
|
2
|
+
import React, { Fragment } from 'react';
|
|
10
3
|
import { jsx } from '@emotion/react';
|
|
4
|
+
import { akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
|
|
5
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { useSharedPluginState } from '../../../hooks';
|
|
7
|
+
import { createWidthContext, WidthContext } from '../../../ui';
|
|
11
8
|
import ExtensionLozenge from '../Lozenge';
|
|
12
9
|
import { overlay } from '../styles';
|
|
13
|
-
import { wrapperStyle } from './styles';
|
|
14
|
-
var InlineExtension =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
import { inlineWrapperStyels, wrapperStyle } from './styles';
|
|
11
|
+
var InlineExtension = function InlineExtension(props) {
|
|
12
|
+
var node = props.node,
|
|
13
|
+
pluginInjectionApi = props.pluginInjectionApi,
|
|
14
|
+
showMacroInteractionDesignUpdates = props.showMacroInteractionDesignUpdates,
|
|
15
|
+
isNodeSelected = props.isNodeSelected,
|
|
16
|
+
children = props.children;
|
|
17
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width']),
|
|
18
|
+
widthState = _useSharedPluginState.widthState;
|
|
19
|
+
var hasChildren = !!children;
|
|
20
|
+
var className = hasChildren ? 'with-overlay with-children' : 'with-overlay';
|
|
21
|
+
var rendererContainerWidth = widthState ? widthState.width - akEditorGutterPadding * 2 : 0;
|
|
22
|
+
var extendedInlineExtension = getBooleanFF('platform.editor.inline_extension.extended_lcqdn') || false;
|
|
23
|
+
var inlineExtensionInternal = jsx(Fragment, null, showMacroInteractionDesignUpdates && jsx(ExtensionLozenge, {
|
|
24
|
+
node: node,
|
|
25
|
+
isNodeSelected: isNodeSelected,
|
|
26
|
+
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates
|
|
27
|
+
}), jsx("div", {
|
|
28
|
+
css: [wrapperStyle, extendedInlineExtension && inlineWrapperStyels],
|
|
29
|
+
className: "extension-container inline ".concat(className)
|
|
30
|
+
}, jsx("div", {
|
|
31
|
+
css: overlay,
|
|
32
|
+
className: "extension-overlay"
|
|
33
|
+
}), children ? children : jsx(ExtensionLozenge, {
|
|
34
|
+
node: node,
|
|
35
|
+
isNodeSelected: isNodeSelected,
|
|
36
|
+
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates
|
|
37
|
+
})));
|
|
38
|
+
if (extendedInlineExtension) {
|
|
39
|
+
return jsx(WidthContext.Provider, {
|
|
40
|
+
value: createWidthContext(rendererContainerWidth)
|
|
41
|
+
}, inlineExtensionInternal);
|
|
20
42
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var _this$props = this.props,
|
|
25
|
-
node = _this$props.node,
|
|
26
|
-
children = _this$props.children,
|
|
27
|
-
showMacroInteractionDesignUpdates = _this$props.showMacroInteractionDesignUpdates,
|
|
28
|
-
isNodeSelected = _this$props.isNodeSelected;
|
|
29
|
-
var hasChildren = !!children;
|
|
30
|
-
var className = hasChildren ? 'with-overlay with-children' : 'with-overlay';
|
|
31
|
-
return jsx(Fragment, null, showMacroInteractionDesignUpdates && jsx(ExtensionLozenge, {
|
|
32
|
-
node: node,
|
|
33
|
-
isNodeSelected: isNodeSelected,
|
|
34
|
-
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates
|
|
35
|
-
}), jsx("div", {
|
|
36
|
-
css: wrapperStyle,
|
|
37
|
-
className: "extension-container inline ".concat(className)
|
|
38
|
-
}, jsx("div", {
|
|
39
|
-
css: overlay,
|
|
40
|
-
className: "extension-overlay"
|
|
41
|
-
}), children ? children : jsx(ExtensionLozenge, {
|
|
42
|
-
node: node,
|
|
43
|
-
isNodeSelected: isNodeSelected,
|
|
44
|
-
showMacroInteractionDesignUpdates: showMacroInteractionDesignUpdates
|
|
45
|
-
})));
|
|
46
|
-
}
|
|
47
|
-
}]);
|
|
48
|
-
return InlineExtension;
|
|
49
|
-
}(Component);
|
|
50
|
-
export { InlineExtension as default };
|
|
43
|
+
return inlineExtensionInternal;
|
|
44
|
+
};
|
|
45
|
+
export default InlineExtension;
|
|
@@ -1,5 +1,33 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject;
|
|
3
1
|
import { css } from '@emotion/react';
|
|
4
2
|
import { wrapperDefault } from '../styles';
|
|
5
|
-
export var wrapperStyle = css(
|
|
3
|
+
export var wrapperStyle = css(wrapperDefault, {
|
|
4
|
+
cursor: 'pointer',
|
|
5
|
+
display: 'inline-flex',
|
|
6
|
+
margin: "1px 1px ".concat("var(--ds-space-050, 4px)"),
|
|
7
|
+
'> img': {
|
|
8
|
+
borderRadius: "var(--ds-border-radius, 3px)"
|
|
9
|
+
},
|
|
10
|
+
'&::after, &::before': {
|
|
11
|
+
verticalAlign: 'text-top',
|
|
12
|
+
display: 'inline-block',
|
|
13
|
+
width: '1px',
|
|
14
|
+
content: "''"
|
|
15
|
+
},
|
|
16
|
+
'&.with-children': {
|
|
17
|
+
padding: 0,
|
|
18
|
+
background: "var(--ds-background-neutral-subtle, white)"
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
export var inlineWrapperStyels = css({
|
|
22
|
+
maxWidth: '100%',
|
|
23
|
+
display: 'inline-block',
|
|
24
|
+
'&::after, &::before': {
|
|
25
|
+
display: 'block'
|
|
26
|
+
},
|
|
27
|
+
'tr &': {
|
|
28
|
+
maxWidth: 'inherit'
|
|
29
|
+
},
|
|
30
|
+
'.rich-media-item': {
|
|
31
|
+
maxWidth: '100%'
|
|
32
|
+
}
|
|
33
|
+
});
|