@atlaskit/editor-plugin-media 5.1.4 → 5.1.5
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
|
|
2
2
|
|
|
3
|
+
## 5.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#184968](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/184968)
|
|
8
|
+
[`a52007f9eed36`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a52007f9eed36) -
|
|
9
|
+
Introduce a performance experiment to avoid running media floating toolbar code unless selected.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 5.1.4
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -29,6 +29,7 @@ var _smartLinkCard = _interopRequireDefault(require("@atlaskit/icon/core/smart-l
|
|
|
29
29
|
var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
|
|
30
30
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
31
31
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
32
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
32
33
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
33
34
|
var _styles = require("../../nodeviews/styles");
|
|
34
35
|
var _altText = require("../../pm-plugins/alt-text");
|
|
@@ -685,6 +686,12 @@ var getMediaTypeMessage = function getMediaTypeMessage(selectedNodeTypeSingle) {
|
|
|
685
686
|
return mediaType ? mediaTypeMessages[mediaType] : _mediaUi.messages.file_unknown_is_selected;
|
|
686
687
|
};
|
|
687
688
|
var overflowDropdwonBtnTriggerTestId = exports.overflowDropdwonBtnTriggerTestId = 'media-overflow-dropdown-trigger';
|
|
689
|
+
var isMediaSelection = function isMediaSelection(selection, nodeType) {
|
|
690
|
+
if (selection instanceof _state2.NodeSelection) {
|
|
691
|
+
return nodeType.includes(selection.node.type);
|
|
692
|
+
}
|
|
693
|
+
return false;
|
|
694
|
+
};
|
|
688
695
|
var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state, intl) {
|
|
689
696
|
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
690
697
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -715,6 +722,11 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
715
722
|
}
|
|
716
723
|
var nodeType = allowMediaInline ? [mediaInline, mediaSingle, media] : [mediaSingle];
|
|
717
724
|
var isSelectedNodeMediaSingle = state.selection instanceof _state2.NodeSelection && state.selection.node.type === mediaSingle;
|
|
725
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_media_floating_toolbar_early_exit', 'isEnabled', true)) {
|
|
726
|
+
if (!isMediaSelection(state.selection, nodeType)) {
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
718
730
|
var baseToolbar = {
|
|
719
731
|
title: 'Media floating controls',
|
|
720
732
|
nodeType: nodeType,
|
|
@@ -19,6 +19,7 @@ import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
|
19
19
|
import { mediaFilmstripItemDOMSelector } from '@atlaskit/media-filmstrip';
|
|
20
20
|
import { messages } from '@atlaskit/media-ui';
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
22
23
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
23
24
|
import { MediaSingleNodeSelector } from '../../nodeviews/styles';
|
|
24
25
|
import { getPluginState as getMediaAltTextPluginState } from '../../pm-plugins/alt-text';
|
|
@@ -681,6 +682,12 @@ const getMediaTypeMessage = selectedNodeTypeSingle => {
|
|
|
681
682
|
return mediaType ? mediaTypeMessages[mediaType] : messages.file_unknown_is_selected;
|
|
682
683
|
};
|
|
683
684
|
export const overflowDropdwonBtnTriggerTestId = 'media-overflow-dropdown-trigger';
|
|
685
|
+
const isMediaSelection = (selection, nodeType) => {
|
|
686
|
+
if (selection instanceof NodeSelection) {
|
|
687
|
+
return nodeType.includes(selection.node.type);
|
|
688
|
+
}
|
|
689
|
+
return false;
|
|
690
|
+
};
|
|
684
691
|
export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) => {
|
|
685
692
|
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
686
693
|
const {
|
|
@@ -715,6 +722,11 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
715
722
|
}
|
|
716
723
|
const nodeType = allowMediaInline ? [mediaInline, mediaSingle, media] : [mediaSingle];
|
|
717
724
|
const isSelectedNodeMediaSingle = state.selection instanceof NodeSelection && state.selection.node.type === mediaSingle;
|
|
725
|
+
if (expValEquals('platform_editor_media_floating_toolbar_early_exit', 'isEnabled', true)) {
|
|
726
|
+
if (!isMediaSelection(state.selection, nodeType)) {
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
718
730
|
const baseToolbar = {
|
|
719
731
|
title: 'Media floating controls',
|
|
720
732
|
nodeType,
|
|
@@ -23,6 +23,7 @@ import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
|
23
23
|
import { mediaFilmstripItemDOMSelector } from '@atlaskit/media-filmstrip';
|
|
24
24
|
import { messages } from '@atlaskit/media-ui';
|
|
25
25
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
26
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
26
27
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
27
28
|
import { MediaSingleNodeSelector } from '../../nodeviews/styles';
|
|
28
29
|
import { getPluginState as getMediaAltTextPluginState } from '../../pm-plugins/alt-text';
|
|
@@ -676,6 +677,12 @@ var getMediaTypeMessage = function getMediaTypeMessage(selectedNodeTypeSingle) {
|
|
|
676
677
|
return mediaType ? mediaTypeMessages[mediaType] : messages.file_unknown_is_selected;
|
|
677
678
|
};
|
|
678
679
|
export var overflowDropdwonBtnTriggerTestId = 'media-overflow-dropdown-trigger';
|
|
680
|
+
var isMediaSelection = function isMediaSelection(selection, nodeType) {
|
|
681
|
+
if (selection instanceof NodeSelection) {
|
|
682
|
+
return nodeType.includes(selection.node.type);
|
|
683
|
+
}
|
|
684
|
+
return false;
|
|
685
|
+
};
|
|
679
686
|
export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
680
687
|
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
681
688
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -706,6 +713,11 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
706
713
|
}
|
|
707
714
|
var nodeType = allowMediaInline ? [mediaInline, mediaSingle, media] : [mediaSingle];
|
|
708
715
|
var isSelectedNodeMediaSingle = state.selection instanceof NodeSelection && state.selection.node.type === mediaSingle;
|
|
716
|
+
if (expValEquals('platform_editor_media_floating_toolbar_early_exit', 'isEnabled', true)) {
|
|
717
|
+
if (!isMediaSelection(state.selection, nodeType)) {
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
709
721
|
var baseToolbar = {
|
|
710
722
|
title: 'Media floating controls',
|
|
711
723
|
nodeType: nodeType,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.5",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"./types": "./src/types/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/adf-schema": "^
|
|
36
|
+
"@atlaskit/adf-schema": "^49.0.5",
|
|
37
37
|
"@atlaskit/analytics-namespaced-context": "^7.0.0",
|
|
38
38
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
39
39
|
"@atlaskit/button": "^23.2.0",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"@atlaskit/primitives": "^14.10.0",
|
|
70
70
|
"@atlaskit/textfield": "^8.0.0",
|
|
71
71
|
"@atlaskit/theme": "^19.0.0",
|
|
72
|
-
"@atlaskit/tmp-editor-statsig": "^9.
|
|
73
|
-
"@atlaskit/tokens": "^5.
|
|
72
|
+
"@atlaskit/tmp-editor-statsig": "^9.5.0",
|
|
73
|
+
"@atlaskit/tokens": "^5.5.0",
|
|
74
74
|
"@atlaskit/tooltip": "^20.3.0",
|
|
75
75
|
"@babel/runtime": "^7.0.0",
|
|
76
76
|
"@emotion/react": "^11.7.1",
|