@atlaskit/editor-plugin-toolbar 2.1.0 → 2.1.3

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,29 @@
1
1
  # @atlaskit/editor-plugin-toolbar
2
2
 
3
+ ## 2.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`553afc302139b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/553afc302139b) -
8
+ Add analytic emitter component which fires an event when dropdowns are viewed
9
+ - Updated dependencies
10
+
11
+ ## 2.1.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [`30aad83e7ded7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/30aad83e7ded7) -
16
+ When editorViewMode is undefined, default to 'edit' as the plugin may not be present.
17
+ - Updated dependencies
18
+
19
+ ## 2.1.1
20
+
21
+ ### Patch Changes
22
+
23
+ - [`345a4e1939d12`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/345a4e1939d12) -
24
+ [ux] [ED-28733] Add responsiveness support for selection toolbar
25
+ - Updated dependencies
26
+
3
27
  ## 2.1.0
4
28
 
5
29
  ### Minor Changes
@@ -17,6 +17,9 @@
17
17
  "../src/**/examples.*"
18
18
  ],
19
19
  "references": [
20
+ {
21
+ "path": "../../editor-plugin-analytics/afm-cc/tsconfig.json"
22
+ },
20
23
  {
21
24
  "path": "../../editor-plugin-connectivity/afm-cc/tsconfig.json"
22
25
  },
@@ -122,6 +122,9 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
122
122
  contentComponent: !disableSelectionToolbar ? function (_ref2) {
123
123
  var editorView = _ref2.editorView,
124
124
  popupsMountPoint = _ref2.popupsMountPoint;
125
+ if (!editorView) {
126
+ return null;
127
+ }
125
128
  return /*#__PURE__*/_react.default.createElement(_SelectionToolbar.SelectionToolbar, {
126
129
  api: api,
127
130
  editorView: editorView,
@@ -106,10 +106,16 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
106
106
  }, /*#__PURE__*/_react.default.createElement(_toolbar.EditorToolbarProvider, {
107
107
  editorView: editorView,
108
108
  editorToolbarDockingPreference: editorToolbarDockingPreference,
109
- editorViewMode: editorViewMode
109
+ editorViewMode: (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_4', 'isEnabled', true) ? editorViewMode !== null && editorViewMode !== void 0 ? editorViewMode : 'edit' : editorViewMode
110
110
  }, /*#__PURE__*/_react.default.createElement(_toolbar.EditorToolbarUIProvider, {
111
111
  api: api,
112
112
  isDisabled: isOffline
113
+ // supress type checks for now
114
+ ,
115
+ fireAnalyticsEvent: (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_toolbar_analytic', 'isEnabled', true) ? function (payload) {
116
+ var _api$analytics;
117
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent(payload);
118
+ } : undefined
113
119
  }, /*#__PURE__*/_react.default.createElement(_editorToolbarModel.ToolbarModelRenderer, {
114
120
  toolbar: toolbar,
115
121
  components: components,
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.getToolbarComponents = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
+ var _analytics = require("@atlaskit/editor-common/analytics");
10
11
  var _toolbar = require("@atlaskit/editor-common/toolbar");
11
12
  var _editorToolbar = require("@atlaskit/editor-toolbar");
12
13
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
@@ -23,7 +24,8 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
23
24
  component: function component(_ref) {
24
25
  var children = _ref.children;
25
26
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.Toolbar, {
26
- label: _consts.SELECTION_TOOLBAR_LABEL
27
+ label: _consts.SELECTION_TOOLBAR_LABEL,
28
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.SELECTION_TOOLBAR
27
29
  }, children);
28
30
  }
29
31
  }, {
@@ -74,6 +76,10 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
74
76
  type: 'toolbar',
75
77
  key: _toolbar.TOOLBARS.PRIMARY_TOOLBAR,
76
78
  rank: _toolbar.TOOLBAR_RANK[_toolbar.TEXT_SECTION_COLLAPSED.key]
79
+ }, (0, _expValEquals.expValEquals)('platform_editor_aifc_selection_toolbar_responsive', 'isEnabled', true) && {
80
+ type: 'toolbar',
81
+ key: _toolbar.TOOLBARS.INLINE_TEXT_TOOLBAR,
82
+ rank: _toolbar.TOOLBAR_RANK[_toolbar.TEXT_SECTION_COLLAPSED.key]
77
83
  }],
78
84
  component: function component(_ref4) {
79
85
  var children = _ref4.children,
@@ -117,6 +117,9 @@ export const toolbarPlugin = ({
117
117
  editorView,
118
118
  popupsMountPoint
119
119
  }) => {
120
+ if (!editorView) {
121
+ return null;
122
+ }
120
123
  return /*#__PURE__*/React.createElement(SelectionToolbar, {
121
124
  api: api,
122
125
  editorView: editorView,
@@ -98,10 +98,16 @@ export const SelectionToolbar = ({
98
98
  }, /*#__PURE__*/React.createElement(EditorToolbarProvider, {
99
99
  editorView: editorView,
100
100
  editorToolbarDockingPreference: editorToolbarDockingPreference,
101
- editorViewMode: editorViewMode
101
+ editorViewMode: expValEquals('platform_editor_toolbar_aifc_patch_4', 'isEnabled', true) ? editorViewMode !== null && editorViewMode !== void 0 ? editorViewMode : 'edit' : editorViewMode
102
102
  }, /*#__PURE__*/React.createElement(EditorToolbarUIProvider, {
103
103
  api: api,
104
104
  isDisabled: isOffline
105
+ // supress type checks for now
106
+ ,
107
+ fireAnalyticsEvent: expValEquals('platform_editor_toolbar_aifc_toolbar_analytic', 'isEnabled', true) ? payload => {
108
+ var _api$analytics;
109
+ api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent(payload);
110
+ } : undefined
105
111
  }, /*#__PURE__*/React.createElement(ToolbarModelRenderer, {
106
112
  toolbar: toolbar,
107
113
  components: components,
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
2
3
  import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_PRIMARY_TOOLBAR, OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_MENU_PRIMARY_TOOLBAR, OVERFLOW_SECTION, OVERFLOW_SECTION_PRIMARY_TOOLBAR, OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_COLLAPSED_GROUP, TEXT_SECTION, TEXT_SECTION_COLLAPSED, TEXT_COLLAPSED_MENU, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
3
4
  import { PrimaryToolbar as PrimaryToolbarBase, Show, Toolbar } from '@atlaskit/editor-toolbar';
4
5
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -16,7 +17,8 @@ export const getToolbarComponents = (api, disableSelectionToolbar) => {
16
17
  children
17
18
  }) => {
18
19
  return /*#__PURE__*/React.createElement(Toolbar, {
19
- label: SELECTION_TOOLBAR_LABEL
20
+ label: SELECTION_TOOLBAR_LABEL,
21
+ actionSubjectId: ACTION_SUBJECT_ID.SELECTION_TOOLBAR
20
22
  }, children);
21
23
  }
22
24
  }, {
@@ -67,6 +69,10 @@ export const getToolbarComponents = (api, disableSelectionToolbar) => {
67
69
  type: 'toolbar',
68
70
  key: TOOLBARS.PRIMARY_TOOLBAR,
69
71
  rank: TOOLBAR_RANK[TEXT_SECTION_COLLAPSED.key]
72
+ }, expValEquals('platform_editor_aifc_selection_toolbar_responsive', 'isEnabled', true) && {
73
+ type: 'toolbar',
74
+ key: TOOLBARS.INLINE_TEXT_TOOLBAR,
75
+ rank: TOOLBAR_RANK[TEXT_SECTION_COLLAPSED.key]
70
76
  }],
71
77
  component: ({
72
78
  children,
@@ -115,6 +115,9 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
115
115
  contentComponent: !disableSelectionToolbar ? function (_ref2) {
116
116
  var editorView = _ref2.editorView,
117
117
  popupsMountPoint = _ref2.popupsMountPoint;
118
+ if (!editorView) {
119
+ return null;
120
+ }
118
121
  return /*#__PURE__*/React.createElement(SelectionToolbar, {
119
122
  api: api,
120
123
  editorView: editorView,
@@ -98,10 +98,16 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
98
98
  }, /*#__PURE__*/React.createElement(EditorToolbarProvider, {
99
99
  editorView: editorView,
100
100
  editorToolbarDockingPreference: editorToolbarDockingPreference,
101
- editorViewMode: editorViewMode
101
+ editorViewMode: expValEquals('platform_editor_toolbar_aifc_patch_4', 'isEnabled', true) ? editorViewMode !== null && editorViewMode !== void 0 ? editorViewMode : 'edit' : editorViewMode
102
102
  }, /*#__PURE__*/React.createElement(EditorToolbarUIProvider, {
103
103
  api: api,
104
104
  isDisabled: isOffline
105
+ // supress type checks for now
106
+ ,
107
+ fireAnalyticsEvent: expValEquals('platform_editor_toolbar_aifc_toolbar_analytic', 'isEnabled', true) ? function (payload) {
108
+ var _api$analytics;
109
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent(payload);
110
+ } : undefined
105
111
  }, /*#__PURE__*/React.createElement(ToolbarModelRenderer, {
106
112
  toolbar: toolbar,
107
113
  components: components,
@@ -1,5 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import React from 'react';
3
+ import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
3
4
  import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_PRIMARY_TOOLBAR, OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_MENU_PRIMARY_TOOLBAR, OVERFLOW_SECTION, OVERFLOW_SECTION_PRIMARY_TOOLBAR, OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_COLLAPSED_GROUP, TEXT_SECTION, TEXT_SECTION_COLLAPSED, TEXT_COLLAPSED_MENU, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
4
5
  import { PrimaryToolbar as PrimaryToolbarBase, Show, Toolbar } from '@atlaskit/editor-toolbar';
5
6
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -16,7 +17,8 @@ export var getToolbarComponents = function getToolbarComponents(api, disableSele
16
17
  component: function component(_ref) {
17
18
  var children = _ref.children;
18
19
  return /*#__PURE__*/React.createElement(Toolbar, {
19
- label: SELECTION_TOOLBAR_LABEL
20
+ label: SELECTION_TOOLBAR_LABEL,
21
+ actionSubjectId: ACTION_SUBJECT_ID.SELECTION_TOOLBAR
20
22
  }, children);
21
23
  }
22
24
  }, {
@@ -67,6 +69,10 @@ export var getToolbarComponents = function getToolbarComponents(api, disableSele
67
69
  type: 'toolbar',
68
70
  key: TOOLBARS.PRIMARY_TOOLBAR,
69
71
  rank: TOOLBAR_RANK[TEXT_SECTION_COLLAPSED.key]
72
+ }, expValEquals('platform_editor_aifc_selection_toolbar_responsive', 'isEnabled', true) && {
73
+ type: 'toolbar',
74
+ key: TOOLBARS.INLINE_TEXT_TOOLBAR,
75
+ rank: TOOLBAR_RANK[TEXT_SECTION_COLLAPSED.key]
70
76
  }],
71
77
  component: function component(_ref4) {
72
78
  var children = _ref4.children,
@@ -1,4 +1,5 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
2
3
  import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
3
4
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
4
5
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
@@ -16,7 +17,8 @@ export type ToolbarPlugin = NextEditorPlugin<'toolbar', {
16
17
  OptionalPlugin<SelectionPlugin>,
17
18
  OptionalPlugin<UserPreferencesPlugin>,
18
19
  OptionalPlugin<EditorViewModePlugin>,
19
- OptionalPlugin<ConnectivityPlugin>
20
+ OptionalPlugin<ConnectivityPlugin>,
21
+ OptionalPlugin<AnalyticsPlugin>
20
22
  ];
21
23
  pluginConfiguration?: ToolbarPluginOptions;
22
24
  sharedState: {
@@ -1,4 +1,5 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
2
3
  import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
3
4
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
4
5
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
@@ -16,7 +17,8 @@ export type ToolbarPlugin = NextEditorPlugin<'toolbar', {
16
17
  OptionalPlugin<SelectionPlugin>,
17
18
  OptionalPlugin<UserPreferencesPlugin>,
18
19
  OptionalPlugin<EditorViewModePlugin>,
19
- OptionalPlugin<ConnectivityPlugin>
20
+ OptionalPlugin<ConnectivityPlugin>,
21
+ OptionalPlugin<AnalyticsPlugin>
20
22
  ];
21
23
  pluginConfiguration?: ToolbarPluginOptions;
22
24
  sharedState: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-toolbar",
3
- "version": "2.1.0",
3
+ "version": "2.1.3",
4
4
  "description": "Toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,22 +28,23 @@
28
28
  "sideEffects": false,
29
29
  "atlaskit:src": "src/index.ts",
30
30
  "dependencies": {
31
+ "@atlaskit/editor-plugin-analytics": "^5.2.0",
31
32
  "@atlaskit/editor-plugin-connectivity": "^5.0.0",
32
33
  "@atlaskit/editor-plugin-editor-viewmode": "^7.0.0",
33
34
  "@atlaskit/editor-plugin-selection": "^5.0.0",
34
35
  "@atlaskit/editor-plugin-user-intent": "^3.0.0",
35
36
  "@atlaskit/editor-plugin-user-preferences": "^3.0.0",
36
37
  "@atlaskit/editor-prosemirror": "7.0.0",
37
- "@atlaskit/editor-toolbar": "^0.8.0",
38
+ "@atlaskit/editor-toolbar": "^0.9.0",
38
39
  "@atlaskit/editor-toolbar-model": "^0.2.0",
39
40
  "@atlaskit/platform-feature-flags-react": "^0.3.0",
40
- "@atlaskit/tmp-editor-statsig": "^12.10.0",
41
+ "@atlaskit/tmp-editor-statsig": "^12.21.0",
41
42
  "@babel/runtime": "^7.0.0",
42
43
  "bind-event-listener": "^3.0.0",
43
44
  "react-intl-next": "npm:react-intl@^5.18.1"
44
45
  },
45
46
  "peerDependencies": {
46
- "@atlaskit/editor-common": "^109.1.0",
47
+ "@atlaskit/editor-common": "^109.6.0",
47
48
  "react": "^18.2.0"
48
49
  },
49
50
  "techstack": {