@atlaskit/editor-plugin-media 23.0.2 → 23.0.4
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
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 23.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1b3056181e6ac`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1b3056181e6ac) -
|
|
8
|
+
Revert EDITOR-9164 (`platform_editor_reduce_forced_layout` `ignoreMutation` change in the media
|
|
9
|
+
single node view). Its optional chaining in a class-field initializer made Babel's
|
|
10
|
+
optional-chaining transform hoist temp variables above the `@jsx jsx` pragma, so the `jsx` import
|
|
11
|
+
from `@emotion/react` was stripped and inserting images threw `ReferenceError: jsx is not defined`
|
|
12
|
+
in Help Center.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 23.0.3
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 23.0.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -20,7 +20,6 @@ var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/rea
|
|
|
20
20
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
21
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
22
22
|
var _contentVisibility = require("@atlaskit/editor-common/utils/content-visibility");
|
|
23
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
24
23
|
var _main = require("../pm-plugins/main");
|
|
25
24
|
var _MediaSSRReactContextsProvider = require("../ui/MediaSSRReactContextsProvider");
|
|
26
25
|
var _mediaSingleNext = require("./mediaSingleNext");
|
|
@@ -99,7 +98,6 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref) {
|
|
|
99
98
|
};
|
|
100
99
|
var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
101
100
|
function MediaSingleNodeView() {
|
|
102
|
-
var _this$reactComponentP, _this$reactComponentP2;
|
|
103
101
|
var _this;
|
|
104
102
|
(0, _classCallCheck2.default)(this, MediaSingleNodeView);
|
|
105
103
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -133,29 +131,20 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
133
131
|
_this.checkAndUpdateSelectionType();
|
|
134
132
|
return _this.selectionType !== null;
|
|
135
133
|
});
|
|
136
|
-
/**
|
|
137
|
-
* Only the percentage-based `ResizableMediaSingle` reads `offsetLeft`, to offset the resize grid
|
|
138
|
-
* for an image indented in a list. Resolved once: `ignoreMutation` is far too hot for a per-call
|
|
139
|
-
* experiment lookup.
|
|
140
|
-
*
|
|
141
|
-
* We can remove skipsOffsetLeftRead and always return true ignoreMutation,
|
|
142
|
-
* Once we removed the legacy media resizer.
|
|
143
|
-
*/
|
|
144
|
-
(0, _defineProperty2.default)(_this, "skipsOffsetLeftRead", (Boolean((_this$reactComponentP = _this.reactComponentProps.mediaOptions) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.allowPixelResizing) || !((_this$reactComponentP2 = _this.reactComponentProps.mediaOptions) !== null && _this$reactComponentP2 !== void 0 && _this$reactComponentP2.allowResizing)) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_forced_layout'));
|
|
145
134
|
return _this;
|
|
146
135
|
}
|
|
147
136
|
(0, _inherits2.default)(MediaSingleNodeView, _ReactNodeView);
|
|
148
137
|
return (0, _createClass2.default)(MediaSingleNodeView, [{
|
|
149
138
|
key: "createDomRef",
|
|
150
139
|
value: function createDomRef() {
|
|
151
|
-
var _this$
|
|
140
|
+
var _this$reactComponentP, _this$reactComponentP2;
|
|
152
141
|
var domRef = document.createElement('div');
|
|
153
142
|
|
|
154
143
|
// control the domRef contentEditable attribute based on the editor view mode
|
|
155
144
|
this.unsubscribeToViewModeChange = this.subscribeToViewModeChange(domRef);
|
|
156
|
-
var initialViewMode = (_this$
|
|
145
|
+
var initialViewMode = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.sharedState.currentState()) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.mode;
|
|
157
146
|
this.updateDomRefContentEditable(domRef, initialViewMode);
|
|
158
|
-
if ((_this$
|
|
147
|
+
if ((_this$reactComponentP2 = this.reactComponentProps.mediaOptions) !== null && _this$reactComponentP2 !== void 0 && _this$reactComponentP2.allowPixelResizing) {
|
|
159
148
|
domRef.classList.add('media-extended-resize-experience');
|
|
160
149
|
}
|
|
161
150
|
domRef.setAttribute('data-media-vc-wrapper', 'true');
|
|
@@ -216,9 +205,9 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
216
205
|
}, {
|
|
217
206
|
key: "subscribeToViewModeChange",
|
|
218
207
|
value: function subscribeToViewModeChange(domRef) {
|
|
219
|
-
var _this$
|
|
208
|
+
var _this$reactComponentP3,
|
|
220
209
|
_this3 = this;
|
|
221
|
-
return (_this$
|
|
210
|
+
return (_this$reactComponentP3 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP3 === void 0 || (_this$reactComponentP3 = _this$reactComponentP3.editorViewMode) === null || _this$reactComponentP3 === void 0 ? void 0 : _this$reactComponentP3.sharedState.onChange(function (viewModeState) {
|
|
222
211
|
var _viewModeState$nextSh;
|
|
223
212
|
_this3.updateDomRefContentEditable(domRef, (_viewModeState$nextSh = viewModeState.nextSharedState) === null || _viewModeState$nextSh === void 0 ? void 0 : _viewModeState$nextSh.mode);
|
|
224
213
|
});
|
|
@@ -226,7 +215,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
226
215
|
}, {
|
|
227
216
|
key: "updateDomRefContentEditable",
|
|
228
217
|
value: function updateDomRefContentEditable(domRef, editorViewMode) {
|
|
229
|
-
var _this$
|
|
218
|
+
var _this$reactComponentP4;
|
|
230
219
|
// if the editor is in view mode, we should not allow editing
|
|
231
220
|
if (editorViewMode === 'view') {
|
|
232
221
|
domRef.contentEditable = 'false';
|
|
@@ -234,7 +223,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
234
223
|
}
|
|
235
224
|
|
|
236
225
|
// if the editor is in edit mode, we should allow editing if the media options allow it
|
|
237
|
-
if ((_this$
|
|
226
|
+
if ((_this$reactComponentP4 = this.reactComponentProps.mediaOptions) !== null && _this$reactComponentP4 !== void 0 && _this$reactComponentP4.allowMediaSingleEditable) {
|
|
238
227
|
// workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
|
|
239
228
|
// see also: https://github.com/ProseMirror/prosemirror/issues/884
|
|
240
229
|
domRef.contentEditable = 'true';
|
|
@@ -283,15 +272,15 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
283
272
|
key: "render",
|
|
284
273
|
value: function render(props, forwardRef) {
|
|
285
274
|
var _this5 = this;
|
|
286
|
-
var _this$
|
|
287
|
-
eventDispatcher = _this$
|
|
288
|
-
fullWidthMode = _this$
|
|
289
|
-
providerFactory = _this$
|
|
290
|
-
mediaOptions = _this$
|
|
291
|
-
dispatchAnalyticsEvent = _this$
|
|
292
|
-
pluginInjectionApi = _this$
|
|
293
|
-
editorAppearance = _this$
|
|
294
|
-
intl = _this$
|
|
275
|
+
var _this$reactComponentP5 = this.reactComponentProps,
|
|
276
|
+
eventDispatcher = _this$reactComponentP5.eventDispatcher,
|
|
277
|
+
fullWidthMode = _this$reactComponentP5.fullWidthMode,
|
|
278
|
+
providerFactory = _this$reactComponentP5.providerFactory,
|
|
279
|
+
mediaOptions = _this$reactComponentP5.mediaOptions,
|
|
280
|
+
dispatchAnalyticsEvent = _this$reactComponentP5.dispatchAnalyticsEvent,
|
|
281
|
+
pluginInjectionApi = _this$reactComponentP5.pluginInjectionApi,
|
|
282
|
+
editorAppearance = _this$reactComponentP5.editorAppearance,
|
|
283
|
+
intl = _this$reactComponentP5.intl;
|
|
295
284
|
// getPos is a boolean for marks, since this is a node we know it must be a function
|
|
296
285
|
var getPos = this.getPos;
|
|
297
286
|
return (0, _react2.jsx)(_MediaSSRReactContextsProvider.MediaSSRReactContextsProvider, {
|
|
@@ -331,10 +320,6 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
331
320
|
}, {
|
|
332
321
|
key: "ignoreMutation",
|
|
333
322
|
value: function ignoreMutation() {
|
|
334
|
-
if (this.skipsOffsetLeftRead) {
|
|
335
|
-
return true;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
323
|
// DOM has changed; recalculate if we need to re-render
|
|
339
324
|
if (this.dom) {
|
|
340
325
|
// Ignored via go/ees005
|
|
@@ -15,7 +15,6 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
|
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
16
16
|
import { isNodeSelectedOrInRange } from '@atlaskit/editor-common/utils';
|
|
17
17
|
import { applyContentVisibility, estimateMediaSingleIntrinsicSize } from '@atlaskit/editor-common/utils/content-visibility';
|
|
18
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
19
18
|
import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
|
|
20
19
|
import { MediaSSRReactContextsProvider } from '../ui/MediaSSRReactContextsProvider';
|
|
21
20
|
import { MediaSingleNodeNext } from './mediaSingleNext';
|
|
@@ -84,7 +83,6 @@ const MediaSingleNodeWrapper = ({
|
|
|
84
83
|
};
|
|
85
84
|
class MediaSingleNodeView extends ReactNodeView {
|
|
86
85
|
constructor(...args) {
|
|
87
|
-
var _this$reactComponentP, _this$reactComponentP2;
|
|
88
86
|
super(...args);
|
|
89
87
|
_defineProperty(this, "lastOffsetLeft", 0);
|
|
90
88
|
_defineProperty(this, "forceViewUpdate", false);
|
|
@@ -115,25 +113,16 @@ class MediaSingleNodeView extends ReactNodeView {
|
|
|
115
113
|
this.checkAndUpdateSelectionType();
|
|
116
114
|
return this.selectionType !== null;
|
|
117
115
|
});
|
|
118
|
-
/**
|
|
119
|
-
* Only the percentage-based `ResizableMediaSingle` reads `offsetLeft`, to offset the resize grid
|
|
120
|
-
* for an image indented in a list. Resolved once: `ignoreMutation` is far too hot for a per-call
|
|
121
|
-
* experiment lookup.
|
|
122
|
-
*
|
|
123
|
-
* We can remove skipsOffsetLeftRead and always return true ignoreMutation,
|
|
124
|
-
* Once we removed the legacy media resizer.
|
|
125
|
-
*/
|
|
126
|
-
_defineProperty(this, "skipsOffsetLeftRead", (Boolean((_this$reactComponentP = this.reactComponentProps.mediaOptions) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.allowPixelResizing) || !((_this$reactComponentP2 = this.reactComponentProps.mediaOptions) !== null && _this$reactComponentP2 !== void 0 && _this$reactComponentP2.allowResizing)) && isExperimentEnabled('platform_editor_reduce_forced_layout'));
|
|
127
116
|
}
|
|
128
117
|
createDomRef() {
|
|
129
|
-
var _this$
|
|
118
|
+
var _this$reactComponentP, _this$reactComponentP2, _this$reactComponentP3, _this$reactComponentP4;
|
|
130
119
|
const domRef = document.createElement('div');
|
|
131
120
|
|
|
132
121
|
// control the domRef contentEditable attribute based on the editor view mode
|
|
133
122
|
this.unsubscribeToViewModeChange = this.subscribeToViewModeChange(domRef);
|
|
134
|
-
const initialViewMode = (_this$
|
|
123
|
+
const initialViewMode = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 ? void 0 : (_this$reactComponentP2 = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : (_this$reactComponentP3 = _this$reactComponentP2.sharedState.currentState()) === null || _this$reactComponentP3 === void 0 ? void 0 : _this$reactComponentP3.mode;
|
|
135
124
|
this.updateDomRefContentEditable(domRef, initialViewMode);
|
|
136
|
-
if ((_this$
|
|
125
|
+
if ((_this$reactComponentP4 = this.reactComponentProps.mediaOptions) !== null && _this$reactComponentP4 !== void 0 && _this$reactComponentP4.allowPixelResizing) {
|
|
137
126
|
domRef.classList.add('media-extended-resize-experience');
|
|
138
127
|
}
|
|
139
128
|
domRef.setAttribute('data-media-vc-wrapper', 'true');
|
|
@@ -185,14 +174,14 @@ class MediaSingleNodeView extends ReactNodeView {
|
|
|
185
174
|
return super.viewShouldUpdate(nextNode);
|
|
186
175
|
}
|
|
187
176
|
subscribeToViewModeChange(domRef) {
|
|
188
|
-
var _this$
|
|
189
|
-
return (_this$
|
|
177
|
+
var _this$reactComponentP5, _this$reactComponentP6;
|
|
178
|
+
return (_this$reactComponentP5 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP5 === void 0 ? void 0 : (_this$reactComponentP6 = _this$reactComponentP5.editorViewMode) === null || _this$reactComponentP6 === void 0 ? void 0 : _this$reactComponentP6.sharedState.onChange(viewModeState => {
|
|
190
179
|
var _viewModeState$nextSh;
|
|
191
180
|
this.updateDomRefContentEditable(domRef, (_viewModeState$nextSh = viewModeState.nextSharedState) === null || _viewModeState$nextSh === void 0 ? void 0 : _viewModeState$nextSh.mode);
|
|
192
181
|
});
|
|
193
182
|
}
|
|
194
183
|
updateDomRefContentEditable(domRef, editorViewMode) {
|
|
195
|
-
var _this$
|
|
184
|
+
var _this$reactComponentP7;
|
|
196
185
|
// if the editor is in view mode, we should not allow editing
|
|
197
186
|
if (editorViewMode === 'view') {
|
|
198
187
|
domRef.contentEditable = 'false';
|
|
@@ -200,7 +189,7 @@ class MediaSingleNodeView extends ReactNodeView {
|
|
|
200
189
|
}
|
|
201
190
|
|
|
202
191
|
// if the editor is in edit mode, we should allow editing if the media options allow it
|
|
203
|
-
if ((_this$
|
|
192
|
+
if ((_this$reactComponentP7 = this.reactComponentProps.mediaOptions) !== null && _this$reactComponentP7 !== void 0 && _this$reactComponentP7.allowMediaSingleEditable) {
|
|
204
193
|
// workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
|
|
205
194
|
// see also: https://github.com/ProseMirror/prosemirror/issues/884
|
|
206
195
|
domRef.contentEditable = 'true';
|
|
@@ -285,10 +274,6 @@ class MediaSingleNodeView extends ReactNodeView {
|
|
|
285
274
|
}));
|
|
286
275
|
}
|
|
287
276
|
ignoreMutation() {
|
|
288
|
-
if (this.skipsOffsetLeftRead) {
|
|
289
|
-
return true;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
277
|
// DOM has changed; recalculate if we need to re-render
|
|
293
278
|
if (this.dom) {
|
|
294
279
|
// Ignored via go/ees005
|
|
@@ -24,7 +24,6 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
|
|
|
24
24
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
25
25
|
import { isNodeSelectedOrInRange } from '@atlaskit/editor-common/utils';
|
|
26
26
|
import { applyContentVisibility, estimateMediaSingleIntrinsicSize } from '@atlaskit/editor-common/utils/content-visibility';
|
|
27
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
28
27
|
import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
|
|
29
28
|
import { MediaSSRReactContextsProvider } from '../ui/MediaSSRReactContextsProvider';
|
|
30
29
|
import { MediaSingleNodeNext } from './mediaSingleNext';
|
|
@@ -95,7 +94,6 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref) {
|
|
|
95
94
|
};
|
|
96
95
|
var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
97
96
|
function MediaSingleNodeView() {
|
|
98
|
-
var _this$reactComponentP, _this$reactComponentP2;
|
|
99
97
|
var _this;
|
|
100
98
|
_classCallCheck(this, MediaSingleNodeView);
|
|
101
99
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -129,29 +127,20 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
129
127
|
_this.checkAndUpdateSelectionType();
|
|
130
128
|
return _this.selectionType !== null;
|
|
131
129
|
});
|
|
132
|
-
/**
|
|
133
|
-
* Only the percentage-based `ResizableMediaSingle` reads `offsetLeft`, to offset the resize grid
|
|
134
|
-
* for an image indented in a list. Resolved once: `ignoreMutation` is far too hot for a per-call
|
|
135
|
-
* experiment lookup.
|
|
136
|
-
*
|
|
137
|
-
* We can remove skipsOffsetLeftRead and always return true ignoreMutation,
|
|
138
|
-
* Once we removed the legacy media resizer.
|
|
139
|
-
*/
|
|
140
|
-
_defineProperty(_this, "skipsOffsetLeftRead", (Boolean((_this$reactComponentP = _this.reactComponentProps.mediaOptions) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.allowPixelResizing) || !((_this$reactComponentP2 = _this.reactComponentProps.mediaOptions) !== null && _this$reactComponentP2 !== void 0 && _this$reactComponentP2.allowResizing)) && isExperimentEnabled('platform_editor_reduce_forced_layout'));
|
|
141
130
|
return _this;
|
|
142
131
|
}
|
|
143
132
|
_inherits(MediaSingleNodeView, _ReactNodeView);
|
|
144
133
|
return _createClass(MediaSingleNodeView, [{
|
|
145
134
|
key: "createDomRef",
|
|
146
135
|
value: function createDomRef() {
|
|
147
|
-
var _this$
|
|
136
|
+
var _this$reactComponentP, _this$reactComponentP2;
|
|
148
137
|
var domRef = document.createElement('div');
|
|
149
138
|
|
|
150
139
|
// control the domRef contentEditable attribute based on the editor view mode
|
|
151
140
|
this.unsubscribeToViewModeChange = this.subscribeToViewModeChange(domRef);
|
|
152
|
-
var initialViewMode = (_this$
|
|
141
|
+
var initialViewMode = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.sharedState.currentState()) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.mode;
|
|
153
142
|
this.updateDomRefContentEditable(domRef, initialViewMode);
|
|
154
|
-
if ((_this$
|
|
143
|
+
if ((_this$reactComponentP2 = this.reactComponentProps.mediaOptions) !== null && _this$reactComponentP2 !== void 0 && _this$reactComponentP2.allowPixelResizing) {
|
|
155
144
|
domRef.classList.add('media-extended-resize-experience');
|
|
156
145
|
}
|
|
157
146
|
domRef.setAttribute('data-media-vc-wrapper', 'true');
|
|
@@ -212,9 +201,9 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
212
201
|
}, {
|
|
213
202
|
key: "subscribeToViewModeChange",
|
|
214
203
|
value: function subscribeToViewModeChange(domRef) {
|
|
215
|
-
var _this$
|
|
204
|
+
var _this$reactComponentP3,
|
|
216
205
|
_this3 = this;
|
|
217
|
-
return (_this$
|
|
206
|
+
return (_this$reactComponentP3 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP3 === void 0 || (_this$reactComponentP3 = _this$reactComponentP3.editorViewMode) === null || _this$reactComponentP3 === void 0 ? void 0 : _this$reactComponentP3.sharedState.onChange(function (viewModeState) {
|
|
218
207
|
var _viewModeState$nextSh;
|
|
219
208
|
_this3.updateDomRefContentEditable(domRef, (_viewModeState$nextSh = viewModeState.nextSharedState) === null || _viewModeState$nextSh === void 0 ? void 0 : _viewModeState$nextSh.mode);
|
|
220
209
|
});
|
|
@@ -222,7 +211,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
222
211
|
}, {
|
|
223
212
|
key: "updateDomRefContentEditable",
|
|
224
213
|
value: function updateDomRefContentEditable(domRef, editorViewMode) {
|
|
225
|
-
var _this$
|
|
214
|
+
var _this$reactComponentP4;
|
|
226
215
|
// if the editor is in view mode, we should not allow editing
|
|
227
216
|
if (editorViewMode === 'view') {
|
|
228
217
|
domRef.contentEditable = 'false';
|
|
@@ -230,7 +219,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
230
219
|
}
|
|
231
220
|
|
|
232
221
|
// if the editor is in edit mode, we should allow editing if the media options allow it
|
|
233
|
-
if ((_this$
|
|
222
|
+
if ((_this$reactComponentP4 = this.reactComponentProps.mediaOptions) !== null && _this$reactComponentP4 !== void 0 && _this$reactComponentP4.allowMediaSingleEditable) {
|
|
234
223
|
// workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
|
|
235
224
|
// see also: https://github.com/ProseMirror/prosemirror/issues/884
|
|
236
225
|
domRef.contentEditable = 'true';
|
|
@@ -279,15 +268,15 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
279
268
|
key: "render",
|
|
280
269
|
value: function render(props, forwardRef) {
|
|
281
270
|
var _this5 = this;
|
|
282
|
-
var _this$
|
|
283
|
-
eventDispatcher = _this$
|
|
284
|
-
fullWidthMode = _this$
|
|
285
|
-
providerFactory = _this$
|
|
286
|
-
mediaOptions = _this$
|
|
287
|
-
dispatchAnalyticsEvent = _this$
|
|
288
|
-
pluginInjectionApi = _this$
|
|
289
|
-
editorAppearance = _this$
|
|
290
|
-
intl = _this$
|
|
271
|
+
var _this$reactComponentP5 = this.reactComponentProps,
|
|
272
|
+
eventDispatcher = _this$reactComponentP5.eventDispatcher,
|
|
273
|
+
fullWidthMode = _this$reactComponentP5.fullWidthMode,
|
|
274
|
+
providerFactory = _this$reactComponentP5.providerFactory,
|
|
275
|
+
mediaOptions = _this$reactComponentP5.mediaOptions,
|
|
276
|
+
dispatchAnalyticsEvent = _this$reactComponentP5.dispatchAnalyticsEvent,
|
|
277
|
+
pluginInjectionApi = _this$reactComponentP5.pluginInjectionApi,
|
|
278
|
+
editorAppearance = _this$reactComponentP5.editorAppearance,
|
|
279
|
+
intl = _this$reactComponentP5.intl;
|
|
291
280
|
// getPos is a boolean for marks, since this is a node we know it must be a function
|
|
292
281
|
var getPos = this.getPos;
|
|
293
282
|
return jsx(MediaSSRReactContextsProvider, {
|
|
@@ -327,10 +316,6 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
327
316
|
}, {
|
|
328
317
|
key: "ignoreMutation",
|
|
329
318
|
value: function ignoreMutation() {
|
|
330
|
-
if (this.skipsOffsetLeftRead) {
|
|
331
|
-
return true;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
319
|
// DOM has changed; recalculate if we need to re-render
|
|
335
320
|
if (this.dom) {
|
|
336
321
|
// Ignored via go/ees005
|
|
@@ -38,15 +38,6 @@ declare class MediaSingleNodeView extends ReactNodeView<MediaSingleNodeViewProps
|
|
|
38
38
|
stopEvent(event: Event): boolean;
|
|
39
39
|
update(node: PMNode, decorations: readonly Decoration[], _innerDecorations?: DecorationSource, isValidUpdate?: (currentNode: PMNode, newNode: PMNode) => boolean): boolean;
|
|
40
40
|
render(props: MediaSingleNodeViewProps, forwardRef?: ForwardRef): jsx.JSX.Element;
|
|
41
|
-
/**
|
|
42
|
-
* Only the percentage-based `ResizableMediaSingle` reads `offsetLeft`, to offset the resize grid
|
|
43
|
-
* for an image indented in a list. Resolved once: `ignoreMutation` is far too hot for a per-call
|
|
44
|
-
* experiment lookup.
|
|
45
|
-
*
|
|
46
|
-
* We can remove skipsOffsetLeftRead and always return true ignoreMutation,
|
|
47
|
-
* Once we removed the legacy media resizer.
|
|
48
|
-
*/
|
|
49
|
-
private readonly skipsOffsetLeftRead;
|
|
50
41
|
ignoreMutation(): boolean;
|
|
51
42
|
destroy(): void;
|
|
52
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "23.0.
|
|
3
|
+
"version": "23.0.4",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
49
49
|
"@atlaskit/form": "^18.0.0",
|
|
50
50
|
"@atlaskit/icon": "^38.0.0",
|
|
51
|
-
"@atlaskit/icon-lab": "^7.
|
|
51
|
+
"@atlaskit/icon-lab": "^7.10.0",
|
|
52
52
|
"@atlaskit/media-card": "^82.1.0",
|
|
53
53
|
"@atlaskit/media-client": "^39.0.0",
|
|
54
54
|
"@atlaskit/media-client-react": "^7.0.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
62
62
|
"@atlaskit/primitives": "^22.5.0",
|
|
63
63
|
"@atlaskit/textfield": "^10.2.0",
|
|
64
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
64
|
+
"@atlaskit/tmp-editor-statsig": "^209.0.0",
|
|
65
65
|
"@atlaskit/tokens": "^20.0.0",
|
|
66
66
|
"@atlaskit/tooltip": "^24.3.0",
|
|
67
67
|
"@babel/runtime": "^7.0.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"uuid": "^11.1.1"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@atlaskit/editor-common": "^125.
|
|
77
|
+
"@atlaskit/editor-common": "^125.4.0",
|
|
78
78
|
"@atlaskit/media-core": "^39.0.0",
|
|
79
79
|
"react": "^18.2.0 || ^19.2.0",
|
|
80
80
|
"react-dom": "^18.2.0 || ^19.2.0",
|