@atlaskit/editor-plugin-card 14.0.1 → 14.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/ui/ResizableEmbedCard.js +33 -17
- package/dist/es2019/ui/ResizableEmbedCard.js +17 -0
- package/dist/esm/ui/ResizableEmbedCard.js +33 -17
- package/dist/types/ui/ResizableEmbedCard.d.ts +1 -0
- package/dist/types-ts4.5/ui/ResizableEmbedCard.d.ts +1 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 14.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 14.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`24dad72901730`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/24dad72901730) -
|
|
14
|
+
Editor-6083: Fix border no shown when resize embed inside synced block
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 14.0.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -15,8 +15,10 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
16
|
var _react2 = require("@emotion/react");
|
|
17
17
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
18
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
18
19
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
19
20
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
21
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
22
|
var _smartCard = require("@atlaskit/smart-card");
|
|
21
23
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
22
24
|
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; }
|
|
@@ -101,6 +103,19 @@ var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Compone
|
|
|
101
103
|
resizedPctWidth: resizedPctWidth
|
|
102
104
|
});
|
|
103
105
|
});
|
|
106
|
+
(0, _defineProperty2.default)(_this, "handleResizeStart", function () {
|
|
107
|
+
var _this$props3 = _this.props,
|
|
108
|
+
view = _this$props3.view,
|
|
109
|
+
getPos = _this$props3.getPos;
|
|
110
|
+
if (typeof getPos === 'function') {
|
|
111
|
+
var pos = getPos();
|
|
112
|
+
if (typeof pos === 'number') {
|
|
113
|
+
var tr = view.state.tr.setSelection(_state.NodeSelection.create(view.state.doc, pos));
|
|
114
|
+
tr.setMeta('scrollIntoView', false);
|
|
115
|
+
view.dispatch(tr);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
});
|
|
104
119
|
(0, _defineProperty2.default)(_this, "highlights", function (newWidth, snapPoints) {
|
|
105
120
|
var snapWidth = (0, _ui.snapTo)(newWidth, snapPoints);
|
|
106
121
|
var _this$props$view$stat = _this.props.view.state.schema.nodes,
|
|
@@ -117,10 +132,10 @@ var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Compone
|
|
|
117
132
|
if (snapWidth > _this.wideLayoutWidth) {
|
|
118
133
|
return ['full-width'];
|
|
119
134
|
}
|
|
120
|
-
var _this$
|
|
121
|
-
layout = _this$
|
|
122
|
-
lineLength = _this$
|
|
123
|
-
gridSize = _this$
|
|
135
|
+
var _this$props4 = _this.props,
|
|
136
|
+
layout = _this$props4.layout,
|
|
137
|
+
lineLength = _this$props4.lineLength,
|
|
138
|
+
gridSize = _this$props4.gridSize;
|
|
124
139
|
var columns = (0, _ui.calcColumnsFromPx)(snapWidth, lineLength, gridSize);
|
|
125
140
|
var columnWidth = Math.round(columns);
|
|
126
141
|
var highlight = [];
|
|
@@ -231,9 +246,9 @@ var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Compone
|
|
|
231
246
|
key: "calcSnapPoints",
|
|
232
247
|
value: function calcSnapPoints() {
|
|
233
248
|
var offsetLeft = this.state.offsetLeft;
|
|
234
|
-
var _this$
|
|
235
|
-
containerWidth = _this$
|
|
236
|
-
lineLength = _this$
|
|
249
|
+
var _this$props5 = this.props,
|
|
250
|
+
containerWidth = _this$props5.containerWidth,
|
|
251
|
+
lineLength = _this$props5.lineLength;
|
|
237
252
|
var snapTargets = [];
|
|
238
253
|
for (var i = 0; i < this.gridWidth; i++) {
|
|
239
254
|
snapTargets.push((0, _ui.calcPxFromColumns)(i, lineLength, this.gridWidth) - offsetLeft);
|
|
@@ -283,9 +298,9 @@ var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Compone
|
|
|
283
298
|
* and hence we use `style` prop.
|
|
284
299
|
*/
|
|
285
300
|
function getHeightDefiningComponent() {
|
|
286
|
-
var _this$
|
|
287
|
-
height = _this$
|
|
288
|
-
aspectRatio = _this$
|
|
301
|
+
var _this$props6 = this.props,
|
|
302
|
+
height = _this$props6.height,
|
|
303
|
+
aspectRatio = _this$props6.aspectRatio;
|
|
289
304
|
var heightDefiningStyles;
|
|
290
305
|
if (height) {
|
|
291
306
|
heightDefiningStyles = {
|
|
@@ -329,13 +344,13 @@ var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Compone
|
|
|
329
344
|
key: "render",
|
|
330
345
|
value: function render() {
|
|
331
346
|
var _this2 = this;
|
|
332
|
-
var _this$
|
|
333
|
-
layout = _this$
|
|
334
|
-
pctWidth = _this$
|
|
335
|
-
containerWidth = _this$
|
|
336
|
-
fullWidthMode = _this$
|
|
337
|
-
isResizeDisabled = _this$
|
|
338
|
-
children = _this$
|
|
347
|
+
var _this$props7 = this.props,
|
|
348
|
+
layout = _this$props7.layout,
|
|
349
|
+
pctWidth = _this$props7.pctWidth,
|
|
350
|
+
containerWidth = _this$props7.containerWidth,
|
|
351
|
+
fullWidthMode = _this$props7.fullWidthMode,
|
|
352
|
+
isResizeDisabled = _this$props7.isResizeDisabled,
|
|
353
|
+
children = _this$props7.children;
|
|
339
354
|
var resizerProps = {
|
|
340
355
|
width: this.calcPxWidth(),
|
|
341
356
|
innerPadding: _editorSharedStyles.akEditorMediaResizeHandlerPadding
|
|
@@ -390,6 +405,7 @@ var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Compone
|
|
|
390
405
|
scaleFactor: !this.wrappedLayout && !this.insideInlineLike ? 2 : 1,
|
|
391
406
|
highlights: this.highlights,
|
|
392
407
|
nodeType: "embed",
|
|
408
|
+
onResizeStart: (0, _experiments.editorExperiment)('platform_synced_block', true) && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_9') ? this.handleResizeStart : undefined,
|
|
393
409
|
handleStyles: nestedInTableHandleStyles(this.isNestedInTable())
|
|
394
410
|
// Ignored via go/ees005
|
|
395
411
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -9,8 +9,10 @@ import React from 'react';
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
10
10
|
import { jsx } from '@emotion/react';
|
|
11
11
|
import { calcColumnsFromPx, calcMediaPxWidth, calcPctFromPx, calcPxFromColumns, handleSides, imageAlignmentMap, Resizer, snapTo, wrappedLayouts, wrapperStyle } from '@atlaskit/editor-common/ui';
|
|
12
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
13
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
13
14
|
import { akEditorBreakoutPadding, akEditorMediaResizeHandlerPadding, akEditorWideLayoutWidth, breakoutWideScaleRatio, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
16
|
import { embedHeaderHeight } from '@atlaskit/smart-card';
|
|
15
17
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
16
18
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -93,6 +95,20 @@ export default class ResizableEmbedCard extends React.Component {
|
|
|
93
95
|
resizedPctWidth
|
|
94
96
|
});
|
|
95
97
|
});
|
|
98
|
+
_defineProperty(this, "handleResizeStart", () => {
|
|
99
|
+
const {
|
|
100
|
+
view,
|
|
101
|
+
getPos
|
|
102
|
+
} = this.props;
|
|
103
|
+
if (typeof getPos === 'function') {
|
|
104
|
+
const pos = getPos();
|
|
105
|
+
if (typeof pos === 'number') {
|
|
106
|
+
const tr = view.state.tr.setSelection(NodeSelection.create(view.state.doc, pos));
|
|
107
|
+
tr.setMeta('scrollIntoView', false);
|
|
108
|
+
view.dispatch(tr);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
96
112
|
_defineProperty(this, "highlights", (newWidth, snapPoints) => {
|
|
97
113
|
const snapWidth = snapTo(newWidth, snapPoints);
|
|
98
114
|
const {
|
|
@@ -371,6 +387,7 @@ export default class ResizableEmbedCard extends React.Component {
|
|
|
371
387
|
scaleFactor: !this.wrappedLayout && !this.insideInlineLike ? 2 : 1,
|
|
372
388
|
highlights: this.highlights,
|
|
373
389
|
nodeType: "embed",
|
|
390
|
+
onResizeStart: editorExperiment('platform_synced_block', true) && fg('platform_synced_block_patch_9') ? this.handleResizeStart : undefined,
|
|
374
391
|
handleStyles: nestedInTableHandleStyles(this.isNestedInTable())
|
|
375
392
|
// Ignored via go/ees005
|
|
376
393
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -18,8 +18,10 @@ import React from 'react';
|
|
|
18
18
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
19
19
|
import { jsx } from '@emotion/react';
|
|
20
20
|
import { calcColumnsFromPx, calcMediaPxWidth, calcPctFromPx, calcPxFromColumns, handleSides, imageAlignmentMap, Resizer, snapTo, wrappedLayouts, wrapperStyle } from '@atlaskit/editor-common/ui';
|
|
21
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
21
22
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
22
23
|
import { akEditorBreakoutPadding, akEditorMediaResizeHandlerPadding, akEditorWideLayoutWidth, breakoutWideScaleRatio, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
24
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
23
25
|
import { embedHeaderHeight } from '@atlaskit/smart-card';
|
|
24
26
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
25
27
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -97,6 +99,19 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
97
99
|
resizedPctWidth: resizedPctWidth
|
|
98
100
|
});
|
|
99
101
|
});
|
|
102
|
+
_defineProperty(_this, "handleResizeStart", function () {
|
|
103
|
+
var _this$props3 = _this.props,
|
|
104
|
+
view = _this$props3.view,
|
|
105
|
+
getPos = _this$props3.getPos;
|
|
106
|
+
if (typeof getPos === 'function') {
|
|
107
|
+
var pos = getPos();
|
|
108
|
+
if (typeof pos === 'number') {
|
|
109
|
+
var tr = view.state.tr.setSelection(NodeSelection.create(view.state.doc, pos));
|
|
110
|
+
tr.setMeta('scrollIntoView', false);
|
|
111
|
+
view.dispatch(tr);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
100
115
|
_defineProperty(_this, "highlights", function (newWidth, snapPoints) {
|
|
101
116
|
var snapWidth = snapTo(newWidth, snapPoints);
|
|
102
117
|
var _this$props$view$stat = _this.props.view.state.schema.nodes,
|
|
@@ -113,10 +128,10 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
113
128
|
if (snapWidth > _this.wideLayoutWidth) {
|
|
114
129
|
return ['full-width'];
|
|
115
130
|
}
|
|
116
|
-
var _this$
|
|
117
|
-
layout = _this$
|
|
118
|
-
lineLength = _this$
|
|
119
|
-
gridSize = _this$
|
|
131
|
+
var _this$props4 = _this.props,
|
|
132
|
+
layout = _this$props4.layout,
|
|
133
|
+
lineLength = _this$props4.lineLength,
|
|
134
|
+
gridSize = _this$props4.gridSize;
|
|
120
135
|
var columns = calcColumnsFromPx(snapWidth, lineLength, gridSize);
|
|
121
136
|
var columnWidth = Math.round(columns);
|
|
122
137
|
var highlight = [];
|
|
@@ -227,9 +242,9 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
227
242
|
key: "calcSnapPoints",
|
|
228
243
|
value: function calcSnapPoints() {
|
|
229
244
|
var offsetLeft = this.state.offsetLeft;
|
|
230
|
-
var _this$
|
|
231
|
-
containerWidth = _this$
|
|
232
|
-
lineLength = _this$
|
|
245
|
+
var _this$props5 = this.props,
|
|
246
|
+
containerWidth = _this$props5.containerWidth,
|
|
247
|
+
lineLength = _this$props5.lineLength;
|
|
233
248
|
var snapTargets = [];
|
|
234
249
|
for (var i = 0; i < this.gridWidth; i++) {
|
|
235
250
|
snapTargets.push(calcPxFromColumns(i, lineLength, this.gridWidth) - offsetLeft);
|
|
@@ -279,9 +294,9 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
279
294
|
* and hence we use `style` prop.
|
|
280
295
|
*/
|
|
281
296
|
function getHeightDefiningComponent() {
|
|
282
|
-
var _this$
|
|
283
|
-
height = _this$
|
|
284
|
-
aspectRatio = _this$
|
|
297
|
+
var _this$props6 = this.props,
|
|
298
|
+
height = _this$props6.height,
|
|
299
|
+
aspectRatio = _this$props6.aspectRatio;
|
|
285
300
|
var heightDefiningStyles;
|
|
286
301
|
if (height) {
|
|
287
302
|
heightDefiningStyles = {
|
|
@@ -325,13 +340,13 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
325
340
|
key: "render",
|
|
326
341
|
value: function render() {
|
|
327
342
|
var _this2 = this;
|
|
328
|
-
var _this$
|
|
329
|
-
layout = _this$
|
|
330
|
-
pctWidth = _this$
|
|
331
|
-
containerWidth = _this$
|
|
332
|
-
fullWidthMode = _this$
|
|
333
|
-
isResizeDisabled = _this$
|
|
334
|
-
children = _this$
|
|
343
|
+
var _this$props7 = this.props,
|
|
344
|
+
layout = _this$props7.layout,
|
|
345
|
+
pctWidth = _this$props7.pctWidth,
|
|
346
|
+
containerWidth = _this$props7.containerWidth,
|
|
347
|
+
fullWidthMode = _this$props7.fullWidthMode,
|
|
348
|
+
isResizeDisabled = _this$props7.isResizeDisabled,
|
|
349
|
+
children = _this$props7.children;
|
|
335
350
|
var resizerProps = {
|
|
336
351
|
width: this.calcPxWidth(),
|
|
337
352
|
innerPadding: akEditorMediaResizeHandlerPadding
|
|
@@ -386,6 +401,7 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
386
401
|
scaleFactor: !this.wrappedLayout && !this.insideInlineLike ? 2 : 1,
|
|
387
402
|
highlights: this.highlights,
|
|
388
403
|
nodeType: "embed",
|
|
404
|
+
onResizeStart: editorExperiment('platform_synced_block', true) && fg('platform_synced_block_patch_9') ? this.handleResizeStart : undefined,
|
|
389
405
|
handleStyles: nestedInTableHandleStyles(this.isNestedInTable())
|
|
390
406
|
// Ignored via go/ees005
|
|
391
407
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -47,6 +47,7 @@ export default class ResizableEmbedCard extends React.Component<Props, State> {
|
|
|
47
47
|
calcSnapPoints(): number[];
|
|
48
48
|
calcPxWidth: (useLayout?: RichMediaLayout) => number;
|
|
49
49
|
get insideInlineLike(): boolean;
|
|
50
|
+
private handleResizeStart;
|
|
50
51
|
highlights: (newWidth: number, snapPoints: number[]) => string[] | number[];
|
|
51
52
|
/**
|
|
52
53
|
* Previously height of the box was controlled with paddingTop/paddingBottom trick inside Wrapper.
|
|
@@ -47,6 +47,7 @@ export default class ResizableEmbedCard extends React.Component<Props, State> {
|
|
|
47
47
|
calcSnapPoints(): number[];
|
|
48
48
|
calcPxWidth: (useLayout?: RichMediaLayout) => number;
|
|
49
49
|
get insideInlineLike(): boolean;
|
|
50
|
+
private handleResizeStart;
|
|
50
51
|
highlights: (newWidth: number, snapPoints: number[]) => string[] | number[];
|
|
51
52
|
/**
|
|
52
53
|
* Previously height of the box was controlled with paddingTop/paddingBottom trick inside Wrapper.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.3",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@atlaskit/primitives": "^18.1.0",
|
|
62
62
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
63
63
|
"@atlaskit/smart-card": "^43.31.0",
|
|
64
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
64
|
+
"@atlaskit/tmp-editor-statsig": "^57.0.0",
|
|
65
65
|
"@atlaskit/tokens": "^12.0.0",
|
|
66
66
|
"@babel/runtime": "^7.0.0",
|
|
67
67
|
"@emotion/react": "^11.7.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"uuid": "^3.1.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@atlaskit/editor-common": "^112.
|
|
74
|
+
"@atlaskit/editor-common": "^112.19.0",
|
|
75
75
|
"@atlaskit/link-provider": "^4.3.0",
|
|
76
76
|
"react": "^18.2.0",
|
|
77
77
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -122,6 +122,9 @@
|
|
|
122
122
|
"platform_editor_adf_with_localid": {
|
|
123
123
|
"type": "boolean"
|
|
124
124
|
},
|
|
125
|
+
"platform_synced_block_patch_9": {
|
|
126
|
+
"type": "boolean"
|
|
127
|
+
},
|
|
125
128
|
"jim-lower-ranking-in-jira-macro-search": {
|
|
126
129
|
"type": "boolean"
|
|
127
130
|
}
|