@atlaskit/editor-plugin-media-insert 26.0.1 → 26.0.2
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-insert
|
|
2
2
|
|
|
3
|
+
## 26.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f614702c47dc2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f614702c47dc2) -
|
|
8
|
+
Clean up the launched media insert tab analytics feature gate.
|
|
9
|
+
|
|
3
10
|
## 26.0.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -16,7 +16,6 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
16
16
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
17
17
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
18
18
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
19
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
19
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
21
20
|
var _tabs = _interopRequireWildcard(require("@atlaskit/tabs"));
|
|
22
21
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
@@ -129,7 +128,6 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
129
128
|
isOnlyExternalLinks = _ref3$isOnlyExternalL === void 0 ? false : _ref3$isOnlyExternalL,
|
|
130
129
|
customizedUrlValidation = _ref3.customizedUrlValidation,
|
|
131
130
|
customizedHelperMessage = _ref3.customizedHelperMessage;
|
|
132
|
-
var isMediaInsertTabWithAnalyticsEnabled = (0, _platformFeatureFlags.fg)('media_insert_tab_with_analytics');
|
|
133
131
|
// Tabs registered by other plugins via `api.mediaInsert.actions.registerInsertTab(...)`.
|
|
134
132
|
// Read once per render; the registry is mutated only at plugin setup time so this is stable
|
|
135
133
|
// for the lifetime of an editor instance.
|
|
@@ -163,8 +161,8 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
163
161
|
var _useUnholyAutofocus = (0, _useUnholyAutofocus2.useUnholyAutofocus)(),
|
|
164
162
|
autofocusRef = _useUnholyAutofocus.autofocusRef,
|
|
165
163
|
onPositionCalculated = _useUnholyAutofocus.onPositionCalculated;
|
|
166
|
-
var tabCount =
|
|
167
|
-
var linkTabIndex =
|
|
164
|
+
var tabCount = registeredTabs.length + (isOnlyExternalLinks ? 1 : 2);
|
|
165
|
+
var linkTabIndex = getLinkTabIndex(registeredTabs.length, isOnlyExternalLinks);
|
|
168
166
|
var getTabAnalyticsMetadata = _react.default.useCallback(function (selectedTabIndex) {
|
|
169
167
|
var registeredTab = registeredTabs[selectedTabIndex];
|
|
170
168
|
if (registeredTab) {
|
|
@@ -207,7 +205,7 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
207
205
|
// initially opened tab needs its viewed analytics event dispatched from an
|
|
208
206
|
// effect. The ref keeps this to once per picker open without setting state.
|
|
209
207
|
_react.default.useEffect(function () {
|
|
210
|
-
if (!
|
|
208
|
+
if (!isOpen) {
|
|
211
209
|
hasDispatchedInitialTabViewedEventRef.current = false;
|
|
212
210
|
return;
|
|
213
211
|
}
|
|
@@ -228,7 +226,7 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
228
226
|
};
|
|
229
227
|
dispatchAnalyticsEvent(payload);
|
|
230
228
|
hasDispatchedInitialTabViewedEventRef.current = true;
|
|
231
|
-
}, [dispatchAnalyticsEvent, getTabAnalyticsMetadata,
|
|
229
|
+
}, [dispatchAnalyticsEvent, getTabAnalyticsMetadata, isOpen, mediaProvider]);
|
|
232
230
|
var handleTabChange = _react.default.useCallback(function (selectedTabIndex, analyticsEvent) {
|
|
233
231
|
var selectedTabMetadata = getTabAnalyticsMetadata(selectedTabIndex);
|
|
234
232
|
selectedTabAnalyticsMetadataRef.current = selectedTabMetadata;
|
|
@@ -304,30 +302,26 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
304
302
|
ref: setOutsideClickTargetRef
|
|
305
303
|
}, /*#__PURE__*/_react.default.createElement(_tabs.default, {
|
|
306
304
|
id: "media-insert-tab-navigation",
|
|
307
|
-
analyticsContext:
|
|
308
|
-
onChange:
|
|
305
|
+
analyticsContext: tabsAnalyticsContext,
|
|
306
|
+
onChange: handleTabChange
|
|
309
307
|
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
310
308
|
paddingBlockEnd: "space.150"
|
|
311
|
-
}, /*#__PURE__*/_react.default.createElement(_tabs.TabList, null,
|
|
309
|
+
}, /*#__PURE__*/_react.default.createElement(_tabs.TabList, null, registeredTabs.map(function (tab, index) {
|
|
312
310
|
return /*#__PURE__*/_react.default.createElement(TabWithAnalytics, {
|
|
313
311
|
key: tab.key,
|
|
314
312
|
onSelectTabForAnalytics: setSelectedTabAnalyticsMetadata,
|
|
315
313
|
selectedTabIndex: index,
|
|
316
314
|
tabCount: tabCount
|
|
317
315
|
}, tab.label);
|
|
318
|
-
}),
|
|
316
|
+
}), !isOnlyExternalLinks && /*#__PURE__*/_react.default.createElement(TabWithAnalytics, {
|
|
319
317
|
onSelectTabForAnalytics: setSelectedTabAnalyticsMetadata,
|
|
320
318
|
selectedTabIndex: registeredTabs.length,
|
|
321
319
|
tabCount: tabCount
|
|
322
|
-
}, fileTabTitle),
|
|
320
|
+
}, fileTabTitle), /*#__PURE__*/_react.default.createElement(TabWithAnalytics, {
|
|
323
321
|
onSelectTabForAnalytics: setSelectedTabAnalyticsMetadata,
|
|
324
322
|
selectedTabIndex: linkTabIndex,
|
|
325
323
|
tabCount: tabCount
|
|
326
|
-
}, intl.formatMessage(_messages.mediaInsertMessages.linkTabTitle)),
|
|
327
|
-
return /*#__PURE__*/_react.default.createElement(_tabs.Tab, {
|
|
328
|
-
key: tab.key
|
|
329
|
-
}, tab.label);
|
|
330
|
-
}), !isMediaInsertTabWithAnalyticsEnabled && !isOnlyExternalLinks && /*#__PURE__*/_react.default.createElement(_tabs.Tab, null, fileTabTitle), !isMediaInsertTabWithAnalyticsEnabled && /*#__PURE__*/_react.default.createElement(_tabs.Tab, null, intl.formatMessage(_messages.mediaInsertMessages.linkTabTitle)))), registeredTabs.map(function (_ref4) {
|
|
324
|
+
}, intl.formatMessage(_messages.mediaInsertMessages.linkTabTitle)))), registeredTabs.map(function (_ref4) {
|
|
331
325
|
var key = _ref4.key,
|
|
332
326
|
TabComponent = _ref4.component;
|
|
333
327
|
return /*#__PURE__*/_react.default.createElement(CustomTabPanel, {
|
|
@@ -7,9 +7,8 @@ import { useSharedPluginStateWithSelector } 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
9
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { Box, Focusable, Text } from '@atlaskit/primitives/compiled';
|
|
12
|
-
import Tabs, {
|
|
11
|
+
import Tabs, { TabList, useTab, useTabPanel } from '@atlaskit/tabs';
|
|
13
12
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
14
13
|
import { useFocusEditor } from './hooks/use-focus-editor';
|
|
15
14
|
import { useUnholyAutofocus } from './hooks/use-unholy-autofocus';
|
|
@@ -115,7 +114,6 @@ export const MediaInsertPicker = ({
|
|
|
115
114
|
customizedHelperMessage
|
|
116
115
|
}) => {
|
|
117
116
|
var _api$mediaInsert$acti, _api$mediaInsert, _api$mediaInsert$acti2, _api$mediaInsert$acti3;
|
|
118
|
-
const isMediaInsertTabWithAnalyticsEnabled = fg('media_insert_tab_with_analytics');
|
|
119
117
|
// Tabs registered by other plugins via `api.mediaInsert.actions.registerInsertTab(...)`.
|
|
120
118
|
// Read once per render; the registry is mutated only at plugin setup time so this is stable
|
|
121
119
|
// for the lifetime of an editor instance.
|
|
@@ -151,8 +149,8 @@ export const MediaInsertPicker = ({
|
|
|
151
149
|
autofocusRef,
|
|
152
150
|
onPositionCalculated
|
|
153
151
|
} = useUnholyAutofocus();
|
|
154
|
-
const tabCount =
|
|
155
|
-
const linkTabIndex =
|
|
152
|
+
const tabCount = registeredTabs.length + (isOnlyExternalLinks ? 1 : 2);
|
|
153
|
+
const linkTabIndex = getLinkTabIndex(registeredTabs.length, isOnlyExternalLinks);
|
|
156
154
|
const getTabAnalyticsMetadata = React.useCallback(selectedTabIndex => {
|
|
157
155
|
const registeredTab = registeredTabs[selectedTabIndex];
|
|
158
156
|
if (registeredTab) {
|
|
@@ -193,7 +191,7 @@ export const MediaInsertPicker = ({
|
|
|
193
191
|
// initially opened tab needs its viewed analytics event dispatched from an
|
|
194
192
|
// effect. The ref keeps this to once per picker open without setting state.
|
|
195
193
|
React.useEffect(() => {
|
|
196
|
-
if (!
|
|
194
|
+
if (!isOpen) {
|
|
197
195
|
hasDispatchedInitialTabViewedEventRef.current = false;
|
|
198
196
|
return;
|
|
199
197
|
}
|
|
@@ -214,7 +212,7 @@ export const MediaInsertPicker = ({
|
|
|
214
212
|
};
|
|
215
213
|
dispatchAnalyticsEvent(payload);
|
|
216
214
|
hasDispatchedInitialTabViewedEventRef.current = true;
|
|
217
|
-
}, [dispatchAnalyticsEvent, getTabAnalyticsMetadata,
|
|
215
|
+
}, [dispatchAnalyticsEvent, getTabAnalyticsMetadata, isOpen, mediaProvider]);
|
|
218
216
|
const handleTabChange = React.useCallback((selectedTabIndex, analyticsEvent) => {
|
|
219
217
|
const selectedTabMetadata = getTabAnalyticsMetadata(selectedTabIndex);
|
|
220
218
|
selectedTabAnalyticsMetadataRef.current = selectedTabMetadata;
|
|
@@ -287,26 +285,24 @@ export const MediaInsertPicker = ({
|
|
|
287
285
|
ref: setOutsideClickTargetRef
|
|
288
286
|
}, /*#__PURE__*/React.createElement(Tabs, {
|
|
289
287
|
id: "media-insert-tab-navigation",
|
|
290
|
-
analyticsContext:
|
|
291
|
-
onChange:
|
|
288
|
+
analyticsContext: tabsAnalyticsContext,
|
|
289
|
+
onChange: handleTabChange
|
|
292
290
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
293
291
|
paddingBlockEnd: "space.150"
|
|
294
|
-
}, /*#__PURE__*/React.createElement(TabList, null,
|
|
292
|
+
}, /*#__PURE__*/React.createElement(TabList, null, registeredTabs.map((tab, index) => /*#__PURE__*/React.createElement(TabWithAnalytics, {
|
|
295
293
|
key: tab.key,
|
|
296
294
|
onSelectTabForAnalytics: setSelectedTabAnalyticsMetadata,
|
|
297
295
|
selectedTabIndex: index,
|
|
298
296
|
tabCount: tabCount
|
|
299
|
-
}, tab.label)),
|
|
297
|
+
}, tab.label)), !isOnlyExternalLinks && /*#__PURE__*/React.createElement(TabWithAnalytics, {
|
|
300
298
|
onSelectTabForAnalytics: setSelectedTabAnalyticsMetadata,
|
|
301
299
|
selectedTabIndex: registeredTabs.length,
|
|
302
300
|
tabCount: tabCount
|
|
303
|
-
}, fileTabTitle),
|
|
301
|
+
}, fileTabTitle), /*#__PURE__*/React.createElement(TabWithAnalytics, {
|
|
304
302
|
onSelectTabForAnalytics: setSelectedTabAnalyticsMetadata,
|
|
305
303
|
selectedTabIndex: linkTabIndex,
|
|
306
304
|
tabCount: tabCount
|
|
307
|
-
}, intl.formatMessage(mediaInsertMessages.linkTabTitle)),
|
|
308
|
-
key: tab.key
|
|
309
|
-
}, tab.label)), !isMediaInsertTabWithAnalyticsEnabled && !isOnlyExternalLinks && /*#__PURE__*/React.createElement(Tab, null, fileTabTitle), !isMediaInsertTabWithAnalyticsEnabled && /*#__PURE__*/React.createElement(Tab, null, intl.formatMessage(mediaInsertMessages.linkTabTitle)))), registeredTabs.map(({
|
|
305
|
+
}, intl.formatMessage(mediaInsertMessages.linkTabTitle)))), registeredTabs.map(({
|
|
310
306
|
key,
|
|
311
307
|
component: TabComponent
|
|
312
308
|
}) => /*#__PURE__*/React.createElement(CustomTabPanel, {
|
|
@@ -10,9 +10,8 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
10
10
|
import { mediaInsertMessages } from '@atlaskit/editor-common/messages';
|
|
11
11
|
import { PlainOutsideClickTargetRefContext, Popup, withOuterListeners } from '@atlaskit/editor-common/ui';
|
|
12
12
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
13
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
import { Box, Focusable, Text } from '@atlaskit/primitives/compiled';
|
|
15
|
-
import Tabs, {
|
|
14
|
+
import Tabs, { TabList, useTab, useTabPanel } from '@atlaskit/tabs';
|
|
16
15
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
17
16
|
import { useFocusEditor } from './hooks/use-focus-editor';
|
|
18
17
|
import { useUnholyAutofocus } from './hooks/use-unholy-autofocus';
|
|
@@ -120,7 +119,6 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref3) {
|
|
|
120
119
|
isOnlyExternalLinks = _ref3$isOnlyExternalL === void 0 ? false : _ref3$isOnlyExternalL,
|
|
121
120
|
customizedUrlValidation = _ref3.customizedUrlValidation,
|
|
122
121
|
customizedHelperMessage = _ref3.customizedHelperMessage;
|
|
123
|
-
var isMediaInsertTabWithAnalyticsEnabled = fg('media_insert_tab_with_analytics');
|
|
124
122
|
// Tabs registered by other plugins via `api.mediaInsert.actions.registerInsertTab(...)`.
|
|
125
123
|
// Read once per render; the registry is mutated only at plugin setup time so this is stable
|
|
126
124
|
// for the lifetime of an editor instance.
|
|
@@ -154,8 +152,8 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref3) {
|
|
|
154
152
|
var _useUnholyAutofocus = useUnholyAutofocus(),
|
|
155
153
|
autofocusRef = _useUnholyAutofocus.autofocusRef,
|
|
156
154
|
onPositionCalculated = _useUnholyAutofocus.onPositionCalculated;
|
|
157
|
-
var tabCount =
|
|
158
|
-
var linkTabIndex =
|
|
155
|
+
var tabCount = registeredTabs.length + (isOnlyExternalLinks ? 1 : 2);
|
|
156
|
+
var linkTabIndex = getLinkTabIndex(registeredTabs.length, isOnlyExternalLinks);
|
|
159
157
|
var getTabAnalyticsMetadata = React.useCallback(function (selectedTabIndex) {
|
|
160
158
|
var registeredTab = registeredTabs[selectedTabIndex];
|
|
161
159
|
if (registeredTab) {
|
|
@@ -198,7 +196,7 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref3) {
|
|
|
198
196
|
// initially opened tab needs its viewed analytics event dispatched from an
|
|
199
197
|
// effect. The ref keeps this to once per picker open without setting state.
|
|
200
198
|
React.useEffect(function () {
|
|
201
|
-
if (!
|
|
199
|
+
if (!isOpen) {
|
|
202
200
|
hasDispatchedInitialTabViewedEventRef.current = false;
|
|
203
201
|
return;
|
|
204
202
|
}
|
|
@@ -219,7 +217,7 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref3) {
|
|
|
219
217
|
};
|
|
220
218
|
dispatchAnalyticsEvent(payload);
|
|
221
219
|
hasDispatchedInitialTabViewedEventRef.current = true;
|
|
222
|
-
}, [dispatchAnalyticsEvent, getTabAnalyticsMetadata,
|
|
220
|
+
}, [dispatchAnalyticsEvent, getTabAnalyticsMetadata, isOpen, mediaProvider]);
|
|
223
221
|
var handleTabChange = React.useCallback(function (selectedTabIndex, analyticsEvent) {
|
|
224
222
|
var selectedTabMetadata = getTabAnalyticsMetadata(selectedTabIndex);
|
|
225
223
|
selectedTabAnalyticsMetadataRef.current = selectedTabMetadata;
|
|
@@ -295,30 +293,26 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref3) {
|
|
|
295
293
|
ref: setOutsideClickTargetRef
|
|
296
294
|
}, /*#__PURE__*/React.createElement(Tabs, {
|
|
297
295
|
id: "media-insert-tab-navigation",
|
|
298
|
-
analyticsContext:
|
|
299
|
-
onChange:
|
|
296
|
+
analyticsContext: tabsAnalyticsContext,
|
|
297
|
+
onChange: handleTabChange
|
|
300
298
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
301
299
|
paddingBlockEnd: "space.150"
|
|
302
|
-
}, /*#__PURE__*/React.createElement(TabList, null,
|
|
300
|
+
}, /*#__PURE__*/React.createElement(TabList, null, registeredTabs.map(function (tab, index) {
|
|
303
301
|
return /*#__PURE__*/React.createElement(TabWithAnalytics, {
|
|
304
302
|
key: tab.key,
|
|
305
303
|
onSelectTabForAnalytics: setSelectedTabAnalyticsMetadata,
|
|
306
304
|
selectedTabIndex: index,
|
|
307
305
|
tabCount: tabCount
|
|
308
306
|
}, tab.label);
|
|
309
|
-
}),
|
|
307
|
+
}), !isOnlyExternalLinks && /*#__PURE__*/React.createElement(TabWithAnalytics, {
|
|
310
308
|
onSelectTabForAnalytics: setSelectedTabAnalyticsMetadata,
|
|
311
309
|
selectedTabIndex: registeredTabs.length,
|
|
312
310
|
tabCount: tabCount
|
|
313
|
-
}, fileTabTitle),
|
|
311
|
+
}, fileTabTitle), /*#__PURE__*/React.createElement(TabWithAnalytics, {
|
|
314
312
|
onSelectTabForAnalytics: setSelectedTabAnalyticsMetadata,
|
|
315
313
|
selectedTabIndex: linkTabIndex,
|
|
316
314
|
tabCount: tabCount
|
|
317
|
-
}, intl.formatMessage(mediaInsertMessages.linkTabTitle)),
|
|
318
|
-
return /*#__PURE__*/React.createElement(Tab, {
|
|
319
|
-
key: tab.key
|
|
320
|
-
}, tab.label);
|
|
321
|
-
}), !isMediaInsertTabWithAnalyticsEnabled && !isOnlyExternalLinks && /*#__PURE__*/React.createElement(Tab, null, fileTabTitle), !isMediaInsertTabWithAnalyticsEnabled && /*#__PURE__*/React.createElement(Tab, null, intl.formatMessage(mediaInsertMessages.linkTabTitle)))), registeredTabs.map(function (_ref4) {
|
|
315
|
+
}, intl.formatMessage(mediaInsertMessages.linkTabTitle)))), registeredTabs.map(function (_ref4) {
|
|
322
316
|
var key = _ref4.key,
|
|
323
317
|
TabComponent = _ref4.component;
|
|
324
318
|
return /*#__PURE__*/React.createElement(CustomTabPanel, {
|
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.2",
|
|
4
4
|
"description": "Media Insert plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"@atlaskit/media-client": "^37.1.0",
|
|
34
34
|
"@atlaskit/media-client-react": "^6.0.0",
|
|
35
35
|
"@atlaskit/media-picker": "^72.0.0",
|
|
36
|
-
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
37
36
|
"@atlaskit/primitives": "^20.0.0",
|
|
38
37
|
"@atlaskit/section-message": "^9.1.0",
|
|
39
38
|
"@atlaskit/tabs": "^20.0.0",
|
|
@@ -93,10 +92,5 @@
|
|
|
93
92
|
"react": "^18.2.0",
|
|
94
93
|
"react-dom": "^18.2.0",
|
|
95
94
|
"react-intl": "^7.0.0"
|
|
96
|
-
},
|
|
97
|
-
"platform-feature-flags": {
|
|
98
|
-
"media_insert_tab_with_analytics": {
|
|
99
|
-
"type": "boolean"
|
|
100
|
-
}
|
|
101
95
|
}
|
|
102
96
|
}
|