@atlaskit/editor-plugin-toolbar 3.5.0 → 3.5.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 +8 -0
- package/dist/cjs/toolbarPlugin.js +1 -1
- package/dist/cjs/ui/Section.js +19 -8
- package/dist/cjs/ui/SelectionToolbar/index.js +5 -3
- package/dist/es2019/toolbarPlugin.js +1 -1
- package/dist/es2019/ui/Section.js +19 -8
- package/dist/es2019/ui/SelectionToolbar/index.js +6 -4
- package/dist/esm/toolbarPlugin.js +1 -1
- package/dist/esm/ui/Section.js +19 -8
- package/dist/esm/ui/SelectionToolbar/index.js +6 -4
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar
|
|
2
2
|
|
|
3
|
+
## 3.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2515f609f1288`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2515f609f1288) -
|
|
8
|
+
ED-29720 Fix the contextual toolbar config for template editor
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 3.5.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -98,7 +98,7 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
98
98
|
return registry.components;
|
|
99
99
|
},
|
|
100
100
|
contextualFormattingMode: function contextualFormattingMode() {
|
|
101
|
-
return contextualFormattingEnabled;
|
|
101
|
+
return contextualFormattingEnabled !== null && contextualFormattingEnabled !== void 0 ? contextualFormattingEnabled : 'always-pinned';
|
|
102
102
|
},
|
|
103
103
|
getBreakpointPreset: function getBreakpointPreset() {
|
|
104
104
|
return (0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_responsive_improve') ? breakpointPreset : undefined;
|
package/dist/cjs/ui/Section.js
CHANGED
|
@@ -12,7 +12,7 @@ var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
13
|
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
14
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
|
-
var shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDocking, disableSelectionToolbar) {
|
|
15
|
+
var shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDocking, contextualFormattingEnabled, disableSelectionToolbar) {
|
|
16
16
|
if (editMode === 'view') {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
@@ -26,17 +26,26 @@ var shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDoc
|
|
|
26
26
|
return true;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
if ((
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_placement_overridden')) {
|
|
30
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === _toolbar.TOOLBARS.INLINE_TEXT_TOOLBAR) {
|
|
31
|
+
return toolbarDocking !== 'top' || contextualFormattingEnabled === 'always-inline';
|
|
32
|
+
}
|
|
33
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === _toolbar.TOOLBARS.PRIMARY_TOOLBAR) {
|
|
34
|
+
return toolbarDocking !== 'none' || contextualFormattingEnabled === 'always-pinned';
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === _toolbar.TOOLBARS.INLINE_TEXT_TOOLBAR && toolbarDocking !== 'top') {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === _toolbar.TOOLBARS.PRIMARY_TOOLBAR && toolbarDocking !== 'none') {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
34
43
|
}
|
|
35
44
|
return false;
|
|
36
45
|
};
|
|
37
46
|
var usePluginState = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
|
|
38
47
|
return (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true);
|
|
39
|
-
}, function (
|
|
48
|
+
}, function (_api) {
|
|
40
49
|
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
41
50
|
editorViewMode = _useEditorToolbar.editorViewMode,
|
|
42
51
|
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference,
|
|
@@ -58,6 +67,7 @@ var usePluginState = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(fun
|
|
|
58
67
|
};
|
|
59
68
|
});
|
|
60
69
|
var Section = exports.Section = function Section(_ref) {
|
|
70
|
+
var _api$toolbar$actions$, _api$toolbar;
|
|
61
71
|
var children = _ref.children,
|
|
62
72
|
parents = _ref.parents,
|
|
63
73
|
api = _ref.api,
|
|
@@ -73,7 +83,8 @@ var Section = exports.Section = function Section(_ref) {
|
|
|
73
83
|
var toolbar = parents.find(function (parent) {
|
|
74
84
|
return parent.type === 'toolbar';
|
|
75
85
|
});
|
|
76
|
-
|
|
86
|
+
var contextualFormattingEnabled = (_api$toolbar$actions$ = api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.contextualFormattingMode()) !== null && _api$toolbar$actions$ !== void 0 ? _api$toolbar$actions$ : 'always-pinned';
|
|
87
|
+
if (isSharedSection && !shouldShowSection(editorViewMode, toolbar, editorToolbarDockingPreference, contextualFormattingEnabled, disableSelectionToolbar)) {
|
|
77
88
|
return null;
|
|
78
89
|
}
|
|
79
90
|
var isFullPage = editorAppearance === 'full-page';
|
|
@@ -107,7 +107,7 @@ var useOnPositionCalculated = (0, _platformFeatureFlagsReact.conditionalHooksFac
|
|
|
107
107
|
return onPositionCalculated;
|
|
108
108
|
});
|
|
109
109
|
var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref) {
|
|
110
|
-
var _api$toolbar;
|
|
110
|
+
var _api$toolbar$actions$, _api$toolbar, _api$toolbar2;
|
|
111
111
|
var api = _ref.api,
|
|
112
112
|
editorView = _ref.editorView,
|
|
113
113
|
mountPoint = _ref.mountPoint,
|
|
@@ -119,8 +119,10 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
|
|
|
119
119
|
shouldShowToolbar = _usePluginState.shouldShowToolbar,
|
|
120
120
|
editorViewMode = _usePluginState.editorViewMode,
|
|
121
121
|
selection = _usePluginState.selection;
|
|
122
|
+
var contextualFormattingEnabled = (_api$toolbar$actions$ = api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.contextualFormattingMode()) !== null && _api$toolbar$actions$ !== void 0 ? _api$toolbar$actions$ : 'always-pinned';
|
|
123
|
+
var selectionToolbarConfigEnabled = (0, _toolbar.shouldShowSelectionToolbar)(contextualFormattingEnabled, editorToolbarDockingPreference);
|
|
122
124
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
123
|
-
var components = api === null || api === void 0 || (_api$
|
|
125
|
+
var components = api === null || api === void 0 || (_api$toolbar2 = api.toolbar) === null || _api$toolbar2 === void 0 ? void 0 : _api$toolbar2.actions.getComponents();
|
|
124
126
|
var toolbar = components === null || components === void 0 ? void 0 : components.find(function (component) {
|
|
125
127
|
return isToolbarComponent(component);
|
|
126
128
|
});
|
|
@@ -135,7 +137,7 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
|
|
|
135
137
|
var isAllSelection = !editorView.state.selection.empty && editorView.state.selection instanceof _state.AllSelection;
|
|
136
138
|
var isCellSelection = !editorView.state.selection.empty && '$anchorCell' in editorView.state.selection;
|
|
137
139
|
var onPositionCalculated = useOnPositionCalculated(editorView);
|
|
138
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) &&
|
|
140
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && selectionToolbarConfigEnabled && disableSelectionToolbarWhenPinned || !components || !toolbar) {
|
|
139
141
|
return null;
|
|
140
142
|
}
|
|
141
143
|
if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) || ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_user_intent_fix') ?
|
|
@@ -83,7 +83,7 @@ export const toolbarPlugin = ({
|
|
|
83
83
|
return registry.components;
|
|
84
84
|
},
|
|
85
85
|
contextualFormattingMode: () => {
|
|
86
|
-
return contextualFormattingEnabled;
|
|
86
|
+
return contextualFormattingEnabled !== null && contextualFormattingEnabled !== void 0 ? contextualFormattingEnabled : 'always-pinned';
|
|
87
87
|
},
|
|
88
88
|
getBreakpointPreset: () => {
|
|
89
89
|
return fg('platform_editor_toolbar_aifc_responsive_improve') ? breakpointPreset : undefined;
|
|
@@ -5,7 +5,7 @@ import { ToolbarSection, SeparatorPosition } from '@atlaskit/editor-toolbar';
|
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
7
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
-
const shouldShowSection = (editMode, toolbar, toolbarDocking, disableSelectionToolbar) => {
|
|
8
|
+
const shouldShowSection = (editMode, toolbar, toolbarDocking, contextualFormattingEnabled, disableSelectionToolbar) => {
|
|
9
9
|
if (editMode === 'view') {
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
@@ -19,15 +19,24 @@ const shouldShowSection = (editMode, toolbar, toolbarDocking, disableSelectionTo
|
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
if ((
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
if (fg('platform_editor_toolbar_aifc_placement_overridden')) {
|
|
23
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.INLINE_TEXT_TOOLBAR) {
|
|
24
|
+
return toolbarDocking !== 'top' || contextualFormattingEnabled === 'always-inline';
|
|
25
|
+
}
|
|
26
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.PRIMARY_TOOLBAR) {
|
|
27
|
+
return toolbarDocking !== 'none' || contextualFormattingEnabled === 'always-pinned';
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.INLINE_TEXT_TOOLBAR && toolbarDocking !== 'top') {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.PRIMARY_TOOLBAR && toolbarDocking !== 'none') {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
27
36
|
}
|
|
28
37
|
return false;
|
|
29
38
|
};
|
|
30
|
-
const usePluginState = conditionalHooksFactory(() => expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true),
|
|
39
|
+
const usePluginState = conditionalHooksFactory(() => expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true), _api => {
|
|
31
40
|
const {
|
|
32
41
|
editorViewMode,
|
|
33
42
|
editorToolbarDockingPreference,
|
|
@@ -59,13 +68,15 @@ export const Section = ({
|
|
|
59
68
|
isSharedSection = true,
|
|
60
69
|
disableSelectionToolbar
|
|
61
70
|
}) => {
|
|
71
|
+
var _api$toolbar$actions$, _api$toolbar;
|
|
62
72
|
const {
|
|
63
73
|
editorViewMode,
|
|
64
74
|
editorToolbarDockingPreference,
|
|
65
75
|
editorAppearance
|
|
66
76
|
} = usePluginState(api);
|
|
67
77
|
const toolbar = parents.find(parent => parent.type === 'toolbar');
|
|
68
|
-
|
|
78
|
+
const contextualFormattingEnabled = (_api$toolbar$actions$ = api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.contextualFormattingMode()) !== null && _api$toolbar$actions$ !== void 0 ? _api$toolbar$actions$ : 'always-pinned';
|
|
79
|
+
if (isSharedSection && !shouldShowSection(editorViewMode, toolbar, editorToolbarDockingPreference, contextualFormattingEnabled, disableSelectionToolbar)) {
|
|
69
80
|
return null;
|
|
70
81
|
}
|
|
71
82
|
const isFullPage = editorAppearance === 'full-page';
|
|
@@ -5,7 +5,7 @@ import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
|
5
5
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
6
6
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
8
|
-
import { EditorToolbarProvider, EditorToolbarUIProvider } from '@atlaskit/editor-common/toolbar';
|
|
8
|
+
import { EditorToolbarProvider, EditorToolbarUIProvider, shouldShowSelectionToolbar } from '@atlaskit/editor-common/toolbar';
|
|
9
9
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
10
10
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
11
11
|
import { calculateToolbarPositionTrackHead, calculateToolbarPositionOnCellSelection } from '@atlaskit/editor-common/utils';
|
|
@@ -101,7 +101,7 @@ export const SelectionToolbar = ({
|
|
|
101
101
|
mountPoint,
|
|
102
102
|
disableSelectionToolbarWhenPinned
|
|
103
103
|
}) => {
|
|
104
|
-
var _api$toolbar;
|
|
104
|
+
var _api$toolbar$actions$, _api$toolbar, _api$toolbar2;
|
|
105
105
|
const {
|
|
106
106
|
connectivityStateMode,
|
|
107
107
|
editorToolbarDockingPreference,
|
|
@@ -111,8 +111,10 @@ export const SelectionToolbar = ({
|
|
|
111
111
|
// @ts-ignore
|
|
112
112
|
selection
|
|
113
113
|
} = usePluginState(api);
|
|
114
|
+
const contextualFormattingEnabled = (_api$toolbar$actions$ = api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.contextualFormattingMode()) !== null && _api$toolbar$actions$ !== void 0 ? _api$toolbar$actions$ : 'always-pinned';
|
|
115
|
+
const selectionToolbarConfigEnabled = shouldShowSelectionToolbar(contextualFormattingEnabled, editorToolbarDockingPreference);
|
|
114
116
|
const intl = useIntl();
|
|
115
|
-
const components = api === null || api === void 0 ? void 0 : (_api$
|
|
117
|
+
const components = api === null || api === void 0 ? void 0 : (_api$toolbar2 = api.toolbar) === null || _api$toolbar2 === void 0 ? void 0 : _api$toolbar2.actions.getComponents();
|
|
116
118
|
const toolbar = components === null || components === void 0 ? void 0 : components.find(component => isToolbarComponent(component));
|
|
117
119
|
const keyboardNavigation = useMemo(() => {
|
|
118
120
|
return getKeyboardNavigationConfig(editorView, intl, api);
|
|
@@ -126,7 +128,7 @@ export const SelectionToolbar = ({
|
|
|
126
128
|
const isAllSelection = !editorView.state.selection.empty && editorView.state.selection instanceof AllSelection;
|
|
127
129
|
const isCellSelection = !editorView.state.selection.empty && '$anchorCell' in editorView.state.selection;
|
|
128
130
|
const onPositionCalculated = useOnPositionCalculated(editorView);
|
|
129
|
-
if (expValEquals('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) &&
|
|
131
|
+
if (expValEquals('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && selectionToolbarConfigEnabled && disableSelectionToolbarWhenPinned || !components || !toolbar) {
|
|
130
132
|
return null;
|
|
131
133
|
}
|
|
132
134
|
if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || (fg('platform_editor_toolbar_aifc_user_intent_fix') ?
|
|
@@ -91,7 +91,7 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
91
91
|
return registry.components;
|
|
92
92
|
},
|
|
93
93
|
contextualFormattingMode: function contextualFormattingMode() {
|
|
94
|
-
return contextualFormattingEnabled;
|
|
94
|
+
return contextualFormattingEnabled !== null && contextualFormattingEnabled !== void 0 ? contextualFormattingEnabled : 'always-pinned';
|
|
95
95
|
},
|
|
96
96
|
getBreakpointPreset: function getBreakpointPreset() {
|
|
97
97
|
return fg('platform_editor_toolbar_aifc_responsive_improve') ? breakpointPreset : undefined;
|
package/dist/esm/ui/Section.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ToolbarSection, SeparatorPosition } from '@atlaskit/editor-toolbar';
|
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
7
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
-
var shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDocking, disableSelectionToolbar) {
|
|
8
|
+
var shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDocking, contextualFormattingEnabled, disableSelectionToolbar) {
|
|
9
9
|
if (editMode === 'view') {
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
@@ -19,17 +19,26 @@ var shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDoc
|
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
if ((
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
if (fg('platform_editor_toolbar_aifc_placement_overridden')) {
|
|
23
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.INLINE_TEXT_TOOLBAR) {
|
|
24
|
+
return toolbarDocking !== 'top' || contextualFormattingEnabled === 'always-inline';
|
|
25
|
+
}
|
|
26
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.PRIMARY_TOOLBAR) {
|
|
27
|
+
return toolbarDocking !== 'none' || contextualFormattingEnabled === 'always-pinned';
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.INLINE_TEXT_TOOLBAR && toolbarDocking !== 'top') {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.PRIMARY_TOOLBAR && toolbarDocking !== 'none') {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
27
36
|
}
|
|
28
37
|
return false;
|
|
29
38
|
};
|
|
30
39
|
var usePluginState = conditionalHooksFactory(function () {
|
|
31
40
|
return expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true);
|
|
32
|
-
}, function (
|
|
41
|
+
}, function (_api) {
|
|
33
42
|
var _useEditorToolbar = useEditorToolbar(),
|
|
34
43
|
editorViewMode = _useEditorToolbar.editorViewMode,
|
|
35
44
|
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference,
|
|
@@ -51,6 +60,7 @@ var usePluginState = conditionalHooksFactory(function () {
|
|
|
51
60
|
};
|
|
52
61
|
});
|
|
53
62
|
export var Section = function Section(_ref) {
|
|
63
|
+
var _api$toolbar$actions$, _api$toolbar;
|
|
54
64
|
var children = _ref.children,
|
|
55
65
|
parents = _ref.parents,
|
|
56
66
|
api = _ref.api,
|
|
@@ -66,7 +76,8 @@ export var Section = function Section(_ref) {
|
|
|
66
76
|
var toolbar = parents.find(function (parent) {
|
|
67
77
|
return parent.type === 'toolbar';
|
|
68
78
|
});
|
|
69
|
-
|
|
79
|
+
var contextualFormattingEnabled = (_api$toolbar$actions$ = api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.contextualFormattingMode()) !== null && _api$toolbar$actions$ !== void 0 ? _api$toolbar$actions$ : 'always-pinned';
|
|
80
|
+
if (isSharedSection && !shouldShowSection(editorViewMode, toolbar, editorToolbarDockingPreference, contextualFormattingEnabled, disableSelectionToolbar)) {
|
|
70
81
|
return null;
|
|
71
82
|
}
|
|
72
83
|
var isFullPage = editorAppearance === 'full-page';
|
|
@@ -5,7 +5,7 @@ import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
|
5
5
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
6
6
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
8
|
-
import { EditorToolbarProvider, EditorToolbarUIProvider } from '@atlaskit/editor-common/toolbar';
|
|
8
|
+
import { EditorToolbarProvider, EditorToolbarUIProvider, shouldShowSelectionToolbar } from '@atlaskit/editor-common/toolbar';
|
|
9
9
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
10
10
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
11
11
|
import { calculateToolbarPositionTrackHead, calculateToolbarPositionOnCellSelection } from '@atlaskit/editor-common/utils';
|
|
@@ -99,7 +99,7 @@ var useOnPositionCalculated = conditionalHooksFactory(function () {
|
|
|
99
99
|
return onPositionCalculated;
|
|
100
100
|
});
|
|
101
101
|
export var SelectionToolbar = function SelectionToolbar(_ref) {
|
|
102
|
-
var _api$toolbar;
|
|
102
|
+
var _api$toolbar$actions$, _api$toolbar, _api$toolbar2;
|
|
103
103
|
var api = _ref.api,
|
|
104
104
|
editorView = _ref.editorView,
|
|
105
105
|
mountPoint = _ref.mountPoint,
|
|
@@ -111,8 +111,10 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
|
|
|
111
111
|
shouldShowToolbar = _usePluginState.shouldShowToolbar,
|
|
112
112
|
editorViewMode = _usePluginState.editorViewMode,
|
|
113
113
|
selection = _usePluginState.selection;
|
|
114
|
+
var contextualFormattingEnabled = (_api$toolbar$actions$ = api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.contextualFormattingMode()) !== null && _api$toolbar$actions$ !== void 0 ? _api$toolbar$actions$ : 'always-pinned';
|
|
115
|
+
var selectionToolbarConfigEnabled = shouldShowSelectionToolbar(contextualFormattingEnabled, editorToolbarDockingPreference);
|
|
114
116
|
var intl = useIntl();
|
|
115
|
-
var components = api === null || api === void 0 || (_api$
|
|
117
|
+
var components = api === null || api === void 0 || (_api$toolbar2 = api.toolbar) === null || _api$toolbar2 === void 0 ? void 0 : _api$toolbar2.actions.getComponents();
|
|
116
118
|
var toolbar = components === null || components === void 0 ? void 0 : components.find(function (component) {
|
|
117
119
|
return isToolbarComponent(component);
|
|
118
120
|
});
|
|
@@ -127,7 +129,7 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
|
|
|
127
129
|
var isAllSelection = !editorView.state.selection.empty && editorView.state.selection instanceof AllSelection;
|
|
128
130
|
var isCellSelection = !editorView.state.selection.empty && '$anchorCell' in editorView.state.selection;
|
|
129
131
|
var onPositionCalculated = useOnPositionCalculated(editorView);
|
|
130
|
-
if (expValEquals('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) &&
|
|
132
|
+
if (expValEquals('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && selectionToolbarConfigEnabled && disableSelectionToolbarWhenPinned || !components || !toolbar) {
|
|
131
133
|
return null;
|
|
132
134
|
}
|
|
133
135
|
if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || (fg('platform_editor_toolbar_aifc_user_intent_fix') ?
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-toolbar",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"description": "Toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"@atlaskit/editor-toolbar-model": "^0.2.0",
|
|
41
41
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
43
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
43
|
+
"@atlaskit/tmp-editor-statsig": "^16.3.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"bind-event-listener": "^3.0.0",
|
|
46
46
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/editor-common": "^110.
|
|
49
|
+
"@atlaskit/editor-common": "^110.50.0",
|
|
50
50
|
"react": "^18.2.0"
|
|
51
51
|
},
|
|
52
52
|
"platform-feature-flags": {
|
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
"platform_editor_toolbar_aifc_placement_config": {
|
|
60
60
|
"type": "boolean"
|
|
61
61
|
},
|
|
62
|
+
"platform_editor_toolbar_aifc_placement_overridden": {
|
|
63
|
+
"type": "boolean"
|
|
64
|
+
},
|
|
62
65
|
"platform_editor_toolbar_aifc_responsive_improve": {
|
|
63
66
|
"type": "boolean"
|
|
64
67
|
},
|