@atlaskit/editor-plugin-floating-toolbar 4.1.18 → 4.2.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,23 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 4.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#164841](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/164841)
8
+ [`9c4d557d5f6b5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9c4d557d5f6b5) -
9
+ Update floating toolbar plugin to dispatch analytics events on dropdown click.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 4.1.19
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 4.1.18
4
22
 
5
23
  ### Patch Changes
@@ -332,6 +332,36 @@ function ContentComponent(_ref5) {
332
332
  supportsViewMode: true
333
333
  }, consolidatedOverflowDropdown]);
334
334
  }
335
+
336
+ // Apply analytics to dropdown
337
+ if (overflowDropdownItems.length > 0 && dispatchAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_editor_overflow_dropdown_click_analytics')) {
338
+ var _items3;
339
+ var currentItems = Array.isArray(items) ? items : (_items3 = items) === null || _items3 === void 0 ? void 0 : _items3(node);
340
+ var updatedItems = currentItems.map(function (item) {
341
+ if (item.type !== 'overflow-dropdown') {
342
+ return item;
343
+ }
344
+ var originalOnClick = item.onClick;
345
+ return _objectSpread(_objectSpread({}, item), {}, {
346
+ onClick: function onClick() {
347
+ var _pluginInjectionApi$e;
348
+ var editorContentMode = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 || (_pluginInjectionApi$e = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.mode;
349
+ dispatchAnalyticsEvent({
350
+ action: _analytics.ACTION.CLICKED,
351
+ actionSubject: _analytics.ACTION_SUBJECT.BUTTON,
352
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.FLOATING_TOOLBAR_OVERFLOW,
353
+ eventType: _analytics.EVENT_TYPE.UI,
354
+ attributes: {
355
+ editorContentMode: editorContentMode
356
+ }
357
+ });
358
+ // Call original onClick if it exists
359
+ originalOnClick === null || originalOnClick === void 0 || originalOnClick();
360
+ }
361
+ });
362
+ });
363
+ items = updatedItems;
364
+ }
335
365
  }
336
366
  var customPositionCalculation;
337
367
  var toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.copyButton) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.hoverDecoration);
@@ -16,8 +16,8 @@ var _react = _interopRequireWildcard(require("react"));
16
16
  var _react2 = require("@emotion/react");
17
17
  var _ui = require("@atlaskit/editor-common/ui");
18
18
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
19
- var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
20
- var _chevronDown2 = _interopRequireDefault(require("@atlaskit/icon/utility/chevron-down"));
19
+ var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
20
+ var _chevronDown2 = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
21
21
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
22
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
23
23
  var _Divider = require("./Divider");
@@ -46,11 +46,12 @@ var CompositeIcon = function CompositeIcon(_ref) {
46
46
  css: iconGroup
47
47
  }, icon, (0, _react2.jsx)("span", {
48
48
  css: dropdownExpandContainer
49
- }, (0, _react2.jsx)(_chevronDown2.default, {
49
+ }, (0, _react2.jsx)(_chevronDown.default, {
50
50
  color: "currentColor",
51
51
  spacing: "spacious",
52
52
  label: "Expand dropdown menu",
53
- LEGACY_fallbackIcon: _chevronDown.default
53
+ LEGACY_fallbackIcon: _chevronDown2.default,
54
+ size: "small"
54
55
  })));
55
56
  };
56
57
  // eslint-disable-next-line @repo/internal/react/no-class-components
@@ -182,11 +183,12 @@ var Dropdown = exports.default = /*#__PURE__*/function (_Component) {
182
183
  testId: buttonTestId,
183
184
  iconAfter: (0, _react2.jsx)("span", {
184
185
  css: dropdownExpandContainer
185
- }, (0, _react2.jsx)(_chevronDown2.default, {
186
+ }, (0, _react2.jsx)(_chevronDown.default, {
186
187
  color: "currentColor",
187
188
  spacing: "spacious",
188
189
  label: "Expand dropdown menu",
189
- LEGACY_fallbackIcon: _chevronDown.default
190
+ LEGACY_fallbackIcon: _chevronDown2.default,
191
+ size: "small"
190
192
  })),
191
193
  icon: iconBefore,
192
194
  onClick: this.toggleOpen,
@@ -6,12 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.ExpandButton = ExpandButton;
8
8
  var _react = _interopRequireDefault(require("react"));
9
- var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/utility/chevron-right"));
9
+ var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/core/chevron-right"));
10
10
  var _compiled = require("@atlaskit/primitives/compiled");
11
11
  function ExpandButton() {
12
12
  return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
13
13
  paddingInline: "space.075"
14
14
  }, /*#__PURE__*/_react.default.createElement(_chevronRight.default, {
15
- label: 'Edit'
15
+ label: 'Edit',
16
+ size: "small"
16
17
  }));
17
18
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import camelCase from 'lodash/camelCase';
3
- import { ACTION, ACTION_SUBJECT, CONTENT_COMPONENT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { isSSR } from '@atlaskit/editor-common/core-utils';
5
5
  import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
6
6
  import {
@@ -317,6 +317,37 @@ export function ContentComponent({
317
317
  supportsViewMode: true
318
318
  }, consolidatedOverflowDropdown];
319
319
  }
320
+
321
+ // Apply analytics to dropdown
322
+ if (overflowDropdownItems.length > 0 && dispatchAnalyticsEvent && fg('platform_editor_overflow_dropdown_click_analytics')) {
323
+ var _items3;
324
+ const currentItems = Array.isArray(items) ? items : (_items3 = items) === null || _items3 === void 0 ? void 0 : _items3(node);
325
+ const updatedItems = currentItems.map(item => {
326
+ if (item.type !== 'overflow-dropdown') {
327
+ return item;
328
+ }
329
+ const originalOnClick = item.onClick;
330
+ return {
331
+ ...item,
332
+ onClick: () => {
333
+ var _pluginInjectionApi$e, _pluginInjectionApi$e2;
334
+ const editorContentMode = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : (_pluginInjectionApi$e2 = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode;
335
+ dispatchAnalyticsEvent({
336
+ action: ACTION.CLICKED,
337
+ actionSubject: ACTION_SUBJECT.BUTTON,
338
+ actionSubjectId: ACTION_SUBJECT_ID.FLOATING_TOOLBAR_OVERFLOW,
339
+ eventType: EVENT_TYPE.UI,
340
+ attributes: {
341
+ editorContentMode
342
+ }
343
+ });
344
+ // Call original onClick if it exists
345
+ originalOnClick === null || originalOnClick === void 0 ? void 0 : originalOnClick();
346
+ }
347
+ };
348
+ });
349
+ items = updatedItems;
350
+ }
320
351
  }
321
352
  let customPositionCalculation;
322
353
  const toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.copyButton) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.hoverDecoration);
@@ -11,8 +11,8 @@ import React, { Component } from 'react';
11
11
  import { css, jsx } from '@emotion/react';
12
12
  import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
13
13
  import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
14
+ import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
14
15
  import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
15
- import ChevronDownIcon from '@atlaskit/icon/utility/chevron-down';
16
16
  import { fg } from '@atlaskit/platform-feature-flags';
17
17
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
18
18
  import { Divider } from './Divider';
@@ -37,7 +37,8 @@ const CompositeIcon = ({
37
37
  color: "currentColor",
38
38
  spacing: "spacious",
39
39
  label: "Expand dropdown menu",
40
- LEGACY_fallbackIcon: ExpandIcon
40
+ LEGACY_fallbackIcon: ExpandIcon,
41
+ size: "small"
41
42
  })));
42
43
  // eslint-disable-next-line @repo/internal/react/no-class-components
43
44
  export default class Dropdown extends Component {
@@ -168,7 +169,8 @@ export default class Dropdown extends Component {
168
169
  color: "currentColor",
169
170
  spacing: "spacious",
170
171
  label: "Expand dropdown menu",
171
- LEGACY_fallbackIcon: ExpandIcon
172
+ LEGACY_fallbackIcon: ExpandIcon,
173
+ size: "small"
172
174
  })),
173
175
  icon: iconBefore,
174
176
  onClick: this.toggleOpen,
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
- import Icon from '@atlaskit/icon/utility/chevron-right';
2
+ import Icon from '@atlaskit/icon/core/chevron-right';
3
3
  import { Box } from '@atlaskit/primitives/compiled';
4
4
  export function ExpandButton() {
5
5
  return /*#__PURE__*/React.createElement(Box, {
6
6
  paddingInline: "space.075"
7
7
  }, /*#__PURE__*/React.createElement(Icon, {
8
- label: 'Edit'
8
+ label: 'Edit',
9
+ size: "small"
9
10
  }));
10
11
  }
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import React from 'react';
6
6
  import camelCase from 'lodash/camelCase';
7
- import { ACTION, ACTION_SUBJECT, CONTENT_COMPONENT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
7
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
8
8
  import { isSSR } from '@atlaskit/editor-common/core-utils';
9
9
  import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
10
10
  import {
@@ -323,6 +323,36 @@ export function ContentComponent(_ref5) {
323
323
  supportsViewMode: true
324
324
  }, consolidatedOverflowDropdown]);
325
325
  }
326
+
327
+ // Apply analytics to dropdown
328
+ if (overflowDropdownItems.length > 0 && dispatchAnalyticsEvent && fg('platform_editor_overflow_dropdown_click_analytics')) {
329
+ var _items3;
330
+ var currentItems = Array.isArray(items) ? items : (_items3 = items) === null || _items3 === void 0 ? void 0 : _items3(node);
331
+ var updatedItems = currentItems.map(function (item) {
332
+ if (item.type !== 'overflow-dropdown') {
333
+ return item;
334
+ }
335
+ var originalOnClick = item.onClick;
336
+ return _objectSpread(_objectSpread({}, item), {}, {
337
+ onClick: function onClick() {
338
+ var _pluginInjectionApi$e;
339
+ var editorContentMode = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 || (_pluginInjectionApi$e = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.mode;
340
+ dispatchAnalyticsEvent({
341
+ action: ACTION.CLICKED,
342
+ actionSubject: ACTION_SUBJECT.BUTTON,
343
+ actionSubjectId: ACTION_SUBJECT_ID.FLOATING_TOOLBAR_OVERFLOW,
344
+ eventType: EVENT_TYPE.UI,
345
+ attributes: {
346
+ editorContentMode: editorContentMode
347
+ }
348
+ });
349
+ // Call original onClick if it exists
350
+ originalOnClick === null || originalOnClick === void 0 || originalOnClick();
351
+ }
352
+ });
353
+ });
354
+ items = updatedItems;
355
+ }
326
356
  }
327
357
  var customPositionCalculation;
328
358
  var toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.copyButton) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.hoverDecoration);
@@ -20,8 +20,8 @@ import React, { Component } from 'react';
20
20
  import { css, jsx } from '@emotion/react';
21
21
  import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
22
22
  import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
23
+ import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
23
24
  import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
24
- import ChevronDownIcon from '@atlaskit/icon/utility/chevron-down';
25
25
  import { fg } from '@atlaskit/platform-feature-flags';
26
26
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
27
27
  import { Divider } from './Divider';
@@ -46,7 +46,8 @@ var CompositeIcon = function CompositeIcon(_ref) {
46
46
  color: "currentColor",
47
47
  spacing: "spacious",
48
48
  label: "Expand dropdown menu",
49
- LEGACY_fallbackIcon: ExpandIcon
49
+ LEGACY_fallbackIcon: ExpandIcon,
50
+ size: "small"
50
51
  })));
51
52
  };
52
53
  // eslint-disable-next-line @repo/internal/react/no-class-components
@@ -182,7 +183,8 @@ var Dropdown = /*#__PURE__*/function (_Component) {
182
183
  color: "currentColor",
183
184
  spacing: "spacious",
184
185
  label: "Expand dropdown menu",
185
- LEGACY_fallbackIcon: ExpandIcon
186
+ LEGACY_fallbackIcon: ExpandIcon,
187
+ size: "small"
186
188
  })),
187
189
  icon: iconBefore,
188
190
  onClick: this.toggleOpen,
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
- import Icon from '@atlaskit/icon/utility/chevron-right';
2
+ import Icon from '@atlaskit/icon/core/chevron-right';
3
3
  import { Box } from '@atlaskit/primitives/compiled';
4
4
  export function ExpandButton() {
5
5
  return /*#__PURE__*/React.createElement(Box, {
6
6
  paddingInline: "space.075"
7
7
  }, /*#__PURE__*/React.createElement(Icon, {
8
- label: 'Edit'
8
+ label: 'Edit',
9
+ size: "small"
9
10
  }));
10
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "4.1.18",
3
+ "version": "4.2.0",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,7 +28,7 @@
28
28
  "@atlaskit/adf-utils": "^19.20.0",
29
29
  "@atlaskit/button": "^23.2.0",
30
30
  "@atlaskit/checkbox": "^17.1.0",
31
- "@atlaskit/editor-common": "^106.3.0",
31
+ "@atlaskit/editor-common": "^106.6.0",
32
32
  "@atlaskit/editor-palette": "^2.1.0",
33
33
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
34
34
  "@atlaskit/editor-plugin-context-panel": "^4.1.0",
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/editor-plugin-emoji": "^3.7.0",
40
40
  "@atlaskit/editor-plugin-extension": "^5.5.0",
41
41
  "@atlaskit/editor-plugin-interaction": "^2.0.0",
42
- "@atlaskit/editor-plugin-table": "^10.11.0",
42
+ "@atlaskit/editor-plugin-table": "^10.12.0",
43
43
  "@atlaskit/editor-plugin-user-intent": "^0.1.0",
44
44
  "@atlaskit/editor-prosemirror": "7.0.0",
45
45
  "@atlaskit/emoji": "^69.3.0",
@@ -48,9 +48,9 @@
48
48
  "@atlaskit/modal-dialog": "^14.2.0",
49
49
  "@atlaskit/platform-feature-flags": "^1.1.0",
50
50
  "@atlaskit/primitives": "^14.8.0",
51
- "@atlaskit/select": "^20.6.0",
51
+ "@atlaskit/select": "^20.7.0",
52
52
  "@atlaskit/theme": "^18.0.0",
53
- "@atlaskit/tmp-editor-statsig": "^5.14.0",
53
+ "@atlaskit/tmp-editor-statsig": "^6.2.0",
54
54
  "@atlaskit/tokens": "^5.1.0",
55
55
  "@atlaskit/tooltip": "^20.3.0",
56
56
  "@babel/runtime": "^7.0.0",
@@ -151,6 +151,9 @@
151
151
  },
152
152
  "platform_editor_controls_patch_12": {
153
153
  "type": "boolean"
154
+ },
155
+ "platform_editor_overflow_dropdown_click_analytics": {
156
+ "type": "boolean"
154
157
  }
155
158
  }
156
159
  }