@atlaskit/editor-core 187.38.3 → 187.38.5
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 +8 -0
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +5 -40
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +28 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +6 -39
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +28 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +6 -41
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +28 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -4
- package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -4
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.38.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d1bd1be0923`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d1bd1be0923) - [ux] ED-19794 updated media resize handle style
|
|
8
|
+
- [`dfb663969a0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dfb663969a0) - ED-19820: Fix for table scroll when insert media node when extended-resize-experience is off
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 187.38.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -36,16 +36,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
36
36
|
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; } } /** @jsx jsx */
|
|
37
37
|
var resizerNextTestId = 'mediaSingle.resizerNext.testid';
|
|
38
38
|
exports.resizerNextTestId = resizerNextTestId;
|
|
39
|
-
var handleComponent = {
|
|
40
|
-
left: (0, _react2.jsx)("div", {
|
|
41
|
-
"data-testid": "richMedia-resize-handle-left-elem",
|
|
42
|
-
contentEditable: false
|
|
43
|
-
}),
|
|
44
|
-
right: (0, _react2.jsx)("div", {
|
|
45
|
-
"data-testid": "richMedia-resize-handle-right-elem",
|
|
46
|
-
contentEditable: false
|
|
47
|
-
})
|
|
48
|
-
};
|
|
49
39
|
var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
50
40
|
(0, _inherits2.default)(ResizableMediaSingleNext, _React$Component);
|
|
51
41
|
var _super = _createSuper(ResizableMediaSingleNext);
|
|
@@ -130,9 +120,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
130
120
|
height = _this$props3.height;
|
|
131
121
|
return Math.round(height / width * newWidth);
|
|
132
122
|
});
|
|
133
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "saveWrapper", function (wrapper) {
|
|
134
|
-
return _this.wrapper = wrapper;
|
|
135
|
-
});
|
|
136
123
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "displayGuideline", function (guidelines) {
|
|
137
124
|
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3;
|
|
138
125
|
return (_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.guideline) === null || _this$props$pluginInj2 === void 0 ? void 0 : (_this$props$pluginInj3 = _this$props$pluginInj2.actions) === null || _this$props$pluginInj3 === void 0 ? void 0 : _this$props$pluginInj3.displayGuideline(_this.props.view)({
|
|
@@ -300,8 +287,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
300
287
|
});
|
|
301
288
|
var initialWidth = props.mediaSingleWidth || _mediaSingle.DEFAULT_IMAGE_WIDTH;
|
|
302
289
|
_this.state = {
|
|
303
|
-
offsetLeft: (0, _mediaSingle.calculateOffsetLeft)(_this.insideInlineLike, _this.insideLayout, _this.props.view.dom, undefined),
|
|
304
|
-
// We default to true until we resolve the file type
|
|
305
290
|
isVideoFile: true,
|
|
306
291
|
isResizing: false,
|
|
307
292
|
size: {
|
|
@@ -317,13 +302,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
317
302
|
(0, _createClass2.default)(ResizableMediaSingleNext, [{
|
|
318
303
|
key: "componentDidUpdate",
|
|
319
304
|
value: function componentDidUpdate(prevProps) {
|
|
320
|
-
var offsetLeft = (0, _mediaSingle.calculateOffsetLeft)(this.insideInlineLike, this.insideLayout, this.props.view.dom, this.wrapper);
|
|
321
|
-
if (offsetLeft !== this.state.offsetLeft && offsetLeft >= 0) {
|
|
322
|
-
this.setState({
|
|
323
|
-
offsetLeft: offsetLeft
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
|
|
327
305
|
// Handle undo, when the actual pctWidth changed,
|
|
328
306
|
// we sync up with the internal state.
|
|
329
307
|
if (prevProps.pctWidth !== this.props.pctWidth) {
|
|
@@ -545,32 +523,19 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
545
523
|
'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
|
|
546
524
|
});
|
|
547
525
|
var resizerNextClassName = (0, _classnames.default)(className, _styles.resizerStyles);
|
|
548
|
-
var
|
|
526
|
+
var isNestedNode = this.isNestedNode();
|
|
527
|
+
var maxWidth = !isResizing && isNestedNode ?
|
|
549
528
|
// set undefined to fall back to 100%
|
|
550
529
|
undefined : this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
|
|
551
530
|
var minWidth = this.calcMinWidth(isVideoFile, lineLength);
|
|
552
|
-
var nestedHandleStyles = function nestedHandleStyles(isNestedNode) {
|
|
553
|
-
if (!isNestedNode) {
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
return {
|
|
557
|
-
left: {
|
|
558
|
-
left: "calc(".concat("var(--ds-space-075, 0.375em)", " * -1)")
|
|
559
|
-
},
|
|
560
|
-
right: {
|
|
561
|
-
right: "calc(".concat("var(--ds-space-075, 0.375em)", " * -1)")
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
};
|
|
565
531
|
return (0, _react2.jsx)("div", {
|
|
566
|
-
ref: this.saveWrapper,
|
|
567
532
|
css: (0, _styled.wrapperStyle)({
|
|
568
533
|
layout: layout,
|
|
569
534
|
isResized: !!pctWidth,
|
|
570
535
|
containerWidth: containerWidth || origWidth,
|
|
571
536
|
fullWidthMode: fullWidthMode,
|
|
572
537
|
mediaSingleWidth: this.state.size.width,
|
|
573
|
-
isNestedNode:
|
|
538
|
+
isNestedNode: isNestedNode,
|
|
574
539
|
isExtendedResizeExperienceOn: true
|
|
575
540
|
})
|
|
576
541
|
}, (0, _react2.jsx)(_resizer.ResizerNext, {
|
|
@@ -585,10 +550,10 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
585
550
|
handleResizeStop: this.handleResizeStop,
|
|
586
551
|
snap: this.state.snaps,
|
|
587
552
|
resizeRatio: _utils2.nonWrappedLayouts.includes(layout) ? 2 : 1,
|
|
588
|
-
handleComponent: handleComponent,
|
|
589
553
|
"data-testid": resizerNextTestId,
|
|
590
554
|
isHandleVisible: selected,
|
|
591
|
-
|
|
555
|
+
handlePositioning: isNestedNode ? 'adjacent' : undefined,
|
|
556
|
+
handleHighlight: "full-height"
|
|
592
557
|
}, children));
|
|
593
558
|
}
|
|
594
559
|
}]);
|
|
@@ -178,6 +178,17 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
178
178
|
get: function get() {
|
|
179
179
|
return _ui.wrappedLayouts.indexOf(this.props.layout) > -1;
|
|
180
180
|
}
|
|
181
|
+
|
|
182
|
+
// check if is inside of a table
|
|
183
|
+
}, {
|
|
184
|
+
key: "isNestedInTable",
|
|
185
|
+
value: function isNestedInTable() {
|
|
186
|
+
var table = this.props.view.state.schema.nodes.table;
|
|
187
|
+
if (!this.$pos) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
return !!(0, _utils.findParentNodeOfTypeClosestToPos)(this.$pos, table);
|
|
191
|
+
}
|
|
181
192
|
}, {
|
|
182
193
|
key: "componentDidMount",
|
|
183
194
|
value: function () {
|
|
@@ -365,6 +376,21 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
365
376
|
offsetLeft: this.state.offsetLeft,
|
|
366
377
|
wrappedLayout: this.wrappedLayout
|
|
367
378
|
};
|
|
379
|
+
var nestedInTableHandleStyles = function nestedInTableHandleStyles(isNestedInTable) {
|
|
380
|
+
if (!isNestedInTable) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
return {
|
|
384
|
+
left: {
|
|
385
|
+
left: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
|
|
386
|
+
paddingLeft: '0px'
|
|
387
|
+
},
|
|
388
|
+
right: {
|
|
389
|
+
right: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
|
|
390
|
+
paddingRight: '0px'
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
};
|
|
368
394
|
return (0, _react2.jsx)("div", {
|
|
369
395
|
ref: this.saveWrapper,
|
|
370
396
|
css: (0, _styled.wrapperStyle)({
|
|
@@ -393,7 +419,8 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
393
419
|
return (0, _react2.jsx)("div", {
|
|
394
420
|
contentEditable: false
|
|
395
421
|
});
|
|
396
|
-
}
|
|
422
|
+
},
|
|
423
|
+
handleStyles: nestedInTableHandleStyles(this.isNestedInTable())
|
|
397
424
|
}), children));
|
|
398
425
|
}
|
|
399
426
|
}]);
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.38.
|
|
9
|
+
var version = "187.38.5";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
@@ -11,23 +11,13 @@ import { wrapperStyle } from './styled';
|
|
|
11
11
|
import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
12
12
|
import classnames from 'classnames';
|
|
13
13
|
import { richMediaClassName, resizerStyles } from '@atlaskit/editor-common/styles';
|
|
14
|
-
import { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_RESIZE_THROTTLE_TIME,
|
|
14
|
+
import { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, DEFAULT_IMAGE_WIDTH, calcMediaSingleMaxWidth } from '@atlaskit/editor-common/media-single';
|
|
15
15
|
import { findClosestSnap, getGuidelinesWithHighlights, generateDefaultGuidelines, generateDynamicGuidelines, getGuidelineSnaps, getGuidelineTypeFromKey, getRelativeGuideSnaps, getRelativeGuidelines } from '@atlaskit/editor-common/guideline';
|
|
16
16
|
import memoizeOne from 'memoize-one';
|
|
17
17
|
import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
|
|
18
18
|
import throttle from 'lodash/throttle';
|
|
19
19
|
import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
|
|
20
20
|
export const resizerNextTestId = 'mediaSingle.resizerNext.testid';
|
|
21
|
-
const handleComponent = {
|
|
22
|
-
left: jsx("div", {
|
|
23
|
-
"data-testid": "richMedia-resize-handle-left-elem",
|
|
24
|
-
contentEditable: false
|
|
25
|
-
}),
|
|
26
|
-
right: jsx("div", {
|
|
27
|
-
"data-testid": "richMedia-resize-handle-right-elem",
|
|
28
|
-
contentEditable: false
|
|
29
|
-
})
|
|
30
|
-
};
|
|
31
21
|
class ResizableMediaSingleNext extends React.Component {
|
|
32
22
|
constructor(props) {
|
|
33
23
|
super(props);
|
|
@@ -111,7 +101,6 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
111
101
|
} = this.props;
|
|
112
102
|
return Math.round(height / width * newWidth);
|
|
113
103
|
});
|
|
114
|
-
_defineProperty(this, "saveWrapper", wrapper => this.wrapper = wrapper);
|
|
115
104
|
_defineProperty(this, "displayGuideline", guidelines => {
|
|
116
105
|
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3;
|
|
117
106
|
return (_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.guideline) === null || _this$props$pluginInj2 === void 0 ? void 0 : (_this$props$pluginInj3 = _this$props$pluginInj2.actions) === null || _this$props$pluginInj3 === void 0 ? void 0 : _this$props$pluginInj3.displayGuideline(this.props.view)({
|
|
@@ -281,8 +270,6 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
281
270
|
});
|
|
282
271
|
const initialWidth = props.mediaSingleWidth || DEFAULT_IMAGE_WIDTH;
|
|
283
272
|
this.state = {
|
|
284
|
-
offsetLeft: calculateOffsetLeft(this.insideInlineLike, this.insideLayout, this.props.view.dom, undefined),
|
|
285
|
-
// We default to true until we resolve the file type
|
|
286
273
|
isVideoFile: true,
|
|
287
274
|
isResizing: false,
|
|
288
275
|
size: {
|
|
@@ -295,13 +282,6 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
295
282
|
};
|
|
296
283
|
}
|
|
297
284
|
componentDidUpdate(prevProps) {
|
|
298
|
-
const offsetLeft = calculateOffsetLeft(this.insideInlineLike, this.insideLayout, this.props.view.dom, this.wrapper);
|
|
299
|
-
if (offsetLeft !== this.state.offsetLeft && offsetLeft >= 0) {
|
|
300
|
-
this.setState({
|
|
301
|
-
offsetLeft
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
|
|
305
285
|
// Handle undo, when the actual pctWidth changed,
|
|
306
286
|
// we sync up with the internal state.
|
|
307
287
|
if (prevProps.pctWidth !== this.props.pctWidth) {
|
|
@@ -461,32 +441,19 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
461
441
|
'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
|
|
462
442
|
});
|
|
463
443
|
const resizerNextClassName = classnames(className, resizerStyles);
|
|
464
|
-
const
|
|
444
|
+
const isNestedNode = this.isNestedNode();
|
|
445
|
+
const maxWidth = !isResizing && isNestedNode ?
|
|
465
446
|
// set undefined to fall back to 100%
|
|
466
447
|
undefined : this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
|
|
467
448
|
const minWidth = this.calcMinWidth(isVideoFile, lineLength);
|
|
468
|
-
const nestedHandleStyles = isNestedNode => {
|
|
469
|
-
if (!isNestedNode) {
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
return {
|
|
473
|
-
left: {
|
|
474
|
-
left: `calc(${"var(--ds-space-075, 0.375em)"} * -1)`
|
|
475
|
-
},
|
|
476
|
-
right: {
|
|
477
|
-
right: `calc(${"var(--ds-space-075, 0.375em)"} * -1)`
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
};
|
|
481
449
|
return jsx("div", {
|
|
482
|
-
ref: this.saveWrapper,
|
|
483
450
|
css: wrapperStyle({
|
|
484
451
|
layout,
|
|
485
452
|
isResized: !!pctWidth,
|
|
486
453
|
containerWidth: containerWidth || origWidth,
|
|
487
454
|
fullWidthMode,
|
|
488
455
|
mediaSingleWidth: this.state.size.width,
|
|
489
|
-
isNestedNode
|
|
456
|
+
isNestedNode,
|
|
490
457
|
isExtendedResizeExperienceOn: true
|
|
491
458
|
})
|
|
492
459
|
}, jsx(ResizerNext, {
|
|
@@ -501,10 +468,10 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
501
468
|
handleResizeStop: this.handleResizeStop,
|
|
502
469
|
snap: this.state.snaps,
|
|
503
470
|
resizeRatio: nonWrappedLayouts.includes(layout) ? 2 : 1,
|
|
504
|
-
handleComponent: handleComponent,
|
|
505
471
|
"data-testid": resizerNextTestId,
|
|
506
472
|
isHandleVisible: selected,
|
|
507
|
-
|
|
473
|
+
handlePositioning: isNestedNode ? 'adjacent' : undefined,
|
|
474
|
+
handleHighlight: "full-height"
|
|
508
475
|
}, children));
|
|
509
476
|
}
|
|
510
477
|
}
|
|
@@ -160,6 +160,17 @@ export default class ResizableMediaSingle extends React.Component {
|
|
|
160
160
|
get wrappedLayout() {
|
|
161
161
|
return wrappedLayouts.indexOf(this.props.layout) > -1;
|
|
162
162
|
}
|
|
163
|
+
|
|
164
|
+
// check if is inside of a table
|
|
165
|
+
isNestedInTable() {
|
|
166
|
+
const {
|
|
167
|
+
table
|
|
168
|
+
} = this.props.view.state.schema.nodes;
|
|
169
|
+
if (!this.$pos) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
return !!findParentNodeOfTypeClosestToPos(this.$pos, table);
|
|
173
|
+
}
|
|
163
174
|
async componentDidMount() {
|
|
164
175
|
const {
|
|
165
176
|
viewMediaClientConfig
|
|
@@ -295,6 +306,21 @@ export default class ResizableMediaSingle extends React.Component {
|
|
|
295
306
|
offsetLeft: this.state.offsetLeft,
|
|
296
307
|
wrappedLayout: this.wrappedLayout
|
|
297
308
|
};
|
|
309
|
+
const nestedInTableHandleStyles = isNestedInTable => {
|
|
310
|
+
if (!isNestedInTable) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
return {
|
|
314
|
+
left: {
|
|
315
|
+
left: `calc(${"var(--ds-space-025, 0.125em)"} * -0.5)`,
|
|
316
|
+
paddingLeft: '0px'
|
|
317
|
+
},
|
|
318
|
+
right: {
|
|
319
|
+
right: `calc(${"var(--ds-space-025, 0.125em)"} * -0.5)`,
|
|
320
|
+
paddingRight: '0px'
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
};
|
|
298
324
|
return jsx("div", {
|
|
299
325
|
ref: this.saveWrapper,
|
|
300
326
|
css: wrapperStyle({
|
|
@@ -321,7 +347,8 @@ export default class ResizableMediaSingle extends React.Component {
|
|
|
321
347
|
,
|
|
322
348
|
handleComponentFunc: () => jsx("div", {
|
|
323
349
|
contentEditable: false
|
|
324
|
-
})
|
|
350
|
+
}),
|
|
351
|
+
handleStyles: nestedInTableHandleStyles(this.isNestedInTable())
|
|
325
352
|
}), children));
|
|
326
353
|
}
|
|
327
354
|
}
|
|
@@ -22,23 +22,13 @@ import { wrapperStyle } from './styled';
|
|
|
22
22
|
import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
23
23
|
import classnames from 'classnames';
|
|
24
24
|
import { richMediaClassName, resizerStyles } from '@atlaskit/editor-common/styles';
|
|
25
|
-
import { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_RESIZE_THROTTLE_TIME,
|
|
25
|
+
import { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, DEFAULT_IMAGE_WIDTH, calcMediaSingleMaxWidth } from '@atlaskit/editor-common/media-single';
|
|
26
26
|
import { findClosestSnap, getGuidelinesWithHighlights, generateDefaultGuidelines, generateDynamicGuidelines, getGuidelineSnaps, getGuidelineTypeFromKey, getRelativeGuideSnaps, getRelativeGuidelines } from '@atlaskit/editor-common/guideline';
|
|
27
27
|
import memoizeOne from 'memoize-one';
|
|
28
28
|
import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
|
|
29
29
|
import throttle from 'lodash/throttle';
|
|
30
30
|
import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
|
|
31
31
|
export var resizerNextTestId = 'mediaSingle.resizerNext.testid';
|
|
32
|
-
var handleComponent = {
|
|
33
|
-
left: jsx("div", {
|
|
34
|
-
"data-testid": "richMedia-resize-handle-left-elem",
|
|
35
|
-
contentEditable: false
|
|
36
|
-
}),
|
|
37
|
-
right: jsx("div", {
|
|
38
|
-
"data-testid": "richMedia-resize-handle-right-elem",
|
|
39
|
-
contentEditable: false
|
|
40
|
-
})
|
|
41
|
-
};
|
|
42
32
|
var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
43
33
|
_inherits(ResizableMediaSingleNext, _React$Component);
|
|
44
34
|
var _super = _createSuper(ResizableMediaSingleNext);
|
|
@@ -123,9 +113,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
123
113
|
height = _this$props3.height;
|
|
124
114
|
return Math.round(height / width * newWidth);
|
|
125
115
|
});
|
|
126
|
-
_defineProperty(_assertThisInitialized(_this), "saveWrapper", function (wrapper) {
|
|
127
|
-
return _this.wrapper = wrapper;
|
|
128
|
-
});
|
|
129
116
|
_defineProperty(_assertThisInitialized(_this), "displayGuideline", function (guidelines) {
|
|
130
117
|
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3;
|
|
131
118
|
return (_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.guideline) === null || _this$props$pluginInj2 === void 0 ? void 0 : (_this$props$pluginInj3 = _this$props$pluginInj2.actions) === null || _this$props$pluginInj3 === void 0 ? void 0 : _this$props$pluginInj3.displayGuideline(_this.props.view)({
|
|
@@ -293,8 +280,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
293
280
|
});
|
|
294
281
|
var initialWidth = props.mediaSingleWidth || DEFAULT_IMAGE_WIDTH;
|
|
295
282
|
_this.state = {
|
|
296
|
-
offsetLeft: calculateOffsetLeft(_this.insideInlineLike, _this.insideLayout, _this.props.view.dom, undefined),
|
|
297
|
-
// We default to true until we resolve the file type
|
|
298
283
|
isVideoFile: true,
|
|
299
284
|
isResizing: false,
|
|
300
285
|
size: {
|
|
@@ -310,13 +295,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
310
295
|
_createClass(ResizableMediaSingleNext, [{
|
|
311
296
|
key: "componentDidUpdate",
|
|
312
297
|
value: function componentDidUpdate(prevProps) {
|
|
313
|
-
var offsetLeft = calculateOffsetLeft(this.insideInlineLike, this.insideLayout, this.props.view.dom, this.wrapper);
|
|
314
|
-
if (offsetLeft !== this.state.offsetLeft && offsetLeft >= 0) {
|
|
315
|
-
this.setState({
|
|
316
|
-
offsetLeft: offsetLeft
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
|
|
320
298
|
// Handle undo, when the actual pctWidth changed,
|
|
321
299
|
// we sync up with the internal state.
|
|
322
300
|
if (prevProps.pctWidth !== this.props.pctWidth) {
|
|
@@ -538,32 +516,19 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
538
516
|
'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
|
|
539
517
|
});
|
|
540
518
|
var resizerNextClassName = classnames(className, resizerStyles);
|
|
541
|
-
var
|
|
519
|
+
var isNestedNode = this.isNestedNode();
|
|
520
|
+
var maxWidth = !isResizing && isNestedNode ?
|
|
542
521
|
// set undefined to fall back to 100%
|
|
543
522
|
undefined : this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
|
|
544
523
|
var minWidth = this.calcMinWidth(isVideoFile, lineLength);
|
|
545
|
-
var nestedHandleStyles = function nestedHandleStyles(isNestedNode) {
|
|
546
|
-
if (!isNestedNode) {
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
return {
|
|
550
|
-
left: {
|
|
551
|
-
left: "calc(".concat("var(--ds-space-075, 0.375em)", " * -1)")
|
|
552
|
-
},
|
|
553
|
-
right: {
|
|
554
|
-
right: "calc(".concat("var(--ds-space-075, 0.375em)", " * -1)")
|
|
555
|
-
}
|
|
556
|
-
};
|
|
557
|
-
};
|
|
558
524
|
return jsx("div", {
|
|
559
|
-
ref: this.saveWrapper,
|
|
560
525
|
css: wrapperStyle({
|
|
561
526
|
layout: layout,
|
|
562
527
|
isResized: !!pctWidth,
|
|
563
528
|
containerWidth: containerWidth || origWidth,
|
|
564
529
|
fullWidthMode: fullWidthMode,
|
|
565
530
|
mediaSingleWidth: this.state.size.width,
|
|
566
|
-
isNestedNode:
|
|
531
|
+
isNestedNode: isNestedNode,
|
|
567
532
|
isExtendedResizeExperienceOn: true
|
|
568
533
|
})
|
|
569
534
|
}, jsx(ResizerNext, {
|
|
@@ -578,10 +543,10 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
578
543
|
handleResizeStop: this.handleResizeStop,
|
|
579
544
|
snap: this.state.snaps,
|
|
580
545
|
resizeRatio: nonWrappedLayouts.includes(layout) ? 2 : 1,
|
|
581
|
-
handleComponent: handleComponent,
|
|
582
546
|
"data-testid": resizerNextTestId,
|
|
583
547
|
isHandleVisible: selected,
|
|
584
|
-
|
|
548
|
+
handlePositioning: isNestedNode ? 'adjacent' : undefined,
|
|
549
|
+
handleHighlight: "full-height"
|
|
585
550
|
}, children));
|
|
586
551
|
}
|
|
587
552
|
}]);
|
|
@@ -172,6 +172,17 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
172
172
|
get: function get() {
|
|
173
173
|
return wrappedLayouts.indexOf(this.props.layout) > -1;
|
|
174
174
|
}
|
|
175
|
+
|
|
176
|
+
// check if is inside of a table
|
|
177
|
+
}, {
|
|
178
|
+
key: "isNestedInTable",
|
|
179
|
+
value: function isNestedInTable() {
|
|
180
|
+
var table = this.props.view.state.schema.nodes.table;
|
|
181
|
+
if (!this.$pos) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
return !!findParentNodeOfTypeClosestToPos(this.$pos, table);
|
|
185
|
+
}
|
|
175
186
|
}, {
|
|
176
187
|
key: "componentDidMount",
|
|
177
188
|
value: function () {
|
|
@@ -359,6 +370,21 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
359
370
|
offsetLeft: this.state.offsetLeft,
|
|
360
371
|
wrappedLayout: this.wrappedLayout
|
|
361
372
|
};
|
|
373
|
+
var nestedInTableHandleStyles = function nestedInTableHandleStyles(isNestedInTable) {
|
|
374
|
+
if (!isNestedInTable) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
return {
|
|
378
|
+
left: {
|
|
379
|
+
left: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
|
|
380
|
+
paddingLeft: '0px'
|
|
381
|
+
},
|
|
382
|
+
right: {
|
|
383
|
+
right: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
|
|
384
|
+
paddingRight: '0px'
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
};
|
|
362
388
|
return jsx("div", {
|
|
363
389
|
ref: this.saveWrapper,
|
|
364
390
|
css: wrapperStyle({
|
|
@@ -387,7 +413,8 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
387
413
|
return jsx("div", {
|
|
388
414
|
contentEditable: false
|
|
389
415
|
});
|
|
390
|
-
}
|
|
416
|
+
},
|
|
417
|
+
handleStyles: nestedInTableHandleStyles(this.isNestedInTable())
|
|
391
418
|
}), children));
|
|
392
419
|
}
|
|
393
420
|
}]);
|
|
@@ -7,7 +7,6 @@ import type { Props } from './types';
|
|
|
7
7
|
import type { Dimensions, HandleResize, HandleResizeStart, Position, Snap } from '@atlaskit/editor-common/resizer';
|
|
8
8
|
import type { GuidelineConfig, RelativeGuides, GuidelineSnapsReference } from '@atlaskit/editor-common/guideline';
|
|
9
9
|
type State = {
|
|
10
|
-
offsetLeft: number;
|
|
11
10
|
isVideoFile: boolean;
|
|
12
11
|
resizedPctWidth?: number;
|
|
13
12
|
isResizing: boolean;
|
|
@@ -16,11 +15,10 @@ type State = {
|
|
|
16
15
|
relativeGuides: RelativeGuides;
|
|
17
16
|
guidelines: GuidelineConfig[];
|
|
18
17
|
};
|
|
19
|
-
export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
|
|
20
18
|
type ResizableMediaSingleNextProps = Props;
|
|
19
|
+
export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
|
|
21
20
|
declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
|
|
22
21
|
private lastSnappedGuidelineKeys;
|
|
23
|
-
private wrapper?;
|
|
24
22
|
constructor(props: ResizableMediaSingleNextProps);
|
|
25
23
|
componentDidUpdate(prevProps: Props): boolean;
|
|
26
24
|
componentDidMount(): Promise<void>;
|
|
@@ -41,7 +39,6 @@ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSin
|
|
|
41
39
|
};
|
|
42
40
|
calcUnwrappedLayout: (width: number, containerWidth: number, contentWidth: number, fullWidthMode?: boolean, isNestedNode?: boolean) => 'center' | 'wide' | 'full-width';
|
|
43
41
|
calcPxHeight: (newWidth: number) => number;
|
|
44
|
-
private saveWrapper;
|
|
45
42
|
private displayGuideline;
|
|
46
43
|
private setIsResizing;
|
|
47
44
|
private updateSizeInPluginState;
|
|
@@ -14,6 +14,7 @@ export default class ResizableMediaSingle extends React.Component<Props, State>
|
|
|
14
14
|
componentDidUpdate(prevProps: Props): boolean;
|
|
15
15
|
private displayGrid;
|
|
16
16
|
get wrappedLayout(): boolean;
|
|
17
|
+
isNestedInTable(): boolean;
|
|
17
18
|
componentDidMount(): Promise<void>;
|
|
18
19
|
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
19
20
|
checkVideoFile(viewMediaClientConfig?: MediaClientConfig): Promise<void>;
|
package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import type { Props } from './types';
|
|
|
7
7
|
import type { Dimensions, HandleResize, HandleResizeStart, Position, Snap } from '@atlaskit/editor-common/resizer';
|
|
8
8
|
import type { GuidelineConfig, RelativeGuides, GuidelineSnapsReference } from '@atlaskit/editor-common/guideline';
|
|
9
9
|
type State = {
|
|
10
|
-
offsetLeft: number;
|
|
11
10
|
isVideoFile: boolean;
|
|
12
11
|
resizedPctWidth?: number;
|
|
13
12
|
isResizing: boolean;
|
|
@@ -16,11 +15,10 @@ type State = {
|
|
|
16
15
|
relativeGuides: RelativeGuides;
|
|
17
16
|
guidelines: GuidelineConfig[];
|
|
18
17
|
};
|
|
19
|
-
export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
|
|
20
18
|
type ResizableMediaSingleNextProps = Props;
|
|
19
|
+
export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
|
|
21
20
|
declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
|
|
22
21
|
private lastSnappedGuidelineKeys;
|
|
23
|
-
private wrapper?;
|
|
24
22
|
constructor(props: ResizableMediaSingleNextProps);
|
|
25
23
|
componentDidUpdate(prevProps: Props): boolean;
|
|
26
24
|
componentDidMount(): Promise<void>;
|
|
@@ -41,7 +39,6 @@ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSin
|
|
|
41
39
|
};
|
|
42
40
|
calcUnwrappedLayout: (width: number, containerWidth: number, contentWidth: number, fullWidthMode?: boolean, isNestedNode?: boolean) => 'center' | 'wide' | 'full-width';
|
|
43
41
|
calcPxHeight: (newWidth: number) => number;
|
|
44
|
-
private saveWrapper;
|
|
45
42
|
private displayGuideline;
|
|
46
43
|
private setIsResizing;
|
|
47
44
|
private updateSizeInPluginState;
|
|
@@ -14,6 +14,7 @@ export default class ResizableMediaSingle extends React.Component<Props, State>
|
|
|
14
14
|
componentDidUpdate(prevProps: Props): boolean;
|
|
15
15
|
private displayGrid;
|
|
16
16
|
get wrappedLayout(): boolean;
|
|
17
|
+
isNestedInTable(): boolean;
|
|
17
18
|
componentDidMount(): Promise<void>;
|
|
18
19
|
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
19
20
|
checkVideoFile(viewMediaClientConfig?: MediaClientConfig): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.38.
|
|
3
|
+
"version": "187.38.5",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"@atlaskit/analytics-next-stable-react-context": "1.0.1",
|
|
50
50
|
"@atlaskit/avatar": "^21.3.0",
|
|
51
51
|
"@atlaskit/avatar-group": "^9.4.0",
|
|
52
|
-
"@atlaskit/button": "^16.
|
|
52
|
+
"@atlaskit/button": "^16.10.0",
|
|
53
53
|
"@atlaskit/calendar": "^13.3.0",
|
|
54
54
|
"@atlaskit/checkbox": "^12.6.0",
|
|
55
55
|
"@atlaskit/code": "^14.6.0",
|
|
56
56
|
"@atlaskit/date": "^0.10.0",
|
|
57
|
-
"@atlaskit/datetime-picker": "^12.
|
|
57
|
+
"@atlaskit/datetime-picker": "^12.9.0",
|
|
58
58
|
"@atlaskit/editor-common": "^74.56.0",
|
|
59
59
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
60
60
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
87
87
|
"@atlaskit/editor-shared-styles": "^2.6.0",
|
|
88
88
|
"@atlaskit/editor-tables": "^2.3.0",
|
|
89
|
-
"@atlaskit/emoji": "^67.
|
|
89
|
+
"@atlaskit/emoji": "^67.5.0",
|
|
90
90
|
"@atlaskit/empty-state": "^7.6.0",
|
|
91
91
|
"@atlaskit/form": "^8.11.0",
|
|
92
92
|
"@atlaskit/icon": "^21.12.0",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"@atlaskit/radio": "^5.6.0",
|
|
109
109
|
"@atlaskit/section-message": "^6.4.0",
|
|
110
110
|
"@atlaskit/select": "^16.5.0",
|
|
111
|
-
"@atlaskit/smart-card": "^26.
|
|
111
|
+
"@atlaskit/smart-card": "^26.21.0",
|
|
112
112
|
"@atlaskit/smart-user-picker": "^6.3.0",
|
|
113
113
|
"@atlaskit/spinner": "^15.5.0",
|
|
114
114
|
"@atlaskit/status": "^1.3.0",
|