@atlaskit/editor-plugin-extension 5.2.5 → 5.2.6
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 +11 -0
- package/dist/cjs/extensionPlugin.js +1 -1
- package/dist/cjs/pm-plugins/toolbar.js +5 -3
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +29 -10
- package/dist/cjs/ui/ConfigPanel/ConfigPanelFieldsLoader.js +7 -1
- package/dist/cjs/ui/ConfigPanel/Fields/Boolean.js +8 -4
- package/dist/cjs/ui/ConfigPanel/Fields/CheckboxGroup.js +4 -2
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +4 -2
- package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +4 -2
- package/dist/cjs/ui/ConfigPanel/Fields/Date.js +4 -2
- package/dist/cjs/ui/ConfigPanel/Fields/DateRange.js +10 -5
- package/dist/cjs/ui/ConfigPanel/Fields/Fieldset.js +2 -1
- package/dist/cjs/ui/ConfigPanel/Fields/Number.js +4 -2
- package/dist/cjs/ui/ConfigPanel/Fields/RadioGroup.js +2 -1
- package/dist/cjs/ui/ConfigPanel/Fields/Select.js +2 -1
- package/dist/cjs/ui/ConfigPanel/Fields/String.js +4 -2
- package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +5 -3
- package/dist/cjs/ui/ConfigPanel/FormContent.js +18 -5
- package/dist/cjs/ui/ConfigPanel/LoadingState.js +28 -1
- package/dist/es2019/extensionPlugin.js +1 -1
- package/dist/es2019/pm-plugins/toolbar.js +5 -4
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +18 -6
- package/dist/es2019/ui/ConfigPanel/ConfigPanelFieldsLoader.js +7 -1
- package/dist/es2019/ui/ConfigPanel/Fields/Boolean.js +8 -4
- package/dist/es2019/ui/ConfigPanel/Fields/CheckboxGroup.js +4 -2
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +4 -2
- package/dist/es2019/ui/ConfigPanel/Fields/CustomSelect.js +4 -2
- package/dist/es2019/ui/ConfigPanel/Fields/Date.js +4 -2
- package/dist/es2019/ui/ConfigPanel/Fields/DateRange.js +10 -5
- package/dist/es2019/ui/ConfigPanel/Fields/Fieldset.js +2 -1
- package/dist/es2019/ui/ConfigPanel/Fields/Number.js +4 -2
- package/dist/es2019/ui/ConfigPanel/Fields/RadioGroup.js +2 -1
- package/dist/es2019/ui/ConfigPanel/Fields/Select.js +2 -1
- package/dist/es2019/ui/ConfigPanel/Fields/String.js +4 -2
- package/dist/es2019/ui/ConfigPanel/Fields/UserSelect.js +5 -3
- package/dist/es2019/ui/ConfigPanel/FormContent.js +19 -5
- package/dist/es2019/ui/ConfigPanel/LoadingState.js +26 -1
- package/dist/esm/extensionPlugin.js +1 -1
- package/dist/esm/pm-plugins/toolbar.js +5 -3
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +29 -10
- package/dist/esm/ui/ConfigPanel/ConfigPanelFieldsLoader.js +7 -1
- package/dist/esm/ui/ConfigPanel/Fields/Boolean.js +8 -4
- package/dist/esm/ui/ConfigPanel/Fields/CheckboxGroup.js +4 -2
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +4 -2
- package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +4 -2
- package/dist/esm/ui/ConfigPanel/Fields/Date.js +4 -2
- package/dist/esm/ui/ConfigPanel/Fields/DateRange.js +10 -5
- package/dist/esm/ui/ConfigPanel/Fields/Fieldset.js +2 -1
- package/dist/esm/ui/ConfigPanel/Fields/Number.js +4 -2
- package/dist/esm/ui/ConfigPanel/Fields/RadioGroup.js +2 -1
- package/dist/esm/ui/ConfigPanel/Fields/Select.js +2 -1
- package/dist/esm/ui/ConfigPanel/Fields/String.js +4 -2
- package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +5 -3
- package/dist/esm/ui/ConfigPanel/FormContent.js +18 -5
- package/dist/esm/ui/ConfigPanel/LoadingState.js +28 -1
- package/dist/types/extensionPluginType.d.ts +3 -1
- package/dist/types/pm-plugins/toolbar.d.ts +2 -1
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +4 -3
- package/dist/types/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +2 -2
- package/dist/types/ui/ConfigPanel/FormContent.d.ts +1 -1
- package/dist/types/ui/ConfigPanel/LoadingState.d.ts +3 -1
- package/dist/types/ui/ConfigPanel/types.d.ts +1 -0
- package/dist/types-ts4.5/extensionPluginType.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/toolbar.d.ts +3 -1
- package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanel.d.ts +4 -3
- package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +2 -2
- package/dist/types-ts4.5/ui/ConfigPanel/FormContent.d.ts +1 -1
- package/dist/types-ts4.5/ui/ConfigPanel/LoadingState.d.ts +3 -1
- package/dist/types-ts4.5/ui/ConfigPanel/types.d.ts +1 -0
- package/package.json +7 -6
|
@@ -13,6 +13,7 @@ import { isTabGroup, configPanelMessages as messages } from '@atlaskit/editor-co
|
|
|
13
13
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
14
14
|
import Form, { FormFooter } from '@atlaskit/form';
|
|
15
15
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
16
17
|
import { ALLOWED_LOGGED_MACRO_PARAMS } from './constants';
|
|
17
18
|
import { DescriptionSummary } from './DescriptionSummary';
|
|
18
19
|
import ErrorMessage from './ErrorMessage';
|
|
@@ -36,7 +37,8 @@ function ConfigForm({
|
|
|
36
37
|
parameters,
|
|
37
38
|
submitting,
|
|
38
39
|
contextIdentifierProvider,
|
|
39
|
-
featureFlags
|
|
40
|
+
featureFlags,
|
|
41
|
+
disableFields
|
|
40
42
|
}) {
|
|
41
43
|
useEffect(() => {
|
|
42
44
|
if (fields) {
|
|
@@ -61,7 +63,8 @@ function ConfigForm({
|
|
|
61
63
|
onFieldChange: onFieldChange,
|
|
62
64
|
firstVisibleFieldName: firstVisibleFieldName,
|
|
63
65
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
64
|
-
featureFlags: featureFlags
|
|
66
|
+
featureFlags: featureFlags,
|
|
67
|
+
isDisabled: disableFields
|
|
65
68
|
}), /*#__PURE__*/React.createElement("div", {
|
|
66
69
|
style: canSave ? {} : {
|
|
67
70
|
display: 'none'
|
|
@@ -185,7 +188,13 @@ class ConfigPanel extends React.Component {
|
|
|
185
188
|
}
|
|
186
189
|
try {
|
|
187
190
|
const serializedData = await serialize(extensionManifest, this.backfillTabFormData(fields, formData, this.state.currentParameters), fields);
|
|
188
|
-
|
|
191
|
+
if (editorExperiment('platform_editor_offline_editing_web', true, {
|
|
192
|
+
exposure: true
|
|
193
|
+
})) {
|
|
194
|
+
await onChange(serializedData);
|
|
195
|
+
} else {
|
|
196
|
+
onChange(serializedData);
|
|
197
|
+
}
|
|
189
198
|
} catch (error) {
|
|
190
199
|
autoSaveReject === null || autoSaveReject === void 0 ? void 0 : autoSaveReject(error);
|
|
191
200
|
// eslint-disable-next-line no-console
|
|
@@ -408,7 +417,8 @@ class ConfigPanel extends React.Component {
|
|
|
408
417
|
onFieldChange: onFieldChange,
|
|
409
418
|
parameters: currentParameters,
|
|
410
419
|
submitting: submitting,
|
|
411
|
-
featureFlags: featureFlags
|
|
420
|
+
featureFlags: featureFlags,
|
|
421
|
+
disableFields: this.props.disableFields
|
|
412
422
|
}))
|
|
413
423
|
);
|
|
414
424
|
});
|
|
@@ -428,7 +438,8 @@ function ConfigFormIntlWithBoundary({
|
|
|
428
438
|
isLoading,
|
|
429
439
|
hasParsedParameters,
|
|
430
440
|
firstVisibleFieldName,
|
|
431
|
-
errorMessage
|
|
441
|
+
errorMessage,
|
|
442
|
+
disableFields
|
|
432
443
|
}) {
|
|
433
444
|
const {
|
|
434
445
|
contextIdentifierState
|
|
@@ -453,7 +464,8 @@ function ConfigFormIntlWithBoundary({
|
|
|
453
464
|
parameters: parameters,
|
|
454
465
|
submitting: submitting,
|
|
455
466
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
456
|
-
featureFlags: featureFlags
|
|
467
|
+
featureFlags: featureFlags,
|
|
468
|
+
disableFields: disableFields
|
|
457
469
|
}));
|
|
458
470
|
}
|
|
459
471
|
const result = withAnalyticsContext({
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
5
|
import ConfigPanel from './ConfigPanel';
|
|
4
6
|
import { useStateFromPromise } from './use-state-from-promise';
|
|
5
7
|
const getFieldsDefinitionFn = (extensionManifest, nodeKey) => {
|
|
@@ -106,6 +108,9 @@ export default function FieldsLoader({
|
|
|
106
108
|
}) {
|
|
107
109
|
const [extensionManifest] = useStateFromPromise(() => extensionProvider.getExtension(extensionType, extensionKey), [extensionProvider, extensionType, extensionKey]);
|
|
108
110
|
const [errorMessage, setErrorMessage] = useState(null);
|
|
111
|
+
const connectivityState = useSharedPluginStateSelector(api, 'connectivity.mode', {
|
|
112
|
+
disabled: editorExperiment('platform_editor_offline_editing_web', false)
|
|
113
|
+
});
|
|
109
114
|
return /*#__PURE__*/React.createElement(FieldDefinitionsPromiseResolver, {
|
|
110
115
|
setErrorMessage: setErrorMessage,
|
|
111
116
|
extensionManifest: extensionManifest,
|
|
@@ -127,6 +132,7 @@ export default function FieldsLoader({
|
|
|
127
132
|
featureFlags: featureFlags
|
|
128
133
|
// Remove below prop when cleaning platform_editor_ai_object_sidebar_injection FG
|
|
129
134
|
,
|
|
130
|
-
usingObjectSidebarPanel: usingObjectSidebarPanel
|
|
135
|
+
usingObjectSidebarPanel: usingObjectSidebarPanel,
|
|
136
|
+
disableFields: connectivityState === 'offline'
|
|
131
137
|
}));
|
|
132
138
|
}
|
|
@@ -52,13 +52,15 @@ function Checkbox({
|
|
|
52
52
|
label,
|
|
53
53
|
description,
|
|
54
54
|
isRequired = false,
|
|
55
|
-
defaultValue = false
|
|
55
|
+
defaultValue = false,
|
|
56
|
+
isDisabled
|
|
56
57
|
} = field;
|
|
57
58
|
return jsx(Field, {
|
|
58
59
|
name: name,
|
|
59
60
|
isRequired: isRequired,
|
|
60
61
|
validate: value => validate(value, isRequired),
|
|
61
|
-
defaultValue: defaultValue
|
|
62
|
+
defaultValue: defaultValue,
|
|
63
|
+
isDisabled: isDisabled
|
|
62
64
|
}, ({
|
|
63
65
|
fieldProps,
|
|
64
66
|
error
|
|
@@ -89,14 +91,16 @@ function Toggle({
|
|
|
89
91
|
label,
|
|
90
92
|
description,
|
|
91
93
|
isRequired = false,
|
|
92
|
-
defaultValue = false
|
|
94
|
+
defaultValue = false,
|
|
95
|
+
isDisabled
|
|
93
96
|
} = field;
|
|
94
97
|
return jsx(Field, {
|
|
95
98
|
name: name,
|
|
96
99
|
isRequired: isRequired,
|
|
97
100
|
validate: value => validate(value, isRequired),
|
|
98
101
|
defaultValue: defaultValue,
|
|
99
|
-
testId: `config-panel-toggle-${name}
|
|
102
|
+
testId: `config-panel-toggle-${name}`,
|
|
103
|
+
isDisabled: isDisabled
|
|
100
104
|
}, ({
|
|
101
105
|
fieldProps,
|
|
102
106
|
error
|
|
@@ -81,7 +81,8 @@ export default function CheckboxGroup({
|
|
|
81
81
|
description,
|
|
82
82
|
defaultValue,
|
|
83
83
|
isRequired = false,
|
|
84
|
-
items: options
|
|
84
|
+
items: options,
|
|
85
|
+
isDisabled
|
|
85
86
|
} = field;
|
|
86
87
|
const label = jsx(Fragment, null, labelBase, isRequired ? jsx("span", {
|
|
87
88
|
css: requiredIndicatorStyles,
|
|
@@ -94,7 +95,8 @@ export default function CheckboxGroup({
|
|
|
94
95
|
name: name,
|
|
95
96
|
isRequired: isRequired,
|
|
96
97
|
defaultValue: defaultValue,
|
|
97
|
-
validate: value => validate(value, isRequired)
|
|
98
|
+
validate: value => validate(value, isRequired),
|
|
99
|
+
isDisabled: isDisabled
|
|
98
100
|
}, props => {
|
|
99
101
|
return jsx(CheckboxGroupInner, _extends({
|
|
100
102
|
label: label,
|
|
@@ -375,14 +375,16 @@ const ColorPickerField = ({
|
|
|
375
375
|
const {
|
|
376
376
|
label,
|
|
377
377
|
defaultValue,
|
|
378
|
-
isRequired
|
|
378
|
+
isRequired,
|
|
379
|
+
isDisabled
|
|
379
380
|
} = field;
|
|
380
381
|
return jsx(Field, {
|
|
381
382
|
name: name,
|
|
382
383
|
isRequired: isRequired,
|
|
383
384
|
defaultValue: defaultValue,
|
|
384
385
|
testId: `config-panel-color-picker-${name}`,
|
|
385
|
-
validate: value => validate(field, value || '')
|
|
386
|
+
validate: value => validate(field, value || ''),
|
|
387
|
+
isDisabled: isDisabled
|
|
386
388
|
}, ({
|
|
387
389
|
fieldProps,
|
|
388
390
|
error
|
|
@@ -37,7 +37,8 @@ function CustomSelect({
|
|
|
37
37
|
isMultiple,
|
|
38
38
|
isRequired,
|
|
39
39
|
label,
|
|
40
|
-
options
|
|
40
|
+
options,
|
|
41
|
+
isDisabled
|
|
41
42
|
} = field;
|
|
42
43
|
const [loading, setLoading] = useState(true);
|
|
43
44
|
const [resolver, setResolver] = useState(null);
|
|
@@ -96,7 +97,8 @@ function CustomSelect({
|
|
|
96
97
|
isRequired: isRequired,
|
|
97
98
|
defaultValue: defaultValue,
|
|
98
99
|
validate: value => validate(field, value),
|
|
99
|
-
testId: `config-panel-custom-select-${name}
|
|
100
|
+
testId: `config-panel-custom-select-${name}`,
|
|
101
|
+
isDisabled: isDisabled
|
|
100
102
|
}, ({
|
|
101
103
|
fieldProps,
|
|
102
104
|
error
|
|
@@ -17,7 +17,8 @@ function Date({
|
|
|
17
17
|
label,
|
|
18
18
|
description,
|
|
19
19
|
defaultValue,
|
|
20
|
-
isRequired
|
|
20
|
+
isRequired,
|
|
21
|
+
isDisabled
|
|
21
22
|
} = field;
|
|
22
23
|
return /*#__PURE__*/React.createElement(Field, {
|
|
23
24
|
name: name,
|
|
@@ -25,7 +26,8 @@ function Date({
|
|
|
25
26
|
defaultValue: defaultValue,
|
|
26
27
|
isRequired: isRequired,
|
|
27
28
|
validate: value => validate(field, value),
|
|
28
|
-
testId: `config-panel-date-picker-${name}
|
|
29
|
+
testId: `config-panel-date-picker-${name}`,
|
|
30
|
+
isDisabled: isDisabled
|
|
29
31
|
}, ({
|
|
30
32
|
fieldProps,
|
|
31
33
|
error
|
|
@@ -37,7 +37,8 @@ const DateField = ({
|
|
|
37
37
|
fieldName,
|
|
38
38
|
onFieldChange,
|
|
39
39
|
intl,
|
|
40
|
-
isRequired
|
|
40
|
+
isRequired,
|
|
41
|
+
isDisabled
|
|
41
42
|
}) => jsx("div", {
|
|
42
43
|
css: horizontalFieldWrapperStyles,
|
|
43
44
|
key: fieldName
|
|
@@ -50,7 +51,8 @@ const DateField = ({
|
|
|
50
51
|
return validateRequired({
|
|
51
52
|
isRequired
|
|
52
53
|
}, value);
|
|
53
|
-
}
|
|
54
|
+
},
|
|
55
|
+
isDisabled: isDisabled
|
|
54
56
|
}, ({
|
|
55
57
|
fieldProps,
|
|
56
58
|
error
|
|
@@ -107,7 +109,8 @@ const DateRange = function ({
|
|
|
107
109
|
defaultValue: currentValue,
|
|
108
110
|
isRequired: field.isRequired,
|
|
109
111
|
validate: value => validate(field, value || ''),
|
|
110
|
-
testId: `config-panel-date-range-${name}
|
|
112
|
+
testId: `config-panel-date-range-${name}`,
|
|
113
|
+
isDisabled: field.isDisabled
|
|
111
114
|
}, ({
|
|
112
115
|
fieldProps,
|
|
113
116
|
error
|
|
@@ -142,14 +145,16 @@ const DateRange = function ({
|
|
|
142
145
|
fieldName: "from",
|
|
143
146
|
onFieldChange: onFieldChange,
|
|
144
147
|
intl: intl,
|
|
145
|
-
isRequired: field.isRequired
|
|
148
|
+
isRequired: field.isRequired,
|
|
149
|
+
isDisabled: field.isDisabled
|
|
146
150
|
}), jsx(DateField, {
|
|
147
151
|
scope: name,
|
|
148
152
|
parentField: field,
|
|
149
153
|
fieldName: "to",
|
|
150
154
|
onFieldChange: onFieldChange,
|
|
151
155
|
intl: intl,
|
|
152
|
-
isRequired: field.isRequired
|
|
156
|
+
isRequired: field.isRequired,
|
|
157
|
+
isDisabled: field.isDisabled
|
|
153
158
|
})), jsx(FieldMessages, {
|
|
154
159
|
description: field.description
|
|
155
160
|
}));
|
|
@@ -219,7 +219,8 @@ class FieldsetField extends React.Component {
|
|
|
219
219
|
canRemoveFields: field.options.isDynamic && visibleFields.size > 1,
|
|
220
220
|
onClickRemove: this.onClickRemove,
|
|
221
221
|
onFieldChange: onFieldChange,
|
|
222
|
-
firstVisibleFieldName: firstVisibleFieldName
|
|
222
|
+
firstVisibleFieldName: firstVisibleFieldName,
|
|
223
|
+
isDisabled: field.isDisabled
|
|
223
224
|
}), children && jsx("div", {
|
|
224
225
|
css: actionsWrapperStyles,
|
|
225
226
|
"data-testId": "fieldset-actions"
|
|
@@ -17,7 +17,8 @@ export default function Number({
|
|
|
17
17
|
label,
|
|
18
18
|
description,
|
|
19
19
|
defaultValue,
|
|
20
|
-
isRequired
|
|
20
|
+
isRequired,
|
|
21
|
+
isDisabled
|
|
21
22
|
} = field;
|
|
22
23
|
function validateNumber(value) {
|
|
23
24
|
const error = validate(field, value || '');
|
|
@@ -38,7 +39,8 @@ export default function Number({
|
|
|
38
39
|
defaultValue: defaultValue === undefined ? '' : String(defaultValue),
|
|
39
40
|
isRequired: isRequired,
|
|
40
41
|
validate: validateNumber,
|
|
41
|
-
testId: `config-panel-number-${name}
|
|
42
|
+
testId: `config-panel-number-${name}`,
|
|
43
|
+
isDisabled: isDisabled
|
|
42
44
|
}, ({
|
|
43
45
|
fieldProps,
|
|
44
46
|
error,
|
|
@@ -21,7 +21,8 @@ export default function RadioField({
|
|
|
21
21
|
defaultValue: field.defaultValue,
|
|
22
22
|
isRequired: field.isRequired,
|
|
23
23
|
validate: value => validate(field, value),
|
|
24
|
-
testId: `config-panel-radio-group-${field.name}
|
|
24
|
+
testId: `config-panel-radio-group-${field.name}`,
|
|
25
|
+
isDisabled: field.isDisabled
|
|
25
26
|
}, ({
|
|
26
27
|
fieldProps,
|
|
27
28
|
error
|
|
@@ -16,7 +16,8 @@ export default function String({
|
|
|
16
16
|
label,
|
|
17
17
|
description,
|
|
18
18
|
defaultValue,
|
|
19
|
-
isRequired
|
|
19
|
+
isRequired,
|
|
20
|
+
isDisabled
|
|
20
21
|
} = field;
|
|
21
22
|
return /*#__PURE__*/React.createElement(Field, {
|
|
22
23
|
name: name,
|
|
@@ -24,7 +25,8 @@ export default function String({
|
|
|
24
25
|
defaultValue: defaultValue || '',
|
|
25
26
|
isRequired: isRequired,
|
|
26
27
|
validate: value => validate(field, value || ''),
|
|
27
|
-
testId: `config-panel-string-${name}
|
|
28
|
+
testId: `config-panel-string-${name}`,
|
|
29
|
+
isDisabled: isDisabled
|
|
28
30
|
}, ({
|
|
29
31
|
fieldProps,
|
|
30
32
|
error,
|
|
@@ -136,7 +136,8 @@ export default function UserSelect({
|
|
|
136
136
|
defaultValue,
|
|
137
137
|
description,
|
|
138
138
|
isRequired,
|
|
139
|
-
options
|
|
139
|
+
options,
|
|
140
|
+
isDisabled
|
|
140
141
|
} = field;
|
|
141
142
|
const {
|
|
142
143
|
type
|
|
@@ -166,7 +167,8 @@ export default function UserSelect({
|
|
|
166
167
|
isRequired: isRequired,
|
|
167
168
|
defaultValue: defaultValue,
|
|
168
169
|
validate: value => validate(field, value),
|
|
169
|
-
testId: `config-panel-user-select-${name}
|
|
170
|
+
testId: `config-panel-user-select-${name}`,
|
|
171
|
+
isDisabled: isDisabled
|
|
170
172
|
}, ({
|
|
171
173
|
fieldProps,
|
|
172
174
|
error,
|
|
@@ -177,7 +179,7 @@ export default function UserSelect({
|
|
|
177
179
|
return /*#__PURE__*/React.createElement(UnhandledType, {
|
|
178
180
|
key: name,
|
|
179
181
|
field: field,
|
|
180
|
-
errorMessage: `Field "${name}" can't be
|
|
182
|
+
errorMessage: `Field "${name}" can't be rendered. Missing provider for "${type}".`
|
|
181
183
|
});
|
|
182
184
|
}
|
|
183
185
|
function onChange(newValue) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { isFieldset } from '@atlaskit/editor-common/extensions';
|
|
3
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
4
|
import Boolean from './Fields/Boolean';
|
|
4
5
|
import ColorPicker from './Fields/ColorPicker';
|
|
5
6
|
import CustomSelect from './Fields/CustomSelect';
|
|
@@ -139,7 +140,8 @@ export function FieldComponent({
|
|
|
139
140
|
parameters: resolvedParameters,
|
|
140
141
|
onFieldChange: onFieldChange,
|
|
141
142
|
extensionManifest: extensionManifest,
|
|
142
|
-
featureFlags: featureFlags
|
|
143
|
+
featureFlags: featureFlags,
|
|
144
|
+
isDisabled: field.isDisabled
|
|
143
145
|
}));
|
|
144
146
|
}
|
|
145
147
|
case 'tab-group':
|
|
@@ -155,7 +157,8 @@ export function FieldComponent({
|
|
|
155
157
|
parameters: tabParameters,
|
|
156
158
|
onFieldChange: onFieldChange,
|
|
157
159
|
extensionManifest: extensionManifest,
|
|
158
|
-
featureFlags: featureFlags
|
|
160
|
+
featureFlags: featureFlags,
|
|
161
|
+
isDisabled: field.isDisabled
|
|
159
162
|
});
|
|
160
163
|
};
|
|
161
164
|
return /*#__PURE__*/React.createElement(TabGroup, {
|
|
@@ -190,13 +193,24 @@ export default function FormContent({
|
|
|
190
193
|
onFieldChange,
|
|
191
194
|
firstVisibleFieldName,
|
|
192
195
|
contextIdentifierProvider,
|
|
193
|
-
featureFlags
|
|
196
|
+
featureFlags,
|
|
197
|
+
isDisabled
|
|
194
198
|
}) {
|
|
199
|
+
let mappedFields = fields;
|
|
200
|
+
if (editorExperiment('platform_editor_offline_editing_web', true)) {
|
|
201
|
+
mappedFields = fields.map(field => {
|
|
202
|
+
var _field$isDisabled;
|
|
203
|
+
return {
|
|
204
|
+
...field,
|
|
205
|
+
isDisabled: (_field$isDisabled = field.isDisabled) !== null && _field$isDisabled !== void 0 ? _field$isDisabled : isDisabled
|
|
206
|
+
};
|
|
207
|
+
});
|
|
208
|
+
}
|
|
195
209
|
return /*#__PURE__*/React.createElement(FormErrorBoundary, {
|
|
196
210
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
197
211
|
extensionKey: extensionManifest.key,
|
|
198
|
-
fields:
|
|
199
|
-
},
|
|
212
|
+
fields: mappedFields
|
|
213
|
+
}, mappedFields.map(field => {
|
|
200
214
|
let fieldElement = /*#__PURE__*/React.createElement(FieldComponent, {
|
|
201
215
|
field: field,
|
|
202
216
|
parameters: parameters || {},
|
|
@@ -4,17 +4,42 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { css, jsx } from '@emotion/react';
|
|
7
|
+
import { injectIntl } from 'react-intl-next';
|
|
8
|
+
import { messages } from '@atlaskit/editor-common/extensions';
|
|
9
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
7
10
|
import Spinner from '@atlaskit/spinner';
|
|
11
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
12
|
const spinnerWrapperStyles = css({
|
|
9
13
|
display: 'flex',
|
|
10
14
|
justifyContent: 'center',
|
|
11
15
|
marginTop: "var(--ds-space-800, 64px)"
|
|
12
16
|
});
|
|
13
|
-
const
|
|
17
|
+
const errorWrapperStyles = css({
|
|
18
|
+
marginTop: "var(--ds-space-400, 32px)" // Add some padding to the top to make sure we place this below the offline status banner
|
|
19
|
+
});
|
|
20
|
+
const LoadingStateWithErrorHandling = injectIntl(props => {
|
|
21
|
+
if (props.error) {
|
|
22
|
+
return jsx("div", {
|
|
23
|
+
css: errorWrapperStyles,
|
|
24
|
+
"data-testid": "ConfigPanelLoadingError"
|
|
25
|
+
}, jsx(SectionMessage, {
|
|
26
|
+
appearance: "error"
|
|
27
|
+
}, props.intl.formatMessage(messages.panelLoadingError)));
|
|
28
|
+
}
|
|
29
|
+
return jsx("div", {
|
|
30
|
+
css: spinnerWrapperStyles,
|
|
31
|
+
"data-testid": "ConfigPanelLoading"
|
|
32
|
+
}, jsx(Spinner, {
|
|
33
|
+
size: "small",
|
|
34
|
+
interactionName: "config-panel-spinner"
|
|
35
|
+
}));
|
|
36
|
+
});
|
|
37
|
+
const LoadingStateWithoutErrorHandling = () => jsx("div", {
|
|
14
38
|
css: spinnerWrapperStyles,
|
|
15
39
|
"data-testid": "ConfigPanelLoading"
|
|
16
40
|
}, jsx(Spinner, {
|
|
17
41
|
size: "small",
|
|
18
42
|
interactionName: "config-panel-spinner"
|
|
19
43
|
}));
|
|
44
|
+
const LoadingState = props => editorExperiment('platform_editor_offline_editing_web', true) ? LoadingStateWithErrorHandling(props) : LoadingStateWithoutErrorHandling();
|
|
20
45
|
export default LoadingState;
|
|
@@ -174,7 +174,7 @@ export var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
174
174
|
hoverDecoration: _api === null || _api === void 0 || (_api$decorations = _api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration,
|
|
175
175
|
applyChangeToContextPanel: _api === null || _api === void 0 || (_api$contextPanel5 = _api.contextPanel) === null || _api$contextPanel5 === void 0 ? void 0 : _api$contextPanel5.actions.applyChange,
|
|
176
176
|
editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics4 = _api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions,
|
|
177
|
-
extensionApi: editorExperiment('platform_editor_controls', 'variant1') ? _api : undefined
|
|
177
|
+
extensionApi: editorExperiment('platform_editor_controls', 'variant1') || editorExperiment('platform_editor_offline_editing_web', true) ? _api : undefined
|
|
178
178
|
}),
|
|
179
179
|
contextPanel:
|
|
180
180
|
// if showContextPanel action is not available, or platform_editor_ai_object_sidebar_injection feature flag is off
|
|
@@ -183,6 +183,7 @@ var breakoutOptions = function breakoutOptions(state, formatMessage, extensionSt
|
|
|
183
183
|
return editorExperiment('platform_editor_controls', 'variant1') ? breakoutDropdownOptions(state, formatMessage, breakoutEnabled, editorAnalyticsAPI) : breakoutButtonListOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
|
|
184
184
|
};
|
|
185
185
|
var editButton = function editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI) {
|
|
186
|
+
var isDisabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
186
187
|
if (!extensionState.showEditButton) {
|
|
187
188
|
return [];
|
|
188
189
|
}
|
|
@@ -202,7 +203,8 @@ var editButton = function editButton(formatMessage, extensionState, applyChangeT
|
|
|
202
203
|
},
|
|
203
204
|
title: formatMessage(messages.edit),
|
|
204
205
|
tabIndex: null,
|
|
205
|
-
focusEditoronEnter: true
|
|
206
|
+
focusEditoronEnter: true,
|
|
207
|
+
disabled: isDisabled
|
|
206
208
|
}];
|
|
207
209
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
208
210
|
editButtonItems.push({
|
|
@@ -262,7 +264,7 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
|
|
|
262
264
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
263
265
|
extensionApi = _ref.extensionApi;
|
|
264
266
|
return function (state, intl) {
|
|
265
|
-
var _hoverDecoration5, _hoverDecoration6, _hoverDecoration7, _hoverDecoration8;
|
|
267
|
+
var _extensionApi$connect, _hoverDecoration5, _hoverDecoration6, _hoverDecoration7, _hoverDecoration8;
|
|
266
268
|
var formatMessage = intl.formatMessage;
|
|
267
269
|
var extensionState = getPluginState(state);
|
|
268
270
|
if (fg('platform_editor_legacy_content_macro')) {
|
|
@@ -276,7 +278,7 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
|
|
|
276
278
|
return;
|
|
277
279
|
}
|
|
278
280
|
var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
|
|
279
|
-
var editButtonItems = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
|
|
281
|
+
var editButtonItems = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI, editorExperiment('platform_editor_offline_editing_web', true) && (extensionApi === null || extensionApi === void 0 || (_extensionApi$connect = extensionApi.connectivity) === null || _extensionApi$connect === void 0 || (_extensionApi$connect = _extensionApi$connect.sharedState) === null || _extensionApi$connect === void 0 || (_extensionApi$connect = _extensionApi$connect.currentState()) === null || _extensionApi$connect === void 0 ? void 0 : _extensionApi$connect.mode) === 'offline');
|
|
280
282
|
var breakoutItems = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
|
|
281
283
|
var extensionObj = getSelectedExtension(state, true);
|
|
282
284
|
|
|
@@ -24,6 +24,7 @@ import { isTabGroup, configPanelMessages as messages } from '@atlaskit/editor-co
|
|
|
24
24
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
25
25
|
import Form, { FormFooter } from '@atlaskit/form';
|
|
26
26
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
27
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
27
28
|
import { ALLOWED_LOGGED_MACRO_PARAMS } from './constants';
|
|
28
29
|
import { DescriptionSummary } from './DescriptionSummary';
|
|
29
30
|
import ErrorMessage from './ErrorMessage';
|
|
@@ -47,7 +48,8 @@ function ConfigForm(_ref) {
|
|
|
47
48
|
parameters = _ref.parameters,
|
|
48
49
|
submitting = _ref.submitting,
|
|
49
50
|
contextIdentifierProvider = _ref.contextIdentifierProvider,
|
|
50
|
-
featureFlags = _ref.featureFlags
|
|
51
|
+
featureFlags = _ref.featureFlags,
|
|
52
|
+
disableFields = _ref.disableFields;
|
|
51
53
|
useEffect(function () {
|
|
52
54
|
if (fields) {
|
|
53
55
|
var firstDuplicateField = findDuplicateFields(fields);
|
|
@@ -71,7 +73,8 @@ function ConfigForm(_ref) {
|
|
|
71
73
|
onFieldChange: onFieldChange,
|
|
72
74
|
firstVisibleFieldName: firstVisibleFieldName,
|
|
73
75
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
74
|
-
featureFlags: featureFlags
|
|
76
|
+
featureFlags: featureFlags,
|
|
77
|
+
isDisabled: disableFields
|
|
75
78
|
}), /*#__PURE__*/React.createElement("div", {
|
|
76
79
|
style: canSave ? {} : {
|
|
77
80
|
display: 'none'
|
|
@@ -200,20 +203,33 @@ var ConfigPanel = /*#__PURE__*/function (_React$Component) {
|
|
|
200
203
|
return serialize(extensionManifest, _this.backfillTabFormData(fields, formData, _this.state.currentParameters), fields);
|
|
201
204
|
case 7:
|
|
202
205
|
serializedData = _context.sent;
|
|
206
|
+
if (!editorExperiment('platform_editor_offline_editing_web', true, {
|
|
207
|
+
exposure: true
|
|
208
|
+
})) {
|
|
209
|
+
_context.next = 13;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
_context.next = 11;
|
|
213
|
+
return onChange(serializedData);
|
|
214
|
+
case 11:
|
|
215
|
+
_context.next = 14;
|
|
216
|
+
break;
|
|
217
|
+
case 13:
|
|
203
218
|
onChange(serializedData);
|
|
204
|
-
|
|
219
|
+
case 14:
|
|
220
|
+
_context.next = 20;
|
|
205
221
|
break;
|
|
206
|
-
case
|
|
207
|
-
_context.prev =
|
|
222
|
+
case 16:
|
|
223
|
+
_context.prev = 16;
|
|
208
224
|
_context.t0 = _context["catch"](4);
|
|
209
225
|
autoSaveReject === null || autoSaveReject === void 0 || autoSaveReject(_context.t0);
|
|
210
226
|
// eslint-disable-next-line no-console
|
|
211
227
|
console.error("Error serializing parameters", _context.t0);
|
|
212
|
-
case
|
|
228
|
+
case 20:
|
|
213
229
|
case "end":
|
|
214
230
|
return _context.stop();
|
|
215
231
|
}
|
|
216
|
-
}, _callee, null, [[4,
|
|
232
|
+
}, _callee, null, [[4, 16]]);
|
|
217
233
|
}));
|
|
218
234
|
return function (_x) {
|
|
219
235
|
return _ref3.apply(this, arguments);
|
|
@@ -453,7 +469,8 @@ var ConfigPanel = /*#__PURE__*/function (_React$Component) {
|
|
|
453
469
|
onFieldChange: onFieldChange,
|
|
454
470
|
parameters: currentParameters,
|
|
455
471
|
submitting: submitting,
|
|
456
|
-
featureFlags: featureFlags
|
|
472
|
+
featureFlags: featureFlags,
|
|
473
|
+
disableFields: _this2.props.disableFields
|
|
457
474
|
}))
|
|
458
475
|
);
|
|
459
476
|
});
|
|
@@ -474,7 +491,8 @@ function ConfigFormIntlWithBoundary(_ref6) {
|
|
|
474
491
|
isLoading = _ref6.isLoading,
|
|
475
492
|
hasParsedParameters = _ref6.hasParsedParameters,
|
|
476
493
|
firstVisibleFieldName = _ref6.firstVisibleFieldName,
|
|
477
|
-
errorMessage = _ref6.errorMessage
|
|
494
|
+
errorMessage = _ref6.errorMessage,
|
|
495
|
+
disableFields = _ref6.disableFields;
|
|
478
496
|
var _useSharedPluginState = useSharedPluginState(api, ['contextIdentifier']),
|
|
479
497
|
contextIdentifierState = _useSharedPluginState.contextIdentifierState;
|
|
480
498
|
var _ref7 = contextIdentifierState !== null && contextIdentifierState !== void 0 ? contextIdentifierState : {},
|
|
@@ -496,7 +514,8 @@ function ConfigFormIntlWithBoundary(_ref6) {
|
|
|
496
514
|
parameters: parameters,
|
|
497
515
|
submitting: submitting,
|
|
498
516
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
499
|
-
featureFlags: featureFlags
|
|
517
|
+
featureFlags: featureFlags,
|
|
518
|
+
disableFields: disableFields
|
|
500
519
|
}));
|
|
501
520
|
}
|
|
502
521
|
var result = withAnalyticsContext({
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import { bind } from 'bind-event-listener';
|
|
4
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
5
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
6
|
import ConfigPanel from './ConfigPanel';
|
|
5
7
|
import { useStateFromPromise } from './use-state-from-promise';
|
|
6
8
|
var getFieldsDefinitionFn = function getFieldsDefinitionFn(extensionManifest, nodeKey) {
|
|
@@ -116,6 +118,9 @@ export default function FieldsLoader(_ref) {
|
|
|
116
118
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
117
119
|
errorMessage = _useState6[0],
|
|
118
120
|
setErrorMessage = _useState6[1];
|
|
121
|
+
var connectivityState = useSharedPluginStateSelector(api, 'connectivity.mode', {
|
|
122
|
+
disabled: editorExperiment('platform_editor_offline_editing_web', false)
|
|
123
|
+
});
|
|
119
124
|
return /*#__PURE__*/React.createElement(FieldDefinitionsPromiseResolver, {
|
|
120
125
|
setErrorMessage: setErrorMessage,
|
|
121
126
|
extensionManifest: extensionManifest,
|
|
@@ -138,7 +143,8 @@ export default function FieldsLoader(_ref) {
|
|
|
138
143
|
featureFlags: featureFlags
|
|
139
144
|
// Remove below prop when cleaning platform_editor_ai_object_sidebar_injection FG
|
|
140
145
|
,
|
|
141
|
-
usingObjectSidebarPanel: usingObjectSidebarPanel
|
|
146
|
+
usingObjectSidebarPanel: usingObjectSidebarPanel,
|
|
147
|
+
disableFields: connectivityState === 'offline'
|
|
142
148
|
});
|
|
143
149
|
});
|
|
144
150
|
}
|