@atlaskit/editor-core 187.26.0 → 187.27.1
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/plugins/insert-block/ui/ToolbarInsertBlock/index.js +9 -9
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +92 -155
- package/dist/cjs/use-preset.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +9 -9
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +73 -136
- package/dist/es2019/use-preset.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +9 -9
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +94 -157
- package/dist/esm/use-preset.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +10 -24
- package/dist/types/use-preset.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +10 -24
- package/dist/types-ts4.5/use-preset.d.ts +1 -1
- package/package.json +2 -2
|
@@ -15,9 +15,9 @@ import React from 'react';
|
|
|
15
15
|
import { jsx } from '@emotion/react';
|
|
16
16
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
17
17
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
18
|
-
import { calcPctFromPx, wrappedLayouts, handleSides, imageAlignmentMap
|
|
18
|
+
import { calcPctFromPx, wrappedLayouts, handleSides, imageAlignmentMap } from '@atlaskit/editor-common/ui';
|
|
19
19
|
import { nonWrappedLayouts, setNodeSelection } from '@atlaskit/editor-common/utils';
|
|
20
|
-
import { akEditorFullWidthLayoutWidth, akEditorGutterPadding
|
|
20
|
+
import { akEditorFullWidthLayoutWidth, akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
|
|
21
21
|
import { wrapperStyle } from './styled';
|
|
22
22
|
import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
23
23
|
import classnames from 'classnames';
|
|
@@ -104,10 +104,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
104
104
|
// so that we have image aligned with text
|
|
105
105
|
return 'full-width';
|
|
106
106
|
});
|
|
107
|
-
_defineProperty(_assertThisInitialized(_this), "calcColumnLeftOffset", function () {
|
|
108
|
-
var offsetLeft = _this.state.offsetLeft;
|
|
109
|
-
return _this.insideInlineLike ? calcColumnsFromPx(offsetLeft, _this.props.lineLength, _this.props.gridSize) : 0;
|
|
110
|
-
});
|
|
111
107
|
_defineProperty(_assertThisInitialized(_this), "calcPxHeight", function (newWidth) {
|
|
112
108
|
var _this$props3 = _this.props,
|
|
113
109
|
_this$props3$width = _this$props3.width,
|
|
@@ -119,9 +115,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
119
115
|
return _this.wrapper = wrapper;
|
|
120
116
|
});
|
|
121
117
|
_defineProperty(_assertThisInitialized(_this), "displayGuideline", function (guidelines) {
|
|
122
|
-
var
|
|
123
|
-
|
|
124
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.guideline) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : (_pluginInjectionApi$d3 = _pluginInjectionApi$d2.actions) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.displayGuideline(_this.props.view)({
|
|
118
|
+
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3, _this$props$pluginInj4;
|
|
119
|
+
return (_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.dependencies) === null || _this$props$pluginInj2 === void 0 ? void 0 : (_this$props$pluginInj3 = _this$props$pluginInj2.guideline) === null || _this$props$pluginInj3 === void 0 ? void 0 : (_this$props$pluginInj4 = _this$props$pluginInj3.actions) === null || _this$props$pluginInj4 === void 0 ? void 0 : _this$props$pluginInj4.displayGuideline(_this.props.view)({
|
|
125
120
|
guidelines: guidelines
|
|
126
121
|
});
|
|
127
122
|
});
|
|
@@ -148,9 +143,10 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
148
143
|
return calcMediaSingleMaxWidth(containerWidth);
|
|
149
144
|
}));
|
|
150
145
|
_defineProperty(_assertThisInitialized(_this), "getRelativeGuides", function () {
|
|
151
|
-
var
|
|
152
|
-
|
|
153
|
-
|
|
146
|
+
var $pos = _this.$pos;
|
|
147
|
+
var relativeGuides = $pos && $pos.nodeAfter && _this.state.size.width ? getRelativeGuidelines(_this.state.relativeGuides, {
|
|
148
|
+
node: $pos.nodeAfter,
|
|
149
|
+
pos: $pos.pos
|
|
154
150
|
}, _this.props.view, _this.props.lineLength, _this.state.size) : [];
|
|
155
151
|
return relativeGuides;
|
|
156
152
|
});
|
|
@@ -167,57 +163,20 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
167
163
|
_this.displayGuideline([].concat(_toConsumableArray(getGuidelinesWithHighlights(gap, MEDIA_SINGLE_SNAP_GAP, activeGuidelineKeys, guidelines)), _toConsumableArray(relativeGuidelines)));
|
|
168
164
|
}
|
|
169
165
|
});
|
|
170
|
-
_defineProperty(_assertThisInitialized(_this), "roundPixelValue", function (value) {
|
|
171
|
-
return Math.round(value);
|
|
172
|
-
});
|
|
173
|
-
_defineProperty(_assertThisInitialized(_this), "getHeightFromNewWidth", function (originalWidth, originalHeight, newWidth) {
|
|
174
|
-
return _this.roundPixelValue(originalHeight / originalWidth * newWidth);
|
|
175
|
-
});
|
|
176
166
|
_defineProperty(_assertThisInitialized(_this), "calculateSizeState", function (size, delta) {
|
|
177
|
-
var
|
|
178
|
-
var
|
|
179
|
-
var onResizeStop = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
180
|
-
var calculatedWidth = _this.roundPixelValue(size.width + delta.width);
|
|
167
|
+
var onResizeStop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
168
|
+
var calculatedWidth = Math.round(size.width + delta.width);
|
|
181
169
|
var calculatedWidthWithLayout = _this.calcNewSize(calculatedWidth, onResizeStop);
|
|
182
|
-
var calculatedHeightWithLayout = _this.getHeightFromNewWidth(originalWidth, originalHeight, calculatedWidth);
|
|
183
170
|
return {
|
|
184
171
|
width: calculatedWidth,
|
|
185
|
-
height:
|
|
172
|
+
height: calculatedWidth / _this.aspectRatio,
|
|
186
173
|
calculatedWidthWithLayout: calculatedWidthWithLayout
|
|
187
174
|
};
|
|
188
175
|
});
|
|
189
176
|
_defineProperty(_assertThisInitialized(_this), "selectCurrentMediaNode", function () {
|
|
190
177
|
// TODO: if adding !this.props.selected, it doesn't work if media single node is at top postion
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (propPos !== undefined) {
|
|
194
|
-
setNodeSelection(_this.props.view, propPos);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
_defineProperty(_assertThisInitialized(_this), "getParentNodeTypeNameFromCurrentPositionNode", function () {
|
|
199
|
-
var $pos = _this.$pos;
|
|
200
|
-
if (!$pos) {
|
|
201
|
-
return undefined;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Supported Parent Nodes
|
|
205
|
-
var _this$props$view$stat = _this.props.view.state.schema.nodes,
|
|
206
|
-
listItem = _this$props$view$stat.listItem,
|
|
207
|
-
expand = _this$props$view$stat.expand,
|
|
208
|
-
tableCell = _this$props$view$stat.tableCell,
|
|
209
|
-
tableHeader = _this$props$view$stat.tableHeader,
|
|
210
|
-
layoutSection = _this$props$view$stat.layoutSection,
|
|
211
|
-
nestedExpand = _this$props$view$stat.nestedExpand;
|
|
212
|
-
var parentNode = findParentNodeOfTypeClosestToPos($pos, [listItem, expand, tableCell, tableHeader, layoutSection, nestedExpand]);
|
|
213
|
-
|
|
214
|
-
// Return matched parent node name
|
|
215
|
-
if (parentNode) {
|
|
216
|
-
return parentNode.node.type.name;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// Return undefined if parent node cannot be found
|
|
220
|
-
return undefined;
|
|
178
|
+
var pos = _this.pos;
|
|
179
|
+
pos && setNodeSelection(_this.props.view, pos);
|
|
221
180
|
});
|
|
222
181
|
_defineProperty(_assertThisInitialized(_this), "handleResizeStart", function () {
|
|
223
182
|
_this.setState({
|
|
@@ -226,17 +185,15 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
226
185
|
_this.selectCurrentMediaNode();
|
|
227
186
|
_this.setIsResizing(true);
|
|
228
187
|
_this.updateSizeInPluginState(_this.state.size.width);
|
|
229
|
-
// re-
|
|
188
|
+
// re-calculate guidelines
|
|
230
189
|
_this.updateGuidelines();
|
|
231
190
|
});
|
|
232
191
|
_defineProperty(_assertThisInitialized(_this), "handleResize", function (size, delta) {
|
|
233
192
|
var _this$props4 = _this.props,
|
|
234
|
-
originalWidth = _this$props4.width,
|
|
235
|
-
originalHeight = _this$props4.height,
|
|
236
193
|
layout = _this$props4.layout,
|
|
237
194
|
updateSize = _this$props4.updateSize,
|
|
238
195
|
lineLength = _this$props4.lineLength;
|
|
239
|
-
var _this$calculateSizeSt = _this.calculateSizeState(size, delta
|
|
196
|
+
var _this$calculateSizeSt = _this.calculateSizeState(size, delta),
|
|
240
197
|
width = _this$calculateSizeSt.width,
|
|
241
198
|
height = _this$calculateSizeSt.height,
|
|
242
199
|
calculatedWidthWithLayout = _this$calculateSizeSt.calculatedWidthWithLayout;
|
|
@@ -259,22 +216,21 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
259
216
|
});
|
|
260
217
|
_defineProperty(_assertThisInitialized(_this), "handleResizeStop", function (size, delta) {
|
|
261
218
|
var _this$props5 = _this.props,
|
|
262
|
-
originalWidth = _this$props5.width,
|
|
263
|
-
originalHeight = _this$props5.height,
|
|
264
219
|
updateSize = _this$props5.updateSize,
|
|
265
220
|
dispatchAnalyticsEvent = _this$props5.dispatchAnalyticsEvent,
|
|
266
221
|
nodeType = _this$props5.nodeType;
|
|
267
|
-
var _this$calculateSizeSt2 = _this.calculateSizeState(size, delta,
|
|
222
|
+
var _this$calculateSizeSt2 = _this.calculateSizeState(size, delta, true),
|
|
268
223
|
width = _this$calculateSizeSt2.width,
|
|
269
224
|
height = _this$calculateSizeSt2.height,
|
|
270
225
|
calculatedWidthWithLayout = _this$calculateSizeSt2.calculatedWidthWithLayout;
|
|
271
226
|
if (dispatchAnalyticsEvent) {
|
|
227
|
+
var $pos = _this.$pos;
|
|
272
228
|
var event = getMediaResizeAnalyticsEvent(nodeType || 'mediaSingle', {
|
|
273
229
|
width: width,
|
|
274
230
|
layout: calculatedWidthWithLayout.layout,
|
|
275
231
|
widthType: 'pixel',
|
|
276
232
|
snapType: getGuidelineTypeFromKey(_this.lastSnappedGuidelineKeys, _this.state.guidelines),
|
|
277
|
-
parentNode:
|
|
233
|
+
parentNode: $pos ? $pos.parent.type.name : undefined
|
|
278
234
|
});
|
|
279
235
|
if (event) {
|
|
280
236
|
dispatchAnalyticsEvent(event);
|
|
@@ -308,23 +264,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
308
264
|
};
|
|
309
265
|
return _this;
|
|
310
266
|
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Calculate media single node initial width if props.mediaSingleWidth is undefined
|
|
314
|
-
* (Mainly when switching from lagacy experience to new experience).
|
|
315
|
-
*
|
|
316
|
-
* @returns initial width in pixel
|
|
317
|
-
*/
|
|
318
267
|
_createClass(ResizableMediaSingleNext, [{
|
|
319
|
-
key: "calcInitialWidth",
|
|
320
|
-
value: function calcInitialWidth() {
|
|
321
|
-
var _this$props6 = this.props,
|
|
322
|
-
origWidth = _this$props6.width,
|
|
323
|
-
contentWidth = _this$props6.lineLength,
|
|
324
|
-
containerWidth = _this$props6.containerWidth;
|
|
325
|
-
return Math.max(Math.min(origWidth || DEFAULT_IMAGE_WIDTH, contentWidth || containerWidth || akEditorDefaultLayoutWidth), MEDIA_SINGLE_MIN_PIXEL_WIDTH);
|
|
326
|
-
}
|
|
327
|
-
}, {
|
|
328
268
|
key: "componentDidUpdate",
|
|
329
269
|
value: function componentDidUpdate(prevProps) {
|
|
330
270
|
var _this2 = this;
|
|
@@ -367,29 +307,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
367
307
|
}
|
|
368
308
|
return true;
|
|
369
309
|
}
|
|
370
|
-
|
|
371
|
-
// check if is inside of layout, table, expand, nestedExpand and list item
|
|
372
|
-
}, {
|
|
373
|
-
key: "isNestedNode",
|
|
374
|
-
value: function isNestedNode() {
|
|
375
|
-
return !!(this.$pos && this.$pos.parent.type.name !== 'doc');
|
|
376
|
-
}
|
|
377
|
-
}, {
|
|
378
|
-
key: "getDefaultGuidelines",
|
|
379
|
-
value: function getDefaultGuidelines() {
|
|
380
|
-
var _this$props7 = this.props,
|
|
381
|
-
lineLength = _this$props7.lineLength,
|
|
382
|
-
containerWidth = _this$props7.containerWidth,
|
|
383
|
-
fullWidthMode = _this$props7.fullWidthMode;
|
|
384
|
-
|
|
385
|
-
// disable guidelines for nested media single node
|
|
386
|
-
return this.isNestedNode() ? [] : generateDefaultGuidelines(lineLength, containerWidth, fullWidthMode);
|
|
387
|
-
}
|
|
388
|
-
}, {
|
|
389
|
-
key: "wrappedLayout",
|
|
390
|
-
get: function get() {
|
|
391
|
-
return wrappedLayouts.indexOf(this.props.layout) > -1;
|
|
392
|
-
}
|
|
393
310
|
}, {
|
|
394
311
|
key: "componentDidMount",
|
|
395
312
|
value: function () {
|
|
@@ -423,18 +340,82 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
423
340
|
this.checkVideoFile(nextProps.viewMediaClientConfig);
|
|
424
341
|
}
|
|
425
342
|
}
|
|
343
|
+
}, {
|
|
344
|
+
key: "wrappedLayout",
|
|
345
|
+
get: function get() {
|
|
346
|
+
return wrappedLayouts.indexOf(this.props.layout) > -1;
|
|
347
|
+
}
|
|
348
|
+
}, {
|
|
349
|
+
key: "pos",
|
|
350
|
+
get: function get() {
|
|
351
|
+
if (typeof this.props.getPos !== 'function') {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
var pos = this.props.getPos();
|
|
355
|
+
if (Number.isNaN(pos) || typeof pos !== 'number') {
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
return pos;
|
|
359
|
+
}
|
|
360
|
+
}, {
|
|
361
|
+
key: "$pos",
|
|
362
|
+
get: function get() {
|
|
363
|
+
var pos = this.pos;
|
|
364
|
+
// need to pass view because we may not get updated props in time
|
|
365
|
+
return pos && this.props.view.state.doc.resolve(pos);
|
|
366
|
+
}
|
|
426
367
|
}, {
|
|
427
368
|
key: "aspectRatio",
|
|
428
369
|
get: function get() {
|
|
429
|
-
var _this$
|
|
430
|
-
width = _this$
|
|
431
|
-
height = _this$
|
|
370
|
+
var _this$props6 = this.props,
|
|
371
|
+
width = _this$props6.width,
|
|
372
|
+
height = _this$props6.height;
|
|
432
373
|
if (width) {
|
|
433
374
|
return width / height;
|
|
434
375
|
}
|
|
376
|
+
|
|
435
377
|
// TODO handle this case
|
|
436
378
|
return 1;
|
|
437
379
|
}
|
|
380
|
+
}, {
|
|
381
|
+
key: "insideInlineLike",
|
|
382
|
+
get: function get() {
|
|
383
|
+
var $pos = this.$pos;
|
|
384
|
+
if (!$pos) {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
var listItem = this.props.view.state.schema.nodes.listItem;
|
|
388
|
+
return !!findParentNodeOfTypeClosestToPos($pos, [listItem]);
|
|
389
|
+
}
|
|
390
|
+
}, {
|
|
391
|
+
key: "insideLayout",
|
|
392
|
+
get: function get() {
|
|
393
|
+
var $pos = this.$pos;
|
|
394
|
+
if (!$pos) {
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
var layoutColumn = this.props.view.state.schema.nodes.layoutColumn;
|
|
398
|
+
return !!findParentNodeOfTypeClosestToPos($pos, [layoutColumn]);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// check if is inside of layout, table, expand, nestedExpand and list item
|
|
402
|
+
}, {
|
|
403
|
+
key: "isNestedNode",
|
|
404
|
+
value: function isNestedNode() {
|
|
405
|
+
var $pos = this.$pos;
|
|
406
|
+
return !!($pos && $pos.parent.type !== $pos.parent.type.schema.nodes.doc);
|
|
407
|
+
}
|
|
408
|
+
}, {
|
|
409
|
+
key: "getDefaultGuidelines",
|
|
410
|
+
value: function getDefaultGuidelines() {
|
|
411
|
+
var _this$props7 = this.props,
|
|
412
|
+
lineLength = _this$props7.lineLength,
|
|
413
|
+
containerWidth = _this$props7.containerWidth,
|
|
414
|
+
fullWidthMode = _this$props7.fullWidthMode;
|
|
415
|
+
|
|
416
|
+
// disable guidelines for nested media single node
|
|
417
|
+
return this.isNestedNode() ? [] : generateDefaultGuidelines(lineLength, containerWidth, fullWidthMode);
|
|
418
|
+
}
|
|
438
419
|
}, {
|
|
439
420
|
key: "checkVideoFile",
|
|
440
421
|
value: function () {
|
|
@@ -489,63 +470,19 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
489
470
|
}
|
|
490
471
|
return checkVideoFile;
|
|
491
472
|
}()
|
|
492
|
-
}, {
|
|
493
|
-
key: "$pos",
|
|
494
|
-
get: function get() {
|
|
495
|
-
if (typeof this.props.getPos !== 'function') {
|
|
496
|
-
return null;
|
|
497
|
-
}
|
|
498
|
-
var pos = this.props.getPos();
|
|
499
|
-
if (Number.isNaN(pos) || typeof pos !== 'number') {
|
|
500
|
-
return null;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
// need to pass view because we may not get updated props in time
|
|
504
|
-
return this.props.view.state.doc.resolve(pos);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* The maxmimum number of grid columns this node can resize to.
|
|
509
|
-
*/
|
|
510
|
-
}, {
|
|
511
|
-
key: "gridWidth",
|
|
512
|
-
get: function get() {
|
|
513
|
-
var gridSize = this.props.gridSize;
|
|
514
|
-
return !(this.wrappedLayout || this.insideInlineLike) ? gridSize / 2 : gridSize;
|
|
515
|
-
}
|
|
516
|
-
}, {
|
|
517
|
-
key: "insideInlineLike",
|
|
518
|
-
get: function get() {
|
|
519
|
-
var $pos = this.$pos;
|
|
520
|
-
if (!$pos) {
|
|
521
|
-
return false;
|
|
522
|
-
}
|
|
523
|
-
var listItem = this.props.view.state.schema.nodes.listItem;
|
|
524
|
-
return !!findParentNodeOfTypeClosestToPos($pos, [listItem]);
|
|
525
|
-
}
|
|
526
|
-
}, {
|
|
527
|
-
key: "insideLayout",
|
|
528
|
-
get: function get() {
|
|
529
|
-
var $pos = this.$pos;
|
|
530
|
-
if (!$pos) {
|
|
531
|
-
return false;
|
|
532
|
-
}
|
|
533
|
-
var layoutColumn = this.props.view.state.schema.nodes.layoutColumn;
|
|
534
|
-
return !!findParentNodeOfTypeClosestToPos($pos, [layoutColumn]);
|
|
535
|
-
}
|
|
536
473
|
}, {
|
|
537
474
|
key: "render",
|
|
538
475
|
value: function render() {
|
|
539
476
|
var _this3 = this;
|
|
540
|
-
var _this$
|
|
541
|
-
origWidth = _this$
|
|
542
|
-
layout = _this$
|
|
543
|
-
pctWidth = _this$
|
|
544
|
-
containerWidth = _this$
|
|
545
|
-
fullWidthMode = _this$
|
|
546
|
-
selected = _this$
|
|
547
|
-
children = _this$
|
|
548
|
-
lineLength = _this$
|
|
477
|
+
var _this$props8 = this.props,
|
|
478
|
+
origWidth = _this$props8.width,
|
|
479
|
+
layout = _this$props8.layout,
|
|
480
|
+
pctWidth = _this$props8.pctWidth,
|
|
481
|
+
containerWidth = _this$props8.containerWidth,
|
|
482
|
+
fullWidthMode = _this$props8.fullWidthMode,
|
|
483
|
+
selected = _this$props8.selected,
|
|
484
|
+
children = _this$props8.children,
|
|
485
|
+
lineLength = _this$props8.lineLength;
|
|
549
486
|
var _this$state = this.state,
|
|
550
487
|
isResizing = _this$state.isResizing,
|
|
551
488
|
size = _this$state.size;
|
package/dist/esm/use-preset.js
CHANGED
|
@@ -21,7 +21,7 @@ import { usePresetContext } from './presets/context';
|
|
|
21
21
|
* , []);
|
|
22
22
|
*
|
|
23
23
|
* // Can execute typesafe commands based on plugin1 or 2
|
|
24
|
-
* const runCommand = () => editorApi.
|
|
24
|
+
* const runCommand = () => editorApi.dependencies.core.actions.execute(
|
|
25
25
|
* editorApi.dependencies.plugin1.commands.doSomething()
|
|
26
26
|
* )
|
|
27
27
|
* return (
|
|
@@ -20,38 +20,27 @@ export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
|
|
|
20
20
|
type ResizableMediaSingleNextProps = Props;
|
|
21
21
|
declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
|
|
22
22
|
private lastSnappedGuidelineKeys;
|
|
23
|
+
private wrapper?;
|
|
23
24
|
constructor(props: ResizableMediaSingleNextProps);
|
|
24
|
-
/**
|
|
25
|
-
* Calculate media single node initial width if props.mediaSingleWidth is undefined
|
|
26
|
-
* (Mainly when switching from lagacy experience to new experience).
|
|
27
|
-
*
|
|
28
|
-
* @returns initial width in pixel
|
|
29
|
-
*/
|
|
30
|
-
calcInitialWidth(): number;
|
|
31
25
|
componentDidUpdate(prevProps: Props): boolean;
|
|
32
|
-
isNestedNode(): boolean;
|
|
33
|
-
private getDefaultGuidelines;
|
|
34
|
-
private updateGuidelines;
|
|
35
|
-
get wrappedLayout(): boolean;
|
|
36
26
|
componentDidMount(): Promise<void>;
|
|
37
27
|
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
28
|
+
get wrappedLayout(): boolean;
|
|
29
|
+
get pos(): number | null;
|
|
30
|
+
get $pos(): 0 | import("prosemirror-model").ResolvedPos | null;
|
|
38
31
|
get aspectRatio(): number;
|
|
32
|
+
get insideInlineLike(): boolean;
|
|
33
|
+
get insideLayout(): boolean;
|
|
34
|
+
isNestedNode(): boolean;
|
|
35
|
+
private getDefaultGuidelines;
|
|
36
|
+
private updateGuidelines;
|
|
39
37
|
checkVideoFile(viewMediaClientConfig?: MediaClientConfig): Promise<void>;
|
|
40
38
|
calcNewSize: (newWidth: number, stop: boolean) => {
|
|
41
39
|
width: number | null;
|
|
42
40
|
layout: MediaSingleLayout;
|
|
43
41
|
};
|
|
44
42
|
calcUnwrappedLayout: (width: number, containerWidth: number, contentWidth: number, fullWidthMode?: boolean) => 'center' | 'wide' | 'full-width';
|
|
45
|
-
get $pos(): import("prosemirror-model").ResolvedPos | null;
|
|
46
|
-
/**
|
|
47
|
-
* The maxmimum number of grid columns this node can resize to.
|
|
48
|
-
*/
|
|
49
|
-
get gridWidth(): number;
|
|
50
|
-
calcColumnLeftOffset: () => number;
|
|
51
|
-
wrapper?: HTMLElement;
|
|
52
43
|
calcPxHeight: (newWidth: number) => number;
|
|
53
|
-
get insideInlineLike(): boolean;
|
|
54
|
-
get insideLayout(): boolean;
|
|
55
44
|
private saveWrapper;
|
|
56
45
|
private displayGuideline;
|
|
57
46
|
private setIsResizing;
|
|
@@ -59,9 +48,7 @@ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSin
|
|
|
59
48
|
private calcMaxWidth;
|
|
60
49
|
private getRelativeGuides;
|
|
61
50
|
updateActiveGuidelines: (width: number | undefined, guidelines: GuidelineConfig[], guidelineSnapsReference: GuidelineSnapsReference) => void;
|
|
62
|
-
|
|
63
|
-
getHeightFromNewWidth: (originalWidth: number, originalHeight: number, newWidth: number) => number;
|
|
64
|
-
calculateSizeState: (size: Position & Dimensions, delta: Dimensions, originalWidth: number | undefined, originalHeight: number, onResizeStop?: boolean) => {
|
|
51
|
+
calculateSizeState: (size: Position & Dimensions, delta: Dimensions, onResizeStop?: boolean) => {
|
|
65
52
|
width: number;
|
|
66
53
|
height: number;
|
|
67
54
|
calculatedWidthWithLayout: {
|
|
@@ -70,7 +57,6 @@ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSin
|
|
|
70
57
|
};
|
|
71
58
|
};
|
|
72
59
|
selectCurrentMediaNode: () => void;
|
|
73
|
-
getParentNodeTypeNameFromCurrentPositionNode: () => string | undefined;
|
|
74
60
|
handleResizeStart: HandleResizeStart;
|
|
75
61
|
handleResize: HandleResize;
|
|
76
62
|
handleResizeStop: HandleResize;
|
|
@@ -32,7 +32,7 @@ interface PresetAPI<PluginNames extends string[] = [], StackPlugins extends AllE
|
|
|
32
32
|
* , []);
|
|
33
33
|
*
|
|
34
34
|
* // Can execute typesafe commands based on plugin1 or 2
|
|
35
|
-
* const runCommand = () => editorApi.
|
|
35
|
+
* const runCommand = () => editorApi.dependencies.core.actions.execute(
|
|
36
36
|
* editorApi.dependencies.plugin1.commands.doSomething()
|
|
37
37
|
* )
|
|
38
38
|
* return (
|
package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts
CHANGED
|
@@ -20,38 +20,27 @@ export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
|
|
|
20
20
|
type ResizableMediaSingleNextProps = Props;
|
|
21
21
|
declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
|
|
22
22
|
private lastSnappedGuidelineKeys;
|
|
23
|
+
private wrapper?;
|
|
23
24
|
constructor(props: ResizableMediaSingleNextProps);
|
|
24
|
-
/**
|
|
25
|
-
* Calculate media single node initial width if props.mediaSingleWidth is undefined
|
|
26
|
-
* (Mainly when switching from lagacy experience to new experience).
|
|
27
|
-
*
|
|
28
|
-
* @returns initial width in pixel
|
|
29
|
-
*/
|
|
30
|
-
calcInitialWidth(): number;
|
|
31
25
|
componentDidUpdate(prevProps: Props): boolean;
|
|
32
|
-
isNestedNode(): boolean;
|
|
33
|
-
private getDefaultGuidelines;
|
|
34
|
-
private updateGuidelines;
|
|
35
|
-
get wrappedLayout(): boolean;
|
|
36
26
|
componentDidMount(): Promise<void>;
|
|
37
27
|
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
28
|
+
get wrappedLayout(): boolean;
|
|
29
|
+
get pos(): number | null;
|
|
30
|
+
get $pos(): 0 | import("prosemirror-model").ResolvedPos | null;
|
|
38
31
|
get aspectRatio(): number;
|
|
32
|
+
get insideInlineLike(): boolean;
|
|
33
|
+
get insideLayout(): boolean;
|
|
34
|
+
isNestedNode(): boolean;
|
|
35
|
+
private getDefaultGuidelines;
|
|
36
|
+
private updateGuidelines;
|
|
39
37
|
checkVideoFile(viewMediaClientConfig?: MediaClientConfig): Promise<void>;
|
|
40
38
|
calcNewSize: (newWidth: number, stop: boolean) => {
|
|
41
39
|
width: number | null;
|
|
42
40
|
layout: MediaSingleLayout;
|
|
43
41
|
};
|
|
44
42
|
calcUnwrappedLayout: (width: number, containerWidth: number, contentWidth: number, fullWidthMode?: boolean) => 'center' | 'wide' | 'full-width';
|
|
45
|
-
get $pos(): import("prosemirror-model").ResolvedPos | null;
|
|
46
|
-
/**
|
|
47
|
-
* The maxmimum number of grid columns this node can resize to.
|
|
48
|
-
*/
|
|
49
|
-
get gridWidth(): number;
|
|
50
|
-
calcColumnLeftOffset: () => number;
|
|
51
|
-
wrapper?: HTMLElement;
|
|
52
43
|
calcPxHeight: (newWidth: number) => number;
|
|
53
|
-
get insideInlineLike(): boolean;
|
|
54
|
-
get insideLayout(): boolean;
|
|
55
44
|
private saveWrapper;
|
|
56
45
|
private displayGuideline;
|
|
57
46
|
private setIsResizing;
|
|
@@ -59,9 +48,7 @@ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSin
|
|
|
59
48
|
private calcMaxWidth;
|
|
60
49
|
private getRelativeGuides;
|
|
61
50
|
updateActiveGuidelines: (width: number | undefined, guidelines: GuidelineConfig[], guidelineSnapsReference: GuidelineSnapsReference) => void;
|
|
62
|
-
|
|
63
|
-
getHeightFromNewWidth: (originalWidth: number, originalHeight: number, newWidth: number) => number;
|
|
64
|
-
calculateSizeState: (size: Position & Dimensions, delta: Dimensions, originalWidth: number | undefined, originalHeight: number, onResizeStop?: boolean) => {
|
|
51
|
+
calculateSizeState: (size: Position & Dimensions, delta: Dimensions, onResizeStop?: boolean) => {
|
|
65
52
|
width: number;
|
|
66
53
|
height: number;
|
|
67
54
|
calculatedWidthWithLayout: {
|
|
@@ -70,7 +57,6 @@ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSin
|
|
|
70
57
|
};
|
|
71
58
|
};
|
|
72
59
|
selectCurrentMediaNode: () => void;
|
|
73
|
-
getParentNodeTypeNameFromCurrentPositionNode: () => string | undefined;
|
|
74
60
|
handleResizeStart: HandleResizeStart;
|
|
75
61
|
handleResize: HandleResize;
|
|
76
62
|
handleResizeStop: HandleResize;
|
|
@@ -34,7 +34,7 @@ interface PresetAPI<PluginNames extends string[] = [
|
|
|
34
34
|
* , []);
|
|
35
35
|
*
|
|
36
36
|
* // Can execute typesafe commands based on plugin1 or 2
|
|
37
|
-
* const runCommand = () => editorApi.
|
|
37
|
+
* const runCommand = () => editorApi.dependencies.core.actions.execute(
|
|
38
38
|
* editorApi.dependencies.plugin1.commands.doSomething()
|
|
39
39
|
* )
|
|
40
40
|
* return (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.
|
|
3
|
+
"version": "187.27.1",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/code": "^14.6.0",
|
|
56
56
|
"@atlaskit/date": "^0.10.0",
|
|
57
57
|
"@atlaskit/datetime-picker": "^12.7.0",
|
|
58
|
-
"@atlaskit/editor-common": "^74.
|
|
58
|
+
"@atlaskit/editor-common": "^74.48.0",
|
|
59
59
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
60
60
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
61
61
|
"@atlaskit/editor-palette": "1.5.1",
|