@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.27.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`719a3a60441`](https://bitbucket.org/atlassian/atlassian-frontend/commits/719a3a60441) - ED-19411 minor refactor of ResizableMediaSingleNext
|
|
8
|
+
|
|
9
|
+
## 187.27.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`967f4819f58`](https://bitbucket.org/atlassian/atlassian-frontend/commits/967f4819f58) - Introduce core plugin that is always injected into the pluginInjectionApi. This has a new action `execute` that replaces the existing `executeCommand` that was called from the `pluginInjectionApi`.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 187.26.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -170,19 +170,19 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleLinkPanel", function (inputMethod) {
|
|
173
|
-
var _pluginInjectionApi$
|
|
173
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3;
|
|
174
174
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
175
|
-
return (_pluginInjectionApi$
|
|
175
|
+
return (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : (_pluginInjectionApi$d3 = _pluginInjectionApi$d2.hyperlink) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.commands.showLinkToolbar(inputMethod))) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : false;
|
|
176
176
|
});
|
|
177
177
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertMention", function (inputMethod) {
|
|
178
|
-
var _pluginInjectionApi$
|
|
178
|
+
var _pluginInjectionApi$d4;
|
|
179
179
|
var _this$props = _this.props,
|
|
180
180
|
editorView = _this$props.editorView,
|
|
181
181
|
pluginInjectionApi = _this$props.pluginInjectionApi;
|
|
182
182
|
if (!editorView) {
|
|
183
183
|
return true;
|
|
184
184
|
}
|
|
185
|
-
var pluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
185
|
+
var pluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies.mention) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.sharedState.currentState();
|
|
186
186
|
if (pluginState && pluginState.canInsertMention === false) {
|
|
187
187
|
return false;
|
|
188
188
|
}
|
|
@@ -190,13 +190,13 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
190
190
|
return true;
|
|
191
191
|
});
|
|
192
192
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertTable", function (inputMethod) {
|
|
193
|
-
var _pluginInjectionApi$
|
|
193
|
+
var _pluginInjectionApi$d5, _pluginInjectionApi$d6, _pluginInjectionApi$d7, _pluginInjectionApi$d8;
|
|
194
194
|
var _this$props2 = _this.props,
|
|
195
195
|
pluginInjectionApi = _this$props2.pluginInjectionApi,
|
|
196
196
|
editorView = _this$props2.editorView;
|
|
197
197
|
var state = editorView.state,
|
|
198
198
|
dispatch = editorView.dispatch;
|
|
199
|
-
return (_pluginInjectionApi$
|
|
199
|
+
return (_pluginInjectionApi$d5 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies.table) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : (_pluginInjectionApi$d7 = (_pluginInjectionApi$d8 = _pluginInjectionApi$d6.actions).insertTable) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : _pluginInjectionApi$d7.call(_pluginInjectionApi$d8, {
|
|
200
200
|
action: _analytics.ACTION.INSERTED,
|
|
201
201
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
202
202
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.TABLE,
|
|
@@ -204,7 +204,7 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
204
204
|
inputMethod: inputMethod
|
|
205
205
|
},
|
|
206
206
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
207
|
-
})(state, dispatch)) !== null && _pluginInjectionApi$
|
|
207
|
+
})(state, dispatch)) !== null && _pluginInjectionApi$d5 !== void 0 ? _pluginInjectionApi$d5 : false;
|
|
208
208
|
});
|
|
209
209
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createDate", function (inputMethod) {
|
|
210
210
|
var editorView = _this.props.editorView;
|
|
@@ -281,10 +281,10 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
281
281
|
};
|
|
282
282
|
});
|
|
283
283
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleSelectedEmoji", function (emojiId) {
|
|
284
|
-
var _pluginInjectionApi$
|
|
284
|
+
var _pluginInjectionApi$d9;
|
|
285
285
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
286
286
|
_this.props.editorView.focus();
|
|
287
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
287
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.core.actions.execute((_pluginInjectionApi$d9 = pluginInjectionApi.dependencies.emoji) === null || _pluginInjectionApi$d9 === void 0 ? void 0 : _pluginInjectionApi$d9.commands.insertEmoji(emojiId, _analytics.INPUT_METHOD.PICKER));
|
|
288
288
|
_this.toggleEmojiPicker();
|
|
289
289
|
return true;
|
|
290
290
|
});
|
|
@@ -111,10 +111,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
111
111
|
// so that we have image aligned with text
|
|
112
112
|
return 'full-width';
|
|
113
113
|
});
|
|
114
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calcColumnLeftOffset", function () {
|
|
115
|
-
var offsetLeft = _this.state.offsetLeft;
|
|
116
|
-
return _this.insideInlineLike ? (0, _ui.calcColumnsFromPx)(offsetLeft, _this.props.lineLength, _this.props.gridSize) : 0;
|
|
117
|
-
});
|
|
118
114
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calcPxHeight", function (newWidth) {
|
|
119
115
|
var _this$props3 = _this.props,
|
|
120
116
|
_this$props3$width = _this$props3.width,
|
|
@@ -126,9 +122,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
126
122
|
return _this.wrapper = wrapper;
|
|
127
123
|
});
|
|
128
124
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "displayGuideline", function (guidelines) {
|
|
129
|
-
var
|
|
130
|
-
|
|
131
|
-
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)({
|
|
125
|
+
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3, _this$props$pluginInj4;
|
|
126
|
+
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)({
|
|
132
127
|
guidelines: guidelines
|
|
133
128
|
});
|
|
134
129
|
});
|
|
@@ -155,9 +150,10 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
155
150
|
return (0, _mediaSingle.calcMediaSingleMaxWidth)(containerWidth);
|
|
156
151
|
}));
|
|
157
152
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getRelativeGuides", function () {
|
|
158
|
-
var
|
|
159
|
-
|
|
160
|
-
|
|
153
|
+
var $pos = _this.$pos;
|
|
154
|
+
var relativeGuides = $pos && $pos.nodeAfter && _this.state.size.width ? (0, _guideline.getRelativeGuidelines)(_this.state.relativeGuides, {
|
|
155
|
+
node: $pos.nodeAfter,
|
|
156
|
+
pos: $pos.pos
|
|
161
157
|
}, _this.props.view, _this.props.lineLength, _this.state.size) : [];
|
|
162
158
|
return relativeGuides;
|
|
163
159
|
});
|
|
@@ -174,57 +170,20 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
174
170
|
_this.displayGuideline([].concat((0, _toConsumableArray2.default)((0, _guideline.getGuidelinesWithHighlights)(gap, _mediaSingle.MEDIA_SINGLE_SNAP_GAP, activeGuidelineKeys, guidelines)), (0, _toConsumableArray2.default)(relativeGuidelines)));
|
|
175
171
|
}
|
|
176
172
|
});
|
|
177
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "roundPixelValue", function (value) {
|
|
178
|
-
return Math.round(value);
|
|
179
|
-
});
|
|
180
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getHeightFromNewWidth", function (originalWidth, originalHeight, newWidth) {
|
|
181
|
-
return _this.roundPixelValue(originalHeight / originalWidth * newWidth);
|
|
182
|
-
});
|
|
183
173
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calculateSizeState", function (size, delta) {
|
|
184
|
-
var
|
|
185
|
-
var
|
|
186
|
-
var onResizeStop = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
187
|
-
var calculatedWidth = _this.roundPixelValue(size.width + delta.width);
|
|
174
|
+
var onResizeStop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
175
|
+
var calculatedWidth = Math.round(size.width + delta.width);
|
|
188
176
|
var calculatedWidthWithLayout = _this.calcNewSize(calculatedWidth, onResizeStop);
|
|
189
|
-
var calculatedHeightWithLayout = _this.getHeightFromNewWidth(originalWidth, originalHeight, calculatedWidth);
|
|
190
177
|
return {
|
|
191
178
|
width: calculatedWidth,
|
|
192
|
-
height:
|
|
179
|
+
height: calculatedWidth / _this.aspectRatio,
|
|
193
180
|
calculatedWidthWithLayout: calculatedWidthWithLayout
|
|
194
181
|
};
|
|
195
182
|
});
|
|
196
183
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectCurrentMediaNode", function () {
|
|
197
184
|
// TODO: if adding !this.props.selected, it doesn't work if media single node is at top postion
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
if (propPos !== undefined) {
|
|
201
|
-
(0, _utils2.setNodeSelection)(_this.props.view, propPos);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getParentNodeTypeNameFromCurrentPositionNode", function () {
|
|
206
|
-
var $pos = _this.$pos;
|
|
207
|
-
if (!$pos) {
|
|
208
|
-
return undefined;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Supported Parent Nodes
|
|
212
|
-
var _this$props$view$stat = _this.props.view.state.schema.nodes,
|
|
213
|
-
listItem = _this$props$view$stat.listItem,
|
|
214
|
-
expand = _this$props$view$stat.expand,
|
|
215
|
-
tableCell = _this$props$view$stat.tableCell,
|
|
216
|
-
tableHeader = _this$props$view$stat.tableHeader,
|
|
217
|
-
layoutSection = _this$props$view$stat.layoutSection,
|
|
218
|
-
nestedExpand = _this$props$view$stat.nestedExpand;
|
|
219
|
-
var parentNode = (0, _utils.findParentNodeOfTypeClosestToPos)($pos, [listItem, expand, tableCell, tableHeader, layoutSection, nestedExpand]);
|
|
220
|
-
|
|
221
|
-
// Return matched parent node name
|
|
222
|
-
if (parentNode) {
|
|
223
|
-
return parentNode.node.type.name;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// Return undefined if parent node cannot be found
|
|
227
|
-
return undefined;
|
|
185
|
+
var pos = _this.pos;
|
|
186
|
+
pos && (0, _utils2.setNodeSelection)(_this.props.view, pos);
|
|
228
187
|
});
|
|
229
188
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleResizeStart", function () {
|
|
230
189
|
_this.setState({
|
|
@@ -233,17 +192,15 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
233
192
|
_this.selectCurrentMediaNode();
|
|
234
193
|
_this.setIsResizing(true);
|
|
235
194
|
_this.updateSizeInPluginState(_this.state.size.width);
|
|
236
|
-
// re-
|
|
195
|
+
// re-calculate guidelines
|
|
237
196
|
_this.updateGuidelines();
|
|
238
197
|
});
|
|
239
198
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleResize", function (size, delta) {
|
|
240
199
|
var _this$props4 = _this.props,
|
|
241
|
-
originalWidth = _this$props4.width,
|
|
242
|
-
originalHeight = _this$props4.height,
|
|
243
200
|
layout = _this$props4.layout,
|
|
244
201
|
updateSize = _this$props4.updateSize,
|
|
245
202
|
lineLength = _this$props4.lineLength;
|
|
246
|
-
var _this$calculateSizeSt = _this.calculateSizeState(size, delta
|
|
203
|
+
var _this$calculateSizeSt = _this.calculateSizeState(size, delta),
|
|
247
204
|
width = _this$calculateSizeSt.width,
|
|
248
205
|
height = _this$calculateSizeSt.height,
|
|
249
206
|
calculatedWidthWithLayout = _this$calculateSizeSt.calculatedWidthWithLayout;
|
|
@@ -266,22 +223,21 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
266
223
|
});
|
|
267
224
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleResizeStop", function (size, delta) {
|
|
268
225
|
var _this$props5 = _this.props,
|
|
269
|
-
originalWidth = _this$props5.width,
|
|
270
|
-
originalHeight = _this$props5.height,
|
|
271
226
|
updateSize = _this$props5.updateSize,
|
|
272
227
|
dispatchAnalyticsEvent = _this$props5.dispatchAnalyticsEvent,
|
|
273
228
|
nodeType = _this$props5.nodeType;
|
|
274
|
-
var _this$calculateSizeSt2 = _this.calculateSizeState(size, delta,
|
|
229
|
+
var _this$calculateSizeSt2 = _this.calculateSizeState(size, delta, true),
|
|
275
230
|
width = _this$calculateSizeSt2.width,
|
|
276
231
|
height = _this$calculateSizeSt2.height,
|
|
277
232
|
calculatedWidthWithLayout = _this$calculateSizeSt2.calculatedWidthWithLayout;
|
|
278
233
|
if (dispatchAnalyticsEvent) {
|
|
234
|
+
var $pos = _this.$pos;
|
|
279
235
|
var event = (0, _analytics.getMediaResizeAnalyticsEvent)(nodeType || 'mediaSingle', {
|
|
280
236
|
width: width,
|
|
281
237
|
layout: calculatedWidthWithLayout.layout,
|
|
282
238
|
widthType: 'pixel',
|
|
283
239
|
snapType: (0, _guideline.getGuidelineTypeFromKey)(_this.lastSnappedGuidelineKeys, _this.state.guidelines),
|
|
284
|
-
parentNode:
|
|
240
|
+
parentNode: $pos ? $pos.parent.type.name : undefined
|
|
285
241
|
});
|
|
286
242
|
if (event) {
|
|
287
243
|
dispatchAnalyticsEvent(event);
|
|
@@ -315,23 +271,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
315
271
|
};
|
|
316
272
|
return _this;
|
|
317
273
|
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Calculate media single node initial width if props.mediaSingleWidth is undefined
|
|
321
|
-
* (Mainly when switching from lagacy experience to new experience).
|
|
322
|
-
*
|
|
323
|
-
* @returns initial width in pixel
|
|
324
|
-
*/
|
|
325
274
|
(0, _createClass2.default)(ResizableMediaSingleNext, [{
|
|
326
|
-
key: "calcInitialWidth",
|
|
327
|
-
value: function calcInitialWidth() {
|
|
328
|
-
var _this$props6 = this.props,
|
|
329
|
-
origWidth = _this$props6.width,
|
|
330
|
-
contentWidth = _this$props6.lineLength,
|
|
331
|
-
containerWidth = _this$props6.containerWidth;
|
|
332
|
-
return Math.max(Math.min(origWidth || _mediaSingle.DEFAULT_IMAGE_WIDTH, contentWidth || containerWidth || _editorSharedStyles.akEditorDefaultLayoutWidth), _mediaSingle.MEDIA_SINGLE_MIN_PIXEL_WIDTH);
|
|
333
|
-
}
|
|
334
|
-
}, {
|
|
335
275
|
key: "componentDidUpdate",
|
|
336
276
|
value: function componentDidUpdate(prevProps) {
|
|
337
277
|
var _this2 = this;
|
|
@@ -374,29 +314,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
374
314
|
}
|
|
375
315
|
return true;
|
|
376
316
|
}
|
|
377
|
-
|
|
378
|
-
// check if is inside of layout, table, expand, nestedExpand and list item
|
|
379
|
-
}, {
|
|
380
|
-
key: "isNestedNode",
|
|
381
|
-
value: function isNestedNode() {
|
|
382
|
-
return !!(this.$pos && this.$pos.parent.type.name !== 'doc');
|
|
383
|
-
}
|
|
384
|
-
}, {
|
|
385
|
-
key: "getDefaultGuidelines",
|
|
386
|
-
value: function getDefaultGuidelines() {
|
|
387
|
-
var _this$props7 = this.props,
|
|
388
|
-
lineLength = _this$props7.lineLength,
|
|
389
|
-
containerWidth = _this$props7.containerWidth,
|
|
390
|
-
fullWidthMode = _this$props7.fullWidthMode;
|
|
391
|
-
|
|
392
|
-
// disable guidelines for nested media single node
|
|
393
|
-
return this.isNestedNode() ? [] : (0, _guideline.generateDefaultGuidelines)(lineLength, containerWidth, fullWidthMode);
|
|
394
|
-
}
|
|
395
|
-
}, {
|
|
396
|
-
key: "wrappedLayout",
|
|
397
|
-
get: function get() {
|
|
398
|
-
return _ui.wrappedLayouts.indexOf(this.props.layout) > -1;
|
|
399
|
-
}
|
|
400
317
|
}, {
|
|
401
318
|
key: "componentDidMount",
|
|
402
319
|
value: function () {
|
|
@@ -430,18 +347,82 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
430
347
|
this.checkVideoFile(nextProps.viewMediaClientConfig);
|
|
431
348
|
}
|
|
432
349
|
}
|
|
350
|
+
}, {
|
|
351
|
+
key: "wrappedLayout",
|
|
352
|
+
get: function get() {
|
|
353
|
+
return _ui.wrappedLayouts.indexOf(this.props.layout) > -1;
|
|
354
|
+
}
|
|
355
|
+
}, {
|
|
356
|
+
key: "pos",
|
|
357
|
+
get: function get() {
|
|
358
|
+
if (typeof this.props.getPos !== 'function') {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
var pos = this.props.getPos();
|
|
362
|
+
if (Number.isNaN(pos) || typeof pos !== 'number') {
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
return pos;
|
|
366
|
+
}
|
|
367
|
+
}, {
|
|
368
|
+
key: "$pos",
|
|
369
|
+
get: function get() {
|
|
370
|
+
var pos = this.pos;
|
|
371
|
+
// need to pass view because we may not get updated props in time
|
|
372
|
+
return pos && this.props.view.state.doc.resolve(pos);
|
|
373
|
+
}
|
|
433
374
|
}, {
|
|
434
375
|
key: "aspectRatio",
|
|
435
376
|
get: function get() {
|
|
436
|
-
var _this$
|
|
437
|
-
width = _this$
|
|
438
|
-
height = _this$
|
|
377
|
+
var _this$props6 = this.props,
|
|
378
|
+
width = _this$props6.width,
|
|
379
|
+
height = _this$props6.height;
|
|
439
380
|
if (width) {
|
|
440
381
|
return width / height;
|
|
441
382
|
}
|
|
383
|
+
|
|
442
384
|
// TODO handle this case
|
|
443
385
|
return 1;
|
|
444
386
|
}
|
|
387
|
+
}, {
|
|
388
|
+
key: "insideInlineLike",
|
|
389
|
+
get: function get() {
|
|
390
|
+
var $pos = this.$pos;
|
|
391
|
+
if (!$pos) {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
var listItem = this.props.view.state.schema.nodes.listItem;
|
|
395
|
+
return !!(0, _utils.findParentNodeOfTypeClosestToPos)($pos, [listItem]);
|
|
396
|
+
}
|
|
397
|
+
}, {
|
|
398
|
+
key: "insideLayout",
|
|
399
|
+
get: function get() {
|
|
400
|
+
var $pos = this.$pos;
|
|
401
|
+
if (!$pos) {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
var layoutColumn = this.props.view.state.schema.nodes.layoutColumn;
|
|
405
|
+
return !!(0, _utils.findParentNodeOfTypeClosestToPos)($pos, [layoutColumn]);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// check if is inside of layout, table, expand, nestedExpand and list item
|
|
409
|
+
}, {
|
|
410
|
+
key: "isNestedNode",
|
|
411
|
+
value: function isNestedNode() {
|
|
412
|
+
var $pos = this.$pos;
|
|
413
|
+
return !!($pos && $pos.parent.type !== $pos.parent.type.schema.nodes.doc);
|
|
414
|
+
}
|
|
415
|
+
}, {
|
|
416
|
+
key: "getDefaultGuidelines",
|
|
417
|
+
value: function getDefaultGuidelines() {
|
|
418
|
+
var _this$props7 = this.props,
|
|
419
|
+
lineLength = _this$props7.lineLength,
|
|
420
|
+
containerWidth = _this$props7.containerWidth,
|
|
421
|
+
fullWidthMode = _this$props7.fullWidthMode;
|
|
422
|
+
|
|
423
|
+
// disable guidelines for nested media single node
|
|
424
|
+
return this.isNestedNode() ? [] : (0, _guideline.generateDefaultGuidelines)(lineLength, containerWidth, fullWidthMode);
|
|
425
|
+
}
|
|
445
426
|
}, {
|
|
446
427
|
key: "checkVideoFile",
|
|
447
428
|
value: function () {
|
|
@@ -496,63 +477,19 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
496
477
|
}
|
|
497
478
|
return checkVideoFile;
|
|
498
479
|
}()
|
|
499
|
-
}, {
|
|
500
|
-
key: "$pos",
|
|
501
|
-
get: function get() {
|
|
502
|
-
if (typeof this.props.getPos !== 'function') {
|
|
503
|
-
return null;
|
|
504
|
-
}
|
|
505
|
-
var pos = this.props.getPos();
|
|
506
|
-
if (Number.isNaN(pos) || typeof pos !== 'number') {
|
|
507
|
-
return null;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
// need to pass view because we may not get updated props in time
|
|
511
|
-
return this.props.view.state.doc.resolve(pos);
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* The maxmimum number of grid columns this node can resize to.
|
|
516
|
-
*/
|
|
517
|
-
}, {
|
|
518
|
-
key: "gridWidth",
|
|
519
|
-
get: function get() {
|
|
520
|
-
var gridSize = this.props.gridSize;
|
|
521
|
-
return !(this.wrappedLayout || this.insideInlineLike) ? gridSize / 2 : gridSize;
|
|
522
|
-
}
|
|
523
|
-
}, {
|
|
524
|
-
key: "insideInlineLike",
|
|
525
|
-
get: function get() {
|
|
526
|
-
var $pos = this.$pos;
|
|
527
|
-
if (!$pos) {
|
|
528
|
-
return false;
|
|
529
|
-
}
|
|
530
|
-
var listItem = this.props.view.state.schema.nodes.listItem;
|
|
531
|
-
return !!(0, _utils.findParentNodeOfTypeClosestToPos)($pos, [listItem]);
|
|
532
|
-
}
|
|
533
|
-
}, {
|
|
534
|
-
key: "insideLayout",
|
|
535
|
-
get: function get() {
|
|
536
|
-
var $pos = this.$pos;
|
|
537
|
-
if (!$pos) {
|
|
538
|
-
return false;
|
|
539
|
-
}
|
|
540
|
-
var layoutColumn = this.props.view.state.schema.nodes.layoutColumn;
|
|
541
|
-
return !!(0, _utils.findParentNodeOfTypeClosestToPos)($pos, [layoutColumn]);
|
|
542
|
-
}
|
|
543
480
|
}, {
|
|
544
481
|
key: "render",
|
|
545
482
|
value: function render() {
|
|
546
483
|
var _this3 = this;
|
|
547
|
-
var _this$
|
|
548
|
-
origWidth = _this$
|
|
549
|
-
layout = _this$
|
|
550
|
-
pctWidth = _this$
|
|
551
|
-
containerWidth = _this$
|
|
552
|
-
fullWidthMode = _this$
|
|
553
|
-
selected = _this$
|
|
554
|
-
children = _this$
|
|
555
|
-
lineLength = _this$
|
|
484
|
+
var _this$props8 = this.props,
|
|
485
|
+
origWidth = _this$props8.width,
|
|
486
|
+
layout = _this$props8.layout,
|
|
487
|
+
pctWidth = _this$props8.pctWidth,
|
|
488
|
+
containerWidth = _this$props8.containerWidth,
|
|
489
|
+
fullWidthMode = _this$props8.fullWidthMode,
|
|
490
|
+
selected = _this$props8.selected,
|
|
491
|
+
children = _this$props8.children,
|
|
492
|
+
lineLength = _this$props8.lineLength;
|
|
556
493
|
var _this$state = this.state,
|
|
557
494
|
isResizing = _this$state.isResizing,
|
|
558
495
|
size = _this$state.size;
|
package/dist/cjs/use-preset.js
CHANGED
|
@@ -27,7 +27,7 @@ var _context = require("./presets/context");
|
|
|
27
27
|
* , []);
|
|
28
28
|
*
|
|
29
29
|
* // Can execute typesafe commands based on plugin1 or 2
|
|
30
|
-
* const runCommand = () => editorApi.
|
|
30
|
+
* const runCommand = () => editorApi.dependencies.core.actions.execute(
|
|
31
31
|
* editorApi.dependencies.plugin1.commands.doSomething()
|
|
32
32
|
* )
|
|
33
33
|
* return (
|
|
@@ -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.
|
|
9
|
+
var version = "187.27.1";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
@@ -151,14 +151,14 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
151
151
|
}
|
|
152
152
|
});
|
|
153
153
|
_defineProperty(this, "toggleLinkPanel", inputMethod => {
|
|
154
|
-
var _pluginInjectionApi$
|
|
154
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3;
|
|
155
155
|
const {
|
|
156
156
|
pluginInjectionApi
|
|
157
157
|
} = this.props;
|
|
158
|
-
return (_pluginInjectionApi$
|
|
158
|
+
return (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : (_pluginInjectionApi$d3 = _pluginInjectionApi$d2.hyperlink) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.commands.showLinkToolbar(inputMethod))) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : false;
|
|
159
159
|
});
|
|
160
160
|
_defineProperty(this, "insertMention", inputMethod => {
|
|
161
|
-
var _pluginInjectionApi$
|
|
161
|
+
var _pluginInjectionApi$d4;
|
|
162
162
|
const {
|
|
163
163
|
editorView,
|
|
164
164
|
pluginInjectionApi
|
|
@@ -166,7 +166,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
166
166
|
if (!editorView) {
|
|
167
167
|
return true;
|
|
168
168
|
}
|
|
169
|
-
const pluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
169
|
+
const pluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies.mention) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.sharedState.currentState();
|
|
170
170
|
if (pluginState && pluginState.canInsertMention === false) {
|
|
171
171
|
return false;
|
|
172
172
|
}
|
|
@@ -174,7 +174,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
174
174
|
return true;
|
|
175
175
|
});
|
|
176
176
|
_defineProperty(this, "insertTable", inputMethod => {
|
|
177
|
-
var _pluginInjectionApi$
|
|
177
|
+
var _pluginInjectionApi$d5, _pluginInjectionApi$d6, _pluginInjectionApi$d7, _pluginInjectionApi$d8;
|
|
178
178
|
const {
|
|
179
179
|
pluginInjectionApi,
|
|
180
180
|
editorView
|
|
@@ -183,7 +183,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
183
183
|
state,
|
|
184
184
|
dispatch
|
|
185
185
|
} = editorView;
|
|
186
|
-
return (_pluginInjectionApi$
|
|
186
|
+
return (_pluginInjectionApi$d5 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies.table) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : (_pluginInjectionApi$d7 = (_pluginInjectionApi$d8 = _pluginInjectionApi$d6.actions).insertTable) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : _pluginInjectionApi$d7.call(_pluginInjectionApi$d8, {
|
|
187
187
|
action: ACTION.INSERTED,
|
|
188
188
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
189
189
|
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
@@ -191,7 +191,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
191
191
|
inputMethod
|
|
192
192
|
},
|
|
193
193
|
eventType: EVENT_TYPE.TRACK
|
|
194
|
-
})(state, dispatch)) !== null && _pluginInjectionApi$
|
|
194
|
+
})(state, dispatch)) !== null && _pluginInjectionApi$d5 !== void 0 ? _pluginInjectionApi$d5 : false;
|
|
195
195
|
});
|
|
196
196
|
_defineProperty(this, "createDate", inputMethod => {
|
|
197
197
|
const {
|
|
@@ -282,12 +282,12 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
282
282
|
return true;
|
|
283
283
|
});
|
|
284
284
|
_defineProperty(this, "handleSelectedEmoji", emojiId => {
|
|
285
|
-
var _pluginInjectionApi$
|
|
285
|
+
var _pluginInjectionApi$d9;
|
|
286
286
|
const {
|
|
287
287
|
pluginInjectionApi
|
|
288
288
|
} = this.props;
|
|
289
289
|
this.props.editorView.focus();
|
|
290
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
290
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.core.actions.execute((_pluginInjectionApi$d9 = pluginInjectionApi.dependencies.emoji) === null || _pluginInjectionApi$d9 === void 0 ? void 0 : _pluginInjectionApi$d9.commands.insertEmoji(emojiId, INPUT_METHOD.PICKER));
|
|
291
291
|
this.toggleEmojiPicker();
|
|
292
292
|
return true;
|
|
293
293
|
});
|