@atlaskit/editor-plugin-selection-toolbar 3.4.0 → 3.4.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,15 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 3.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#139189](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/139189)
8
+ [`33e0a9b6291ae`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/33e0a9b6291ae) -
9
+ [ux] When table is selected via drag handle, we show Table floating controls toolbar. If the table
10
+ selected via other means, we show the Text Formatting toolbar.
11
+ - Updated dependencies
12
+
3
13
  ## 3.4.0
4
14
 
5
15
  ### Minor Changes
@@ -217,6 +217,14 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
217
217
  // do not show the toolbar.
218
218
  return;
219
219
  }
220
+ if (isCellSelection && isEditorControlsEnabled && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_5')) {
221
+ var _api$blockControls;
222
+ var isSelectedViaDragHandle = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.isSelectedViaDragHandle;
223
+ if (isSelectedViaDragHandle) {
224
+ return;
225
+ }
226
+ }
227
+
220
228
  // Resolve the selectionToolbarHandlers to a list of SelectionToolbarGroups
221
229
  // and filter out any handlers which returned undefined
222
230
  var resolved = __selectionToolbarHandlers.map(function (selectionToolbarHandler) {
@@ -13,10 +13,12 @@ var React = _react;
13
13
  var _runtime = require("@compiled/react/runtime");
14
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
15
  var _reactIntlNext = require("react-intl-next");
16
+ var _analytics = require("@atlaskit/editor-common/analytics");
16
17
  var _keymaps = require("@atlaskit/editor-common/keymaps");
17
18
  var _messages = _interopRequireDefault(require("@atlaskit/editor-common/messages"));
18
19
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
19
20
  var _showMoreHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/show-more-horizontal"));
21
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
22
  var _overflowToolbarConfig = require("./overflow-toolbar-config");
21
23
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
24
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -47,6 +49,18 @@ function PrimaryToolbarComponent(_ref) {
47
49
  var item = _ref2.item;
48
50
  item === null || item === void 0 || (_item$onClick = item.onClick) === null || _item$onClick === void 0 || _item$onClick.call(item);
49
51
  }, []);
52
+ (0, _react.useEffect)(function () {
53
+ if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4')) {
54
+ var _api$analytics;
55
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
56
+ action: _analytics.ACTION.RENDERED,
57
+ actionSubject: _analytics.ACTION_SUBJECT.TOOLBAR,
58
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.DOCKED_PRIMARY_TOOLBAR,
59
+ eventType: _analytics.EVENT_TYPE.UI
60
+ });
61
+ }
62
+ // eslint-disable-next-line react-hooks/exhaustive-deps
63
+ }, []);
50
64
  return /*#__PURE__*/React.createElement(_uiMenu.DropdownMenu, {
51
65
  isOpen: isOpen,
52
66
  onOpenChange: function onOpenChange(attrs) {
@@ -213,6 +213,14 @@ export const selectionToolbarPlugin = ({
213
213
  // do not show the toolbar.
214
214
  return;
215
215
  }
216
+ if (isCellSelection && isEditorControlsEnabled && fg('platform_editor_controls_patch_5')) {
217
+ var _api$blockControls, _api$blockControls$sh;
218
+ const isSelectedViaDragHandle = api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : (_api$blockControls$sh = _api$blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.isSelectedViaDragHandle;
219
+ if (isSelectedViaDragHandle) {
220
+ return;
221
+ }
222
+ }
223
+
216
224
  // Resolve the selectionToolbarHandlers to a list of SelectionToolbarGroups
217
225
  // and filter out any handlers which returned undefined
218
226
  const resolved = __selectionToolbarHandlers.map(selectionToolbarHandler => selectionToolbarHandler(state, intl, providerFactory)).filter(resolved => resolved !== undefined);
@@ -2,12 +2,14 @@
2
2
  import "./PrimaryToolbarComponent.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
- import { useCallback, useMemo, useState } from 'react';
5
+ import { useCallback, useEffect, useMemo, useState } from 'react';
6
6
  import { useIntl } from 'react-intl-next';
7
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
7
8
  import { addLink, getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
8
9
  import messages from '@atlaskit/editor-common/messages';
9
10
  import { ArrowKeyNavigationType, DropdownMenu, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
10
11
  import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
11
13
  import { getOverflowPrimaryToolbarConfig } from './overflow-toolbar-config';
12
14
  const DROPDOWN_WIDTH = 240;
13
15
  const buttonStyles = null;
@@ -33,6 +35,18 @@ export function PrimaryToolbarComponent({
33
35
  var _item$onClick;
34
36
  item === null || item === void 0 ? void 0 : (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item);
35
37
  }, []);
38
+ useEffect(() => {
39
+ if (fg('platform_editor_controls_patch_4')) {
40
+ var _api$analytics;
41
+ api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent({
42
+ action: ACTION.RENDERED,
43
+ actionSubject: ACTION_SUBJECT.TOOLBAR,
44
+ actionSubjectId: ACTION_SUBJECT_ID.DOCKED_PRIMARY_TOOLBAR,
45
+ eventType: EVENT_TYPE.UI
46
+ });
47
+ }
48
+ // eslint-disable-next-line react-hooks/exhaustive-deps
49
+ }, []);
36
50
  return /*#__PURE__*/React.createElement(DropdownMenu, {
37
51
  isOpen: isOpen,
38
52
  onOpenChange: attrs => setIsOpen(attrs.isOpen),
@@ -210,6 +210,14 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
210
210
  // do not show the toolbar.
211
211
  return;
212
212
  }
213
+ if (isCellSelection && isEditorControlsEnabled && fg('platform_editor_controls_patch_5')) {
214
+ var _api$blockControls;
215
+ var isSelectedViaDragHandle = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.isSelectedViaDragHandle;
216
+ if (isSelectedViaDragHandle) {
217
+ return;
218
+ }
219
+ }
220
+
213
221
  // Resolve the selectionToolbarHandlers to a list of SelectionToolbarGroups
214
222
  // and filter out any handlers which returned undefined
215
223
  var resolved = __selectionToolbarHandlers.map(function (selectionToolbarHandler) {
@@ -3,12 +3,14 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import "./PrimaryToolbarComponent.compiled.css";
4
4
  import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
- import { useCallback, useMemo, useState } from 'react';
6
+ import { useCallback, useEffect, useMemo, useState } from 'react';
7
7
  import { useIntl } from 'react-intl-next';
8
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
8
9
  import { addLink, getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
9
10
  import messages from '@atlaskit/editor-common/messages';
10
11
  import { ArrowKeyNavigationType, DropdownMenu, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
11
12
  import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
12
14
  import { getOverflowPrimaryToolbarConfig } from './overflow-toolbar-config';
13
15
  var DROPDOWN_WIDTH = 240;
14
16
  var buttonStyles = null;
@@ -37,6 +39,18 @@ export function PrimaryToolbarComponent(_ref) {
37
39
  var item = _ref2.item;
38
40
  item === null || item === void 0 || (_item$onClick = item.onClick) === null || _item$onClick === void 0 || _item$onClick.call(item);
39
41
  }, []);
42
+ useEffect(function () {
43
+ if (fg('platform_editor_controls_patch_4')) {
44
+ var _api$analytics;
45
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
46
+ action: ACTION.RENDERED,
47
+ actionSubject: ACTION_SUBJECT.TOOLBAR,
48
+ actionSubjectId: ACTION_SUBJECT_ID.DOCKED_PRIMARY_TOOLBAR,
49
+ eventType: EVENT_TYPE.UI
50
+ });
51
+ }
52
+ // eslint-disable-next-line react-hooks/exhaustive-deps
53
+ }, []);
40
54
  return /*#__PURE__*/React.createElement(DropdownMenu, {
41
55
  isOpen: isOpen,
42
56
  onOpenChange: function onOpenChange(attrs) {
@@ -1,5 +1,6 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin, UserPreferencesProvider } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
+ import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
3
4
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
4
5
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
5
6
  import type { ToolbarDocking } from './types';
@@ -17,7 +18,8 @@ export type SelectionToolbarPlugin = NextEditorPlugin<'selectionToolbar', {
17
18
  dependencies: [
18
19
  OptionalPlugin<EditorViewModePlugin>,
19
20
  OptionalPlugin<PrimaryToolbarPlugin>,
20
- OptionalPlugin<AnalyticsPlugin>
21
+ OptionalPlugin<AnalyticsPlugin>,
22
+ OptionalPlugin<BlockControlsPlugin>
21
23
  ];
22
24
  actions?: {
23
25
  suppressToolbar?: () => boolean;
@@ -1,5 +1,6 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin, UserPreferencesProvider } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
+ import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
3
4
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
4
5
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
5
6
  import type { ToolbarDocking } from './types';
@@ -17,7 +18,8 @@ export type SelectionToolbarPlugin = NextEditorPlugin<'selectionToolbar', {
17
18
  dependencies: [
18
19
  OptionalPlugin<EditorViewModePlugin>,
19
20
  OptionalPlugin<PrimaryToolbarPlugin>,
20
- OptionalPlugin<AnalyticsPlugin>
21
+ OptionalPlugin<AnalyticsPlugin>,
22
+ OptionalPlugin<BlockControlsPlugin>
21
23
  ];
22
24
  actions?: {
23
25
  suppressToolbar?: () => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,16 +34,17 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/css": "^0.10.0",
37
- "@atlaskit/editor-common": "^103.4.0",
37
+ "@atlaskit/editor-common": "^103.7.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
39
+ "@atlaskit/editor-plugin-block-controls": "^3.10.0",
39
40
  "@atlaskit/editor-plugin-editor-viewmode": "^3.1.0",
40
41
  "@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
41
42
  "@atlaskit/editor-prosemirror": "7.0.0",
42
- "@atlaskit/icon": "^25.5.0",
43
- "@atlaskit/icon-lab": "^4.6.0",
43
+ "@atlaskit/icon": "^25.6.0",
44
+ "@atlaskit/icon-lab": "^4.8.0",
44
45
  "@atlaskit/menu": "^3.2.0",
45
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
46
- "@atlaskit/tmp-editor-statsig": "^4.6.0",
47
+ "@atlaskit/tmp-editor-statsig": "^4.8.0",
47
48
  "@atlaskit/tokens": "^4.7.0",
48
49
  "@babel/runtime": "^7.0.0",
49
50
  "bind-event-listener": "^3.0.0"
@@ -99,6 +100,9 @@
99
100
  },
100
101
  "platform_editor_controls_patch_4": {
101
102
  "type": "boolean"
103
+ },
104
+ "platform_editor_controls_patch_5": {
105
+ "type": "boolean"
102
106
  }
103
107
  }
104
108
  }