@atlaskit/editor-plugin-media 8.3.1 → 8.4.0
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,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 8.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`641ffaa365b47`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/641ffaa365b47) -
|
|
8
|
+
[ux] add prevent auto focus after uploading support
|
|
9
|
+
|
|
3
10
|
## 8.3.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -50,6 +50,7 @@ var MEDIA_CONTENT_WRAP_CLASS_NAME = exports.MEDIA_CONTENT_WRAP_CLASS_NAME = 'med
|
|
|
50
50
|
var MEDIA_PLUGIN_IS_RESIZING_KEY = exports.MEDIA_PLUGIN_IS_RESIZING_KEY = 'mediaSinglePlugin.isResizing';
|
|
51
51
|
var MEDIA_PLUGIN_RESIZING_WIDTH_KEY = exports.MEDIA_PLUGIN_RESIZING_WIDTH_KEY = 'mediaSinglePlugin.resizing-width';
|
|
52
52
|
var createDropPlaceholder = function createDropPlaceholder(intl, nodeViewPortalProviderAPI, dropPlaceholderKey, allowDropLine) {
|
|
53
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
53
54
|
var dropPlaceholder = document.createElement('div');
|
|
54
55
|
var createElement = _react.default.createElement;
|
|
55
56
|
if (allowDropLine) {
|
|
@@ -670,7 +671,14 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
670
671
|
}, {
|
|
671
672
|
key: "selectLastAddedMediaNode",
|
|
672
673
|
value: function selectLastAddedMediaNode() {
|
|
673
|
-
var
|
|
674
|
+
var _this$mediaOptions5,
|
|
675
|
+
_this2 = this;
|
|
676
|
+
// if preventAutoFocusOnUpload is enabled, skip auto-selection and just clear the tracking array
|
|
677
|
+
if ((_this$mediaOptions5 = this.mediaOptions) !== null && _this$mediaOptions5 !== void 0 && _this$mediaOptions5.preventAutoFocusOnUpload && (0, _platformFeatureFlags.fg)('jira_kuro-jjj_disable_auto_focus_after_img_upload')) {
|
|
678
|
+
this.lastAddedMediaSingleFileIds = [];
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
|
|
674
682
|
// if lastAddedMediaSingleFileIds is empty exit because there are no added media single nodes to be selected
|
|
675
683
|
if (this.lastAddedMediaSingleFileIds.length !== 0) {
|
|
676
684
|
this.waitForPendingTasks().then(function () {
|
|
@@ -969,6 +977,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
969
977
|
var videoControls = videoControlsWrapperRef === null || videoControlsWrapperRef === void 0 ? void 0 : videoControlsWrapperRef.querySelectorAll('button, [tabindex]:not([tabindex="-1"])');
|
|
970
978
|
if (videoControls) {
|
|
971
979
|
var isVideoControl = Array.from(videoControls).some(function (videoControl) {
|
|
980
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
972
981
|
return document.activeElement === videoControl;
|
|
973
982
|
});
|
|
974
983
|
if (isVideoControl) {
|
|
@@ -33,6 +33,7 @@ export const MEDIA_CONTENT_WRAP_CLASS_NAME = 'media-content-wrap';
|
|
|
33
33
|
export const MEDIA_PLUGIN_IS_RESIZING_KEY = 'mediaSinglePlugin.isResizing';
|
|
34
34
|
export const MEDIA_PLUGIN_RESIZING_WIDTH_KEY = 'mediaSinglePlugin.resizing-width';
|
|
35
35
|
const createDropPlaceholder = (intl, nodeViewPortalProviderAPI, dropPlaceholderKey, allowDropLine) => {
|
|
36
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
36
37
|
const dropPlaceholder = document.createElement('div');
|
|
37
38
|
const createElement = React.createElement;
|
|
38
39
|
if (allowDropLine) {
|
|
@@ -595,6 +596,13 @@ export class MediaPluginStateImplementation {
|
|
|
595
596
|
return (_this$pluginInjection5 = this.pluginInjectionApi) === null || _this$pluginInjection5 === void 0 ? void 0 : (_this$pluginInjection6 = _this$pluginInjection5.contextIdentifier) === null || _this$pluginInjection6 === void 0 ? void 0 : (_this$pluginInjection7 = _this$pluginInjection6.sharedState.currentState()) === null || _this$pluginInjection7 === void 0 ? void 0 : _this$pluginInjection7.contextIdentifierProvider;
|
|
596
597
|
}
|
|
597
598
|
selectLastAddedMediaNode() {
|
|
599
|
+
var _this$mediaOptions5;
|
|
600
|
+
// if preventAutoFocusOnUpload is enabled, skip auto-selection and just clear the tracking array
|
|
601
|
+
if ((_this$mediaOptions5 = this.mediaOptions) !== null && _this$mediaOptions5 !== void 0 && _this$mediaOptions5.preventAutoFocusOnUpload && fg('jira_kuro-jjj_disable_auto_focus_after_img_upload')) {
|
|
602
|
+
this.lastAddedMediaSingleFileIds = [];
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
|
|
598
606
|
// if lastAddedMediaSingleFileIds is empty exit because there are no added media single nodes to be selected
|
|
599
607
|
if (this.lastAddedMediaSingleFileIds.length !== 0) {
|
|
600
608
|
this.waitForPendingTasks().then(() => {
|
|
@@ -859,6 +867,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
859
867
|
const videoControls = videoControlsWrapperRef === null || videoControlsWrapperRef === void 0 ? void 0 : videoControlsWrapperRef.querySelectorAll('button, [tabindex]:not([tabindex="-1"])');
|
|
860
868
|
if (videoControls) {
|
|
861
869
|
const isVideoControl = Array.from(videoControls).some(videoControl => {
|
|
870
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
862
871
|
return document.activeElement === videoControl;
|
|
863
872
|
});
|
|
864
873
|
if (isVideoControl) {
|
|
@@ -42,6 +42,7 @@ export var MEDIA_CONTENT_WRAP_CLASS_NAME = 'media-content-wrap';
|
|
|
42
42
|
export var MEDIA_PLUGIN_IS_RESIZING_KEY = 'mediaSinglePlugin.isResizing';
|
|
43
43
|
export var MEDIA_PLUGIN_RESIZING_WIDTH_KEY = 'mediaSinglePlugin.resizing-width';
|
|
44
44
|
var createDropPlaceholder = function createDropPlaceholder(intl, nodeViewPortalProviderAPI, dropPlaceholderKey, allowDropLine) {
|
|
45
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
45
46
|
var dropPlaceholder = document.createElement('div');
|
|
46
47
|
var createElement = React.createElement;
|
|
47
48
|
if (allowDropLine) {
|
|
@@ -662,7 +663,14 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
662
663
|
}, {
|
|
663
664
|
key: "selectLastAddedMediaNode",
|
|
664
665
|
value: function selectLastAddedMediaNode() {
|
|
665
|
-
var
|
|
666
|
+
var _this$mediaOptions5,
|
|
667
|
+
_this2 = this;
|
|
668
|
+
// if preventAutoFocusOnUpload is enabled, skip auto-selection and just clear the tracking array
|
|
669
|
+
if ((_this$mediaOptions5 = this.mediaOptions) !== null && _this$mediaOptions5 !== void 0 && _this$mediaOptions5.preventAutoFocusOnUpload && fg('jira_kuro-jjj_disable_auto_focus_after_img_upload')) {
|
|
670
|
+
this.lastAddedMediaSingleFileIds = [];
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
|
|
666
674
|
// if lastAddedMediaSingleFileIds is empty exit because there are no added media single nodes to be selected
|
|
667
675
|
if (this.lastAddedMediaSingleFileIds.length !== 0) {
|
|
668
676
|
this.waitForPendingTasks().then(function () {
|
|
@@ -961,6 +969,7 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
961
969
|
var videoControls = videoControlsWrapperRef === null || videoControlsWrapperRef === void 0 ? void 0 : videoControlsWrapperRef.querySelectorAll('button, [tabindex]:not([tabindex="-1"])');
|
|
962
970
|
if (videoControls) {
|
|
963
971
|
var isVideoControl = Array.from(videoControls).some(function (videoControl) {
|
|
972
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
964
973
|
return document.activeElement === videoControl;
|
|
965
974
|
});
|
|
966
975
|
if (isVideoControl) {
|
|
@@ -40,6 +40,12 @@ export interface MediaPluginOptions {
|
|
|
40
40
|
allowResizing?: boolean;
|
|
41
41
|
allowResizingInTables?: boolean;
|
|
42
42
|
allowTemplatePlaceholders?: boolean | PlaceholderTextOptions;
|
|
43
|
+
/**
|
|
44
|
+
* When enabled, prevents automatic focus/selection of media nodes after upload completion.
|
|
45
|
+
* The existing focus will be preserved instead of switching to the uploaded media.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
preventAutoFocusOnUpload?: boolean;
|
|
43
49
|
altTextValidator?: (value: string) => string[];
|
|
44
50
|
customDropzoneContainer?: HTMLElement;
|
|
45
51
|
customMediaPicker?: CustomMediaPicker;
|
|
@@ -40,6 +40,12 @@ export interface MediaPluginOptions {
|
|
|
40
40
|
allowResizing?: boolean;
|
|
41
41
|
allowResizingInTables?: boolean;
|
|
42
42
|
allowTemplatePlaceholders?: boolean | PlaceholderTextOptions;
|
|
43
|
+
/**
|
|
44
|
+
* When enabled, prevents automatic focus/selection of media nodes after upload completion.
|
|
45
|
+
* The existing focus will be preserved instead of switching to the uploaded media.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
preventAutoFocusOnUpload?: boolean;
|
|
43
49
|
altTextValidator?: (value: string) => string[];
|
|
44
50
|
customDropzoneContainer?: HTMLElement;
|
|
45
51
|
customMediaPicker?: CustomMediaPicker;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"uuid": "^3.1.0"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
|
-
"@atlaskit/editor-common": "^110.
|
|
81
|
+
"@atlaskit/editor-common": "^110.17.0",
|
|
82
82
|
"@atlaskit/media-core": "^37.0.0",
|
|
83
83
|
"react": "^18.2.0",
|
|
84
84
|
"react-dom": "^18.2.0",
|
|
@@ -162,6 +162,9 @@
|
|
|
162
162
|
},
|
|
163
163
|
"platform_editor_fix_media_card_removal": {
|
|
164
164
|
"type": "boolean"
|
|
165
|
+
},
|
|
166
|
+
"jira_kuro-jjj_disable_auto_focus_after_img_upload": {
|
|
167
|
+
"type": "boolean"
|
|
165
168
|
}
|
|
166
169
|
},
|
|
167
170
|
"stricter": {
|