@atlaskit/editor-core 187.38.2 → 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 +16 -0
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/media/index.js +2 -2
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -3
- package/dist/cjs/plugins/media/pm-plugins/main.js +11 -12
- package/dist/cjs/plugins/media/toolbar/linking.js +4 -2
- 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/labs/next/presets/default.js +1 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/media/index.js +2 -2
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/main.js +11 -12
- package/dist/es2019/plugins/media/toolbar/linking.js +4 -2
- 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/labs/next/presets/default.js +1 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/media/index.js +2 -2
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +2 -3
- package/dist/esm/plugins/media/pm-plugins/main.js +11 -12
- package/dist/esm/plugins/media/toolbar/linking.js +4 -2
- 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/labs/next/presets/default.d.ts +1 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/media/commands/linking.d.ts +2 -2
- package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
- package/dist/types/plugins/media/picker-facade.d.ts +4 -4
- package/dist/types/plugins/media/pm-plugins/alt-text/commands.d.ts +1 -1
- package/dist/types/plugins/media/pm-plugins/alt-text/keymap.d.ts +1 -1
- package/dist/types/plugins/media/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +4 -4
- package/dist/types/plugins/media/toolbar/alt-text.d.ts +1 -1
- package/dist/types/plugins/media/toolbar/commands.d.ts +4 -4
- package/dist/types/plugins/media/ui/MediaPicker/BrowserWrapper.d.ts +2 -2
- package/dist/types/plugins/media/ui/MediaPicker/DropzoneWrapper.d.ts +3 -3
- package/dist/types/plugins/media/ui/MediaPicker/PickerFacadeProvider.d.ts +3 -3
- 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/plugins/media/utils/media-files.d.ts +2 -2
- package/dist/types/plugins/media/utils/media-single.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +1 -1
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/media/commands/linking.d.ts +2 -2
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/picker-facade.d.ts +4 -4
- package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/commands.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/keymap.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/pm-plugins/main.d.ts +4 -4
- package/dist/types-ts4.5/plugins/media/toolbar/alt-text.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/toolbar/commands.d.ts +4 -4
- package/dist/types-ts4.5/plugins/media/ui/MediaPicker/BrowserWrapper.d.ts +2 -2
- package/dist/types-ts4.5/plugins/media/ui/MediaPicker/DropzoneWrapper.d.ts +3 -3
- package/dist/types-ts4.5/plugins/media/ui/MediaPicker/PickerFacadeProvider.d.ts +3 -3
- 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/dist/types-ts4.5/plugins/media/utils/media-files.d.ts +2 -2
- package/dist/types-ts4.5/plugins/media/utils/media-single.d.ts +1 -1
- package/package.json +7 -6
- package/report.api.md +7 -14
- package/tmp/api-report-tmp.d.ts +7 -14
- package/dist/cjs/plugins/placeholder/index.js +0 -135
- package/dist/es2019/plugins/placeholder/index.js +0 -123
- package/dist/esm/plugins/placeholder/index.js +0 -124
- package/dist/types/plugins/placeholder/index.d.ts +0 -22
- package/dist/types-ts4.5/plugins/placeholder/index.d.ts +0 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
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
|
+
|
|
11
|
+
## 187.38.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`1b66c23221e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1b66c23221e) - Fix missing analytics parameter in media plugin.
|
|
16
|
+
- [`da2d3589ba4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/da2d3589ba4) - Extract placeholder plugin from editor-core to "@atlaskit/editor-plugin-placeholder"
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 187.38.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -24,7 +24,7 @@ var _floatingToolbar = _interopRequireDefault(require("../../../plugins/floating
|
|
|
24
24
|
var _clipboard = _interopRequireDefault(require("../../../plugins/clipboard"));
|
|
25
25
|
var _plugins = require("../../../plugins");
|
|
26
26
|
var _editorPluginAnalytics = require("@atlaskit/editor-plugin-analytics");
|
|
27
|
-
var
|
|
27
|
+
var _editorPluginPlaceholder = require("@atlaskit/editor-plugin-placeholder");
|
|
28
28
|
var _annotation = _interopRequireDefault(require("../../../plugins/annotation"));
|
|
29
29
|
var _editorPluginComposition = require("@atlaskit/editor-plugin-composition");
|
|
30
30
|
var _quickInsert = _interopRequireDefault(require("../../../plugins/quick-insert"));
|
|
@@ -76,7 +76,7 @@ function createDefaultPreset(options) {
|
|
|
76
76
|
return builder;
|
|
77
77
|
}).add([_editorPluginHyperlink.hyperlinkPlugin, options.hyperlinkOptions]).add([_editorPluginTextFormatting.textFormattingPlugin, options.textFormatting]).add(_editorPluginWidth.widthPlugin).add([_quickInsert.default, options.quickInsert]).add([_typeAhead.default, options.typeAhead || {
|
|
78
78
|
createAnalyticsEvent: options.createAnalyticsEvent
|
|
79
|
-
}]).add([
|
|
79
|
+
}]).add([_editorPluginPlaceholder.placeholderPlugin, options.placeholder]).add(_editorPluginUnsupportedContent.unsupportedContentPlugin).add(_editorPluginEditorDisabled.editorDisabledPlugin).add([_submitEditor.default, options.submitEditor]).add(_fakeTextCursor.default).add(_floatingToolbar.default).add([_selection.default, options.selection]).add([_codeBlock.default, options.codeBlock || {
|
|
80
80
|
appearance: 'full-page'
|
|
81
81
|
}]);
|
|
82
82
|
return preset;
|
|
@@ -257,12 +257,6 @@ Object.defineProperty(exports, "pastePlugin", {
|
|
|
257
257
|
return _paste.default;
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
|
-
Object.defineProperty(exports, "placeholderPlugin", {
|
|
261
|
-
enumerable: true,
|
|
262
|
-
get: function get() {
|
|
263
|
-
return _placeholder.default;
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
260
|
Object.defineProperty(exports, "placeholderTextPlugin", {
|
|
267
261
|
enumerable: true,
|
|
268
262
|
get: function get() {
|
|
@@ -361,7 +355,6 @@ var _media = _interopRequireDefault(require("./media"));
|
|
|
361
355
|
var _mentions = _interopRequireDefault(require("./mentions"));
|
|
362
356
|
var _panel = _interopRequireDefault(require("./panel"));
|
|
363
357
|
var _paste = _interopRequireDefault(require("./paste"));
|
|
364
|
-
var _placeholder = _interopRequireDefault(require("./placeholder"));
|
|
365
358
|
var _placeholderText = _interopRequireDefault(require("./placeholder-text"));
|
|
366
359
|
var _quickInsert = _interopRequireDefault(require("./quick-insert"));
|
|
367
360
|
var _saveOnEnter = _interopRequireDefault(require("./save-on-enter"));
|
|
@@ -110,7 +110,7 @@ var mediaPlugin = function mediaPlugin(_ref) {
|
|
|
110
110
|
providerFactory: providerFactory,
|
|
111
111
|
nodeViews: {
|
|
112
112
|
mediaGroup: (0, _mediaGroup.ReactMediaGroupNode)(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
113
|
-
mediaSingle: (0, _mediaSingle.ReactMediaSingleNode)(portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent, options
|
|
113
|
+
mediaSingle: (0, _mediaSingle.ReactMediaSingleNode)(portalProviderAPI, eventDispatcher, providerFactory, api, dispatchAnalyticsEvent, options),
|
|
114
114
|
media: (0, _mediaNodeView.ReactMediaNode)(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
115
115
|
mediaInline: (0, _mediaInline.ReactMediaInlineNode)(portalProviderAPI, eventDispatcher, providerFactory, api)
|
|
116
116
|
},
|
|
@@ -120,7 +120,7 @@ var mediaPlugin = function mediaPlugin(_ref) {
|
|
|
120
120
|
customDropzoneContainer: options && options.customDropzoneContainer,
|
|
121
121
|
customMediaPicker: options && options.customMediaPicker,
|
|
122
122
|
allowResizing: !!(options && options.allowResizing)
|
|
123
|
-
}, reactContext, getIntl, dispatch, options, featureFlags.newInsertionBehaviour
|
|
123
|
+
}, reactContext, getIntl, api, dispatch, options, featureFlags.newInsertionBehaviour);
|
|
124
124
|
}
|
|
125
125
|
}, {
|
|
126
126
|
name: 'mediaKeymap',
|
|
@@ -607,9 +607,8 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
607
607
|
}]);
|
|
608
608
|
return MediaSingleNodeView;
|
|
609
609
|
}(_reactNodeView.default);
|
|
610
|
-
var ReactMediaSingleNode = function ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent) {
|
|
611
|
-
var mediaOptions = arguments.length >
|
|
612
|
-
var pluginInjectionApi = arguments.length > 5 ? arguments[5] : undefined;
|
|
610
|
+
var ReactMediaSingleNode = function ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, pluginInjectionApi, dispatchAnalyticsEvent) {
|
|
611
|
+
var mediaOptions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
613
612
|
return function (node, view, getPos) {
|
|
614
613
|
var hasIntlContext = true;
|
|
615
614
|
return new MediaSingleNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
@@ -72,7 +72,7 @@ var createDropPlaceholder = function createDropPlaceholder(intl, allowDropLine)
|
|
|
72
72
|
};
|
|
73
73
|
var MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
|
|
74
74
|
var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
75
|
-
function MediaPluginStateImplementation(_state, options, mediaOptions, newInsertionBehaviour, _dispatch,
|
|
75
|
+
function MediaPluginStateImplementation(_state, options, mediaOptions, newInsertionBehaviour, _dispatch, pluginInjectionApi) {
|
|
76
76
|
var _this = this;
|
|
77
77
|
(0, _classCallCheck2.default)(this, MediaPluginStateImplementation);
|
|
78
78
|
(0, _defineProperty2.default)(this, "allowsUploads", false);
|
|
@@ -225,9 +225,10 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
225
225
|
*
|
|
226
226
|
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
227
227
|
*/
|
|
228
|
-
(0, _defineProperty2.default)(this, "insertFile", function (mediaState, onMediaStateChanged, pickerType
|
|
229
|
-
var _mediaState$collectio, _this$mediaOptions2;
|
|
228
|
+
(0, _defineProperty2.default)(this, "insertFile", function (mediaState, onMediaStateChanged, pickerType) {
|
|
229
|
+
var _this$pluginInjection, _this$pluginInjection2, _mediaState$collectio, _this$mediaOptions2;
|
|
230
230
|
var state = _this.view.state;
|
|
231
|
+
var editorAnalyticsAPI = (_this$pluginInjection = _this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : (_this$pluginInjection2 = _this$pluginInjection.analytics) === null || _this$pluginInjection2 === void 0 ? void 0 : _this$pluginInjection2.actions;
|
|
231
232
|
var mediaStateWithContext = _objectSpread(_objectSpread({}, mediaState), {}, {
|
|
232
233
|
contextId: _this.contextIdentifierProvider ? _this.contextIdentifierProvider.objectId : undefined
|
|
233
234
|
});
|
|
@@ -243,16 +244,14 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
243
244
|
});
|
|
244
245
|
}
|
|
245
246
|
if ((0, _mediaSingle.isMediaSingle)(state.schema, mediaStateWithContext.fileMimeType)) {
|
|
246
|
-
var _this$
|
|
247
|
+
var _this$pluginInjection3;
|
|
247
248
|
// read width state right before inserting to get up-to-date and define values
|
|
248
|
-
var widthPluginState = (_this$
|
|
249
|
-
(0, _mediaSingle.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, _this.newInsertionBehaviour, widthPluginState,
|
|
249
|
+
var widthPluginState = (_this$pluginInjection3 = _this.pluginInjectionApi) === null || _this$pluginInjection3 === void 0 ? void 0 : _this$pluginInjection3.width.sharedState.currentState();
|
|
250
|
+
(0, _mediaSingle.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, _this.newInsertionBehaviour, widthPluginState, editorAnalyticsAPI);
|
|
250
251
|
} else if ((0, _mediaCommon2.getMediaFeatureFlag)('mediaInline', (_this$mediaOptions2 = _this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags) && !(0, _document.isInEmptyLine)(state) && (!(0, _mediaCommon.isInsidePotentialEmptyParagraph)(state) || (0, _utils3.isInListItem)(state)) && (0, _mediaFiles.canInsertMediaInline)(state)) {
|
|
251
|
-
|
|
252
|
-
(0, _mediaFiles.insertMediaInlineNode)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(_this.view, mediaStateWithContext, collection, _this.getInputMethod(pickerType));
|
|
252
|
+
(0, _mediaFiles.insertMediaInlineNode)(editorAnalyticsAPI)(_this.view, mediaStateWithContext, collection, _this.getInputMethod(pickerType));
|
|
253
253
|
} else {
|
|
254
|
-
|
|
255
|
-
(0, _mediaFiles.insertMediaGroupNode)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType));
|
|
254
|
+
(0, _mediaFiles.insertMediaGroupNode)(editorAnalyticsAPI)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType));
|
|
256
255
|
}
|
|
257
256
|
|
|
258
257
|
// do events when media state changes
|
|
@@ -489,7 +488,7 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
489
488
|
this.mediaOptions = mediaOptions;
|
|
490
489
|
this.newInsertionBehaviour = newInsertionBehaviour;
|
|
491
490
|
this.dispatch = _dispatch;
|
|
492
|
-
this.pluginInjectionApi =
|
|
491
|
+
this.pluginInjectionApi = pluginInjectionApi;
|
|
493
492
|
this.waitForMediaUpload = options.waitForMediaUpload === undefined ? true : options.waitForMediaUpload;
|
|
494
493
|
var nodes = _state.schema.nodes;
|
|
495
494
|
(0, _assert.default)(nodes.media && (nodes.mediaGroup || nodes.mediaSingle), 'Editor: unable to init media plugin - media or mediaGroup/mediaSingle node absent in schema');
|
|
@@ -642,7 +641,7 @@ var getMediaPluginState = function getMediaPluginState(state) {
|
|
|
642
641
|
return _pluginKey.stateKey.getState(state);
|
|
643
642
|
};
|
|
644
643
|
exports.getMediaPluginState = getMediaPluginState;
|
|
645
|
-
var createPlugin = function createPlugin(_schema, options, reactContext, getIntl, dispatch, mediaOptions, newInsertionBehaviour
|
|
644
|
+
var createPlugin = function createPlugin(_schema, options, reactContext, getIntl, pluginInjectionApi, dispatch, mediaOptions, newInsertionBehaviour) {
|
|
646
645
|
var intl = getIntl();
|
|
647
646
|
var dropPlaceholder = createDropPlaceholder(intl, mediaOptions && mediaOptions.allowDropzoneDropLine);
|
|
648
647
|
return new _safePlugin.SafePlugin({
|
|
@@ -63,7 +63,8 @@ var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, mediaLinki
|
|
|
63
63
|
},
|
|
64
64
|
onBack: function onBack(href, meta) {
|
|
65
65
|
if (href.trim() && meta.inputMethod) {
|
|
66
|
-
|
|
66
|
+
var _pluginInjectionApi$a2;
|
|
67
|
+
(0, _linking.setUrlToMedia)(href, meta.inputMethod, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(view.state, view.dispatch, view);
|
|
67
68
|
}
|
|
68
69
|
(0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view);
|
|
69
70
|
},
|
|
@@ -79,7 +80,8 @@ var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, mediaLinki
|
|
|
79
80
|
dispatch(tr);
|
|
80
81
|
},
|
|
81
82
|
onSubmit: function onSubmit(href, meta) {
|
|
82
|
-
|
|
83
|
+
var _pluginInjectionApi$a3;
|
|
84
|
+
(0, _linking.setUrlToMedia)(href, meta.inputMethod, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(view.state, view.dispatch, view);
|
|
83
85
|
(0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view);
|
|
84
86
|
},
|
|
85
87
|
onBlur: function onBlur() {
|
|
@@ -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('.');
|
|
@@ -18,7 +18,7 @@ import floatingToolbarPlugin from '../../../plugins/floating-toolbar';
|
|
|
18
18
|
import clipboardPlugin from '../../../plugins/clipboard';
|
|
19
19
|
import { analyticsPlugin as deprecatedAnalyticsPlugin } from '../../../plugins';
|
|
20
20
|
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
21
|
-
import placeholderPlugin from '
|
|
21
|
+
import { placeholderPlugin } from '@atlaskit/editor-plugin-placeholder';
|
|
22
22
|
import annotationPlugin from '../../../plugins/annotation';
|
|
23
23
|
import { compositionPlugin } from '@atlaskit/editor-plugin-composition';
|
|
24
24
|
import quickInsertPlugin from '../../../plugins/quick-insert';
|
|
@@ -18,7 +18,6 @@ export { default as mediaPlugin } from './media';
|
|
|
18
18
|
export { default as mentionsPlugin } from './mentions';
|
|
19
19
|
export { default as panelPlugin } from './panel';
|
|
20
20
|
export { default as pastePlugin } from './paste';
|
|
21
|
-
export { default as placeholderPlugin } from './placeholder';
|
|
22
21
|
export { default as placeholderTextPlugin } from './placeholder-text';
|
|
23
22
|
export { default as quickInsertPlugin } from './quick-insert';
|
|
24
23
|
export { default as saveOnEnterPlugin } from './save-on-enter';
|
|
@@ -97,7 +97,7 @@ const mediaPlugin = ({
|
|
|
97
97
|
providerFactory,
|
|
98
98
|
nodeViews: {
|
|
99
99
|
mediaGroup: ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
100
|
-
mediaSingle: ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent, options
|
|
100
|
+
mediaSingle: ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, api, dispatchAnalyticsEvent, options),
|
|
101
101
|
media: ReactMediaNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
102
102
|
mediaInline: ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory, api)
|
|
103
103
|
},
|
|
@@ -107,7 +107,7 @@ const mediaPlugin = ({
|
|
|
107
107
|
customDropzoneContainer: options && options.customDropzoneContainer,
|
|
108
108
|
customMediaPicker: options && options.customMediaPicker,
|
|
109
109
|
allowResizing: !!(options && options.allowResizing)
|
|
110
|
-
}, reactContext, getIntl, dispatch, options, featureFlags.newInsertionBehaviour
|
|
110
|
+
}, reactContext, getIntl, api, dispatch, options, featureFlags.newInsertionBehaviour);
|
|
111
111
|
}
|
|
112
112
|
}, {
|
|
113
113
|
name: 'mediaKeymap',
|
|
@@ -490,7 +490,7 @@ class MediaSingleNodeView extends ReactNodeView {
|
|
|
490
490
|
return true;
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
export const ReactMediaSingleNode = (portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent, mediaOptions = {}
|
|
493
|
+
export const ReactMediaSingleNode = (portalProviderAPI, eventDispatcher, providerFactory, pluginInjectionApi, dispatchAnalyticsEvent, mediaOptions = {}) => (node, view, getPos) => {
|
|
494
494
|
const hasIntlContext = true;
|
|
495
495
|
return new MediaSingleNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
496
496
|
eventDispatcher,
|
|
@@ -46,7 +46,7 @@ const createDropPlaceholder = (intl, allowDropLine) => {
|
|
|
46
46
|
};
|
|
47
47
|
const MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
|
|
48
48
|
export class MediaPluginStateImplementation {
|
|
49
|
-
constructor(_state, options, mediaOptions, newInsertionBehaviour, _dispatch,
|
|
49
|
+
constructor(_state, options, mediaOptions, newInsertionBehaviour, _dispatch, pluginInjectionApi) {
|
|
50
50
|
_defineProperty(this, "allowsUploads", false);
|
|
51
51
|
_defineProperty(this, "ignoreLinks", false);
|
|
52
52
|
_defineProperty(this, "waitForMediaUpload", true);
|
|
@@ -151,11 +151,12 @@ export class MediaPluginStateImplementation {
|
|
|
151
151
|
*
|
|
152
152
|
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
153
153
|
*/
|
|
154
|
-
_defineProperty(this, "insertFile", (mediaState, onMediaStateChanged, pickerType
|
|
155
|
-
var _mediaState$collectio, _this$mediaOptions2;
|
|
154
|
+
_defineProperty(this, "insertFile", (mediaState, onMediaStateChanged, pickerType) => {
|
|
155
|
+
var _this$pluginInjection, _this$pluginInjection2, _mediaState$collectio, _this$mediaOptions2;
|
|
156
156
|
const {
|
|
157
157
|
state
|
|
158
158
|
} = this.view;
|
|
159
|
+
const editorAnalyticsAPI = (_this$pluginInjection = this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : (_this$pluginInjection2 = _this$pluginInjection.analytics) === null || _this$pluginInjection2 === void 0 ? void 0 : _this$pluginInjection2.actions;
|
|
159
160
|
const mediaStateWithContext = {
|
|
160
161
|
...mediaState,
|
|
161
162
|
contextId: this.contextIdentifierProvider ? this.contextIdentifierProvider.objectId : undefined
|
|
@@ -172,16 +173,14 @@ export class MediaPluginStateImplementation {
|
|
|
172
173
|
});
|
|
173
174
|
}
|
|
174
175
|
if (isMediaSingle(state.schema, mediaStateWithContext.fileMimeType)) {
|
|
175
|
-
var _this$
|
|
176
|
+
var _this$pluginInjection3;
|
|
176
177
|
// read width state right before inserting to get up-to-date and define values
|
|
177
|
-
const widthPluginState = (_this$
|
|
178
|
-
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert, this.newInsertionBehaviour, widthPluginState,
|
|
178
|
+
const widthPluginState = (_this$pluginInjection3 = this.pluginInjectionApi) === null || _this$pluginInjection3 === void 0 ? void 0 : _this$pluginInjection3.width.sharedState.currentState();
|
|
179
|
+
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert, this.newInsertionBehaviour, widthPluginState, editorAnalyticsAPI);
|
|
179
180
|
} else if (getMediaFeatureFlag('mediaInline', (_this$mediaOptions2 = this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInListItem(state)) && canInsertMediaInline(state)) {
|
|
180
|
-
|
|
181
|
-
insertMediaInlineNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(this.view, mediaStateWithContext, collection, this.getInputMethod(pickerType));
|
|
181
|
+
insertMediaInlineNode(editorAnalyticsAPI)(this.view, mediaStateWithContext, collection, this.getInputMethod(pickerType));
|
|
182
182
|
} else {
|
|
183
|
-
|
|
184
|
-
insertMediaGroupNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(this.view, [mediaStateWithContext], collection, this.getInputMethod(pickerType));
|
|
183
|
+
insertMediaGroupNode(editorAnalyticsAPI)(this.view, [mediaStateWithContext], collection, this.getInputMethod(pickerType));
|
|
185
184
|
}
|
|
186
185
|
|
|
187
186
|
// do events when media state changes
|
|
@@ -417,7 +416,7 @@ export class MediaPluginStateImplementation {
|
|
|
417
416
|
this.mediaOptions = mediaOptions;
|
|
418
417
|
this.newInsertionBehaviour = newInsertionBehaviour;
|
|
419
418
|
this.dispatch = _dispatch;
|
|
420
|
-
this.pluginInjectionApi =
|
|
419
|
+
this.pluginInjectionApi = pluginInjectionApi;
|
|
421
420
|
this.waitForMediaUpload = options.waitForMediaUpload === undefined ? true : options.waitForMediaUpload;
|
|
422
421
|
const {
|
|
423
422
|
nodes
|
|
@@ -525,7 +524,7 @@ export class MediaPluginStateImplementation {
|
|
|
525
524
|
}
|
|
526
525
|
}
|
|
527
526
|
export const getMediaPluginState = state => stateKey.getState(state);
|
|
528
|
-
export const createPlugin = (_schema, options, reactContext, getIntl, dispatch, mediaOptions, newInsertionBehaviour
|
|
527
|
+
export const createPlugin = (_schema, options, reactContext, getIntl, pluginInjectionApi, dispatch, mediaOptions, newInsertionBehaviour) => {
|
|
529
528
|
const intl = getIntl();
|
|
530
529
|
const dropPlaceholder = createDropPlaceholder(intl, mediaOptions && mediaOptions.allowDropzoneDropLine);
|
|
531
530
|
return new SafePlugin({
|
|
@@ -61,7 +61,8 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
|
|
|
61
61
|
},
|
|
62
62
|
onBack: (href, meta) => {
|
|
63
63
|
if (href.trim() && meta.inputMethod) {
|
|
64
|
-
|
|
64
|
+
var _pluginInjectionApi$a2;
|
|
65
|
+
setUrlToMedia(href, meta.inputMethod, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(view.state, view.dispatch, view);
|
|
65
66
|
}
|
|
66
67
|
hideLinkingToolbar(view.state, view.dispatch, view);
|
|
67
68
|
},
|
|
@@ -81,7 +82,8 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
|
|
|
81
82
|
dispatch(tr);
|
|
82
83
|
},
|
|
83
84
|
onSubmit: (href, meta) => {
|
|
84
|
-
|
|
85
|
+
var _pluginInjectionApi$a3;
|
|
86
|
+
setUrlToMedia(href, meta.inputMethod, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(view.state, view.dispatch, view);
|
|
85
87
|
hideLinkingToolbar(view.state, view.dispatch, view);
|
|
86
88
|
},
|
|
87
89
|
onBlur: () => {
|
|
@@ -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
|
}
|