@atlaskit/editor-plugin-card 40.0.3 → 40.0.4
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 +9 -0
- package/dist/cjs/ui/DatasourceDropdownOption.js +19 -6
- package/dist/cjs/ui/EditToolbarButton/EditToolbarButtonPresentation.js +24 -15
- package/dist/cjs/ui/EditToolbarButton/index.js +24 -15
- package/dist/cjs/ui/LinkToolbarAppearanceDropdown.js +28 -4
- package/dist/es2019/ui/DatasourceDropdownOption.js +17 -6
- package/dist/es2019/ui/EditToolbarButton/EditToolbarButtonPresentation.js +25 -16
- package/dist/es2019/ui/EditToolbarButton/index.js +25 -16
- package/dist/es2019/ui/LinkToolbarAppearanceDropdown.js +26 -4
- package/dist/esm/ui/DatasourceDropdownOption.js +19 -6
- package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +25 -16
- package/dist/esm/ui/EditToolbarButton/index.js +25 -16
- package/dist/esm/ui/LinkToolbarAppearanceDropdown.js +28 -4
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 40.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`915a4d1801d1e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/915a4d1801d1e) -
|
|
8
|
+
Use new dropdown items for the AI editor insert menu and for Smart Link and native embed toolbar
|
|
9
|
+
menus behind platform-dst-new-menu.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 40.0.3
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.datasourceDisplayInformation = exports.DatasourceDropdownOption = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _dropdownItem = require("@atlaskit/dropdown-menu/dropdown-item");
|
|
9
10
|
var _card = require("@atlaskit/editor-common/messages/card");
|
|
10
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
12
|
var _smartLinkList = _interopRequireDefault(require("@atlaskit/icon/core/smart-link-list"));
|
|
12
13
|
var _schema = require("@atlaskit/link-datasource/utils/schema");
|
|
13
14
|
var _useSmartLinkContext = require("@atlaskit/link-provider/use-smart-link-context");
|
|
14
15
|
var _buttonItem = _interopRequireDefault(require("@atlaskit/menu/button-item"));
|
|
16
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
15
17
|
var _doc = require("../pm-plugins/doc");
|
|
16
18
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
17
19
|
var _useFetchDatasourceInfo = require("./useFetchDatasourceInfo");
|
|
@@ -88,16 +90,27 @@ var DatasourceDropdownOption = exports.DatasourceDropdownOption = function Datas
|
|
|
88
90
|
return null;
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
var title = intl.formatMessage(_card.messages.datasourceAppearanceTitle);
|
|
94
|
+
var icon = (0, _smartLinkList.default)({
|
|
95
|
+
label: title
|
|
96
|
+
});
|
|
97
|
+
return (0, _fg.fg)('platform-dst-new-menu') ? /*#__PURE__*/_react.default.createElement(_dropdownItem.DropdownItem, {
|
|
98
|
+
key: title,
|
|
99
|
+
elemBefore: icon
|
|
96
100
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
97
101
|
,
|
|
98
102
|
onClick: function onClick() {
|
|
99
103
|
return dispatchCommand(onChangeAppearance);
|
|
100
104
|
},
|
|
101
105
|
isSelected: selected
|
|
102
|
-
},
|
|
106
|
+
}, title) : /*#__PURE__*/_react.default.createElement(_buttonItem.default, {
|
|
107
|
+
key: title,
|
|
108
|
+
iconBefore: icon
|
|
109
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
110
|
+
,
|
|
111
|
+
onClick: function onClick() {
|
|
112
|
+
return dispatchCommand(onChangeAppearance);
|
|
113
|
+
},
|
|
114
|
+
isSelected: selected
|
|
115
|
+
}, title);
|
|
103
116
|
};
|
|
@@ -9,6 +9,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
var _reactIntl = require("react-intl");
|
|
12
|
+
var _dropdownItem = require("@atlaskit/dropdown-menu/dropdown-item");
|
|
13
|
+
var _dropdownItemGroup = require("@atlaskit/dropdown-menu/dropdown-item-group");
|
|
12
14
|
var _Button = _interopRequireDefault(require("@atlaskit/editor-common/FloatingToolbar/Button"));
|
|
13
15
|
var _card = require("@atlaskit/editor-common/messages/card");
|
|
14
16
|
var _linkToolbar = require("@atlaskit/editor-common/messages/link-toolbar");
|
|
@@ -17,6 +19,7 @@ var _DropdownContainer = require("@atlaskit/editor-common/ui-menu/DropdownContai
|
|
|
17
19
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
|
|
18
20
|
var _edit = _interopRequireDefault(require("@atlaskit/icon/core/edit"));
|
|
19
21
|
var _buttonItem = _interopRequireDefault(require("@atlaskit/menu/button-item"));
|
|
22
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
20
23
|
var _flex = require("@atlaskit/primitives/compiled/flex");
|
|
21
24
|
var _utils = require("../../pm-plugins/utils");
|
|
22
25
|
var _editDatasourceAction = require("../editDatasourceAction");
|
|
@@ -95,6 +98,8 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
95
98
|
}
|
|
96
99
|
case 'edit-dropdown':
|
|
97
100
|
{
|
|
101
|
+
var useNewMenu = (0, _fg.fg)('platform-dst-new-menu');
|
|
102
|
+
var MenuItem = useNewMenu ? _dropdownItem.DropdownItem : _buttonItem.default;
|
|
98
103
|
var trigger = (0, _react2.jsx)(_flex.Flex, {
|
|
99
104
|
gap: "space.050"
|
|
100
105
|
}, (0, _react2.jsx)(_Button.default, {
|
|
@@ -113,6 +118,21 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
113
118
|
// Ignored via go/ees005
|
|
114
119
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
115
120
|
, _card.messages.editDropdownTriggerTitle)));
|
|
121
|
+
var items = (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(MenuItem, {
|
|
122
|
+
key: "edit.link",
|
|
123
|
+
onClick: onEditLink,
|
|
124
|
+
testId: "edit-dropdown-edit-link-item"
|
|
125
|
+
}, (0, _react2.jsx)(_reactIntl.FormattedMessage
|
|
126
|
+
// Ignored via go/ees005
|
|
127
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
128
|
+
, _card.messages.editDropdownEditLinkTitle)), (0, _react2.jsx)(MenuItem, {
|
|
129
|
+
key: "edit.datasource",
|
|
130
|
+
onClick: onEditDatasource,
|
|
131
|
+
testId: "edit-dropdown-edit-datasource-item"
|
|
132
|
+
}, (0, _react2.jsx)(_reactIntl.FormattedMessage
|
|
133
|
+
// Ignored via go/ees005
|
|
134
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
135
|
+
, _card.messages.editDropdownEditDatasourceTitle)));
|
|
116
136
|
return (0, _react2.jsx)(_flex.Flex, {
|
|
117
137
|
ref: containerRef
|
|
118
138
|
}, (0, _react2.jsx)(_DropdownContainer.DropdownContainer, {
|
|
@@ -121,27 +141,16 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
121
141
|
handleClickOutside: onClose,
|
|
122
142
|
handleEscapeKeydown: onClose,
|
|
123
143
|
trigger: trigger,
|
|
144
|
+
fitWidth: useNewMenu ? 200 : undefined,
|
|
124
145
|
scrollableElement: containerRef.current
|
|
125
146
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
126
147
|
,
|
|
127
148
|
arrowKeyNavigationProviderOptions: {
|
|
128
149
|
type: _types.ArrowKeyNavigationType.MENU
|
|
129
150
|
}
|
|
130
|
-
}, (0, _react2.jsx)(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
testId: "edit-dropdown-edit-link-item"
|
|
134
|
-
}, (0, _react2.jsx)(_reactIntl.FormattedMessage
|
|
135
|
-
// Ignored via go/ees005
|
|
136
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
137
|
-
, _card.messages.editDropdownEditLinkTitle)), (0, _react2.jsx)(_buttonItem.default, {
|
|
138
|
-
key: "edit.datasource",
|
|
139
|
-
onClick: onEditDatasource,
|
|
140
|
-
testId: "edit-dropdown-edit-datasource-item"
|
|
141
|
-
}, (0, _react2.jsx)(_reactIntl.FormattedMessage
|
|
142
|
-
// Ignored via go/ees005
|
|
143
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
144
|
-
, _card.messages.editDropdownEditDatasourceTitle))));
|
|
151
|
+
}, useNewMenu ? (0, _react2.jsx)("div", {
|
|
152
|
+
role: "menu"
|
|
153
|
+
}, (0, _react2.jsx)(_dropdownItemGroup.DropdownItemGroup, null, items)) : items));
|
|
145
154
|
}
|
|
146
155
|
case 'none':
|
|
147
156
|
default:
|
|
@@ -10,6 +10,8 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _reactIntl = require("react-intl");
|
|
13
|
+
var _dropdownItem = require("@atlaskit/dropdown-menu/dropdown-item");
|
|
14
|
+
var _dropdownItemGroup = require("@atlaskit/dropdown-menu/dropdown-item-group");
|
|
13
15
|
var _Button = _interopRequireDefault(require("@atlaskit/editor-common/FloatingToolbar/Button"));
|
|
14
16
|
var _card = require("@atlaskit/editor-common/messages/card");
|
|
15
17
|
var _linkToolbar = require("@atlaskit/editor-common/messages/link-toolbar");
|
|
@@ -18,6 +20,7 @@ var _DropdownContainer = require("@atlaskit/editor-common/ui-menu/DropdownContai
|
|
|
18
20
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
|
|
19
21
|
var _useSmartLinkContext = require("@atlaskit/link-provider/use-smart-link-context");
|
|
20
22
|
var _buttonItem = _interopRequireDefault(require("@atlaskit/menu/button-item"));
|
|
23
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
21
24
|
var _flex = require("@atlaskit/primitives/compiled/flex");
|
|
22
25
|
var _utils = require("../../pm-plugins/utils");
|
|
23
26
|
var _editDatasourceAction = require("../editDatasourceAction");
|
|
@@ -122,6 +125,8 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
122
125
|
}
|
|
123
126
|
case 'edit-dropdown':
|
|
124
127
|
{
|
|
128
|
+
var useNewMenu = (0, _fg.fg)('platform-dst-new-menu');
|
|
129
|
+
var MenuItem = useNewMenu ? _dropdownItem.DropdownItem : _buttonItem.default;
|
|
125
130
|
var trigger = (0, _react2.jsx)(_flex.Flex, {
|
|
126
131
|
gap: "space.050"
|
|
127
132
|
}, (0, _react2.jsx)(_Button.default, {
|
|
@@ -140,6 +145,21 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
140
145
|
// Ignored via go/ees005
|
|
141
146
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
142
147
|
, _card.messages.editDropdownTriggerTitle)));
|
|
148
|
+
var items = (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(MenuItem, {
|
|
149
|
+
key: "edit.link",
|
|
150
|
+
onClick: onEditLink,
|
|
151
|
+
testId: "edit-dropdown-edit-link-item"
|
|
152
|
+
}, (0, _react2.jsx)(_reactIntl.FormattedMessage
|
|
153
|
+
// Ignored via go/ees005
|
|
154
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
155
|
+
, _card.messages.editDropdownEditLinkTitle)), (0, _react2.jsx)(MenuItem, {
|
|
156
|
+
key: "edit.datasource",
|
|
157
|
+
onClick: onEditDatasource,
|
|
158
|
+
testId: "edit-dropdown-edit-datasource-item"
|
|
159
|
+
}, (0, _react2.jsx)(_reactIntl.FormattedMessage
|
|
160
|
+
// Ignored via go/ees005
|
|
161
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
162
|
+
, _card.messages.editDropdownEditDatasourceTitle)));
|
|
143
163
|
return (0, _react2.jsx)(_flex.Flex, {
|
|
144
164
|
ref: containerRef
|
|
145
165
|
}, (0, _react2.jsx)(_DropdownContainer.DropdownContainer, {
|
|
@@ -148,27 +168,16 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
148
168
|
handleClickOutside: onClose,
|
|
149
169
|
handleEscapeKeydown: onClose,
|
|
150
170
|
trigger: trigger,
|
|
171
|
+
fitWidth: useNewMenu ? 200 : undefined,
|
|
151
172
|
scrollableElement: containerRef.current
|
|
152
173
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
153
174
|
,
|
|
154
175
|
arrowKeyNavigationProviderOptions: {
|
|
155
176
|
type: _types.ArrowKeyNavigationType.MENU
|
|
156
177
|
}
|
|
157
|
-
}, (0, _react2.jsx)(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
testId: "edit-dropdown-edit-link-item"
|
|
161
|
-
}, (0, _react2.jsx)(_reactIntl.FormattedMessage
|
|
162
|
-
// Ignored via go/ees005
|
|
163
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
164
|
-
, _card.messages.editDropdownEditLinkTitle)), (0, _react2.jsx)(_buttonItem.default, {
|
|
165
|
-
key: "edit.datasource",
|
|
166
|
-
onClick: onEditDatasource,
|
|
167
|
-
testId: "edit-dropdown-edit-datasource-item"
|
|
168
|
-
}, (0, _react2.jsx)(_reactIntl.FormattedMessage
|
|
169
|
-
// Ignored via go/ees005
|
|
170
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
171
|
-
, _card.messages.editDropdownEditDatasourceTitle))));
|
|
178
|
+
}, useNewMenu ? (0, _react2.jsx)("div", {
|
|
179
|
+
role: "menu"
|
|
180
|
+
}, (0, _react2.jsx)(_dropdownItemGroup.DropdownItemGroup, null, items)) : items));
|
|
172
181
|
}
|
|
173
182
|
case 'none':
|
|
174
183
|
default:
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.isTransformedEmbedSupportedInParent = exports.getUnavailableMessage = exports.getLinkAppearanceDropdown = exports.LinkAppearanceMenu = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _dropdownItem = require("@atlaskit/dropdown-menu/dropdown-item");
|
|
11
|
+
var _dropdownItemGroup = require("@atlaskit/dropdown-menu/dropdown-item-group");
|
|
10
12
|
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
11
13
|
var _card = require("@atlaskit/editor-common/card");
|
|
12
14
|
var _linkToolbarDropdownOptions = require("@atlaskit/editor-common/card/link-toolbar-dropdown-options");
|
|
@@ -139,8 +141,24 @@ var LinkAppearanceMenu = exports.LinkAppearanceMenu = function LinkAppearanceMen
|
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
// TODO: ED-26961 - this implementation does not support change boarding via pulse
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
var useNewMenu = (0, _fg.fg)('platform-dst-new-menu');
|
|
145
|
+
var ItemGroup = useNewMenu ? _dropdownItemGroup.DropdownItemGroup : _section.default;
|
|
146
|
+
return /*#__PURE__*/_react.default.createElement(_menuGroup.default, {
|
|
147
|
+
role: useNewMenu ? 'menu' : undefined
|
|
148
|
+
}, /*#__PURE__*/_react.default.createElement(ItemGroup, null, finalOptions.map(function (option) {
|
|
149
|
+
var item = useNewMenu ? /*#__PURE__*/_react.default.createElement(_dropdownItem.DropdownItem, {
|
|
150
|
+
key: option.title,
|
|
151
|
+
elemBefore: option.icon
|
|
152
|
+
// eslint-disable-next-line @atlassian/perf-linting/detect-unnecessary-rerenders, @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
153
|
+
,
|
|
154
|
+
onClick: function onClick() {
|
|
155
|
+
return option.onClick();
|
|
156
|
+
},
|
|
157
|
+
isSelected: option.selected,
|
|
158
|
+
isDisabled: showUnsupportedOptionsDisabled && option.disabled,
|
|
159
|
+
description: option.description,
|
|
160
|
+
shouldDescriptionWrap: true
|
|
161
|
+
}, option.title) : /*#__PURE__*/_react.default.createElement(_buttonItem.default, {
|
|
144
162
|
key: option.title,
|
|
145
163
|
iconBefore: option.icon
|
|
146
164
|
// eslint-disable-next-line @atlassian/perf-linting/detect-unnecessary-rerenders, @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -164,9 +182,15 @@ var LinkAppearanceMenu = exports.LinkAppearanceMenu = function LinkAppearanceMen
|
|
|
164
182
|
selected: Boolean(isDatasourceView),
|
|
165
183
|
inputMethod: _enums.INPUT_METHOD.FLOATING_TB,
|
|
166
184
|
dispatchCommand: dispatchCommand
|
|
167
|
-
})), 'href' in settingsConfig && settingsConfig.href && /*#__PURE__*/_react.default.createElement(
|
|
185
|
+
})), 'href' in settingsConfig && settingsConfig.href && /*#__PURE__*/_react.default.createElement(ItemGroup, {
|
|
168
186
|
hasSeparator: true
|
|
169
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
187
|
+
}, useNewMenu ? /*#__PURE__*/_react.default.createElement(_dropdownItem.DropdownItem, {
|
|
188
|
+
elemBefore: Icon && /*#__PURE__*/_react.default.createElement(Icon, {
|
|
189
|
+
label: "Settings"
|
|
190
|
+
}),
|
|
191
|
+
href: settingsConfig.href,
|
|
192
|
+
target: 'target' in settingsConfig ? settingsConfig.target : undefined
|
|
193
|
+
}, intl.formatMessage(_linkToolbar.linkToolbarMessages.preferencesLink)) : /*#__PURE__*/_react.default.createElement(_linkItem.default, {
|
|
170
194
|
iconBefore: Icon && /*#__PURE__*/_react.default.createElement(Icon, {
|
|
171
195
|
label: "Settings"
|
|
172
196
|
}),
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
|
|
2
3
|
import { messages } from '@atlaskit/editor-common/messages/card';
|
|
3
4
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
import SmartLinkListIcon from '@atlaskit/icon/core/smart-link-list';
|
|
5
6
|
import { buildDatasourceAdf } from '@atlaskit/link-datasource/utils/schema';
|
|
6
7
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
7
8
|
import ButtonItem from '@atlaskit/menu/button-item';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
10
|
import { updateCardViaDatasource } from '../pm-plugins/doc';
|
|
9
11
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
10
12
|
import { useFetchDatasourceInfo } from './useFetchDatasourceInfo';
|
|
@@ -83,14 +85,23 @@ export const DatasourceDropdownOption = ({
|
|
|
83
85
|
return null;
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
const title = intl.formatMessage(messages.datasourceAppearanceTitle);
|
|
89
|
+
const icon = SmartLinkListIcon({
|
|
90
|
+
label: title
|
|
91
|
+
});
|
|
92
|
+
return fg('platform-dst-new-menu') ? /*#__PURE__*/React.createElement(DropdownItem, {
|
|
93
|
+
key: title,
|
|
94
|
+
elemBefore: icon
|
|
95
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
96
|
+
,
|
|
97
|
+
onClick: () => dispatchCommand(onChangeAppearance),
|
|
98
|
+
isSelected: selected
|
|
99
|
+
}, title) : /*#__PURE__*/React.createElement(ButtonItem, {
|
|
100
|
+
key: title,
|
|
101
|
+
iconBefore: icon
|
|
91
102
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
92
103
|
,
|
|
93
104
|
onClick: () => dispatchCommand(onChangeAppearance),
|
|
94
105
|
isSelected: selected
|
|
95
|
-
},
|
|
106
|
+
}, title);
|
|
96
107
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import { useCallback, useRef, useState } from 'react';
|
|
5
|
+
import { Fragment, useCallback, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { FormattedMessage } from 'react-intl';
|
|
10
|
+
import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
|
|
11
|
+
import { DropdownItemGroup } from '@atlaskit/dropdown-menu/dropdown-item-group';
|
|
10
12
|
import Button from '@atlaskit/editor-common/FloatingToolbar/Button';
|
|
11
13
|
import { messages } from '@atlaskit/editor-common/messages/card';
|
|
12
14
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages/link-toolbar';
|
|
@@ -15,6 +17,7 @@ import { DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu
|
|
|
15
17
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
16
18
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
17
19
|
import ButtonItem from '@atlaskit/menu/button-item';
|
|
20
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
18
21
|
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
19
22
|
import { focusEditorView } from '../../pm-plugins/utils';
|
|
20
23
|
import { editDatasource } from '../editDatasourceAction';
|
|
@@ -78,6 +81,8 @@ const EditToolbarButtonPresentation = ({
|
|
|
78
81
|
}
|
|
79
82
|
case 'edit-dropdown':
|
|
80
83
|
{
|
|
84
|
+
const useNewMenu = fg('platform-dst-new-menu');
|
|
85
|
+
const MenuItem = useNewMenu ? DropdownItem : ButtonItem;
|
|
81
86
|
const trigger = jsx(Flex, {
|
|
82
87
|
gap: "space.050"
|
|
83
88
|
}, jsx(Button, {
|
|
@@ -96,6 +101,21 @@ const EditToolbarButtonPresentation = ({
|
|
|
96
101
|
// Ignored via go/ees005
|
|
97
102
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
98
103
|
, messages.editDropdownTriggerTitle)));
|
|
104
|
+
const items = jsx(Fragment, null, jsx(MenuItem, {
|
|
105
|
+
key: "edit.link",
|
|
106
|
+
onClick: onEditLink,
|
|
107
|
+
testId: "edit-dropdown-edit-link-item"
|
|
108
|
+
}, jsx(FormattedMessage
|
|
109
|
+
// Ignored via go/ees005
|
|
110
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
111
|
+
, messages.editDropdownEditLinkTitle)), jsx(MenuItem, {
|
|
112
|
+
key: "edit.datasource",
|
|
113
|
+
onClick: onEditDatasource,
|
|
114
|
+
testId: "edit-dropdown-edit-datasource-item"
|
|
115
|
+
}, jsx(FormattedMessage
|
|
116
|
+
// Ignored via go/ees005
|
|
117
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
118
|
+
, messages.editDropdownEditDatasourceTitle)));
|
|
99
119
|
return jsx(Flex, {
|
|
100
120
|
ref: containerRef
|
|
101
121
|
}, jsx(UiDropdown, {
|
|
@@ -104,27 +124,16 @@ const EditToolbarButtonPresentation = ({
|
|
|
104
124
|
handleClickOutside: onClose,
|
|
105
125
|
handleEscapeKeydown: onClose,
|
|
106
126
|
trigger: trigger,
|
|
127
|
+
fitWidth: useNewMenu ? 200 : undefined,
|
|
107
128
|
scrollableElement: containerRef.current
|
|
108
129
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
109
130
|
,
|
|
110
131
|
arrowKeyNavigationProviderOptions: {
|
|
111
132
|
type: ArrowKeyNavigationType.MENU
|
|
112
133
|
}
|
|
113
|
-
}, jsx(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
testId: "edit-dropdown-edit-link-item"
|
|
117
|
-
}, jsx(FormattedMessage
|
|
118
|
-
// Ignored via go/ees005
|
|
119
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
120
|
-
, messages.editDropdownEditLinkTitle)), jsx(ButtonItem, {
|
|
121
|
-
key: "edit.datasource",
|
|
122
|
-
onClick: onEditDatasource,
|
|
123
|
-
testId: "edit-dropdown-edit-datasource-item"
|
|
124
|
-
}, jsx(FormattedMessage
|
|
125
|
-
// Ignored via go/ees005
|
|
126
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
127
|
-
, messages.editDropdownEditDatasourceTitle))));
|
|
134
|
+
}, useNewMenu ? jsx("div", {
|
|
135
|
+
role: "menu"
|
|
136
|
+
}, jsx(DropdownItemGroup, null, items)) : items));
|
|
128
137
|
}
|
|
129
138
|
case 'none':
|
|
130
139
|
default:
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import { Fragment, useCallback, useMemo, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { FormattedMessage } from 'react-intl';
|
|
10
|
+
import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
|
|
11
|
+
import { DropdownItemGroup } from '@atlaskit/dropdown-menu/dropdown-item-group';
|
|
10
12
|
import Button from '@atlaskit/editor-common/FloatingToolbar/Button';
|
|
11
13
|
import { messages } from '@atlaskit/editor-common/messages/card';
|
|
12
14
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages/link-toolbar';
|
|
@@ -15,6 +17,7 @@ import { DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu
|
|
|
15
17
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
16
18
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
17
19
|
import ButtonItem from '@atlaskit/menu/button-item';
|
|
20
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
18
21
|
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
19
22
|
import { focusEditorView, isDatasourceConfigEditable } from '../../pm-plugins/utils';
|
|
20
23
|
import { editDatasource } from '../editDatasourceAction';
|
|
@@ -107,6 +110,8 @@ const EditToolbarButtonWithCardContext = props => {
|
|
|
107
110
|
}
|
|
108
111
|
case 'edit-dropdown':
|
|
109
112
|
{
|
|
113
|
+
const useNewMenu = fg('platform-dst-new-menu');
|
|
114
|
+
const MenuItem = useNewMenu ? DropdownItem : ButtonItem;
|
|
110
115
|
const trigger = jsx(Flex, {
|
|
111
116
|
gap: "space.050"
|
|
112
117
|
}, jsx(Button, {
|
|
@@ -125,6 +130,21 @@ const EditToolbarButtonWithCardContext = props => {
|
|
|
125
130
|
// Ignored via go/ees005
|
|
126
131
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
127
132
|
, messages.editDropdownTriggerTitle)));
|
|
133
|
+
const items = jsx(Fragment, null, jsx(MenuItem, {
|
|
134
|
+
key: "edit.link",
|
|
135
|
+
onClick: onEditLink,
|
|
136
|
+
testId: "edit-dropdown-edit-link-item"
|
|
137
|
+
}, jsx(FormattedMessage
|
|
138
|
+
// Ignored via go/ees005
|
|
139
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
140
|
+
, messages.editDropdownEditLinkTitle)), jsx(MenuItem, {
|
|
141
|
+
key: "edit.datasource",
|
|
142
|
+
onClick: onEditDatasource,
|
|
143
|
+
testId: "edit-dropdown-edit-datasource-item"
|
|
144
|
+
}, jsx(FormattedMessage
|
|
145
|
+
// Ignored via go/ees005
|
|
146
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
147
|
+
, messages.editDropdownEditDatasourceTitle)));
|
|
128
148
|
return jsx(Flex, {
|
|
129
149
|
ref: containerRef
|
|
130
150
|
}, jsx(UiDropdown, {
|
|
@@ -133,27 +153,16 @@ const EditToolbarButtonWithCardContext = props => {
|
|
|
133
153
|
handleClickOutside: onClose,
|
|
134
154
|
handleEscapeKeydown: onClose,
|
|
135
155
|
trigger: trigger,
|
|
156
|
+
fitWidth: useNewMenu ? 200 : undefined,
|
|
136
157
|
scrollableElement: containerRef.current
|
|
137
158
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
138
159
|
,
|
|
139
160
|
arrowKeyNavigationProviderOptions: {
|
|
140
161
|
type: ArrowKeyNavigationType.MENU
|
|
141
162
|
}
|
|
142
|
-
}, jsx(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
testId: "edit-dropdown-edit-link-item"
|
|
146
|
-
}, jsx(FormattedMessage
|
|
147
|
-
// Ignored via go/ees005
|
|
148
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
149
|
-
, messages.editDropdownEditLinkTitle)), jsx(ButtonItem, {
|
|
150
|
-
key: "edit.datasource",
|
|
151
|
-
onClick: onEditDatasource,
|
|
152
|
-
testId: "edit-dropdown-edit-datasource-item"
|
|
153
|
-
}, jsx(FormattedMessage
|
|
154
|
-
// Ignored via go/ees005
|
|
155
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
156
|
-
, messages.editDropdownEditDatasourceTitle))));
|
|
163
|
+
}, useNewMenu ? jsx("div", {
|
|
164
|
+
role: "menu"
|
|
165
|
+
}, jsx(DropdownItemGroup, null, items)) : items));
|
|
157
166
|
}
|
|
158
167
|
case 'none':
|
|
159
168
|
default:
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
|
|
3
|
+
import { DropdownItemGroup } from '@atlaskit/dropdown-menu/dropdown-item-group';
|
|
2
4
|
import { ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
|
|
3
5
|
import { appearancePropsMap } from '@atlaskit/editor-common/card';
|
|
4
6
|
import { getDropdownOption } from '@atlaskit/editor-common/card/link-toolbar-dropdown-options';
|
|
@@ -126,8 +128,22 @@ export const LinkAppearanceMenu = ({
|
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
// TODO: ED-26961 - this implementation does not support change boarding via pulse
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
const useNewMenu = fg('platform-dst-new-menu');
|
|
132
|
+
const ItemGroup = useNewMenu ? DropdownItemGroup : Section;
|
|
133
|
+
return /*#__PURE__*/React.createElement(MenuGroup, {
|
|
134
|
+
role: useNewMenu ? 'menu' : undefined
|
|
135
|
+
}, /*#__PURE__*/React.createElement(ItemGroup, null, finalOptions.map(option => {
|
|
136
|
+
const item = useNewMenu ? /*#__PURE__*/React.createElement(DropdownItem, {
|
|
137
|
+
key: option.title,
|
|
138
|
+
elemBefore: option.icon
|
|
139
|
+
// eslint-disable-next-line @atlassian/perf-linting/detect-unnecessary-rerenders, @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
140
|
+
,
|
|
141
|
+
onClick: () => option.onClick(),
|
|
142
|
+
isSelected: option.selected,
|
|
143
|
+
isDisabled: showUnsupportedOptionsDisabled && option.disabled,
|
|
144
|
+
description: option.description,
|
|
145
|
+
shouldDescriptionWrap: true
|
|
146
|
+
}, option.title) : /*#__PURE__*/React.createElement(ButtonItem, {
|
|
131
147
|
key: option.title,
|
|
132
148
|
iconBefore: option.icon
|
|
133
149
|
// eslint-disable-next-line @atlassian/perf-linting/detect-unnecessary-rerenders, @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -149,9 +165,15 @@ export const LinkAppearanceMenu = ({
|
|
|
149
165
|
selected: Boolean(isDatasourceView),
|
|
150
166
|
inputMethod: INPUT_METHOD.FLOATING_TB,
|
|
151
167
|
dispatchCommand: dispatchCommand
|
|
152
|
-
})), 'href' in settingsConfig && settingsConfig.href && /*#__PURE__*/React.createElement(
|
|
168
|
+
})), 'href' in settingsConfig && settingsConfig.href && /*#__PURE__*/React.createElement(ItemGroup, {
|
|
153
169
|
hasSeparator: true
|
|
154
|
-
}, /*#__PURE__*/React.createElement(
|
|
170
|
+
}, useNewMenu ? /*#__PURE__*/React.createElement(DropdownItem, {
|
|
171
|
+
elemBefore: Icon && /*#__PURE__*/React.createElement(Icon, {
|
|
172
|
+
label: "Settings"
|
|
173
|
+
}),
|
|
174
|
+
href: settingsConfig.href,
|
|
175
|
+
target: 'target' in settingsConfig ? settingsConfig.target : undefined
|
|
176
|
+
}, intl.formatMessage(linkToolbarMessages.preferencesLink)) : /*#__PURE__*/React.createElement(LinkItem, {
|
|
155
177
|
iconBefore: Icon && /*#__PURE__*/React.createElement(Icon, {
|
|
156
178
|
label: "Settings"
|
|
157
179
|
}),
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
|
|
2
3
|
import { messages } from '@atlaskit/editor-common/messages/card';
|
|
3
4
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
import SmartLinkListIcon from '@atlaskit/icon/core/smart-link-list';
|
|
5
6
|
import { buildDatasourceAdf } from '@atlaskit/link-datasource/utils/schema';
|
|
6
7
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
7
8
|
import ButtonItem from '@atlaskit/menu/button-item';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
10
|
import { updateCardViaDatasource } from '../pm-plugins/doc';
|
|
9
11
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
10
12
|
import { useFetchDatasourceInfo } from './useFetchDatasourceInfo';
|
|
@@ -81,16 +83,27 @@ export var DatasourceDropdownOption = function DatasourceDropdownOption(_ref) {
|
|
|
81
83
|
return null;
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
var title = intl.formatMessage(messages.datasourceAppearanceTitle);
|
|
87
|
+
var icon = SmartLinkListIcon({
|
|
88
|
+
label: title
|
|
89
|
+
});
|
|
90
|
+
return fg('platform-dst-new-menu') ? /*#__PURE__*/React.createElement(DropdownItem, {
|
|
91
|
+
key: title,
|
|
92
|
+
elemBefore: icon
|
|
89
93
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
90
94
|
,
|
|
91
95
|
onClick: function onClick() {
|
|
92
96
|
return dispatchCommand(onChangeAppearance);
|
|
93
97
|
},
|
|
94
98
|
isSelected: selected
|
|
95
|
-
},
|
|
99
|
+
}, title) : /*#__PURE__*/React.createElement(ButtonItem, {
|
|
100
|
+
key: title,
|
|
101
|
+
iconBefore: icon
|
|
102
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
103
|
+
,
|
|
104
|
+
onClick: function onClick() {
|
|
105
|
+
return dispatchCommand(onChangeAppearance);
|
|
106
|
+
},
|
|
107
|
+
isSelected: selected
|
|
108
|
+
}, title);
|
|
96
109
|
};
|
|
@@ -3,11 +3,13 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
* @jsxRuntime classic
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
|
-
import { useCallback, useRef, useState } from 'react';
|
|
6
|
+
import { Fragment, useCallback, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { FormattedMessage } from 'react-intl';
|
|
11
|
+
import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
|
|
12
|
+
import { DropdownItemGroup } from '@atlaskit/dropdown-menu/dropdown-item-group';
|
|
11
13
|
import Button from '@atlaskit/editor-common/FloatingToolbar/Button';
|
|
12
14
|
import { messages } from '@atlaskit/editor-common/messages/card';
|
|
13
15
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages/link-toolbar';
|
|
@@ -16,6 +18,7 @@ import { DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu
|
|
|
16
18
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
17
19
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
18
20
|
import ButtonItem from '@atlaskit/menu/button-item';
|
|
21
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
19
22
|
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
20
23
|
import { focusEditorView } from '../../pm-plugins/utils';
|
|
21
24
|
import { editDatasource } from '../editDatasourceAction';
|
|
@@ -87,6 +90,8 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
87
90
|
}
|
|
88
91
|
case 'edit-dropdown':
|
|
89
92
|
{
|
|
93
|
+
var useNewMenu = fg('platform-dst-new-menu');
|
|
94
|
+
var MenuItem = useNewMenu ? DropdownItem : ButtonItem;
|
|
90
95
|
var trigger = jsx(Flex, {
|
|
91
96
|
gap: "space.050"
|
|
92
97
|
}, jsx(Button, {
|
|
@@ -105,6 +110,21 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
105
110
|
// Ignored via go/ees005
|
|
106
111
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
107
112
|
, messages.editDropdownTriggerTitle)));
|
|
113
|
+
var items = jsx(Fragment, null, jsx(MenuItem, {
|
|
114
|
+
key: "edit.link",
|
|
115
|
+
onClick: onEditLink,
|
|
116
|
+
testId: "edit-dropdown-edit-link-item"
|
|
117
|
+
}, jsx(FormattedMessage
|
|
118
|
+
// Ignored via go/ees005
|
|
119
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
120
|
+
, messages.editDropdownEditLinkTitle)), jsx(MenuItem, {
|
|
121
|
+
key: "edit.datasource",
|
|
122
|
+
onClick: onEditDatasource,
|
|
123
|
+
testId: "edit-dropdown-edit-datasource-item"
|
|
124
|
+
}, jsx(FormattedMessage
|
|
125
|
+
// Ignored via go/ees005
|
|
126
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
127
|
+
, messages.editDropdownEditDatasourceTitle)));
|
|
108
128
|
return jsx(Flex, {
|
|
109
129
|
ref: containerRef
|
|
110
130
|
}, jsx(UiDropdown, {
|
|
@@ -113,27 +133,16 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
113
133
|
handleClickOutside: onClose,
|
|
114
134
|
handleEscapeKeydown: onClose,
|
|
115
135
|
trigger: trigger,
|
|
136
|
+
fitWidth: useNewMenu ? 200 : undefined,
|
|
116
137
|
scrollableElement: containerRef.current
|
|
117
138
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
118
139
|
,
|
|
119
140
|
arrowKeyNavigationProviderOptions: {
|
|
120
141
|
type: ArrowKeyNavigationType.MENU
|
|
121
142
|
}
|
|
122
|
-
}, jsx(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
testId: "edit-dropdown-edit-link-item"
|
|
126
|
-
}, jsx(FormattedMessage
|
|
127
|
-
// Ignored via go/ees005
|
|
128
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
129
|
-
, messages.editDropdownEditLinkTitle)), jsx(ButtonItem, {
|
|
130
|
-
key: "edit.datasource",
|
|
131
|
-
onClick: onEditDatasource,
|
|
132
|
-
testId: "edit-dropdown-edit-datasource-item"
|
|
133
|
-
}, jsx(FormattedMessage
|
|
134
|
-
// Ignored via go/ees005
|
|
135
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
136
|
-
, messages.editDropdownEditDatasourceTitle))));
|
|
143
|
+
}, useNewMenu ? jsx("div", {
|
|
144
|
+
role: "menu"
|
|
145
|
+
}, jsx(DropdownItemGroup, null, items)) : items));
|
|
137
146
|
}
|
|
138
147
|
case 'none':
|
|
139
148
|
default:
|
|
@@ -5,11 +5,13 @@ var _excluded = ["extensionKey"];
|
|
|
5
5
|
* @jsxRuntime classic
|
|
6
6
|
* @jsx jsx
|
|
7
7
|
*/
|
|
8
|
-
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
8
|
+
import { Fragment, useCallback, useMemo, useRef, useState } from 'react';
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
11
11
|
import { css, jsx } from '@emotion/react';
|
|
12
12
|
import { FormattedMessage } from 'react-intl';
|
|
13
|
+
import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
|
|
14
|
+
import { DropdownItemGroup } from '@atlaskit/dropdown-menu/dropdown-item-group';
|
|
13
15
|
import Button from '@atlaskit/editor-common/FloatingToolbar/Button';
|
|
14
16
|
import { messages } from '@atlaskit/editor-common/messages/card';
|
|
15
17
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages/link-toolbar';
|
|
@@ -18,6 +20,7 @@ import { DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu
|
|
|
18
20
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
19
21
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
20
22
|
import ButtonItem from '@atlaskit/menu/button-item';
|
|
23
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
21
24
|
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
22
25
|
import { focusEditorView, isDatasourceConfigEditable } from '../../pm-plugins/utils';
|
|
23
26
|
import { editDatasource } from '../editDatasourceAction';
|
|
@@ -116,6 +119,8 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
116
119
|
}
|
|
117
120
|
case 'edit-dropdown':
|
|
118
121
|
{
|
|
122
|
+
var useNewMenu = fg('platform-dst-new-menu');
|
|
123
|
+
var MenuItem = useNewMenu ? DropdownItem : ButtonItem;
|
|
119
124
|
var trigger = jsx(Flex, {
|
|
120
125
|
gap: "space.050"
|
|
121
126
|
}, jsx(Button, {
|
|
@@ -134,6 +139,21 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
134
139
|
// Ignored via go/ees005
|
|
135
140
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
136
141
|
, messages.editDropdownTriggerTitle)));
|
|
142
|
+
var items = jsx(Fragment, null, jsx(MenuItem, {
|
|
143
|
+
key: "edit.link",
|
|
144
|
+
onClick: onEditLink,
|
|
145
|
+
testId: "edit-dropdown-edit-link-item"
|
|
146
|
+
}, jsx(FormattedMessage
|
|
147
|
+
// Ignored via go/ees005
|
|
148
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
149
|
+
, messages.editDropdownEditLinkTitle)), jsx(MenuItem, {
|
|
150
|
+
key: "edit.datasource",
|
|
151
|
+
onClick: onEditDatasource,
|
|
152
|
+
testId: "edit-dropdown-edit-datasource-item"
|
|
153
|
+
}, jsx(FormattedMessage
|
|
154
|
+
// Ignored via go/ees005
|
|
155
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
156
|
+
, messages.editDropdownEditDatasourceTitle)));
|
|
137
157
|
return jsx(Flex, {
|
|
138
158
|
ref: containerRef
|
|
139
159
|
}, jsx(UiDropdown, {
|
|
@@ -142,27 +162,16 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
142
162
|
handleClickOutside: onClose,
|
|
143
163
|
handleEscapeKeydown: onClose,
|
|
144
164
|
trigger: trigger,
|
|
165
|
+
fitWidth: useNewMenu ? 200 : undefined,
|
|
145
166
|
scrollableElement: containerRef.current
|
|
146
167
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
147
168
|
,
|
|
148
169
|
arrowKeyNavigationProviderOptions: {
|
|
149
170
|
type: ArrowKeyNavigationType.MENU
|
|
150
171
|
}
|
|
151
|
-
}, jsx(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
testId: "edit-dropdown-edit-link-item"
|
|
155
|
-
}, jsx(FormattedMessage
|
|
156
|
-
// Ignored via go/ees005
|
|
157
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
158
|
-
, messages.editDropdownEditLinkTitle)), jsx(ButtonItem, {
|
|
159
|
-
key: "edit.datasource",
|
|
160
|
-
onClick: onEditDatasource,
|
|
161
|
-
testId: "edit-dropdown-edit-datasource-item"
|
|
162
|
-
}, jsx(FormattedMessage
|
|
163
|
-
// Ignored via go/ees005
|
|
164
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
165
|
-
, messages.editDropdownEditDatasourceTitle))));
|
|
172
|
+
}, useNewMenu ? jsx("div", {
|
|
173
|
+
role: "menu"
|
|
174
|
+
}, jsx(DropdownItemGroup, null, items)) : items));
|
|
166
175
|
}
|
|
167
176
|
case 'none':
|
|
168
177
|
default:
|
|
@@ -2,6 +2,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
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; }
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
|
|
6
|
+
import { DropdownItemGroup } from '@atlaskit/dropdown-menu/dropdown-item-group';
|
|
5
7
|
import { ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
|
|
6
8
|
import { appearancePropsMap } from '@atlaskit/editor-common/card';
|
|
7
9
|
import { getDropdownOption } from '@atlaskit/editor-common/card/link-toolbar-dropdown-options';
|
|
@@ -132,8 +134,24 @@ export var LinkAppearanceMenu = function LinkAppearanceMenu(_ref) {
|
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
// TODO: ED-26961 - this implementation does not support change boarding via pulse
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
var useNewMenu = fg('platform-dst-new-menu');
|
|
138
|
+
var ItemGroup = useNewMenu ? DropdownItemGroup : Section;
|
|
139
|
+
return /*#__PURE__*/React.createElement(MenuGroup, {
|
|
140
|
+
role: useNewMenu ? 'menu' : undefined
|
|
141
|
+
}, /*#__PURE__*/React.createElement(ItemGroup, null, finalOptions.map(function (option) {
|
|
142
|
+
var item = useNewMenu ? /*#__PURE__*/React.createElement(DropdownItem, {
|
|
143
|
+
key: option.title,
|
|
144
|
+
elemBefore: option.icon
|
|
145
|
+
// eslint-disable-next-line @atlassian/perf-linting/detect-unnecessary-rerenders, @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
146
|
+
,
|
|
147
|
+
onClick: function onClick() {
|
|
148
|
+
return option.onClick();
|
|
149
|
+
},
|
|
150
|
+
isSelected: option.selected,
|
|
151
|
+
isDisabled: showUnsupportedOptionsDisabled && option.disabled,
|
|
152
|
+
description: option.description,
|
|
153
|
+
shouldDescriptionWrap: true
|
|
154
|
+
}, option.title) : /*#__PURE__*/React.createElement(ButtonItem, {
|
|
137
155
|
key: option.title,
|
|
138
156
|
iconBefore: option.icon
|
|
139
157
|
// eslint-disable-next-line @atlassian/perf-linting/detect-unnecessary-rerenders, @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -157,9 +175,15 @@ export var LinkAppearanceMenu = function LinkAppearanceMenu(_ref) {
|
|
|
157
175
|
selected: Boolean(isDatasourceView),
|
|
158
176
|
inputMethod: INPUT_METHOD.FLOATING_TB,
|
|
159
177
|
dispatchCommand: dispatchCommand
|
|
160
|
-
})), 'href' in settingsConfig && settingsConfig.href && /*#__PURE__*/React.createElement(
|
|
178
|
+
})), 'href' in settingsConfig && settingsConfig.href && /*#__PURE__*/React.createElement(ItemGroup, {
|
|
161
179
|
hasSeparator: true
|
|
162
|
-
}, /*#__PURE__*/React.createElement(
|
|
180
|
+
}, useNewMenu ? /*#__PURE__*/React.createElement(DropdownItem, {
|
|
181
|
+
elemBefore: Icon && /*#__PURE__*/React.createElement(Icon, {
|
|
182
|
+
label: "Settings"
|
|
183
|
+
}),
|
|
184
|
+
href: settingsConfig.href,
|
|
185
|
+
target: 'target' in settingsConfig ? settingsConfig.target : undefined
|
|
186
|
+
}, intl.formatMessage(linkToolbarMessages.preferencesLink)) : /*#__PURE__*/React.createElement(LinkItem, {
|
|
163
187
|
iconBefore: Icon && /*#__PURE__*/React.createElement(Icon, {
|
|
164
188
|
label: "Settings"
|
|
165
189
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "40.0.
|
|
3
|
+
"version": "40.0.4",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@atlaskit/analytics-next": "^12.6.0",
|
|
26
26
|
"@atlaskit/css": "^1.1.0",
|
|
27
27
|
"@atlaskit/custom-steps": "^1.1.0",
|
|
28
|
+
"@atlaskit/dropdown-menu": "^22.2.0",
|
|
28
29
|
"@atlaskit/editor-card-provider": "^8.2.0",
|
|
29
30
|
"@atlaskit/editor-plugin-analytics": "^34.0.0",
|
|
30
31
|
"@atlaskit/editor-plugin-annotation": "^34.0.0",
|
|
@@ -60,11 +61,11 @@
|
|
|
60
61
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
61
62
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
62
63
|
"@atlaskit/platform-feature-flags-react": "^1.2.0",
|
|
63
|
-
"@atlaskit/primitives": "^22.
|
|
64
|
+
"@atlaskit/primitives": "^22.9.0",
|
|
64
65
|
"@atlaskit/prosemirror-history": "^1.4.0",
|
|
65
66
|
"@atlaskit/smart-card": "^46.20.0",
|
|
66
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
67
|
-
"@atlaskit/tokens": "^20.
|
|
67
|
+
"@atlaskit/tmp-editor-statsig": "^274.0.0",
|
|
68
|
+
"@atlaskit/tokens": "^20.15.0",
|
|
68
69
|
"@atlaskit/tooltip": "^24.4.0",
|
|
69
70
|
"@babel/runtime": "^7.0.0",
|
|
70
71
|
"@emotion/react": "^11.7.1",
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"uuid": "^11.1.1"
|
|
74
75
|
},
|
|
75
76
|
"peerDependencies": {
|
|
76
|
-
"@atlaskit/editor-common": "^138.
|
|
77
|
+
"@atlaskit/editor-common": "^138.3.0",
|
|
77
78
|
"@atlaskit/link-provider": "^6.4.0",
|
|
78
79
|
"react": "^18.2.0 || ^19.2.0",
|
|
79
80
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -108,7 +109,7 @@
|
|
|
108
109
|
"compassUnitTestMetricSourceId": "ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:metric-source/c5751cc6-3513-4070-9deb-af31e86aed34/e6f3220b-0ca2-445a-a4c5-78cff6ca2a34",
|
|
109
110
|
"devDependencies": {
|
|
110
111
|
"@atlaskit/docs": "^12.3.0",
|
|
111
|
-
"@atlaskit/editor-common": "^138.
|
|
112
|
+
"@atlaskit/editor-common": "^138.3.0",
|
|
112
113
|
"@atlaskit/link-provider": "^6.4.0",
|
|
113
114
|
"react": "^19.2.0",
|
|
114
115
|
"react-intl": "^7.0.0"
|