@atlaskit/editor-plugin-extension 0.5.2 → 0.6.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
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-extension
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#67100](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67100) [`55cdf07c41cb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/55cdf07c41cb) - Allow create label formatting for custom fields from extension
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 0.5.2
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -142,7 +142,8 @@ function CustomSelect(_ref2) {
|
|
|
142
142
|
var message = intl.formatMessage(_messages.messages.createOption);
|
|
143
143
|
return "".concat(message, " \"").concat(value, "\"");
|
|
144
144
|
}
|
|
145
|
-
var isCreatable = options.isCreatable
|
|
145
|
+
var isCreatable = options.isCreatable,
|
|
146
|
+
customFormatCreateLabel = options.formatCreateLabel;
|
|
146
147
|
return /*#__PURE__*/_react.default.createElement(_form.Field, {
|
|
147
148
|
name: name,
|
|
148
149
|
label: label,
|
|
@@ -172,7 +173,7 @@ function CustomSelect(_ref2) {
|
|
|
172
173
|
validationState: error ? 'error' : 'default',
|
|
173
174
|
defaultOptions: defaultOptions,
|
|
174
175
|
formatCreateLabel: function formatCreateLabel(value) {
|
|
175
|
-
return _formatCreateLabel(value);
|
|
176
|
+
return customFormatCreateLabel ? customFormatCreateLabel(value) : _formatCreateLabel(value);
|
|
176
177
|
},
|
|
177
178
|
formatOptionLabel: _SelectItem.formatOptionLabel,
|
|
178
179
|
loadOptions: function loadOptions(searchTerm) {
|
|
@@ -88,7 +88,8 @@ function CustomSelect({
|
|
|
88
88
|
return `${message} "${value}"`;
|
|
89
89
|
}
|
|
90
90
|
const {
|
|
91
|
-
isCreatable
|
|
91
|
+
isCreatable,
|
|
92
|
+
formatCreateLabel: customFormatCreateLabel
|
|
92
93
|
} = options;
|
|
93
94
|
return /*#__PURE__*/React.createElement(Field, {
|
|
94
95
|
name: name,
|
|
@@ -114,7 +115,7 @@ function CustomSelect({
|
|
|
114
115
|
isValidNewOption: value => !!(isCreatable && value),
|
|
115
116
|
validationState: error ? 'error' : 'default',
|
|
116
117
|
defaultOptions: defaultOptions,
|
|
117
|
-
formatCreateLabel: value => formatCreateLabel(value),
|
|
118
|
+
formatCreateLabel: value => customFormatCreateLabel ? customFormatCreateLabel(value) : formatCreateLabel(value),
|
|
118
119
|
formatOptionLabel: formatOptionLabel,
|
|
119
120
|
loadOptions: searchTerm => {
|
|
120
121
|
return resolver(searchTerm, fieldDefaultValue, parameters);
|
|
@@ -132,7 +132,8 @@ function CustomSelect(_ref2) {
|
|
|
132
132
|
var message = intl.formatMessage(messages.createOption);
|
|
133
133
|
return "".concat(message, " \"").concat(value, "\"");
|
|
134
134
|
}
|
|
135
|
-
var isCreatable = options.isCreatable
|
|
135
|
+
var isCreatable = options.isCreatable,
|
|
136
|
+
customFormatCreateLabel = options.formatCreateLabel;
|
|
136
137
|
return /*#__PURE__*/React.createElement(Field, {
|
|
137
138
|
name: name,
|
|
138
139
|
label: label,
|
|
@@ -162,7 +163,7 @@ function CustomSelect(_ref2) {
|
|
|
162
163
|
validationState: error ? 'error' : 'default',
|
|
163
164
|
defaultOptions: defaultOptions,
|
|
164
165
|
formatCreateLabel: function formatCreateLabel(value) {
|
|
165
|
-
return _formatCreateLabel(value);
|
|
166
|
+
return customFormatCreateLabel ? customFormatCreateLabel(value) : _formatCreateLabel(value);
|
|
166
167
|
},
|
|
167
168
|
formatOptionLabel: formatOptionLabel,
|
|
168
169
|
loadOptions: function loadOptions(searchTerm) {
|
|
@@ -565,6 +565,21 @@ export const customFields: FieldDefinition[] = [
|
|
|
565
565
|
},
|
|
566
566
|
},
|
|
567
567
|
},
|
|
568
|
+
{
|
|
569
|
+
name: 'custom-format-create-label',
|
|
570
|
+
type: 'custom',
|
|
571
|
+
label: 'Custom: Customized create label',
|
|
572
|
+
description: 'Select or create an option with a custom label',
|
|
573
|
+
options: {
|
|
574
|
+
isCreatable: true,
|
|
575
|
+
formatCreateLabel: (value: string) => {
|
|
576
|
+
return `Add "${value}" to the list`;
|
|
577
|
+
},
|
|
578
|
+
resolver: {
|
|
579
|
+
type: 'mock-resolver',
|
|
580
|
+
},
|
|
581
|
+
},
|
|
582
|
+
},
|
|
568
583
|
{
|
|
569
584
|
name: 'unsupported',
|
|
570
585
|
type: 'custom',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "editor-plugin-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/button": "^17.2.0",
|
|
32
32
|
"@atlaskit/checkbox": "^13.0.0",
|
|
33
33
|
"@atlaskit/datetime-picker": "^13.0.3",
|
|
34
|
-
"@atlaskit/editor-common": "^76.
|
|
34
|
+
"@atlaskit/editor-common": "^76.41.0",
|
|
35
35
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^0.4.0",
|
|
37
37
|
"@atlaskit/editor-plugin-context-panel": "^0.2.0",
|