@atlaskit/editor-plugin-card 4.5.5 → 4.5.7
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 +15 -0
- package/dist/cjs/nodeviews/embedCard.js +4 -1
- package/dist/cjs/ui/ResizableEmbedCard.js +6 -0
- package/dist/es2019/nodeviews/embedCard.js +4 -1
- package/dist/es2019/ui/ResizableEmbedCard.js +6 -0
- package/dist/esm/nodeviews/embedCard.js +4 -1
- package/dist/esm/ui/ResizableEmbedCard.js +6 -0
- package/dist/types/ui/ResizableEmbedCard.d.ts +1 -0
- package/dist/types-ts4.5/ui/ResizableEmbedCard.d.ts +1 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 4.5.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#179137](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/179137)
|
|
8
|
+
[`163478624d145`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/163478624d145) -
|
|
9
|
+
Update embedCard component to avoid rerenderings when editor gets disabled
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 4.5.6
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 4.5.5
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -57,7 +57,8 @@ var CardInner = function CardInner(_ref) {
|
|
|
57
57
|
}
|
|
58
58
|
var lineLength = getLineLength(view, pos, widthStateLineLength);
|
|
59
59
|
var containerWidth = (0, _utils.isRichMediaInsideOfBlockNode)(view, pos) ? lineLength : widthStateWidth;
|
|
60
|
-
|
|
60
|
+
var editorDisabledWhenGateDisabled = (editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) && !(0, _platformFeatureFlags.fg)('platform_fix_embedded_card_re-rendering');
|
|
61
|
+
if (!allowResizing || !hasPreview || editorDisabledWhenGateDisabled) {
|
|
61
62
|
// There are two ways `width` and `height` can be defined here:
|
|
62
63
|
// 1) Either as `heightAlone` as height value and no width
|
|
63
64
|
// 2) or as `1` for height and aspectRation (defined or a default one) as a width
|
|
@@ -97,6 +98,8 @@ var CardInner = function CardInner(_ref) {
|
|
|
97
98
|
displayGrid: displayGrid,
|
|
98
99
|
updateSize: updateSize,
|
|
99
100
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
101
|
+
}, (0, _platformFeatureFlags.fg)('platform_fix_embedded_card_re-rendering') && {
|
|
102
|
+
isResizeDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
|
|
100
103
|
}), smartCard);
|
|
101
104
|
};
|
|
102
105
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -17,6 +17,7 @@ var _react2 = require("@emotion/react");
|
|
|
17
17
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
18
18
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
19
19
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
20
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
21
|
var _smartCard = require("@atlaskit/smart-card");
|
|
21
22
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -330,6 +331,7 @@ var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Compone
|
|
|
330
331
|
pctWidth = _this$props6.pctWidth,
|
|
331
332
|
containerWidth = _this$props6.containerWidth,
|
|
332
333
|
fullWidthMode = _this$props6.fullWidthMode,
|
|
334
|
+
isResizeDisabled = _this$props6.isResizeDisabled,
|
|
333
335
|
children = _this$props6.children;
|
|
334
336
|
var resizerProps = {
|
|
335
337
|
width: this.calcPxWidth(),
|
|
@@ -337,6 +339,10 @@ var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Compone
|
|
|
337
339
|
};
|
|
338
340
|
var enable = {};
|
|
339
341
|
_ui.handleSides.forEach(function (side) {
|
|
342
|
+
if (isResizeDisabled && (0, _platformFeatureFlags.fg)('platform_fix_embedded_card_re-rendering')) {
|
|
343
|
+
enable[side] = false;
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
340
346
|
var oppositeSide = side === 'left' ? 'right' : 'left';
|
|
341
347
|
enable[side] = ['full-width', 'wide', 'center'].concat("wrap-".concat(oppositeSide)).concat("align-".concat(_ui.imageAlignmentMap[oppositeSide])).indexOf(layout) > -1;
|
|
342
348
|
if (side === 'left' && _this2.insideInlineLike) {
|
|
@@ -41,7 +41,8 @@ const CardInner = ({
|
|
|
41
41
|
}
|
|
42
42
|
const lineLength = getLineLength(view, pos, widthStateLineLength);
|
|
43
43
|
const containerWidth = isRichMediaInsideOfBlockNode(view, pos) ? lineLength : widthStateWidth;
|
|
44
|
-
|
|
44
|
+
const editorDisabledWhenGateDisabled = (editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) && !fg('platform_fix_embedded_card_re-rendering');
|
|
45
|
+
if (!allowResizing || !hasPreview || editorDisabledWhenGateDisabled) {
|
|
45
46
|
// There are two ways `width` and `height` can be defined here:
|
|
46
47
|
// 1) Either as `heightAlone` as height value and no width
|
|
47
48
|
// 2) or as `1` for height and aspectRation (defined or a default one) as a width
|
|
@@ -81,6 +82,8 @@ const CardInner = ({
|
|
|
81
82
|
displayGrid: displayGrid,
|
|
82
83
|
updateSize: updateSize,
|
|
83
84
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
85
|
+
}, fg('platform_fix_embedded_card_re-rendering') && {
|
|
86
|
+
isResizeDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
|
|
84
87
|
}), smartCard);
|
|
85
88
|
};
|
|
86
89
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -11,6 +11,7 @@ import { jsx } from '@emotion/react';
|
|
|
11
11
|
import { calcColumnsFromPx, calcMediaPxWidth, calcPctFromPx, calcPxFromColumns, handleSides, imageAlignmentMap, Resizer, snapTo, wrappedLayouts, wrapperStyle } from '@atlaskit/editor-common/ui';
|
|
12
12
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
13
13
|
import { akEditorBreakoutPadding, akEditorMediaResizeHandlerPadding, akEditorWideLayoutWidth, breakoutWideScaleRatio, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { embedHeaderHeight } from '@atlaskit/smart-card';
|
|
15
16
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
16
17
|
export default class ResizableEmbedCard extends React.Component {
|
|
@@ -310,6 +311,7 @@ export default class ResizableEmbedCard extends React.Component {
|
|
|
310
311
|
pctWidth,
|
|
311
312
|
containerWidth,
|
|
312
313
|
fullWidthMode,
|
|
314
|
+
isResizeDisabled,
|
|
313
315
|
children
|
|
314
316
|
} = this.props;
|
|
315
317
|
const resizerProps = {
|
|
@@ -318,6 +320,10 @@ export default class ResizableEmbedCard extends React.Component {
|
|
|
318
320
|
};
|
|
319
321
|
const enable = {};
|
|
320
322
|
handleSides.forEach(side => {
|
|
323
|
+
if (isResizeDisabled && fg('platform_fix_embedded_card_re-rendering')) {
|
|
324
|
+
enable[side] = false;
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
321
327
|
const oppositeSide = side === 'left' ? 'right' : 'left';
|
|
322
328
|
enable[side] = ['full-width', 'wide', 'center'].concat(`wrap-${oppositeSide}`).concat(`align-${imageAlignmentMap[oppositeSide]}`).indexOf(layout) > -1;
|
|
323
329
|
if (side === 'left' && this.insideInlineLike) {
|
|
@@ -50,7 +50,8 @@ var CardInner = function CardInner(_ref) {
|
|
|
50
50
|
}
|
|
51
51
|
var lineLength = getLineLength(view, pos, widthStateLineLength);
|
|
52
52
|
var containerWidth = isRichMediaInsideOfBlockNode(view, pos) ? lineLength : widthStateWidth;
|
|
53
|
-
|
|
53
|
+
var editorDisabledWhenGateDisabled = (editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) && !fg('platform_fix_embedded_card_re-rendering');
|
|
54
|
+
if (!allowResizing || !hasPreview || editorDisabledWhenGateDisabled) {
|
|
54
55
|
// There are two ways `width` and `height` can be defined here:
|
|
55
56
|
// 1) Either as `heightAlone` as height value and no width
|
|
56
57
|
// 2) or as `1` for height and aspectRation (defined or a default one) as a width
|
|
@@ -90,6 +91,8 @@ var CardInner = function CardInner(_ref) {
|
|
|
90
91
|
displayGrid: displayGrid,
|
|
91
92
|
updateSize: updateSize,
|
|
92
93
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
94
|
+
}, fg('platform_fix_embedded_card_re-rendering') && {
|
|
95
|
+
isResizeDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
|
|
93
96
|
}), smartCard);
|
|
94
97
|
};
|
|
95
98
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -20,6 +20,7 @@ import { jsx } from '@emotion/react';
|
|
|
20
20
|
import { calcColumnsFromPx, calcMediaPxWidth, calcPctFromPx, calcPxFromColumns, handleSides, imageAlignmentMap, Resizer, snapTo, wrappedLayouts, wrapperStyle } from '@atlaskit/editor-common/ui';
|
|
21
21
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
22
22
|
import { akEditorBreakoutPadding, akEditorMediaResizeHandlerPadding, akEditorWideLayoutWidth, breakoutWideScaleRatio, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
23
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
23
24
|
import { embedHeaderHeight } from '@atlaskit/smart-card';
|
|
24
25
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
25
26
|
var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
@@ -326,6 +327,7 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
326
327
|
pctWidth = _this$props6.pctWidth,
|
|
327
328
|
containerWidth = _this$props6.containerWidth,
|
|
328
329
|
fullWidthMode = _this$props6.fullWidthMode,
|
|
330
|
+
isResizeDisabled = _this$props6.isResizeDisabled,
|
|
329
331
|
children = _this$props6.children;
|
|
330
332
|
var resizerProps = {
|
|
331
333
|
width: this.calcPxWidth(),
|
|
@@ -333,6 +335,10 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
333
335
|
};
|
|
334
336
|
var enable = {};
|
|
335
337
|
handleSides.forEach(function (side) {
|
|
338
|
+
if (isResizeDisabled && fg('platform_fix_embedded_card_re-rendering')) {
|
|
339
|
+
enable[side] = false;
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
336
342
|
var oppositeSide = side === 'left' ? 'right' : 'left';
|
|
337
343
|
enable[side] = ['full-width', 'wide', 'center'].concat("wrap-".concat(oppositeSide)).concat("align-".concat(imageAlignmentMap[oppositeSide])).indexOf(layout) > -1;
|
|
338
344
|
if (side === 'left' && _this2.insideInlineLike) {
|
|
@@ -14,6 +14,7 @@ export type Props = Omit<ResizerProps, 'height' | 'width'> & {
|
|
|
14
14
|
width?: number;
|
|
15
15
|
height?: number;
|
|
16
16
|
aspectRatio: number;
|
|
17
|
+
isResizeDisabled?: boolean;
|
|
17
18
|
};
|
|
18
19
|
export default class ResizableEmbedCard extends React.Component<Props, State> {
|
|
19
20
|
static defaultProps: {
|
|
@@ -14,6 +14,7 @@ export type Props = Omit<ResizerProps, 'height' | 'width'> & {
|
|
|
14
14
|
width?: number;
|
|
15
15
|
height?: number;
|
|
16
16
|
aspectRatio: number;
|
|
17
|
+
isResizeDisabled?: boolean;
|
|
17
18
|
};
|
|
18
19
|
export default class ResizableEmbedCard extends React.Component<Props, State> {
|
|
19
20
|
static defaultProps: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.7",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
"@atlaskit/link-datasource": "^3.15.0",
|
|
53
53
|
"@atlaskit/linking-common": "^6.0.0",
|
|
54
54
|
"@atlaskit/linking-types": "^9.5.0",
|
|
55
|
-
"@atlaskit/menu": "2.13.
|
|
55
|
+
"@atlaskit/menu": "2.13.7",
|
|
56
56
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
57
57
|
"@atlaskit/primitives": "^13.3.0",
|
|
58
58
|
"@atlaskit/smart-card": "^32.7.0",
|
|
59
59
|
"@atlaskit/theme": "^14.0.0",
|
|
60
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
61
|
-
"@atlaskit/tokens": "^2.
|
|
60
|
+
"@atlaskit/tmp-editor-statsig": "^2.27.0",
|
|
61
|
+
"@atlaskit/tokens": "^2.5.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|
|
63
63
|
"@emotion/react": "^11.7.1",
|
|
64
64
|
"lodash": "^4.17.21",
|
|
@@ -137,6 +137,9 @@
|
|
|
137
137
|
},
|
|
138
138
|
"platform_inline_node_as_valid_annotation_selection": {
|
|
139
139
|
"type": "boolean"
|
|
140
|
+
},
|
|
141
|
+
"platform_fix_embedded_card_re-rendering": {
|
|
142
|
+
"type": "boolean"
|
|
140
143
|
}
|
|
141
144
|
},
|
|
142
145
|
"stricter": {
|