@atlaskit/editor-plugin-floating-toolbar 0.7.28 → 0.8.0

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,17 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#68277](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68277) [`fe0abf4abc01`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fe0abf4abc01) - Enable the selection toolbar to work with live pages view mode
8
+
9
+ ## 0.7.29
10
+
11
+ ### Patch Changes
12
+
13
+ - [#67948](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67948) [`28fcdf6793a4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/28fcdf6793a4) - Expand/collapse for panel and table color pickers
14
+
3
15
  ## 0.7.28
4
16
 
5
17
  ### Patch Changes
@@ -194,9 +194,10 @@ function ContentComponent(_ref5) {
194
194
  providerFactory = _ref5.providerFactory,
195
195
  dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
196
196
  var featureFlags = (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f = pluginInjectionApi.featureFlags) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.sharedState.currentState()) || {};
197
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorDisabled']),
197
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode']),
198
198
  floatingToolbarState = _useSharedPluginState.floatingToolbarState,
199
- editorDisabledState = _useSharedPluginState.editorDisabledState;
199
+ editorDisabledState = _useSharedPluginState.editorDisabledState,
200
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
200
201
  var _ref6 = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {},
201
202
  configWithNodeInfo = _ref6.configWithNodeInfo,
202
203
  floatingToolbarData = _ref6.floatingToolbarData;
@@ -232,7 +233,9 @@ function ContentComponent(_ref5) {
232
233
  _config$mediaAssistiv = config.mediaAssistiveMessage,
233
234
  mediaAssistiveMessage = _config$mediaAssistiv === void 0 ? '' : _config$mediaAssistiv;
234
235
  var targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
235
- if (!targetRef || editorDisabledState && editorDisabledState.editorDisabled) {
236
+ var isEditorDisabled = editorDisabledState && editorDisabledState.editorDisabled;
237
+ var isInViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
238
+ if (!targetRef || isEditorDisabled && !isInViewMode) {
236
239
  return null;
237
240
  }
238
241
  var customPositionCalculation;
@@ -175,6 +175,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
175
175
  return (0, _react2.jsx)(_uiMenu.ColorPickerButton, {
176
176
  skipFocusButtonAfterPick: true,
177
177
  key: idx,
178
+ isAriaExpanded: item.isAriaExpanded,
178
179
  title: item.title,
179
180
  onChange: function onChange(selected) {
180
181
  dispatchCommand(item.onChange(selected));
@@ -184,8 +184,9 @@ function ContentComponent({
184
184
  const featureFlags = (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.featureFlags) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.sharedState.currentState()) || {};
185
185
  const {
186
186
  floatingToolbarState,
187
- editorDisabledState
188
- } = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled']);
187
+ editorDisabledState,
188
+ editorViewModeState
189
+ } = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode']);
189
190
  const {
190
191
  configWithNodeInfo,
191
192
  floatingToolbarData
@@ -220,7 +221,9 @@ function ContentComponent({
220
221
  mediaAssistiveMessage = ''
221
222
  } = config;
222
223
  const targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
223
- if (!targetRef || editorDisabledState && editorDisabledState.editorDisabled) {
224
+ const isEditorDisabled = editorDisabledState && editorDisabledState.editorDisabled;
225
+ const isInViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
226
+ if (!targetRef || isEditorDisabled && !isInViewMode) {
224
227
  return null;
225
228
  }
226
229
  let customPositionCalculation;
@@ -141,6 +141,7 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
141
141
  return jsx(ColorPickerButton, {
142
142
  skipFocusButtonAfterPick: true,
143
143
  key: idx,
144
+ isAriaExpanded: item.isAriaExpanded,
144
145
  title: item.title,
145
146
  onChange: selected => {
146
147
  dispatchCommand(item.onChange(selected));
@@ -185,9 +185,10 @@ function ContentComponent(_ref5) {
185
185
  providerFactory = _ref5.providerFactory,
186
186
  dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
187
187
  var featureFlags = (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f = pluginInjectionApi.featureFlags) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.sharedState.currentState()) || {};
188
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled']),
188
+ var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode']),
189
189
  floatingToolbarState = _useSharedPluginState.floatingToolbarState,
190
- editorDisabledState = _useSharedPluginState.editorDisabledState;
190
+ editorDisabledState = _useSharedPluginState.editorDisabledState,
191
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
191
192
  var _ref6 = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {},
192
193
  configWithNodeInfo = _ref6.configWithNodeInfo,
193
194
  floatingToolbarData = _ref6.floatingToolbarData;
@@ -223,7 +224,9 @@ function ContentComponent(_ref5) {
223
224
  _config$mediaAssistiv = config.mediaAssistiveMessage,
224
225
  mediaAssistiveMessage = _config$mediaAssistiv === void 0 ? '' : _config$mediaAssistiv;
225
226
  var targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
226
- if (!targetRef || editorDisabledState && editorDisabledState.editorDisabled) {
227
+ var isEditorDisabled = editorDisabledState && editorDisabledState.editorDisabled;
228
+ var isInViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
229
+ if (!targetRef || isEditorDisabled && !isInViewMode) {
227
230
  return null;
228
231
  }
229
232
  var customPositionCalculation;
@@ -166,6 +166,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
166
166
  return jsx(ColorPickerButton, {
167
167
  skipFocusButtonAfterPick: true,
168
168
  key: idx,
169
+ isAriaExpanded: item.isAriaExpanded,
169
170
  title: item.title,
170
171
  onChange: function onChange(selected) {
171
172
  dispatchCommand(item.onChange(selected));
@@ -3,6 +3,7 @@ import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
3
3
  import type { CopyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
4
4
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
5
  import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
6
+ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
6
7
  import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
7
8
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
8
9
  import type { Node } from '@atlaskit/editor-prosemirror/model';
@@ -30,7 +31,8 @@ export type FloatingToolbarPlugin = NextEditorPlugin<'floatingToolbar', {
30
31
  OptionalPlugin<ContextPanelPlugin>,
31
32
  OptionalPlugin<ExtensionPlugin>,
32
33
  CopyButtonPlugin,
33
- EditorDisabledPlugin
34
+ EditorDisabledPlugin,
35
+ OptionalPlugin<EditorViewModePlugin>
34
36
  ];
35
37
  actions: {
36
38
  forceFocusSelector: ForceFocusSelector;
@@ -3,6 +3,7 @@ import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
3
3
  import type { CopyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
4
4
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
5
  import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
6
+ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
6
7
  import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
7
8
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
8
9
  import type { Node } from '@atlaskit/editor-prosemirror/model';
@@ -30,7 +31,8 @@ export type FloatingToolbarPlugin = NextEditorPlugin<'floatingToolbar', {
30
31
  OptionalPlugin<ContextPanelPlugin>,
31
32
  OptionalPlugin<ExtensionPlugin>,
32
33
  CopyButtonPlugin,
33
- EditorDisabledPlugin
34
+ EditorDisabledPlugin,
35
+ OptionalPlugin<EditorViewModePlugin>
34
36
  ];
35
37
  actions: {
36
38
  forceFocusSelector: ForceFocusSelector;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "0.7.28",
3
+ "version": "0.8.0",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,6 +34,7 @@
34
34
  "@atlaskit/editor-plugin-copy-button": "^1.0.0",
35
35
  "@atlaskit/editor-plugin-decorations": "^0.2.0",
36
36
  "@atlaskit/editor-plugin-editor-disabled": "^0.2.0",
37
+ "@atlaskit/editor-plugin-editor-viewmode": "^0.1.0",
37
38
  "@atlaskit/editor-plugin-extension": "^0.6.0",
38
39
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
39
40
  "@atlaskit/editor-plugin-table": "^7.0.0",