@atlaskit/editor-plugin-panel 4.2.5 → 4.2.7
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 +15 -0
- package/dist/cjs/ui/panelTypeDropdown.js +102 -0
- package/dist/cjs/ui/toolbar.js +8 -1
- package/dist/es2019/ui/panelTypeDropdown.js +100 -0
- package/dist/es2019/ui/toolbar.js +8 -1
- package/dist/esm/ui/panelTypeDropdown.js +95 -0
- package/dist/esm/ui/toolbar.js +8 -1
- package/dist/types/ui/panelTypeDropdown.d.ts +10 -0
- package/dist/types-ts4.5/ui/panelTypeDropdown.d.ts +10 -0
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-panel
|
|
2
2
|
|
|
3
|
+
## 4.2.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 4.2.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#123966](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/123966)
|
|
14
|
+
[`980562a51a41f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/980562a51a41f) -
|
|
15
|
+
[ux] ED-26796 Change panel type buttons into dropdown
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 4.2.5
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.panelTypeDropdown = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
+
var _crossCircle = _interopRequireDefault(require("@atlaskit/icon/core/cross-circle"));
|
|
12
|
+
var _customize = _interopRequireDefault(require("@atlaskit/icon/core/customize"));
|
|
13
|
+
var _discovery = _interopRequireDefault(require("@atlaskit/icon/core/discovery"));
|
|
14
|
+
var _information = _interopRequireDefault(require("@atlaskit/icon/core/information"));
|
|
15
|
+
var _success = _interopRequireDefault(require("@atlaskit/icon/core/success"));
|
|
16
|
+
var _warning = _interopRequireDefault(require("@atlaskit/icon/core/warning"));
|
|
17
|
+
var _actions = require("../editor-actions/actions");
|
|
18
|
+
var panelTitleAndIcon = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _adfSchema.PanelType.INFO, {
|
|
19
|
+
title: _messages.panelMessages.info,
|
|
20
|
+
icon: (0, _information.default)({
|
|
21
|
+
label: 'info-icon',
|
|
22
|
+
color: "var(--ds-icon-information, #1D7AFC)"
|
|
23
|
+
})
|
|
24
|
+
}), _adfSchema.PanelType.NOTE, {
|
|
25
|
+
title: _messages.panelMessages.note,
|
|
26
|
+
icon: (0, _discovery.default)({
|
|
27
|
+
label: 'note-icon',
|
|
28
|
+
color: "var(--ds-icon-discovery, #8270DB)"
|
|
29
|
+
})
|
|
30
|
+
}), _adfSchema.PanelType.SUCCESS, {
|
|
31
|
+
title: _messages.panelMessages.success,
|
|
32
|
+
icon: (0, _success.default)({
|
|
33
|
+
label: 'success-icon',
|
|
34
|
+
color: "var(--ds-icon-success, #22A06B)"
|
|
35
|
+
})
|
|
36
|
+
}), _adfSchema.PanelType.WARNING, {
|
|
37
|
+
title: _messages.panelMessages.warning,
|
|
38
|
+
icon: (0, _warning.default)({
|
|
39
|
+
label: 'warning-icon',
|
|
40
|
+
color: "var(--ds-icon-warning, #E56910)"
|
|
41
|
+
})
|
|
42
|
+
}), _adfSchema.PanelType.ERROR, {
|
|
43
|
+
title: _messages.panelMessages.error,
|
|
44
|
+
icon: (0, _crossCircle.default)({
|
|
45
|
+
label: 'error-icon',
|
|
46
|
+
color: "var(--ds-icon-danger, #C9372C)"
|
|
47
|
+
})
|
|
48
|
+
}), _adfSchema.PanelType.CUSTOM, {
|
|
49
|
+
title: _messages.panelMessages.custom,
|
|
50
|
+
icon: (0, _customize.default)({
|
|
51
|
+
label: 'custom-icon'
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
var panelTypeDropdown = exports.panelTypeDropdown = function panelTypeDropdown(_ref) {
|
|
55
|
+
var activePanelType = _ref.activePanelType,
|
|
56
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
57
|
+
formatMessage = _ref.formatMessage;
|
|
58
|
+
var dropdownOptions = [{
|
|
59
|
+
id: 'editor.panel.info',
|
|
60
|
+
icon: panelTitleAndIcon[_adfSchema.PanelType.INFO].icon,
|
|
61
|
+
onClick: (0, _actions.changePanelType)(editorAnalyticsAPI)(_adfSchema.PanelType.INFO),
|
|
62
|
+
selected: activePanelType === _adfSchema.PanelType.INFO,
|
|
63
|
+
title: formatMessage(panelTitleAndIcon[_adfSchema.PanelType.INFO].title)
|
|
64
|
+
}, {
|
|
65
|
+
id: 'editor.panel.note',
|
|
66
|
+
icon: panelTitleAndIcon[_adfSchema.PanelType.NOTE].icon,
|
|
67
|
+
onClick: (0, _actions.changePanelType)(editorAnalyticsAPI)(_adfSchema.PanelType.NOTE),
|
|
68
|
+
selected: activePanelType === _adfSchema.PanelType.NOTE,
|
|
69
|
+
title: formatMessage(panelTitleAndIcon[_adfSchema.PanelType.NOTE].title)
|
|
70
|
+
}, {
|
|
71
|
+
id: 'editor.panel.success',
|
|
72
|
+
icon: panelTitleAndIcon[_adfSchema.PanelType.SUCCESS].icon,
|
|
73
|
+
onClick: (0, _actions.changePanelType)(editorAnalyticsAPI)(_adfSchema.PanelType.SUCCESS),
|
|
74
|
+
selected: activePanelType === _adfSchema.PanelType.SUCCESS,
|
|
75
|
+
title: formatMessage(panelTitleAndIcon[_adfSchema.PanelType.SUCCESS].title)
|
|
76
|
+
}, {
|
|
77
|
+
id: 'editor.panel.warning',
|
|
78
|
+
icon: panelTitleAndIcon[_adfSchema.PanelType.WARNING].icon,
|
|
79
|
+
onClick: (0, _actions.changePanelType)(editorAnalyticsAPI)(_adfSchema.PanelType.WARNING),
|
|
80
|
+
selected: activePanelType === _adfSchema.PanelType.WARNING,
|
|
81
|
+
title: formatMessage(panelTitleAndIcon[_adfSchema.PanelType.WARNING].title)
|
|
82
|
+
}, {
|
|
83
|
+
id: 'editor.panel.error',
|
|
84
|
+
icon: panelTitleAndIcon[_adfSchema.PanelType.ERROR].icon,
|
|
85
|
+
onClick: (0, _actions.changePanelType)(editorAnalyticsAPI)(_adfSchema.PanelType.ERROR),
|
|
86
|
+
selected: activePanelType === _adfSchema.PanelType.ERROR,
|
|
87
|
+
title: formatMessage(panelTitleAndIcon[_adfSchema.PanelType.ERROR].title)
|
|
88
|
+
}];
|
|
89
|
+
var selectedPanelType = activePanelType || _adfSchema.PanelType.INFO;
|
|
90
|
+
var selectedTitleAndIcon = panelTitleAndIcon[selectedPanelType];
|
|
91
|
+
return {
|
|
92
|
+
id: 'panel-type-dropdown',
|
|
93
|
+
testId: 'panel-type-dropdown-trigger',
|
|
94
|
+
type: 'dropdown',
|
|
95
|
+
options: dropdownOptions,
|
|
96
|
+
showSelected: true,
|
|
97
|
+
iconBefore: function iconBefore() {
|
|
98
|
+
return selectedTitleAndIcon.icon;
|
|
99
|
+
},
|
|
100
|
+
title: formatMessage(selectedTitleAndIcon.title)
|
|
101
|
+
};
|
|
102
|
+
};
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -33,6 +33,7 @@ var _warning2 = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/warn
|
|
|
33
33
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
34
34
|
var _actions = require("../editor-actions/actions");
|
|
35
35
|
var _utils2 = require("../pm-plugins/utils/utils");
|
|
36
|
+
var _panelTypeDropdown = require("./panelTypeDropdown");
|
|
36
37
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
37
38
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
38
39
|
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; }
|
|
@@ -58,7 +59,7 @@ var panelIconMap = exports.panelIconMap = (0, _defineProperty2.default)((0, _def
|
|
|
58
59
|
});
|
|
59
60
|
var getToolbarItems = exports.getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, hoverDecoration, editorAnalyticsAPI, activePanelType, activePanelColor, activePanelIcon, state, api) {
|
|
60
61
|
// TODO: ED-14403 - investigate why these titles are not getting translated for the tooltips
|
|
61
|
-
var items = [{
|
|
62
|
+
var items = (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? [{
|
|
62
63
|
id: 'editor.panel.info',
|
|
63
64
|
type: 'button',
|
|
64
65
|
icon: _information.default,
|
|
@@ -103,6 +104,12 @@ var getToolbarItems = exports.getToolbarItems = function getToolbarItems(formatM
|
|
|
103
104
|
selected: activePanelType === _adfSchema.PanelType.ERROR,
|
|
104
105
|
title: formatMessage(_messages.panelMessages.error),
|
|
105
106
|
tabIndex: null
|
|
107
|
+
}] : [(0, _panelTypeDropdown.panelTypeDropdown)({
|
|
108
|
+
activePanelType: activePanelType,
|
|
109
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
110
|
+
formatMessage: formatMessage
|
|
111
|
+
}), {
|
|
112
|
+
type: 'separator'
|
|
106
113
|
}];
|
|
107
114
|
if (isCustomPanelEnabled) {
|
|
108
115
|
var changeColor = function changeColor(color) {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { PanelType } from '@atlaskit/adf-schema';
|
|
2
|
+
import { panelMessages as messages } from '@atlaskit/editor-common/messages';
|
|
3
|
+
import CrossCircleIcon from '@atlaskit/icon/core/cross-circle';
|
|
4
|
+
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
5
|
+
import DiscoveryIcon from '@atlaskit/icon/core/discovery';
|
|
6
|
+
import InformationIcon from '@atlaskit/icon/core/information';
|
|
7
|
+
import SuccessIcon from '@atlaskit/icon/core/success';
|
|
8
|
+
import WarningIcon from '@atlaskit/icon/core/warning';
|
|
9
|
+
import { changePanelType } from '../editor-actions/actions';
|
|
10
|
+
const panelTitleAndIcon = {
|
|
11
|
+
[PanelType.INFO]: {
|
|
12
|
+
title: messages.info,
|
|
13
|
+
icon: InformationIcon({
|
|
14
|
+
label: 'info-icon',
|
|
15
|
+
color: "var(--ds-icon-information, #1D7AFC)"
|
|
16
|
+
})
|
|
17
|
+
},
|
|
18
|
+
[PanelType.NOTE]: {
|
|
19
|
+
title: messages.note,
|
|
20
|
+
icon: DiscoveryIcon({
|
|
21
|
+
label: 'note-icon',
|
|
22
|
+
color: "var(--ds-icon-discovery, #8270DB)"
|
|
23
|
+
})
|
|
24
|
+
},
|
|
25
|
+
[PanelType.SUCCESS]: {
|
|
26
|
+
title: messages.success,
|
|
27
|
+
icon: SuccessIcon({
|
|
28
|
+
label: 'success-icon',
|
|
29
|
+
color: "var(--ds-icon-success, #22A06B)"
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
[PanelType.WARNING]: {
|
|
33
|
+
title: messages.warning,
|
|
34
|
+
icon: WarningIcon({
|
|
35
|
+
label: 'warning-icon',
|
|
36
|
+
color: "var(--ds-icon-warning, #E56910)"
|
|
37
|
+
})
|
|
38
|
+
},
|
|
39
|
+
[PanelType.ERROR]: {
|
|
40
|
+
title: messages.error,
|
|
41
|
+
icon: CrossCircleIcon({
|
|
42
|
+
label: 'error-icon',
|
|
43
|
+
color: "var(--ds-icon-danger, #C9372C)"
|
|
44
|
+
})
|
|
45
|
+
},
|
|
46
|
+
[PanelType.CUSTOM]: {
|
|
47
|
+
title: messages.custom,
|
|
48
|
+
icon: CustomizeIcon({
|
|
49
|
+
label: 'custom-icon'
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export const panelTypeDropdown = ({
|
|
54
|
+
activePanelType,
|
|
55
|
+
editorAnalyticsAPI,
|
|
56
|
+
formatMessage
|
|
57
|
+
}) => {
|
|
58
|
+
const dropdownOptions = [{
|
|
59
|
+
id: 'editor.panel.info',
|
|
60
|
+
icon: panelTitleAndIcon[PanelType.INFO].icon,
|
|
61
|
+
onClick: changePanelType(editorAnalyticsAPI)(PanelType.INFO),
|
|
62
|
+
selected: activePanelType === PanelType.INFO,
|
|
63
|
+
title: formatMessage(panelTitleAndIcon[PanelType.INFO].title)
|
|
64
|
+
}, {
|
|
65
|
+
id: 'editor.panel.note',
|
|
66
|
+
icon: panelTitleAndIcon[PanelType.NOTE].icon,
|
|
67
|
+
onClick: changePanelType(editorAnalyticsAPI)(PanelType.NOTE),
|
|
68
|
+
selected: activePanelType === PanelType.NOTE,
|
|
69
|
+
title: formatMessage(panelTitleAndIcon[PanelType.NOTE].title)
|
|
70
|
+
}, {
|
|
71
|
+
id: 'editor.panel.success',
|
|
72
|
+
icon: panelTitleAndIcon[PanelType.SUCCESS].icon,
|
|
73
|
+
onClick: changePanelType(editorAnalyticsAPI)(PanelType.SUCCESS),
|
|
74
|
+
selected: activePanelType === PanelType.SUCCESS,
|
|
75
|
+
title: formatMessage(panelTitleAndIcon[PanelType.SUCCESS].title)
|
|
76
|
+
}, {
|
|
77
|
+
id: 'editor.panel.warning',
|
|
78
|
+
icon: panelTitleAndIcon[PanelType.WARNING].icon,
|
|
79
|
+
onClick: changePanelType(editorAnalyticsAPI)(PanelType.WARNING),
|
|
80
|
+
selected: activePanelType === PanelType.WARNING,
|
|
81
|
+
title: formatMessage(panelTitleAndIcon[PanelType.WARNING].title)
|
|
82
|
+
}, {
|
|
83
|
+
id: 'editor.panel.error',
|
|
84
|
+
icon: panelTitleAndIcon[PanelType.ERROR].icon,
|
|
85
|
+
onClick: changePanelType(editorAnalyticsAPI)(PanelType.ERROR),
|
|
86
|
+
selected: activePanelType === PanelType.ERROR,
|
|
87
|
+
title: formatMessage(panelTitleAndIcon[PanelType.ERROR].title)
|
|
88
|
+
}];
|
|
89
|
+
const selectedPanelType = activePanelType || PanelType.INFO;
|
|
90
|
+
const selectedTitleAndIcon = panelTitleAndIcon[selectedPanelType];
|
|
91
|
+
return {
|
|
92
|
+
id: 'panel-type-dropdown',
|
|
93
|
+
testId: 'panel-type-dropdown-trigger',
|
|
94
|
+
type: 'dropdown',
|
|
95
|
+
options: dropdownOptions,
|
|
96
|
+
showSelected: true,
|
|
97
|
+
iconBefore: () => selectedTitleAndIcon.icon,
|
|
98
|
+
title: formatMessage(selectedTitleAndIcon.title)
|
|
99
|
+
};
|
|
100
|
+
};
|
|
@@ -24,6 +24,7 @@ import LegacyWarningIcon from '@atlaskit/icon/glyph/editor/warning';
|
|
|
24
24
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
25
25
|
import { changePanelType, removePanel } from '../editor-actions/actions';
|
|
26
26
|
import { findPanel } from '../pm-plugins/utils/utils';
|
|
27
|
+
import { panelTypeDropdown } from './panelTypeDropdown';
|
|
27
28
|
export const panelIconMap = {
|
|
28
29
|
[PanelType.INFO]: {
|
|
29
30
|
shortName: ':info:',
|
|
@@ -52,7 +53,7 @@ export const panelIconMap = {
|
|
|
52
53
|
};
|
|
53
54
|
export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, hoverDecoration, editorAnalyticsAPI, activePanelType, activePanelColor, activePanelIcon, state, api) => {
|
|
54
55
|
// TODO: ED-14403 - investigate why these titles are not getting translated for the tooltips
|
|
55
|
-
const items = [{
|
|
56
|
+
const items = editorExperiment('platform_editor_controls', 'control') ? [{
|
|
56
57
|
id: 'editor.panel.info',
|
|
57
58
|
type: 'button',
|
|
58
59
|
icon: InformationIcon,
|
|
@@ -97,6 +98,12 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
|
|
|
97
98
|
selected: activePanelType === PanelType.ERROR,
|
|
98
99
|
title: formatMessage(messages.error),
|
|
99
100
|
tabIndex: null
|
|
101
|
+
}] : [panelTypeDropdown({
|
|
102
|
+
activePanelType,
|
|
103
|
+
editorAnalyticsAPI,
|
|
104
|
+
formatMessage
|
|
105
|
+
}), {
|
|
106
|
+
type: 'separator'
|
|
100
107
|
}];
|
|
101
108
|
if (isCustomPanelEnabled) {
|
|
102
109
|
const changeColor = color => (state, dispatch) => {
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { PanelType } from '@atlaskit/adf-schema';
|
|
3
|
+
import { panelMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import CrossCircleIcon from '@atlaskit/icon/core/cross-circle';
|
|
5
|
+
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
6
|
+
import DiscoveryIcon from '@atlaskit/icon/core/discovery';
|
|
7
|
+
import InformationIcon from '@atlaskit/icon/core/information';
|
|
8
|
+
import SuccessIcon from '@atlaskit/icon/core/success';
|
|
9
|
+
import WarningIcon from '@atlaskit/icon/core/warning';
|
|
10
|
+
import { changePanelType } from '../editor-actions/actions';
|
|
11
|
+
var panelTitleAndIcon = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, PanelType.INFO, {
|
|
12
|
+
title: messages.info,
|
|
13
|
+
icon: InformationIcon({
|
|
14
|
+
label: 'info-icon',
|
|
15
|
+
color: "var(--ds-icon-information, #1D7AFC)"
|
|
16
|
+
})
|
|
17
|
+
}), PanelType.NOTE, {
|
|
18
|
+
title: messages.note,
|
|
19
|
+
icon: DiscoveryIcon({
|
|
20
|
+
label: 'note-icon',
|
|
21
|
+
color: "var(--ds-icon-discovery, #8270DB)"
|
|
22
|
+
})
|
|
23
|
+
}), PanelType.SUCCESS, {
|
|
24
|
+
title: messages.success,
|
|
25
|
+
icon: SuccessIcon({
|
|
26
|
+
label: 'success-icon',
|
|
27
|
+
color: "var(--ds-icon-success, #22A06B)"
|
|
28
|
+
})
|
|
29
|
+
}), PanelType.WARNING, {
|
|
30
|
+
title: messages.warning,
|
|
31
|
+
icon: WarningIcon({
|
|
32
|
+
label: 'warning-icon',
|
|
33
|
+
color: "var(--ds-icon-warning, #E56910)"
|
|
34
|
+
})
|
|
35
|
+
}), PanelType.ERROR, {
|
|
36
|
+
title: messages.error,
|
|
37
|
+
icon: CrossCircleIcon({
|
|
38
|
+
label: 'error-icon',
|
|
39
|
+
color: "var(--ds-icon-danger, #C9372C)"
|
|
40
|
+
})
|
|
41
|
+
}), PanelType.CUSTOM, {
|
|
42
|
+
title: messages.custom,
|
|
43
|
+
icon: CustomizeIcon({
|
|
44
|
+
label: 'custom-icon'
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
export var panelTypeDropdown = function panelTypeDropdown(_ref) {
|
|
48
|
+
var activePanelType = _ref.activePanelType,
|
|
49
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
50
|
+
formatMessage = _ref.formatMessage;
|
|
51
|
+
var dropdownOptions = [{
|
|
52
|
+
id: 'editor.panel.info',
|
|
53
|
+
icon: panelTitleAndIcon[PanelType.INFO].icon,
|
|
54
|
+
onClick: changePanelType(editorAnalyticsAPI)(PanelType.INFO),
|
|
55
|
+
selected: activePanelType === PanelType.INFO,
|
|
56
|
+
title: formatMessage(panelTitleAndIcon[PanelType.INFO].title)
|
|
57
|
+
}, {
|
|
58
|
+
id: 'editor.panel.note',
|
|
59
|
+
icon: panelTitleAndIcon[PanelType.NOTE].icon,
|
|
60
|
+
onClick: changePanelType(editorAnalyticsAPI)(PanelType.NOTE),
|
|
61
|
+
selected: activePanelType === PanelType.NOTE,
|
|
62
|
+
title: formatMessage(panelTitleAndIcon[PanelType.NOTE].title)
|
|
63
|
+
}, {
|
|
64
|
+
id: 'editor.panel.success',
|
|
65
|
+
icon: panelTitleAndIcon[PanelType.SUCCESS].icon,
|
|
66
|
+
onClick: changePanelType(editorAnalyticsAPI)(PanelType.SUCCESS),
|
|
67
|
+
selected: activePanelType === PanelType.SUCCESS,
|
|
68
|
+
title: formatMessage(panelTitleAndIcon[PanelType.SUCCESS].title)
|
|
69
|
+
}, {
|
|
70
|
+
id: 'editor.panel.warning',
|
|
71
|
+
icon: panelTitleAndIcon[PanelType.WARNING].icon,
|
|
72
|
+
onClick: changePanelType(editorAnalyticsAPI)(PanelType.WARNING),
|
|
73
|
+
selected: activePanelType === PanelType.WARNING,
|
|
74
|
+
title: formatMessage(panelTitleAndIcon[PanelType.WARNING].title)
|
|
75
|
+
}, {
|
|
76
|
+
id: 'editor.panel.error',
|
|
77
|
+
icon: panelTitleAndIcon[PanelType.ERROR].icon,
|
|
78
|
+
onClick: changePanelType(editorAnalyticsAPI)(PanelType.ERROR),
|
|
79
|
+
selected: activePanelType === PanelType.ERROR,
|
|
80
|
+
title: formatMessage(panelTitleAndIcon[PanelType.ERROR].title)
|
|
81
|
+
}];
|
|
82
|
+
var selectedPanelType = activePanelType || PanelType.INFO;
|
|
83
|
+
var selectedTitleAndIcon = panelTitleAndIcon[selectedPanelType];
|
|
84
|
+
return {
|
|
85
|
+
id: 'panel-type-dropdown',
|
|
86
|
+
testId: 'panel-type-dropdown-trigger',
|
|
87
|
+
type: 'dropdown',
|
|
88
|
+
options: dropdownOptions,
|
|
89
|
+
showSelected: true,
|
|
90
|
+
iconBefore: function iconBefore() {
|
|
91
|
+
return selectedTitleAndIcon.icon;
|
|
92
|
+
},
|
|
93
|
+
title: formatMessage(selectedTitleAndIcon.title)
|
|
94
|
+
};
|
|
95
|
+
};
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -27,6 +27,7 @@ import LegacyWarningIcon from '@atlaskit/icon/glyph/editor/warning';
|
|
|
27
27
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
28
28
|
import { changePanelType, removePanel } from '../editor-actions/actions';
|
|
29
29
|
import { findPanel } from '../pm-plugins/utils/utils';
|
|
30
|
+
import { panelTypeDropdown } from './panelTypeDropdown';
|
|
30
31
|
export var panelIconMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, PanelType.INFO, {
|
|
31
32
|
shortName: ':info:',
|
|
32
33
|
id: 'atlassian-info'
|
|
@@ -48,7 +49,7 @@ export var panelIconMap = _defineProperty(_defineProperty(_defineProperty(_defin
|
|
|
48
49
|
});
|
|
49
50
|
export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, hoverDecoration, editorAnalyticsAPI, activePanelType, activePanelColor, activePanelIcon, state, api) {
|
|
50
51
|
// TODO: ED-14403 - investigate why these titles are not getting translated for the tooltips
|
|
51
|
-
var items = [{
|
|
52
|
+
var items = editorExperiment('platform_editor_controls', 'control') ? [{
|
|
52
53
|
id: 'editor.panel.info',
|
|
53
54
|
type: 'button',
|
|
54
55
|
icon: InformationIcon,
|
|
@@ -93,6 +94,12 @@ export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeTy
|
|
|
93
94
|
selected: activePanelType === PanelType.ERROR,
|
|
94
95
|
title: formatMessage(messages.error),
|
|
95
96
|
tabIndex: null
|
|
97
|
+
}] : [panelTypeDropdown({
|
|
98
|
+
activePanelType: activePanelType,
|
|
99
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
100
|
+
formatMessage: formatMessage
|
|
101
|
+
}), {
|
|
102
|
+
type: 'separator'
|
|
96
103
|
}];
|
|
97
104
|
if (isCustomPanelEnabled) {
|
|
98
105
|
var changeColor = function changeColor(color) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { Command, FloatingToolbarDropdown } from '@atlaskit/editor-common/types';
|
|
4
|
+
type Props = {
|
|
5
|
+
activePanelType?: string;
|
|
6
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
7
|
+
formatMessage: IntlShape['formatMessage'];
|
|
8
|
+
};
|
|
9
|
+
export declare const panelTypeDropdown: ({ activePanelType, editorAnalyticsAPI, formatMessage, }: Props) => FloatingToolbarDropdown<Command>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { Command, FloatingToolbarDropdown } from '@atlaskit/editor-common/types';
|
|
4
|
+
type Props = {
|
|
5
|
+
activePanelType?: string;
|
|
6
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
7
|
+
formatMessage: IntlShape['formatMessage'];
|
|
8
|
+
};
|
|
9
|
+
export declare const panelTypeDropdown: ({ activePanelType, editorAnalyticsAPI, formatMessage, }: Props) => FloatingToolbarDropdown<Command>;
|
|
10
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-panel",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.7",
|
|
4
4
|
"description": "Panel plugin for @atlaskit/editor-core.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
35
|
-
"@atlaskit/editor-common": "^102.
|
|
35
|
+
"@atlaskit/editor-common": "^102.4.0",
|
|
36
36
|
"@atlaskit/editor-palette": "^2.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^2.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|
|
@@ -40,10 +40,11 @@
|
|
|
40
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
42
42
|
"@atlaskit/emoji": "^68.0.0",
|
|
43
|
-
"@atlaskit/icon": "^
|
|
43
|
+
"@atlaskit/icon": "^25.0.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/theme": "^18.0.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^3.
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^3.6.0",
|
|
47
|
+
"@atlaskit/tokens": "^4.4.0",
|
|
47
48
|
"@babel/runtime": "^7.0.0",
|
|
48
49
|
"uuid": "^3.1.0"
|
|
49
50
|
},
|