@atlaskit/editor-plugin-panel 4.0.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/cjs/panelPlugin.js +133 -109
- package/dist/cjs/ui/toolbar.js +1 -2
- package/dist/es2019/panelPlugin.js +122 -100
- package/dist/es2019/ui/toolbar.js +1 -2
- package/dist/esm/panelPlugin.js +134 -110
- package/dist/esm/ui/toolbar.js +1 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-panel
|
|
2
2
|
|
|
3
|
+
## 4.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#120472](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120472)
|
|
8
|
+
[`4758d7dd443dd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4758d7dd443dd) -
|
|
9
|
+
[ux] ED-26766 update adf-schema from 47.2.1 to 47.6.0 and adf-schema-json from 1.27.0 to 1.31.0
|
|
10
|
+
and feature gated the usage of new prosemirror nodes in blockTypePlugin, expandPlugin, listPlugin
|
|
11
|
+
and panelPlugin as the new defaults of these nodes support nesting of extensions
|
|
12
|
+
- [#120472](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120472)
|
|
13
|
+
[`73c800ab5f2fc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/73c800ab5f2fc) -
|
|
14
|
+
ED-26766 update adf-schema from 47.2.1 to 47.6.0 and adf-schema-json from 1.27.0 to 1.31.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#120007](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120007)
|
|
19
|
+
[`e87df0a8c73c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e87df0a8c73c6) -
|
|
20
|
+
[ux] Do not add headings, lists, layouts, panels in the new QuickInsert menu
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
23
|
+
## 4.1.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- [#119765](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/119765)
|
|
28
|
+
[`5a27b842be965`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5a27b842be965) -
|
|
29
|
+
Add deprecated label to `forceStaticToolbar` in floating toolbar property and remove its usage
|
|
30
|
+
across plugins
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
|
|
3
36
|
## 4.0.1
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/dist/cjs/panelPlugin.js
CHANGED
|
@@ -11,6 +11,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
11
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
12
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
13
13
|
var _colors = require("@atlaskit/theme/colors");
|
|
14
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
15
|
var _actions = require("./editor-actions/actions");
|
|
15
16
|
var _keymaps = _interopRequireDefault(require("./pm-plugins/keymaps"));
|
|
16
17
|
var _main = require("./pm-plugins/main");
|
|
@@ -22,7 +23,7 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
22
23
|
return {
|
|
23
24
|
name: 'panel',
|
|
24
25
|
nodes: function nodes() {
|
|
25
|
-
var panelNode = (0, _adfSchema.extendedPanel)(!!options.allowCustomPanel);
|
|
26
|
+
var panelNode = (0, _experiments.editorExperiment)('platform_editor_nested_non_bodied_macros', 'test') ? (0, _adfSchema.extendedPanel)(!!options.allowCustomPanel) : (0, _adfSchema.panelWithoutNestedNonBodiedMacros)(!!options.allowCustomPanel);
|
|
26
27
|
return [{
|
|
27
28
|
name: 'panel',
|
|
28
29
|
node: panelNode
|
|
@@ -53,127 +54,150 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
53
54
|
pluginsOptions: {
|
|
54
55
|
quickInsert: function quickInsert(_ref3) {
|
|
55
56
|
var formatMessage = _ref3.formatMessage;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
action: function action(insert, state) {
|
|
139
|
-
return createPanelAction({
|
|
140
|
-
state: state,
|
|
141
|
-
attributes: {
|
|
142
|
-
panelType: _adfSchema.PanelType.ERROR
|
|
143
|
-
},
|
|
144
|
-
api: api,
|
|
145
|
-
insert: insert
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}];
|
|
149
|
-
if (options.allowCustomPanel && options.allowCustomPanelEdit) {
|
|
150
|
-
quickInsertOptions.push({
|
|
151
|
-
id: 'custompanel',
|
|
152
|
-
title: formatMessage(_messages.blockTypeMessages.customPanel),
|
|
153
|
-
description: formatMessage(_messages.blockTypeMessages.customPanelDescription),
|
|
57
|
+
if ((0, _experiments.editorExperiment)('platform_editor_insertion', 'variant1')) {
|
|
58
|
+
return [{
|
|
59
|
+
id: 'infopanel',
|
|
60
|
+
title: formatMessage(_messages.blockTypeMessages.infoPanel),
|
|
61
|
+
keywords: ['panel'],
|
|
62
|
+
description: formatMessage(_messages.blockTypeMessages.infoPanelDescription),
|
|
63
|
+
priority: 800,
|
|
64
|
+
icon: function icon() {
|
|
65
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanel, null);
|
|
66
|
+
},
|
|
67
|
+
action: function action(insert, state) {
|
|
68
|
+
return createPanelAction({
|
|
69
|
+
state: state,
|
|
70
|
+
attributes: {
|
|
71
|
+
panelType: _adfSchema.PanelType.INFO
|
|
72
|
+
},
|
|
73
|
+
api: api,
|
|
74
|
+
insert: insert
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}];
|
|
78
|
+
} else {
|
|
79
|
+
var quickInsertOptions = [{
|
|
80
|
+
id: 'infopanel',
|
|
81
|
+
title: formatMessage(_messages.blockTypeMessages.infoPanel),
|
|
82
|
+
keywords: ['panel'],
|
|
83
|
+
description: formatMessage(_messages.blockTypeMessages.infoPanelDescription),
|
|
84
|
+
priority: 800,
|
|
85
|
+
icon: function icon() {
|
|
86
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanel, null);
|
|
87
|
+
},
|
|
88
|
+
action: function action(insert, state) {
|
|
89
|
+
return createPanelAction({
|
|
90
|
+
state: state,
|
|
91
|
+
attributes: {
|
|
92
|
+
panelType: _adfSchema.PanelType.INFO
|
|
93
|
+
},
|
|
94
|
+
api: api,
|
|
95
|
+
insert: insert
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
id: 'notepanel',
|
|
100
|
+
title: formatMessage(_messages.blockTypeMessages.notePanel),
|
|
101
|
+
description: formatMessage(_messages.blockTypeMessages.notePanelDescription),
|
|
102
|
+
priority: 1000,
|
|
103
|
+
icon: function icon() {
|
|
104
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanelNote, null);
|
|
105
|
+
},
|
|
106
|
+
action: function action(insert, state) {
|
|
107
|
+
return createPanelAction({
|
|
108
|
+
state: state,
|
|
109
|
+
attributes: {
|
|
110
|
+
panelType: _adfSchema.PanelType.NOTE
|
|
111
|
+
},
|
|
112
|
+
api: api,
|
|
113
|
+
insert: insert
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
id: 'successpanel',
|
|
118
|
+
title: formatMessage(_messages.blockTypeMessages.successPanel),
|
|
119
|
+
description: formatMessage(_messages.blockTypeMessages.successPanelDescription),
|
|
120
|
+
keywords: ['tip'],
|
|
121
|
+
priority: 1000,
|
|
122
|
+
icon: function icon() {
|
|
123
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanelSuccess, null);
|
|
124
|
+
},
|
|
125
|
+
action: function action(insert, state) {
|
|
126
|
+
return createPanelAction({
|
|
127
|
+
state: state,
|
|
128
|
+
attributes: {
|
|
129
|
+
panelType: _adfSchema.PanelType.SUCCESS
|
|
130
|
+
},
|
|
131
|
+
api: api,
|
|
132
|
+
insert: insert
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}, {
|
|
136
|
+
id: 'warningpanel',
|
|
137
|
+
title: formatMessage(_messages.blockTypeMessages.warningPanel),
|
|
138
|
+
description: formatMessage(_messages.blockTypeMessages.warningPanelDescription),
|
|
154
139
|
priority: 1000,
|
|
155
140
|
icon: function icon() {
|
|
156
|
-
return /*#__PURE__*/_react.default.createElement(_quickInsert.
|
|
141
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanelWarning, null);
|
|
157
142
|
},
|
|
158
143
|
action: function action(insert, state) {
|
|
159
144
|
return createPanelAction({
|
|
160
145
|
state: state,
|
|
161
146
|
attributes: {
|
|
162
|
-
panelType: _adfSchema.PanelType.
|
|
163
|
-
panelIcon: ':rainbow:',
|
|
164
|
-
panelIconId: '1f308',
|
|
165
|
-
panelIconText: '🌈',
|
|
166
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-7268
|
|
167
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
168
|
-
panelColor: _colors.T50
|
|
147
|
+
panelType: _adfSchema.PanelType.WARNING
|
|
169
148
|
},
|
|
170
149
|
api: api,
|
|
171
150
|
insert: insert
|
|
172
151
|
});
|
|
173
152
|
}
|
|
174
|
-
}
|
|
153
|
+
}, {
|
|
154
|
+
id: 'errorpanel',
|
|
155
|
+
title: formatMessage(_messages.blockTypeMessages.errorPanel),
|
|
156
|
+
description: formatMessage(_messages.blockTypeMessages.errorPanelDescription),
|
|
157
|
+
priority: 1000,
|
|
158
|
+
icon: function icon() {
|
|
159
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanelError, null);
|
|
160
|
+
},
|
|
161
|
+
action: function action(insert, state) {
|
|
162
|
+
return createPanelAction({
|
|
163
|
+
state: state,
|
|
164
|
+
attributes: {
|
|
165
|
+
panelType: _adfSchema.PanelType.ERROR
|
|
166
|
+
},
|
|
167
|
+
api: api,
|
|
168
|
+
insert: insert
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}];
|
|
172
|
+
if (options.allowCustomPanel && options.allowCustomPanelEdit) {
|
|
173
|
+
quickInsertOptions.push({
|
|
174
|
+
id: 'custompanel',
|
|
175
|
+
title: formatMessage(_messages.blockTypeMessages.customPanel),
|
|
176
|
+
description: formatMessage(_messages.blockTypeMessages.customPanelDescription),
|
|
177
|
+
priority: 1000,
|
|
178
|
+
icon: function icon() {
|
|
179
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconCustomPanel, null);
|
|
180
|
+
},
|
|
181
|
+
action: function action(insert, state) {
|
|
182
|
+
return createPanelAction({
|
|
183
|
+
state: state,
|
|
184
|
+
attributes: {
|
|
185
|
+
panelType: _adfSchema.PanelType.CUSTOM,
|
|
186
|
+
panelIcon: ':rainbow:',
|
|
187
|
+
panelIconId: '1f308',
|
|
188
|
+
panelIconText: '🌈',
|
|
189
|
+
// TODO: https://product-fabric.atlassian.net/browse/DSP-7268
|
|
190
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
191
|
+
panelColor: _colors.T50
|
|
192
|
+
},
|
|
193
|
+
api: api,
|
|
194
|
+
insert: insert
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return quickInsertOptions;
|
|
175
200
|
}
|
|
176
|
-
return quickInsertOptions;
|
|
177
201
|
},
|
|
178
202
|
floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
|
|
179
203
|
return (0, _toolbar.getToolbarConfig)(state, intl, options, providerFactory, api);
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -338,8 +338,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
338
338
|
nodeType: nodeType,
|
|
339
339
|
items: items,
|
|
340
340
|
scrollable: true,
|
|
341
|
-
groupLabel: formatMessage(_messages.panelMessages.panelsGroup)
|
|
342
|
-
forceStaticToolbar: true
|
|
341
|
+
groupLabel: formatMessage(_messages.panelMessages.panelsGroup)
|
|
343
342
|
};
|
|
344
343
|
}
|
|
345
344
|
return;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { extendedPanel, PanelType } from '@atlaskit/adf-schema';
|
|
2
|
+
import { extendedPanel, panelWithoutNestedNonBodiedMacros, PanelType } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { IconCustomPanel, IconPanel, IconPanelError, IconPanelNote, IconPanelSuccess, IconPanelWarning } from '@atlaskit/editor-common/quick-insert';
|
|
6
6
|
import { T50 } from '@atlaskit/theme/colors';
|
|
7
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
import { insertPanelWithAnalytics } from './editor-actions/actions';
|
|
8
9
|
import keymap from './pm-plugins/keymaps';
|
|
9
10
|
import { createPlugin } from './pm-plugins/main';
|
|
@@ -14,7 +15,7 @@ const panelPlugin = ({
|
|
|
14
15
|
}) => ({
|
|
15
16
|
name: 'panel',
|
|
16
17
|
nodes() {
|
|
17
|
-
const panelNode = extendedPanel(!!options.allowCustomPanel);
|
|
18
|
+
const panelNode = editorExperiment('platform_editor_nested_non_bodied_macros', 'test') ? extendedPanel(!!options.allowCustomPanel) : panelWithoutNestedNonBodiedMacros(!!options.allowCustomPanel);
|
|
18
19
|
return [{
|
|
19
20
|
name: 'panel',
|
|
20
21
|
node: panelNode
|
|
@@ -43,115 +44,136 @@ const panelPlugin = ({
|
|
|
43
44
|
quickInsert: ({
|
|
44
45
|
formatMessage
|
|
45
46
|
}) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
state,
|
|
121
|
-
attributes: {
|
|
122
|
-
panelType: PanelType.ERROR
|
|
123
|
-
},
|
|
124
|
-
api,
|
|
125
|
-
insert
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}];
|
|
129
|
-
if (options.allowCustomPanel && options.allowCustomPanelEdit) {
|
|
130
|
-
quickInsertOptions.push({
|
|
131
|
-
id: 'custompanel',
|
|
132
|
-
title: formatMessage(blockTypeMessages.customPanel),
|
|
133
|
-
description: formatMessage(blockTypeMessages.customPanelDescription),
|
|
47
|
+
if (editorExperiment('platform_editor_insertion', 'variant1')) {
|
|
48
|
+
return [{
|
|
49
|
+
id: 'infopanel',
|
|
50
|
+
title: formatMessage(blockTypeMessages.infoPanel),
|
|
51
|
+
keywords: ['panel'],
|
|
52
|
+
description: formatMessage(blockTypeMessages.infoPanelDescription),
|
|
53
|
+
priority: 800,
|
|
54
|
+
icon: () => /*#__PURE__*/React.createElement(IconPanel, null),
|
|
55
|
+
action(insert, state) {
|
|
56
|
+
return createPanelAction({
|
|
57
|
+
state,
|
|
58
|
+
attributes: {
|
|
59
|
+
panelType: PanelType.INFO
|
|
60
|
+
},
|
|
61
|
+
api,
|
|
62
|
+
insert
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}];
|
|
66
|
+
} else {
|
|
67
|
+
const quickInsertOptions = [{
|
|
68
|
+
id: 'infopanel',
|
|
69
|
+
title: formatMessage(blockTypeMessages.infoPanel),
|
|
70
|
+
keywords: ['panel'],
|
|
71
|
+
description: formatMessage(blockTypeMessages.infoPanelDescription),
|
|
72
|
+
priority: 800,
|
|
73
|
+
icon: () => /*#__PURE__*/React.createElement(IconPanel, null),
|
|
74
|
+
action(insert, state) {
|
|
75
|
+
return createPanelAction({
|
|
76
|
+
state,
|
|
77
|
+
attributes: {
|
|
78
|
+
panelType: PanelType.INFO
|
|
79
|
+
},
|
|
80
|
+
api,
|
|
81
|
+
insert
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
id: 'notepanel',
|
|
86
|
+
title: formatMessage(blockTypeMessages.notePanel),
|
|
87
|
+
description: formatMessage(blockTypeMessages.notePanelDescription),
|
|
88
|
+
priority: 1000,
|
|
89
|
+
icon: () => /*#__PURE__*/React.createElement(IconPanelNote, null),
|
|
90
|
+
action(insert, state) {
|
|
91
|
+
return createPanelAction({
|
|
92
|
+
state,
|
|
93
|
+
attributes: {
|
|
94
|
+
panelType: PanelType.NOTE
|
|
95
|
+
},
|
|
96
|
+
api,
|
|
97
|
+
insert
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
id: 'successpanel',
|
|
102
|
+
title: formatMessage(blockTypeMessages.successPanel),
|
|
103
|
+
description: formatMessage(blockTypeMessages.successPanelDescription),
|
|
104
|
+
keywords: ['tip'],
|
|
105
|
+
priority: 1000,
|
|
106
|
+
icon: () => /*#__PURE__*/React.createElement(IconPanelSuccess, null),
|
|
107
|
+
action(insert, state) {
|
|
108
|
+
return createPanelAction({
|
|
109
|
+
state,
|
|
110
|
+
attributes: {
|
|
111
|
+
panelType: PanelType.SUCCESS
|
|
112
|
+
},
|
|
113
|
+
api,
|
|
114
|
+
insert
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
id: 'warningpanel',
|
|
119
|
+
title: formatMessage(blockTypeMessages.warningPanel),
|
|
120
|
+
description: formatMessage(blockTypeMessages.warningPanelDescription),
|
|
134
121
|
priority: 1000,
|
|
135
|
-
icon: () => /*#__PURE__*/React.createElement(
|
|
122
|
+
icon: () => /*#__PURE__*/React.createElement(IconPanelWarning, null),
|
|
136
123
|
action(insert, state) {
|
|
137
124
|
return createPanelAction({
|
|
138
125
|
state,
|
|
139
126
|
attributes: {
|
|
140
|
-
panelType: PanelType.
|
|
141
|
-
panelIcon: ':rainbow:',
|
|
142
|
-
panelIconId: '1f308',
|
|
143
|
-
panelIconText: '🌈',
|
|
144
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-7268
|
|
145
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
146
|
-
panelColor: T50
|
|
127
|
+
panelType: PanelType.WARNING
|
|
147
128
|
},
|
|
148
129
|
api,
|
|
149
130
|
insert
|
|
150
131
|
});
|
|
151
132
|
}
|
|
152
|
-
}
|
|
133
|
+
}, {
|
|
134
|
+
id: 'errorpanel',
|
|
135
|
+
title: formatMessage(blockTypeMessages.errorPanel),
|
|
136
|
+
description: formatMessage(blockTypeMessages.errorPanelDescription),
|
|
137
|
+
priority: 1000,
|
|
138
|
+
icon: () => /*#__PURE__*/React.createElement(IconPanelError, null),
|
|
139
|
+
action(insert, state) {
|
|
140
|
+
return createPanelAction({
|
|
141
|
+
state,
|
|
142
|
+
attributes: {
|
|
143
|
+
panelType: PanelType.ERROR
|
|
144
|
+
},
|
|
145
|
+
api,
|
|
146
|
+
insert
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}];
|
|
150
|
+
if (options.allowCustomPanel && options.allowCustomPanelEdit) {
|
|
151
|
+
quickInsertOptions.push({
|
|
152
|
+
id: 'custompanel',
|
|
153
|
+
title: formatMessage(blockTypeMessages.customPanel),
|
|
154
|
+
description: formatMessage(blockTypeMessages.customPanelDescription),
|
|
155
|
+
priority: 1000,
|
|
156
|
+
icon: () => /*#__PURE__*/React.createElement(IconCustomPanel, null),
|
|
157
|
+
action(insert, state) {
|
|
158
|
+
return createPanelAction({
|
|
159
|
+
state,
|
|
160
|
+
attributes: {
|
|
161
|
+
panelType: PanelType.CUSTOM,
|
|
162
|
+
panelIcon: ':rainbow:',
|
|
163
|
+
panelIconId: '1f308',
|
|
164
|
+
panelIconText: '🌈',
|
|
165
|
+
// TODO: https://product-fabric.atlassian.net/browse/DSP-7268
|
|
166
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
167
|
+
panelColor: T50
|
|
168
|
+
},
|
|
169
|
+
api,
|
|
170
|
+
insert
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return quickInsertOptions;
|
|
153
176
|
}
|
|
154
|
-
return quickInsertOptions;
|
|
155
177
|
},
|
|
156
178
|
floatingToolbar: (state, intl, providerFactory) => getToolbarConfig(state, intl, options, providerFactory, api)
|
|
157
179
|
}
|
|
@@ -322,8 +322,7 @@ export const getToolbarConfig = (state, intl, options = {}, providerFactory, api
|
|
|
322
322
|
nodeType,
|
|
323
323
|
items,
|
|
324
324
|
scrollable: true,
|
|
325
|
-
groupLabel: formatMessage(messages.panelsGroup)
|
|
326
|
-
forceStaticToolbar: true
|
|
325
|
+
groupLabel: formatMessage(messages.panelsGroup)
|
|
327
326
|
};
|
|
328
327
|
}
|
|
329
328
|
return;
|
package/dist/esm/panelPlugin.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { extendedPanel, PanelType } from '@atlaskit/adf-schema';
|
|
2
|
+
import { extendedPanel, panelWithoutNestedNonBodiedMacros, PanelType } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { IconCustomPanel, IconPanel, IconPanelError, IconPanelNote, IconPanelSuccess, IconPanelWarning } from '@atlaskit/editor-common/quick-insert';
|
|
6
6
|
import { T50 } from '@atlaskit/theme/colors';
|
|
7
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
import { insertPanelWithAnalytics } from './editor-actions/actions';
|
|
8
9
|
import keymap from './pm-plugins/keymaps';
|
|
9
10
|
import { createPlugin } from './pm-plugins/main';
|
|
@@ -15,7 +16,7 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
15
16
|
return {
|
|
16
17
|
name: 'panel',
|
|
17
18
|
nodes: function nodes() {
|
|
18
|
-
var panelNode = extendedPanel(!!options.allowCustomPanel);
|
|
19
|
+
var panelNode = editorExperiment('platform_editor_nested_non_bodied_macros', 'test') ? extendedPanel(!!options.allowCustomPanel) : panelWithoutNestedNonBodiedMacros(!!options.allowCustomPanel);
|
|
19
20
|
return [{
|
|
20
21
|
name: 'panel',
|
|
21
22
|
node: panelNode
|
|
@@ -46,127 +47,150 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
46
47
|
pluginsOptions: {
|
|
47
48
|
quickInsert: function quickInsert(_ref3) {
|
|
48
49
|
var formatMessage = _ref3.formatMessage;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
action: function action(insert, state) {
|
|
132
|
-
return createPanelAction({
|
|
133
|
-
state: state,
|
|
134
|
-
attributes: {
|
|
135
|
-
panelType: PanelType.ERROR
|
|
136
|
-
},
|
|
137
|
-
api: api,
|
|
138
|
-
insert: insert
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}];
|
|
142
|
-
if (options.allowCustomPanel && options.allowCustomPanelEdit) {
|
|
143
|
-
quickInsertOptions.push({
|
|
144
|
-
id: 'custompanel',
|
|
145
|
-
title: formatMessage(blockTypeMessages.customPanel),
|
|
146
|
-
description: formatMessage(blockTypeMessages.customPanelDescription),
|
|
50
|
+
if (editorExperiment('platform_editor_insertion', 'variant1')) {
|
|
51
|
+
return [{
|
|
52
|
+
id: 'infopanel',
|
|
53
|
+
title: formatMessage(blockTypeMessages.infoPanel),
|
|
54
|
+
keywords: ['panel'],
|
|
55
|
+
description: formatMessage(blockTypeMessages.infoPanelDescription),
|
|
56
|
+
priority: 800,
|
|
57
|
+
icon: function icon() {
|
|
58
|
+
return /*#__PURE__*/React.createElement(IconPanel, null);
|
|
59
|
+
},
|
|
60
|
+
action: function action(insert, state) {
|
|
61
|
+
return createPanelAction({
|
|
62
|
+
state: state,
|
|
63
|
+
attributes: {
|
|
64
|
+
panelType: PanelType.INFO
|
|
65
|
+
},
|
|
66
|
+
api: api,
|
|
67
|
+
insert: insert
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}];
|
|
71
|
+
} else {
|
|
72
|
+
var quickInsertOptions = [{
|
|
73
|
+
id: 'infopanel',
|
|
74
|
+
title: formatMessage(blockTypeMessages.infoPanel),
|
|
75
|
+
keywords: ['panel'],
|
|
76
|
+
description: formatMessage(blockTypeMessages.infoPanelDescription),
|
|
77
|
+
priority: 800,
|
|
78
|
+
icon: function icon() {
|
|
79
|
+
return /*#__PURE__*/React.createElement(IconPanel, null);
|
|
80
|
+
},
|
|
81
|
+
action: function action(insert, state) {
|
|
82
|
+
return createPanelAction({
|
|
83
|
+
state: state,
|
|
84
|
+
attributes: {
|
|
85
|
+
panelType: PanelType.INFO
|
|
86
|
+
},
|
|
87
|
+
api: api,
|
|
88
|
+
insert: insert
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
id: 'notepanel',
|
|
93
|
+
title: formatMessage(blockTypeMessages.notePanel),
|
|
94
|
+
description: formatMessage(blockTypeMessages.notePanelDescription),
|
|
95
|
+
priority: 1000,
|
|
96
|
+
icon: function icon() {
|
|
97
|
+
return /*#__PURE__*/React.createElement(IconPanelNote, null);
|
|
98
|
+
},
|
|
99
|
+
action: function action(insert, state) {
|
|
100
|
+
return createPanelAction({
|
|
101
|
+
state: state,
|
|
102
|
+
attributes: {
|
|
103
|
+
panelType: PanelType.NOTE
|
|
104
|
+
},
|
|
105
|
+
api: api,
|
|
106
|
+
insert: insert
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
id: 'successpanel',
|
|
111
|
+
title: formatMessage(blockTypeMessages.successPanel),
|
|
112
|
+
description: formatMessage(blockTypeMessages.successPanelDescription),
|
|
113
|
+
keywords: ['tip'],
|
|
114
|
+
priority: 1000,
|
|
115
|
+
icon: function icon() {
|
|
116
|
+
return /*#__PURE__*/React.createElement(IconPanelSuccess, null);
|
|
117
|
+
},
|
|
118
|
+
action: function action(insert, state) {
|
|
119
|
+
return createPanelAction({
|
|
120
|
+
state: state,
|
|
121
|
+
attributes: {
|
|
122
|
+
panelType: PanelType.SUCCESS
|
|
123
|
+
},
|
|
124
|
+
api: api,
|
|
125
|
+
insert: insert
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
id: 'warningpanel',
|
|
130
|
+
title: formatMessage(blockTypeMessages.warningPanel),
|
|
131
|
+
description: formatMessage(blockTypeMessages.warningPanelDescription),
|
|
147
132
|
priority: 1000,
|
|
148
133
|
icon: function icon() {
|
|
149
|
-
return /*#__PURE__*/React.createElement(
|
|
134
|
+
return /*#__PURE__*/React.createElement(IconPanelWarning, null);
|
|
150
135
|
},
|
|
151
136
|
action: function action(insert, state) {
|
|
152
137
|
return createPanelAction({
|
|
153
138
|
state: state,
|
|
154
139
|
attributes: {
|
|
155
|
-
panelType: PanelType.
|
|
156
|
-
panelIcon: ':rainbow:',
|
|
157
|
-
panelIconId: '1f308',
|
|
158
|
-
panelIconText: '🌈',
|
|
159
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-7268
|
|
160
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
161
|
-
panelColor: T50
|
|
140
|
+
panelType: PanelType.WARNING
|
|
162
141
|
},
|
|
163
142
|
api: api,
|
|
164
143
|
insert: insert
|
|
165
144
|
});
|
|
166
145
|
}
|
|
167
|
-
}
|
|
146
|
+
}, {
|
|
147
|
+
id: 'errorpanel',
|
|
148
|
+
title: formatMessage(blockTypeMessages.errorPanel),
|
|
149
|
+
description: formatMessage(blockTypeMessages.errorPanelDescription),
|
|
150
|
+
priority: 1000,
|
|
151
|
+
icon: function icon() {
|
|
152
|
+
return /*#__PURE__*/React.createElement(IconPanelError, null);
|
|
153
|
+
},
|
|
154
|
+
action: function action(insert, state) {
|
|
155
|
+
return createPanelAction({
|
|
156
|
+
state: state,
|
|
157
|
+
attributes: {
|
|
158
|
+
panelType: PanelType.ERROR
|
|
159
|
+
},
|
|
160
|
+
api: api,
|
|
161
|
+
insert: insert
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}];
|
|
165
|
+
if (options.allowCustomPanel && options.allowCustomPanelEdit) {
|
|
166
|
+
quickInsertOptions.push({
|
|
167
|
+
id: 'custompanel',
|
|
168
|
+
title: formatMessage(blockTypeMessages.customPanel),
|
|
169
|
+
description: formatMessage(blockTypeMessages.customPanelDescription),
|
|
170
|
+
priority: 1000,
|
|
171
|
+
icon: function icon() {
|
|
172
|
+
return /*#__PURE__*/React.createElement(IconCustomPanel, null);
|
|
173
|
+
},
|
|
174
|
+
action: function action(insert, state) {
|
|
175
|
+
return createPanelAction({
|
|
176
|
+
state: state,
|
|
177
|
+
attributes: {
|
|
178
|
+
panelType: PanelType.CUSTOM,
|
|
179
|
+
panelIcon: ':rainbow:',
|
|
180
|
+
panelIconId: '1f308',
|
|
181
|
+
panelIconText: '🌈',
|
|
182
|
+
// TODO: https://product-fabric.atlassian.net/browse/DSP-7268
|
|
183
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
184
|
+
panelColor: T50
|
|
185
|
+
},
|
|
186
|
+
api: api,
|
|
187
|
+
insert: insert
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return quickInsertOptions;
|
|
168
193
|
}
|
|
169
|
-
return quickInsertOptions;
|
|
170
194
|
},
|
|
171
195
|
floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
|
|
172
196
|
return getToolbarConfig(state, intl, options, providerFactory, api);
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -328,8 +328,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
|
328
328
|
nodeType: nodeType,
|
|
329
329
|
items: items,
|
|
330
330
|
scrollable: true,
|
|
331
|
-
groupLabel: formatMessage(messages.panelsGroup)
|
|
332
|
-
forceStaticToolbar: true
|
|
331
|
+
groupLabel: formatMessage(messages.panelsGroup)
|
|
333
332
|
};
|
|
334
333
|
}
|
|
335
334
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-panel",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Panel plugin for @atlaskit/editor-core.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/adf-schema": "^47.
|
|
35
|
-
"@atlaskit/editor-common": "^100.
|
|
34
|
+
"@atlaskit/adf-schema": "^47.6.0",
|
|
35
|
+
"@atlaskit/editor-common": "^100.5.0",
|
|
36
36
|
"@atlaskit/editor-palette": "2.0.0",
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^2.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|
|
39
|
-
"@atlaskit/editor-plugin-emoji": "^3.
|
|
39
|
+
"@atlaskit/editor-plugin-emoji": "^3.1.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
|
-
"@atlaskit/editor-shared-styles": "^3.
|
|
41
|
+
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
42
42
|
"@atlaskit/emoji": "^68.0.0",
|
|
43
43
|
"@atlaskit/icon": "^24.1.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/theme": "^17.0.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^3.
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^3.4.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
48
48
|
"uuid": "^3.1.0"
|
|
49
49
|
},
|