@atlaskit/editor-plugin-media-insert 6.3.0 → 6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media-insert
|
|
2
2
|
|
|
3
|
+
## 6.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#146359](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/146359)
|
|
8
|
+
[`cb179949b078a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cb179949b078a) -
|
|
9
|
+
Migrate media to use useSharedPluginStateSelector
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 6.3.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
|
@@ -14,10 +14,12 @@ var _getDomRefFromSelection = require("@atlaskit/editor-common/get-dom-ref-from-
|
|
|
14
14
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
15
15
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
16
16
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
17
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
17
18
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
18
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
21
|
var _tabs = _interopRequireWildcard(require("@atlaskit/tabs"));
|
|
22
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
21
23
|
var _useFocusEditor = require("./hooks/use-focus-editor");
|
|
22
24
|
var _useUnholyAutofocus2 = require("./hooks/use-unholy-autofocus");
|
|
23
25
|
var _LocalMedia = require("./LocalMedia");
|
|
@@ -59,9 +61,26 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
59
61
|
insertFile = _ref2.insertFile,
|
|
60
62
|
_ref2$isOnlyExternalL = _ref2.isOnlyExternalLinks,
|
|
61
63
|
isOnlyExternalLinks = _ref2$isOnlyExternalL === void 0 ? false : _ref2$isOnlyExternalL;
|
|
62
|
-
var _ref3 = (_useSharedPluginState = (_useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['mediaInsert']
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
var _ref3 = (_useSharedPluginState = (_useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['mediaInsert'], {
|
|
65
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
66
|
+
})) === null || _useSharedPluginState2 === void 0 ? void 0 : _useSharedPluginState2.mediaInsertState) !== null && _useSharedPluginState !== void 0 ? _useSharedPluginState : {},
|
|
67
|
+
oldIsOpen = _ref3.isOpen,
|
|
68
|
+
oldMountInfo = _ref3.mountInfo;
|
|
69
|
+
var oldMediaProvider = (_useSharedPluginState3 = (0, _hooks.useSharedPluginState)(api, ['media'], {
|
|
70
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
71
|
+
})) === null || _useSharedPluginState3 === void 0 || (_useSharedPluginState3 = _useSharedPluginState3.mediaState) === null || _useSharedPluginState3 === void 0 ? void 0 : _useSharedPluginState3.mediaProvider;
|
|
72
|
+
var isOpenSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'mediaInsert.isOpen', {
|
|
73
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
74
|
+
});
|
|
75
|
+
var mountInfoSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'mediaInsert.mountInfo', {
|
|
76
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
77
|
+
});
|
|
78
|
+
var mediaProviderSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'media.mediaProvider', {
|
|
79
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
80
|
+
});
|
|
81
|
+
var isOpen = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isOpenSelector : oldIsOpen;
|
|
82
|
+
var mountInfo = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? mountInfoSelector : oldMountInfo;
|
|
83
|
+
var mediaProvider = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? mediaProviderSelector : oldMediaProvider;
|
|
65
84
|
var targetRef;
|
|
66
85
|
var mountPoint;
|
|
67
86
|
if (mountInfo) {
|
|
@@ -73,7 +92,6 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
73
92
|
targetRef = (0, _getDomRefFromSelection.getDomRefFromSelection)(editorView, _analytics.ACTION_SUBJECT_ID.PICKER_MEDIA, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
74
93
|
mountPoint = popupsMountPoint;
|
|
75
94
|
}
|
|
76
|
-
var mediaProvider = (_useSharedPluginState3 = (0, _hooks.useSharedPluginState)(api, ['media'])) === null || _useSharedPluginState3 === void 0 || (_useSharedPluginState3 = _useSharedPluginState3.mediaState) === null || _useSharedPluginState3 === void 0 ? void 0 : _useSharedPluginState3.mediaProvider;
|
|
77
95
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
78
96
|
var focusEditor = (0, _useFocusEditor.useFocusEditor)({
|
|
79
97
|
editorView: editorView
|
|
@@ -6,10 +6,12 @@ import { getDomRefFromSelection } from '@atlaskit/editor-common/get-dom-ref-from
|
|
|
6
6
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { mediaInsertMessages } from '@atlaskit/editor-common/messages';
|
|
8
8
|
import { PlainOutsideClickTargetRefContext, Popup, withOuterListeners } from '@atlaskit/editor-common/ui';
|
|
9
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
9
10
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
12
13
|
import Tabs, { Tab, TabList, useTabPanel } from '@atlaskit/tabs';
|
|
14
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
15
|
import { useFocusEditor } from './hooks/use-focus-editor';
|
|
14
16
|
import { useUnholyAutofocus } from './hooks/use-unholy-autofocus';
|
|
15
17
|
import { LocalMedia } from './LocalMedia';
|
|
@@ -51,9 +53,26 @@ export const MediaInsertPicker = ({
|
|
|
51
53
|
}) => {
|
|
52
54
|
var _useSharedPluginState, _useSharedPluginState2, _useSharedPluginState3, _useSharedPluginState4;
|
|
53
55
|
const {
|
|
54
|
-
isOpen,
|
|
55
|
-
mountInfo
|
|
56
|
-
} = (_useSharedPluginState = (_useSharedPluginState2 = useSharedPluginState(api, ['mediaInsert']
|
|
56
|
+
isOpen: oldIsOpen,
|
|
57
|
+
mountInfo: oldMountInfo
|
|
58
|
+
} = (_useSharedPluginState = (_useSharedPluginState2 = useSharedPluginState(api, ['mediaInsert'], {
|
|
59
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
60
|
+
})) === null || _useSharedPluginState2 === void 0 ? void 0 : _useSharedPluginState2.mediaInsertState) !== null && _useSharedPluginState !== void 0 ? _useSharedPluginState : {};
|
|
61
|
+
const oldMediaProvider = (_useSharedPluginState3 = useSharedPluginState(api, ['media'], {
|
|
62
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
63
|
+
})) === null || _useSharedPluginState3 === void 0 ? void 0 : (_useSharedPluginState4 = _useSharedPluginState3.mediaState) === null || _useSharedPluginState4 === void 0 ? void 0 : _useSharedPluginState4.mediaProvider;
|
|
64
|
+
const isOpenSelector = useSharedPluginStateSelector(api, 'mediaInsert.isOpen', {
|
|
65
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
66
|
+
});
|
|
67
|
+
const mountInfoSelector = useSharedPluginStateSelector(api, 'mediaInsert.mountInfo', {
|
|
68
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
69
|
+
});
|
|
70
|
+
const mediaProviderSelector = useSharedPluginStateSelector(api, 'media.mediaProvider', {
|
|
71
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
72
|
+
});
|
|
73
|
+
const isOpen = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isOpenSelector : oldIsOpen;
|
|
74
|
+
const mountInfo = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? mountInfoSelector : oldMountInfo;
|
|
75
|
+
const mediaProvider = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? mediaProviderSelector : oldMediaProvider;
|
|
57
76
|
let targetRef;
|
|
58
77
|
let mountPoint;
|
|
59
78
|
if (mountInfo) {
|
|
@@ -65,7 +84,6 @@ export const MediaInsertPicker = ({
|
|
|
65
84
|
targetRef = getDomRefFromSelection(editorView, ACTION_SUBJECT_ID.PICKER_MEDIA, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
66
85
|
mountPoint = popupsMountPoint;
|
|
67
86
|
}
|
|
68
|
-
const mediaProvider = (_useSharedPluginState3 = useSharedPluginState(api, ['media'])) === null || _useSharedPluginState3 === void 0 ? void 0 : (_useSharedPluginState4 = _useSharedPluginState3.mediaState) === null || _useSharedPluginState4 === void 0 ? void 0 : _useSharedPluginState4.mediaProvider;
|
|
69
87
|
const intl = useIntl();
|
|
70
88
|
const focusEditor = useFocusEditor({
|
|
71
89
|
editorView
|
|
@@ -6,10 +6,12 @@ import { getDomRefFromSelection } from '@atlaskit/editor-common/get-dom-ref-from
|
|
|
6
6
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { mediaInsertMessages } from '@atlaskit/editor-common/messages';
|
|
8
8
|
import { PlainOutsideClickTargetRefContext, Popup, withOuterListeners } from '@atlaskit/editor-common/ui';
|
|
9
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
9
10
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
12
13
|
import Tabs, { Tab, TabList, useTabPanel } from '@atlaskit/tabs';
|
|
14
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
15
|
import { useFocusEditor } from './hooks/use-focus-editor';
|
|
14
16
|
import { useUnholyAutofocus } from './hooks/use-unholy-autofocus';
|
|
15
17
|
import { LocalMedia } from './LocalMedia';
|
|
@@ -49,9 +51,26 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref2) {
|
|
|
49
51
|
insertFile = _ref2.insertFile,
|
|
50
52
|
_ref2$isOnlyExternalL = _ref2.isOnlyExternalLinks,
|
|
51
53
|
isOnlyExternalLinks = _ref2$isOnlyExternalL === void 0 ? false : _ref2$isOnlyExternalL;
|
|
52
|
-
var _ref3 = (_useSharedPluginState = (_useSharedPluginState2 = useSharedPluginState(api, ['mediaInsert']
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
var _ref3 = (_useSharedPluginState = (_useSharedPluginState2 = useSharedPluginState(api, ['mediaInsert'], {
|
|
55
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
56
|
+
})) === null || _useSharedPluginState2 === void 0 ? void 0 : _useSharedPluginState2.mediaInsertState) !== null && _useSharedPluginState !== void 0 ? _useSharedPluginState : {},
|
|
57
|
+
oldIsOpen = _ref3.isOpen,
|
|
58
|
+
oldMountInfo = _ref3.mountInfo;
|
|
59
|
+
var oldMediaProvider = (_useSharedPluginState3 = useSharedPluginState(api, ['media'], {
|
|
60
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
61
|
+
})) === null || _useSharedPluginState3 === void 0 || (_useSharedPluginState3 = _useSharedPluginState3.mediaState) === null || _useSharedPluginState3 === void 0 ? void 0 : _useSharedPluginState3.mediaProvider;
|
|
62
|
+
var isOpenSelector = useSharedPluginStateSelector(api, 'mediaInsert.isOpen', {
|
|
63
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
64
|
+
});
|
|
65
|
+
var mountInfoSelector = useSharedPluginStateSelector(api, 'mediaInsert.mountInfo', {
|
|
66
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
67
|
+
});
|
|
68
|
+
var mediaProviderSelector = useSharedPluginStateSelector(api, 'media.mediaProvider', {
|
|
69
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
70
|
+
});
|
|
71
|
+
var isOpen = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isOpenSelector : oldIsOpen;
|
|
72
|
+
var mountInfo = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? mountInfoSelector : oldMountInfo;
|
|
73
|
+
var mediaProvider = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? mediaProviderSelector : oldMediaProvider;
|
|
55
74
|
var targetRef;
|
|
56
75
|
var mountPoint;
|
|
57
76
|
if (mountInfo) {
|
|
@@ -63,7 +82,6 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref2) {
|
|
|
63
82
|
targetRef = getDomRefFromSelection(editorView, ACTION_SUBJECT_ID.PICKER_MEDIA, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
64
83
|
mountPoint = popupsMountPoint;
|
|
65
84
|
}
|
|
66
|
-
var mediaProvider = (_useSharedPluginState3 = useSharedPluginState(api, ['media'])) === null || _useSharedPluginState3 === void 0 || (_useSharedPluginState3 = _useSharedPluginState3.mediaState) === null || _useSharedPluginState3 === void 0 ? void 0 : _useSharedPluginState3.mediaProvider;
|
|
67
85
|
var intl = useIntl();
|
|
68
86
|
var focusEditor = useFocusEditor({
|
|
69
87
|
editorView: editorView
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media-insert",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.1",
|
|
4
4
|
"description": "Media Insert plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
29
29
|
"@atlaskit/button": "^23.0.0",
|
|
30
|
-
"@atlaskit/editor-common": "^103.
|
|
30
|
+
"@atlaskit/editor-common": "^103.20.0",
|
|
31
31
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
32
32
|
"@atlaskit/editor-plugin-media": "^2.7.0",
|
|
33
33
|
"@atlaskit/editor-prosemirror": "7.0.0",
|