@atlaskit/editor-plugin-media-insert 26.0.16 → 26.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/ui/MediaInsertPicker.js +18 -8
- package/dist/cjs/ui/hooks/use-focus-editor.js +1 -1
- package/dist/es2019/ui/MediaInsertPicker.js +18 -8
- package/dist/es2019/ui/hooks/use-focus-editor.js +1 -1
- package/dist/esm/ui/MediaInsertPicker.js +18 -8
- package/dist/esm/ui/hooks/use-focus-editor.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media-insert
|
|
2
2
|
|
|
3
|
+
## 26.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6c4fbb3dc1b7f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6c4fbb3dc1b7f) -
|
|
8
|
+
[ux] Fix MediaInsertPicker not returning focus to the editor on close.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 26.0.16
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -18,6 +18,7 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
18
18
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
19
19
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
20
|
var _tabs = _interopRequireWildcard(require("@atlaskit/tabs"));
|
|
21
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
22
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
22
23
|
var _useFocusEditor = require("./hooks/use-focus-editor");
|
|
23
24
|
var _useUnholyAutofocus2 = require("./hooks/use-unholy-autofocus");
|
|
@@ -275,8 +276,10 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
275
276
|
};
|
|
276
277
|
dispatchAnalyticsEvent(payload);
|
|
277
278
|
}
|
|
278
|
-
_closeMediaInsertPicker();
|
|
279
|
-
|
|
279
|
+
_closeMediaInsertPicker(); // Focuses editor on unmount
|
|
280
|
+
if (!(0, _expValEquals.expValEquals)('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true)) {
|
|
281
|
+
focusEditor();
|
|
282
|
+
}
|
|
280
283
|
};
|
|
281
284
|
};
|
|
282
285
|
var fileTabTitle = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc_page_experiences_editor_image_generation', 'isEnabled', true) ? intl.formatMessage(_messages.mediaInsertMessages.uploadTabTitle) : intl.formatMessage(_messages.mediaInsertMessages.fileTabTitle);
|
|
@@ -290,6 +293,7 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
290
293
|
fitHeight: 390,
|
|
291
294
|
fitWidth: 340,
|
|
292
295
|
mountTo: mountPoint,
|
|
296
|
+
onUnmount: (0, _expValEquals.expValEquals)('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true) ? focusEditor : undefined,
|
|
293
297
|
boundariesElement: popupsBoundariesElement,
|
|
294
298
|
handleClickOutside: handleClose(_analytics.INPUT_METHOD.MOUSE),
|
|
295
299
|
handleEscapeKeydown: handleClose(_analytics.INPUT_METHOD.KEYBOARD),
|
|
@@ -331,8 +335,10 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
331
335
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
332
336
|
, {
|
|
333
337
|
closeMediaInsertPicker: function closeMediaInsertPicker() {
|
|
334
|
-
_closeMediaInsertPicker();
|
|
335
|
-
|
|
338
|
+
_closeMediaInsertPicker(); // Focuses editor on unmount
|
|
339
|
+
if (!(0, _expValEquals.expValEquals)('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true)) {
|
|
340
|
+
focusEditor();
|
|
341
|
+
}
|
|
336
342
|
},
|
|
337
343
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
338
344
|
insertMediaSingle: insertMediaSingle,
|
|
@@ -344,8 +350,10 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
344
350
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
345
351
|
,
|
|
346
352
|
closeMediaInsertPicker: function closeMediaInsertPicker() {
|
|
347
|
-
_closeMediaInsertPicker();
|
|
348
|
-
|
|
353
|
+
_closeMediaInsertPicker(); // Focuses editor on unmount
|
|
354
|
+
if (!(0, _expValEquals.expValEquals)('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true)) {
|
|
355
|
+
focusEditor();
|
|
356
|
+
}
|
|
349
357
|
},
|
|
350
358
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
351
359
|
insertFile: insertFile
|
|
@@ -355,8 +363,10 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
355
363
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
356
364
|
,
|
|
357
365
|
closeMediaInsertPicker: function closeMediaInsertPicker() {
|
|
358
|
-
_closeMediaInsertPicker();
|
|
359
|
-
|
|
366
|
+
_closeMediaInsertPicker(); // Focuses editor on unmount
|
|
367
|
+
if (!(0, _expValEquals.expValEquals)('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true)) {
|
|
368
|
+
focusEditor();
|
|
369
|
+
}
|
|
360
370
|
},
|
|
361
371
|
insertMediaSingle: insertMediaSingle,
|
|
362
372
|
insertExternalMediaSingle: insertExternalMediaSingle,
|
|
@@ -8,7 +8,7 @@ var _react = require("react");
|
|
|
8
8
|
var useFocusEditor = exports.useFocusEditor = function useFocusEditor(_ref) {
|
|
9
9
|
var editorView = _ref.editorView;
|
|
10
10
|
var focusEditor = (0, _react.useCallback)(function () {
|
|
11
|
-
//
|
|
11
|
+
// Use setTimeout to run this async after any DOM updates in same callback
|
|
12
12
|
setTimeout(function () {
|
|
13
13
|
return editorView.focus();
|
|
14
14
|
}, 0);
|
|
@@ -9,6 +9,7 @@ import { PlainOutsideClickTargetRefContext, Popup, withOuterListeners } from '@a
|
|
|
9
9
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { Box, Focusable, Text } from '@atlaskit/primitives/compiled';
|
|
11
11
|
import Tabs, { TabList, useTab, useTabPanel } from '@atlaskit/tabs';
|
|
12
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
13
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
13
14
|
import { useFocusEditor } from './hooks/use-focus-editor';
|
|
14
15
|
import { useUnholyAutofocus } from './hooks/use-unholy-autofocus';
|
|
@@ -260,8 +261,10 @@ export const MediaInsertPicker = ({
|
|
|
260
261
|
};
|
|
261
262
|
dispatchAnalyticsEvent(payload);
|
|
262
263
|
}
|
|
263
|
-
closeMediaInsertPicker();
|
|
264
|
-
|
|
264
|
+
closeMediaInsertPicker(); // Focuses editor on unmount
|
|
265
|
+
if (!expValEquals('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true)) {
|
|
266
|
+
focusEditor();
|
|
267
|
+
}
|
|
265
268
|
};
|
|
266
269
|
const fileTabTitle = expValEqualsNoExposure('cc_page_experiences_editor_image_generation', 'isEnabled', true) ? intl.formatMessage(mediaInsertMessages.uploadTabTitle) : intl.formatMessage(mediaInsertMessages.fileTabTitle);
|
|
267
270
|
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
@@ -274,6 +277,7 @@ export const MediaInsertPicker = ({
|
|
|
274
277
|
fitHeight: 390,
|
|
275
278
|
fitWidth: 340,
|
|
276
279
|
mountTo: mountPoint,
|
|
280
|
+
onUnmount: expValEquals('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true) ? focusEditor : undefined,
|
|
277
281
|
boundariesElement: popupsBoundariesElement,
|
|
278
282
|
handleClickOutside: handleClose(INPUT_METHOD.MOUSE),
|
|
279
283
|
handleEscapeKeydown: handleClose(INPUT_METHOD.KEYBOARD),
|
|
@@ -312,8 +316,10 @@ export const MediaInsertPicker = ({
|
|
|
312
316
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
313
317
|
, {
|
|
314
318
|
closeMediaInsertPicker: () => {
|
|
315
|
-
closeMediaInsertPicker();
|
|
316
|
-
|
|
319
|
+
closeMediaInsertPicker(); // Focuses editor on unmount
|
|
320
|
+
if (!expValEquals('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true)) {
|
|
321
|
+
focusEditor();
|
|
322
|
+
}
|
|
317
323
|
},
|
|
318
324
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
319
325
|
insertMediaSingle: insertMediaSingle,
|
|
@@ -324,8 +330,10 @@ export const MediaInsertPicker = ({
|
|
|
324
330
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
325
331
|
,
|
|
326
332
|
closeMediaInsertPicker: () => {
|
|
327
|
-
closeMediaInsertPicker();
|
|
328
|
-
|
|
333
|
+
closeMediaInsertPicker(); // Focuses editor on unmount
|
|
334
|
+
if (!expValEquals('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true)) {
|
|
335
|
+
focusEditor();
|
|
336
|
+
}
|
|
329
337
|
},
|
|
330
338
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
331
339
|
insertFile: insertFile
|
|
@@ -335,8 +343,10 @@ export const MediaInsertPicker = ({
|
|
|
335
343
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
336
344
|
,
|
|
337
345
|
closeMediaInsertPicker: () => {
|
|
338
|
-
closeMediaInsertPicker();
|
|
339
|
-
|
|
346
|
+
closeMediaInsertPicker(); // Focuses editor on unmount
|
|
347
|
+
if (!expValEquals('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true)) {
|
|
348
|
+
focusEditor();
|
|
349
|
+
}
|
|
340
350
|
},
|
|
341
351
|
insertMediaSingle: insertMediaSingle,
|
|
342
352
|
insertExternalMediaSingle: insertExternalMediaSingle,
|
|
@@ -3,7 +3,7 @@ export const useFocusEditor = ({
|
|
|
3
3
|
editorView
|
|
4
4
|
}) => {
|
|
5
5
|
const focusEditor = useCallback(() => {
|
|
6
|
-
//
|
|
6
|
+
// Use setTimeout to run this async after any DOM updates in same callback
|
|
7
7
|
setTimeout(() => editorView.focus(), 0);
|
|
8
8
|
}, [editorView]);
|
|
9
9
|
return focusEditor;
|
|
@@ -12,6 +12,7 @@ import { PlainOutsideClickTargetRefContext, Popup, withOuterListeners } from '@a
|
|
|
12
12
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
13
13
|
import { Box, Focusable, Text } from '@atlaskit/primitives/compiled';
|
|
14
14
|
import Tabs, { TabList, useTab, useTabPanel } from '@atlaskit/tabs';
|
|
15
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
16
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
16
17
|
import { useFocusEditor } from './hooks/use-focus-editor';
|
|
17
18
|
import { useUnholyAutofocus } from './hooks/use-unholy-autofocus';
|
|
@@ -266,8 +267,10 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref3) {
|
|
|
266
267
|
};
|
|
267
268
|
dispatchAnalyticsEvent(payload);
|
|
268
269
|
}
|
|
269
|
-
_closeMediaInsertPicker();
|
|
270
|
-
|
|
270
|
+
_closeMediaInsertPicker(); // Focuses editor on unmount
|
|
271
|
+
if (!expValEquals('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true)) {
|
|
272
|
+
focusEditor();
|
|
273
|
+
}
|
|
271
274
|
};
|
|
272
275
|
};
|
|
273
276
|
var fileTabTitle = expValEqualsNoExposure('cc_page_experiences_editor_image_generation', 'isEnabled', true) ? intl.formatMessage(mediaInsertMessages.uploadTabTitle) : intl.formatMessage(mediaInsertMessages.fileTabTitle);
|
|
@@ -281,6 +284,7 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref3) {
|
|
|
281
284
|
fitHeight: 390,
|
|
282
285
|
fitWidth: 340,
|
|
283
286
|
mountTo: mountPoint,
|
|
287
|
+
onUnmount: expValEquals('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true) ? focusEditor : undefined,
|
|
284
288
|
boundariesElement: popupsBoundariesElement,
|
|
285
289
|
handleClickOutside: handleClose(INPUT_METHOD.MOUSE),
|
|
286
290
|
handleEscapeKeydown: handleClose(INPUT_METHOD.KEYBOARD),
|
|
@@ -322,8 +326,10 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref3) {
|
|
|
322
326
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
323
327
|
, {
|
|
324
328
|
closeMediaInsertPicker: function closeMediaInsertPicker() {
|
|
325
|
-
_closeMediaInsertPicker();
|
|
326
|
-
|
|
329
|
+
_closeMediaInsertPicker(); // Focuses editor on unmount
|
|
330
|
+
if (!expValEquals('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true)) {
|
|
331
|
+
focusEditor();
|
|
332
|
+
}
|
|
327
333
|
},
|
|
328
334
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
329
335
|
insertMediaSingle: insertMediaSingle,
|
|
@@ -335,8 +341,10 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref3) {
|
|
|
335
341
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
336
342
|
,
|
|
337
343
|
closeMediaInsertPicker: function closeMediaInsertPicker() {
|
|
338
|
-
_closeMediaInsertPicker();
|
|
339
|
-
|
|
344
|
+
_closeMediaInsertPicker(); // Focuses editor on unmount
|
|
345
|
+
if (!expValEquals('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true)) {
|
|
346
|
+
focusEditor();
|
|
347
|
+
}
|
|
340
348
|
},
|
|
341
349
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
342
350
|
insertFile: insertFile
|
|
@@ -346,8 +354,10 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref3) {
|
|
|
346
354
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
347
355
|
,
|
|
348
356
|
closeMediaInsertPicker: function closeMediaInsertPicker() {
|
|
349
|
-
_closeMediaInsertPicker();
|
|
350
|
-
|
|
357
|
+
_closeMediaInsertPicker(); // Focuses editor on unmount
|
|
358
|
+
if (!expValEquals('platform_editor_fix_focus_MediaInsertPicker', 'isEnabled', true)) {
|
|
359
|
+
focusEditor();
|
|
360
|
+
}
|
|
351
361
|
},
|
|
352
362
|
insertMediaSingle: insertMediaSingle,
|
|
353
363
|
insertExternalMediaSingle: insertExternalMediaSingle,
|
|
@@ -2,7 +2,7 @@ import { useCallback } from 'react';
|
|
|
2
2
|
export var useFocusEditor = function useFocusEditor(_ref) {
|
|
3
3
|
var editorView = _ref.editorView;
|
|
4
4
|
var focusEditor = useCallback(function () {
|
|
5
|
-
//
|
|
5
|
+
// Use setTimeout to run this async after any DOM updates in same callback
|
|
6
6
|
setTimeout(function () {
|
|
7
7
|
return editorView.focus();
|
|
8
8
|
}, 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media-insert",
|
|
3
|
-
"version": "26.0.
|
|
3
|
+
"version": "26.0.17",
|
|
4
4
|
"description": "Media Insert plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"@atlaskit/media-client": "^37.2.0",
|
|
34
34
|
"@atlaskit/media-client-react": "^6.1.0",
|
|
35
35
|
"@atlaskit/media-picker": "^72.1.0",
|
|
36
|
-
"@atlaskit/primitives": "^20.
|
|
36
|
+
"@atlaskit/primitives": "^20.6.0",
|
|
37
37
|
"@atlaskit/section-message": "^9.2.0",
|
|
38
38
|
"@atlaskit/tabs": "^20.1.0",
|
|
39
39
|
"@atlaskit/textfield": "^9.1.0",
|
|
40
|
-
"@atlaskit/tmp-editor-statsig": "^124.
|
|
40
|
+
"@atlaskit/tmp-editor-statsig": "^124.7.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@atlaskit/editor-common": "^116.
|
|
45
|
-
"@atlaskit/tokens": "^15.
|
|
44
|
+
"@atlaskit/editor-common": "^116.28.0",
|
|
45
|
+
"@atlaskit/tokens": "^15.8.0",
|
|
46
46
|
"react": "^18.2.0",
|
|
47
47
|
"react-dom": "^18.2.0",
|
|
48
48
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|