@atlaskit/editor-plugin-toolbar 3.4.18 → 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 CHANGED
@@ -1,5 +1,24 @@
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
+
11
+ ## 3.5.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`82d57d01a0f61`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/82d57d01a0f61) -
16
+ Distinguish between collab offline and internet offline cases for connectivity mode
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 3.4.18
4
23
 
5
24
  ### Patch 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;
@@ -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 ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === _toolbar.TOOLBARS.INLINE_TEXT_TOOLBAR && toolbarDocking !== 'top') {
30
- return true;
31
- }
32
- if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === _toolbar.TOOLBARS.PRIMARY_TOOLBAR && toolbarDocking !== 'none') {
33
- return true;
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 (api) {
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
- if (isSharedSection && !shouldShowSection(editorViewMode, toolbar, editorToolbarDockingPreference, disableSelectionToolbar)) {
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';
@@ -16,6 +16,7 @@ var _toolbar = require("@atlaskit/editor-common/toolbar");
16
16
  var _ui = require("@atlaskit/editor-common/ui");
17
17
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
18
18
  var _utils = require("@atlaskit/editor-common/utils");
19
+ var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
19
20
  var _state = require("@atlaskit/editor-prosemirror/state");
20
21
  var _editorToolbar = require("@atlaskit/editor-toolbar");
21
22
  var _editorToolbarModel = require("@atlaskit/editor-toolbar-model");
@@ -106,7 +107,7 @@ var useOnPositionCalculated = (0, _platformFeatureFlagsReact.conditionalHooksFac
106
107
  return onPositionCalculated;
107
108
  });
108
109
  var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref) {
109
- var _api$toolbar;
110
+ var _api$toolbar$actions$, _api$toolbar, _api$toolbar2;
110
111
  var api = _ref.api,
111
112
  editorView = _ref.editorView,
112
113
  mountPoint = _ref.mountPoint,
@@ -118,8 +119,10 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
118
119
  shouldShowToolbar = _usePluginState.shouldShowToolbar,
119
120
  editorViewMode = _usePluginState.editorViewMode,
120
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);
121
124
  var intl = (0, _reactIntlNext.useIntl)();
122
- var components = api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.getComponents();
125
+ var components = api === null || api === void 0 || (_api$toolbar2 = api.toolbar) === null || _api$toolbar2 === void 0 ? void 0 : _api$toolbar2.actions.getComponents();
123
126
  var toolbar = components === null || components === void 0 ? void 0 : components.find(function (component) {
124
127
  return isToolbarComponent(component);
125
128
  });
@@ -129,12 +132,12 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
129
132
  var _useToolbarUI = (0, _editorToolbar.useToolbarUI)(),
130
133
  isDisabled = _useToolbarUI.isDisabled;
131
134
  var patch6Enabled = (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_6', 'isEnabled', true);
132
- var isOffline = connectivityStateMode === 'offline';
135
+ var isOffline = (0, _editorPluginConnectivity.isOfflineMode)(connectivityStateMode);
133
136
  var isTextSelection = !editorView.state.selection.empty && editorView.state.selection instanceof _state.TextSelection;
134
137
  var isAllSelection = !editorView.state.selection.empty && editorView.state.selection instanceof _state.AllSelection;
135
138
  var isCellSelection = !editorView.state.selection.empty && '$anchorCell' in editorView.state.selection;
136
139
  var onPositionCalculated = useOnPositionCalculated(editorView);
137
- if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && editorToolbarDockingPreference === 'top' && disableSelectionToolbarWhenPinned || !components || !toolbar) {
140
+ if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && selectionToolbarConfigEnabled && disableSelectionToolbarWhenPinned || !components || !toolbar) {
138
141
  return null;
139
142
  }
140
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 ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.INLINE_TEXT_TOOLBAR && toolbarDocking !== 'top') {
23
- return true;
24
- }
25
- if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.PRIMARY_TOOLBAR && toolbarDocking !== 'none') {
26
- return true;
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), api => {
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
- if (isSharedSection && !shouldShowSection(editorViewMode, toolbar, editorToolbarDockingPreference, disableSelectionToolbar)) {
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,10 +5,11 @@ 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';
12
+ import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
12
13
  import { AllSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
13
14
  import { ToolbarSection, ToolbarButtonGroup, ToolbarDropdownItemSection, useToolbarUI } from '@atlaskit/editor-toolbar';
14
15
  import { ToolbarModelRenderer } from '@atlaskit/editor-toolbar-model';
@@ -100,7 +101,7 @@ export const SelectionToolbar = ({
100
101
  mountPoint,
101
102
  disableSelectionToolbarWhenPinned
102
103
  }) => {
103
- var _api$toolbar;
104
+ var _api$toolbar$actions$, _api$toolbar, _api$toolbar2;
104
105
  const {
105
106
  connectivityStateMode,
106
107
  editorToolbarDockingPreference,
@@ -110,8 +111,10 @@ export const SelectionToolbar = ({
110
111
  // @ts-ignore
111
112
  selection
112
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);
113
116
  const intl = useIntl();
114
- const components = api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.getComponents();
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();
115
118
  const toolbar = components === null || components === void 0 ? void 0 : components.find(component => isToolbarComponent(component));
116
119
  const keyboardNavigation = useMemo(() => {
117
120
  return getKeyboardNavigationConfig(editorView, intl, api);
@@ -120,12 +123,12 @@ export const SelectionToolbar = ({
120
123
  isDisabled
121
124
  } = useToolbarUI();
122
125
  const patch6Enabled = expValEquals('platform_editor_toolbar_aifc_patch_6', 'isEnabled', true);
123
- const isOffline = connectivityStateMode === 'offline';
126
+ const isOffline = isOfflineMode(connectivityStateMode);
124
127
  const isTextSelection = !editorView.state.selection.empty && editorView.state.selection instanceof TextSelection;
125
128
  const isAllSelection = !editorView.state.selection.empty && editorView.state.selection instanceof AllSelection;
126
129
  const isCellSelection = !editorView.state.selection.empty && '$anchorCell' in editorView.state.selection;
127
130
  const onPositionCalculated = useOnPositionCalculated(editorView);
128
- if (expValEquals('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && editorToolbarDockingPreference === 'top' && disableSelectionToolbarWhenPinned || !components || !toolbar) {
131
+ if (expValEquals('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && selectionToolbarConfigEnabled && disableSelectionToolbarWhenPinned || !components || !toolbar) {
129
132
  return null;
130
133
  }
131
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;
@@ -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 ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.INLINE_TEXT_TOOLBAR && toolbarDocking !== 'top') {
23
- return true;
24
- }
25
- if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === TOOLBARS.PRIMARY_TOOLBAR && toolbarDocking !== 'none') {
26
- return true;
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 (api) {
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
- if (isSharedSection && !shouldShowSection(editorViewMode, toolbar, editorToolbarDockingPreference, disableSelectionToolbar)) {
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,10 +5,11 @@ 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';
12
+ import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
12
13
  import { AllSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
13
14
  import { ToolbarSection, ToolbarButtonGroup, ToolbarDropdownItemSection, useToolbarUI } from '@atlaskit/editor-toolbar';
14
15
  import { ToolbarModelRenderer } from '@atlaskit/editor-toolbar-model';
@@ -98,7 +99,7 @@ var useOnPositionCalculated = conditionalHooksFactory(function () {
98
99
  return onPositionCalculated;
99
100
  });
100
101
  export var SelectionToolbar = function SelectionToolbar(_ref) {
101
- var _api$toolbar;
102
+ var _api$toolbar$actions$, _api$toolbar, _api$toolbar2;
102
103
  var api = _ref.api,
103
104
  editorView = _ref.editorView,
104
105
  mountPoint = _ref.mountPoint,
@@ -110,8 +111,10 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
110
111
  shouldShowToolbar = _usePluginState.shouldShowToolbar,
111
112
  editorViewMode = _usePluginState.editorViewMode,
112
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);
113
116
  var intl = useIntl();
114
- var components = api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.getComponents();
117
+ var components = api === null || api === void 0 || (_api$toolbar2 = api.toolbar) === null || _api$toolbar2 === void 0 ? void 0 : _api$toolbar2.actions.getComponents();
115
118
  var toolbar = components === null || components === void 0 ? void 0 : components.find(function (component) {
116
119
  return isToolbarComponent(component);
117
120
  });
@@ -121,12 +124,12 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
121
124
  var _useToolbarUI = useToolbarUI(),
122
125
  isDisabled = _useToolbarUI.isDisabled;
123
126
  var patch6Enabled = expValEquals('platform_editor_toolbar_aifc_patch_6', 'isEnabled', true);
124
- var isOffline = connectivityStateMode === 'offline';
127
+ var isOffline = isOfflineMode(connectivityStateMode);
125
128
  var isTextSelection = !editorView.state.selection.empty && editorView.state.selection instanceof TextSelection;
126
129
  var isAllSelection = !editorView.state.selection.empty && editorView.state.selection instanceof AllSelection;
127
130
  var isCellSelection = !editorView.state.selection.empty && '$anchorCell' in editorView.state.selection;
128
131
  var onPositionCalculated = useOnPositionCalculated(editorView);
129
- if (expValEquals('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && editorToolbarDockingPreference === 'top' && disableSelectionToolbarWhenPinned || !components || !toolbar) {
132
+ if (expValEquals('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && selectionToolbarConfigEnabled && disableSelectionToolbarWhenPinned || !components || !toolbar) {
130
133
  return null;
131
134
  }
132
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.4.18",
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",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@atlaskit/browser-apis": "^0.0.1",
32
32
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
33
- "@atlaskit/editor-plugin-connectivity": "^6.0.0",
33
+ "@atlaskit/editor-plugin-connectivity": "^6.1.0",
34
34
  "@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
35
35
  "@atlaskit/editor-plugin-selection": "^6.1.0",
36
36
  "@atlaskit/editor-plugin-user-intent": "^4.0.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.0.0",
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.46.0",
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
  },