@atlaskit/editor-plugin-floating-toolbar 4.1.19 → 4.2.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 +18 -0
- package/dist/cjs/floatingToolbarPlugin.js +30 -0
- package/dist/cjs/ui/Dropdown.js +8 -6
- package/dist/cjs/ui/ExpandButton.js +3 -2
- package/dist/cjs/ui/ScrollButton.js +8 -3
- package/dist/cjs/ui/ScrollButtons.js +6 -4
- package/dist/es2019/floatingToolbarPlugin.js +32 -1
- package/dist/es2019/ui/Dropdown.js +5 -3
- package/dist/es2019/ui/ExpandButton.js +3 -2
- package/dist/es2019/ui/ScrollButton.js +6 -3
- package/dist/es2019/ui/ScrollButtons.js +6 -4
- package/dist/esm/floatingToolbarPlugin.js +31 -1
- package/dist/esm/ui/Dropdown.js +5 -3
- package/dist/esm/ui/ExpandButton.js +3 -2
- package/dist/esm/ui/ScrollButton.js +8 -3
- package/dist/esm/ui/ScrollButtons.js +6 -4
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-floating-toolbar
|
|
2
2
|
|
|
3
|
+
## 4.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 4.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#164841](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/164841)
|
|
14
|
+
[`9c4d557d5f6b5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9c4d557d5f6b5) -
|
|
15
|
+
Update floating toolbar plugin to dispatch analytics events on dropdown click.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 4.1.19
|
|
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);
|
package/dist/cjs/ui/Dropdown.js
CHANGED
|
@@ -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/
|
|
20
|
-
var _chevronDown2 = _interopRequireDefault(require("@atlaskit/icon/
|
|
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)(
|
|
49
|
+
}, (0, _react2.jsx)(_chevronDown.default, {
|
|
50
50
|
color: "currentColor",
|
|
51
51
|
spacing: "spacious",
|
|
52
52
|
label: "Expand dropdown menu",
|
|
53
|
-
LEGACY_fallbackIcon:
|
|
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)(
|
|
186
|
+
}, (0, _react2.jsx)(_chevronDown.default, {
|
|
186
187
|
color: "currentColor",
|
|
187
188
|
spacing: "spacious",
|
|
188
189
|
label: "Expand dropdown menu",
|
|
189
|
-
LEGACY_fallbackIcon:
|
|
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/
|
|
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
|
}
|
|
@@ -12,8 +12,8 @@ var _bindEventListener = require("bind-event-listener");
|
|
|
12
12
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
13
13
|
var _new = require("@atlaskit/button/new");
|
|
14
14
|
var _floatingToolbar = require("@atlaskit/editor-common/floating-toolbar");
|
|
15
|
-
var _chevronLeftChevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/
|
|
16
|
-
var _chevronRightChevronRightLarge = _interopRequireDefault(require("@atlaskit/icon/
|
|
15
|
+
var _chevronLeftChevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-left--chevron-left-large"));
|
|
16
|
+
var _chevronRightChevronRightLarge = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-right--chevron-right-large"));
|
|
17
17
|
var _primitives = require("@atlaskit/primitives");
|
|
18
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
19
|
var rightSideStyles = (0, _primitives.xcss)({
|
|
@@ -138,7 +138,12 @@ var ScrollButton = exports.ScrollButton = function ScrollButton(_ref) {
|
|
|
138
138
|
label: intl.formatMessage(side === 'left' ? _floatingToolbar.messages.floatingToolbarScrollLeft : _floatingToolbar.messages.floatingToolbarScrollRight),
|
|
139
139
|
onClick: onClick,
|
|
140
140
|
isDisabled: disabled,
|
|
141
|
-
icon:
|
|
141
|
+
icon: function icon(iconProps) {
|
|
142
|
+
return /*#__PURE__*/_react.default.createElement(Icon, {
|
|
143
|
+
label: iconProps.label,
|
|
144
|
+
size: "small"
|
|
145
|
+
});
|
|
146
|
+
},
|
|
142
147
|
isTooltipDisabled: false,
|
|
143
148
|
tooltip: {
|
|
144
149
|
position: 'top'
|
|
@@ -12,8 +12,8 @@ var _react2 = require("@emotion/react");
|
|
|
12
12
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
13
13
|
var _floatingToolbar = require("@atlaskit/editor-common/floating-toolbar");
|
|
14
14
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
15
|
-
var _chevronLeftChevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/
|
|
16
|
-
var _chevronRightChevronRightLarge = _interopRequireDefault(require("@atlaskit/icon/
|
|
15
|
+
var _chevronLeftChevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-left--chevron-left-large"));
|
|
16
|
+
var _chevronRightChevronRightLarge = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-right--chevron-right-large"));
|
|
17
17
|
var _colors = require("@atlaskit/theme/colors");
|
|
18
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
19
|
/**
|
|
@@ -154,14 +154,16 @@ var ScrollButtons = exports.ScrollButtons = function ScrollButtons(_ref) {
|
|
|
154
154
|
}, (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
155
155
|
title: intl.formatMessage(_floatingToolbar.messages.floatingToolbarScrollLeft),
|
|
156
156
|
icon: (0, _react2.jsx)(LeftIcon, {
|
|
157
|
-
label: intl.formatMessage(_floatingToolbar.messages.floatingToolbarScrollLeft)
|
|
157
|
+
label: intl.formatMessage(_floatingToolbar.messages.floatingToolbarScrollLeft),
|
|
158
|
+
size: "small"
|
|
158
159
|
}),
|
|
159
160
|
onClick: scrollLeft,
|
|
160
161
|
disabled: !canScrollLeft || disabled
|
|
161
162
|
}), (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
162
163
|
title: intl.formatMessage(_floatingToolbar.messages.floatingToolbarScrollRight),
|
|
163
164
|
icon: (0, _react2.jsx)(RightIcon, {
|
|
164
|
-
label: intl.formatMessage(_floatingToolbar.messages.floatingToolbarScrollRight)
|
|
165
|
+
label: intl.formatMessage(_floatingToolbar.messages.floatingToolbarScrollRight),
|
|
166
|
+
size: "small"
|
|
165
167
|
}),
|
|
166
168
|
onClick: scrollRight,
|
|
167
169
|
disabled: !canScrollRight || disabled
|
|
@@ -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/
|
|
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
|
}
|
|
@@ -3,8 +3,8 @@ import { bind } from 'bind-event-listener';
|
|
|
3
3
|
import rafSchedule from 'raf-schd';
|
|
4
4
|
import { IconButton } from '@atlaskit/button/new';
|
|
5
5
|
import { messages } from '@atlaskit/editor-common/floating-toolbar';
|
|
6
|
-
import ChevronLeftLargeIcon from '@atlaskit/icon/
|
|
7
|
-
import ChevronRightLargeIcon from '@atlaskit/icon/
|
|
6
|
+
import ChevronLeftLargeIcon from '@atlaskit/icon/core/migration/chevron-left--chevron-left-large';
|
|
7
|
+
import ChevronRightLargeIcon from '@atlaskit/icon/core/migration/chevron-right--chevron-right-large';
|
|
8
8
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
9
9
|
const rightSideStyles = xcss({
|
|
10
10
|
borderLeft: `solid ${"var(--ds-border, #091E4224)"} 1px`,
|
|
@@ -124,7 +124,10 @@ export const ScrollButton = ({
|
|
|
124
124
|
label: intl.formatMessage(side === 'left' ? messages.floatingToolbarScrollLeft : messages.floatingToolbarScrollRight),
|
|
125
125
|
onClick: onClick,
|
|
126
126
|
isDisabled: disabled,
|
|
127
|
-
icon: Icon,
|
|
127
|
+
icon: iconProps => /*#__PURE__*/React.createElement(Icon, {
|
|
128
|
+
label: iconProps.label,
|
|
129
|
+
size: "small"
|
|
130
|
+
}),
|
|
128
131
|
isTooltipDisabled: false,
|
|
129
132
|
tooltip: {
|
|
130
133
|
position: 'top'
|
|
@@ -9,8 +9,8 @@ import { css, jsx } from '@emotion/react';
|
|
|
9
9
|
import rafSchedule from 'raf-schd';
|
|
10
10
|
import { messages } from '@atlaskit/editor-common/floating-toolbar';
|
|
11
11
|
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
12
|
-
import ChevronLeftLargeIcon from '@atlaskit/icon/
|
|
13
|
-
import ChevronRightLargeIcon from '@atlaskit/icon/
|
|
12
|
+
import ChevronLeftLargeIcon from '@atlaskit/icon/core/migration/chevron-left--chevron-left-large';
|
|
13
|
+
import ChevronRightLargeIcon from '@atlaskit/icon/core/migration/chevron-right--chevron-right-large';
|
|
14
14
|
import { N30 } from '@atlaskit/theme/colors';
|
|
15
15
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
16
16
|
const toolbarScrollButtons = css({
|
|
@@ -134,14 +134,16 @@ export const ScrollButtons = ({
|
|
|
134
134
|
}, jsx(Button, {
|
|
135
135
|
title: intl.formatMessage(messages.floatingToolbarScrollLeft),
|
|
136
136
|
icon: jsx(LeftIcon, {
|
|
137
|
-
label: intl.formatMessage(messages.floatingToolbarScrollLeft)
|
|
137
|
+
label: intl.formatMessage(messages.floatingToolbarScrollLeft),
|
|
138
|
+
size: "small"
|
|
138
139
|
}),
|
|
139
140
|
onClick: scrollLeft,
|
|
140
141
|
disabled: !canScrollLeft || disabled
|
|
141
142
|
}), jsx(Button, {
|
|
142
143
|
title: intl.formatMessage(messages.floatingToolbarScrollRight),
|
|
143
144
|
icon: jsx(RightIcon, {
|
|
144
|
-
label: intl.formatMessage(messages.floatingToolbarScrollRight)
|
|
145
|
+
label: intl.formatMessage(messages.floatingToolbarScrollRight),
|
|
146
|
+
size: "small"
|
|
145
147
|
}),
|
|
146
148
|
onClick: scrollRight,
|
|
147
149
|
disabled: !canScrollRight || disabled
|
|
@@ -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);
|
package/dist/esm/ui/Dropdown.js
CHANGED
|
@@ -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/
|
|
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,8 +4,8 @@ import { bind } from 'bind-event-listener';
|
|
|
4
4
|
import rafSchedule from 'raf-schd';
|
|
5
5
|
import { IconButton } from '@atlaskit/button/new';
|
|
6
6
|
import { messages } from '@atlaskit/editor-common/floating-toolbar';
|
|
7
|
-
import ChevronLeftLargeIcon from '@atlaskit/icon/
|
|
8
|
-
import ChevronRightLargeIcon from '@atlaskit/icon/
|
|
7
|
+
import ChevronLeftLargeIcon from '@atlaskit/icon/core/migration/chevron-left--chevron-left-large';
|
|
8
|
+
import ChevronRightLargeIcon from '@atlaskit/icon/core/migration/chevron-right--chevron-right-large';
|
|
9
9
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
10
10
|
var rightSideStyles = xcss({
|
|
11
11
|
borderLeft: "solid ".concat("var(--ds-border, #091E4224)", " 1px"),
|
|
@@ -129,7 +129,12 @@ export var ScrollButton = function ScrollButton(_ref) {
|
|
|
129
129
|
label: intl.formatMessage(side === 'left' ? messages.floatingToolbarScrollLeft : messages.floatingToolbarScrollRight),
|
|
130
130
|
onClick: onClick,
|
|
131
131
|
isDisabled: disabled,
|
|
132
|
-
icon:
|
|
132
|
+
icon: function icon(iconProps) {
|
|
133
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
134
|
+
label: iconProps.label,
|
|
135
|
+
size: "small"
|
|
136
|
+
});
|
|
137
|
+
},
|
|
133
138
|
isTooltipDisabled: false,
|
|
134
139
|
tooltip: {
|
|
135
140
|
position: 'top'
|
|
@@ -10,8 +10,8 @@ import { css, jsx } from '@emotion/react';
|
|
|
10
10
|
import rafSchedule from 'raf-schd';
|
|
11
11
|
import { messages } from '@atlaskit/editor-common/floating-toolbar';
|
|
12
12
|
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
13
|
-
import ChevronLeftLargeIcon from '@atlaskit/icon/
|
|
14
|
-
import ChevronRightLargeIcon from '@atlaskit/icon/
|
|
13
|
+
import ChevronLeftLargeIcon from '@atlaskit/icon/core/migration/chevron-left--chevron-left-large';
|
|
14
|
+
import ChevronRightLargeIcon from '@atlaskit/icon/core/migration/chevron-right--chevron-right-large';
|
|
15
15
|
import { N30 } from '@atlaskit/theme/colors';
|
|
16
16
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
17
17
|
var toolbarScrollButtons = css({
|
|
@@ -144,14 +144,16 @@ export var ScrollButtons = function ScrollButtons(_ref) {
|
|
|
144
144
|
}, jsx(Button, {
|
|
145
145
|
title: intl.formatMessage(messages.floatingToolbarScrollLeft),
|
|
146
146
|
icon: jsx(LeftIcon, {
|
|
147
|
-
label: intl.formatMessage(messages.floatingToolbarScrollLeft)
|
|
147
|
+
label: intl.formatMessage(messages.floatingToolbarScrollLeft),
|
|
148
|
+
size: "small"
|
|
148
149
|
}),
|
|
149
150
|
onClick: scrollLeft,
|
|
150
151
|
disabled: !canScrollLeft || disabled
|
|
151
152
|
}), jsx(Button, {
|
|
152
153
|
title: intl.formatMessage(messages.floatingToolbarScrollRight),
|
|
153
154
|
icon: jsx(RightIcon, {
|
|
154
|
-
label: intl.formatMessage(messages.floatingToolbarScrollRight)
|
|
155
|
+
label: intl.formatMessage(messages.floatingToolbarScrollRight),
|
|
156
|
+
size: "small"
|
|
155
157
|
}),
|
|
156
158
|
onClick: scrollRight,
|
|
157
159
|
disabled: !canScrollRight || disabled
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-floating-toolbar",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
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.
|
|
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",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@atlaskit/primitives": "^14.8.0",
|
|
51
51
|
"@atlaskit/select": "^20.7.0",
|
|
52
52
|
"@atlaskit/theme": "^18.0.0",
|
|
53
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
53
|
+
"@atlaskit/tmp-editor-statsig": "^7.0.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
|
}
|