@atlaskit/editor-plugin-extension 5.2.4 → 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 +20 -0
- package/dist/cjs/extensionPlugin.js +1 -1
- package/dist/cjs/pm-plugins/toolbar.js +5 -3
- package/dist/cjs/pm-plugins/utils.js +3 -5
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +29 -10
- package/dist/cjs/ui/ConfigPanel/ConfigPanelFieldsLoader.js +7 -1
- package/dist/cjs/ui/ConfigPanel/FieldMessages.js +3 -3
- package/dist/cjs/ui/ConfigPanel/Fields/Boolean.js +10 -6
- package/dist/cjs/ui/ConfigPanel/Fields/CheckboxGroup.js +4 -2
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +6 -4
- 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/FormErrorBoundary.js +3 -3
- package/dist/cjs/ui/ConfigPanel/LoadingState.js +28 -1
- package/dist/cjs/ui/useConfigPanelPluginHook.js +2 -2
- package/dist/es2019/extensionPlugin.js +1 -1
- package/dist/es2019/pm-plugins/toolbar.js +5 -4
- package/dist/es2019/pm-plugins/utils.js +3 -5
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +18 -6
- package/dist/es2019/ui/ConfigPanel/ConfigPanelFieldsLoader.js +7 -1
- package/dist/es2019/ui/ConfigPanel/FieldMessages.js +1 -1
- package/dist/es2019/ui/ConfigPanel/Fields/Boolean.js +9 -5
- package/dist/es2019/ui/ConfigPanel/Fields/CheckboxGroup.js +4 -2
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +5 -3
- 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/FormErrorBoundary.js +1 -1
- package/dist/es2019/ui/ConfigPanel/LoadingState.js +26 -1
- package/dist/es2019/ui/useConfigPanelPluginHook.js +1 -1
- package/dist/esm/extensionPlugin.js +1 -1
- package/dist/esm/pm-plugins/toolbar.js +5 -3
- package/dist/esm/pm-plugins/utils.js +3 -5
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +29 -10
- package/dist/esm/ui/ConfigPanel/ConfigPanelFieldsLoader.js +7 -1
- package/dist/esm/ui/ConfigPanel/FieldMessages.js +1 -1
- package/dist/esm/ui/ConfigPanel/Fields/Boolean.js +9 -5
- package/dist/esm/ui/ConfigPanel/Fields/CheckboxGroup.js +4 -2
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +5 -3
- 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/FormErrorBoundary.js +1 -1
- package/dist/esm/ui/ConfigPanel/LoadingState.js +28 -1
- package/dist/esm/ui/useConfigPanelPluginHook.js +1 -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 +9 -8
|
@@ -6,7 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("@emotion/react");
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _extensions = require("@atlaskit/editor-common/extensions");
|
|
11
|
+
var _sectionMessage = _interopRequireDefault(require("@atlaskit/section-message"));
|
|
9
12
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
13
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
10
14
|
/**
|
|
11
15
|
* @jsxRuntime classic
|
|
12
16
|
* @jsx jsx
|
|
@@ -18,7 +22,27 @@ var spinnerWrapperStyles = (0, _react.css)({
|
|
|
18
22
|
justifyContent: 'center',
|
|
19
23
|
marginTop: "var(--ds-space-800, 64px)"
|
|
20
24
|
});
|
|
21
|
-
var
|
|
25
|
+
var errorWrapperStyles = (0, _react.css)({
|
|
26
|
+
marginTop: "var(--ds-space-400, 32px)" // Add some padding to the top to make sure we place this below the offline status banner
|
|
27
|
+
});
|
|
28
|
+
var LoadingStateWithErrorHandling = (0, _reactIntlNext.injectIntl)(function (props) {
|
|
29
|
+
if (props.error) {
|
|
30
|
+
return (0, _react.jsx)("div", {
|
|
31
|
+
css: errorWrapperStyles,
|
|
32
|
+
"data-testid": "ConfigPanelLoadingError"
|
|
33
|
+
}, (0, _react.jsx)(_sectionMessage.default, {
|
|
34
|
+
appearance: "error"
|
|
35
|
+
}, props.intl.formatMessage(_extensions.messages.panelLoadingError)));
|
|
36
|
+
}
|
|
37
|
+
return (0, _react.jsx)("div", {
|
|
38
|
+
css: spinnerWrapperStyles,
|
|
39
|
+
"data-testid": "ConfigPanelLoading"
|
|
40
|
+
}, (0, _react.jsx)(_spinner.default, {
|
|
41
|
+
size: "small",
|
|
42
|
+
interactionName: "config-panel-spinner"
|
|
43
|
+
}));
|
|
44
|
+
});
|
|
45
|
+
var LoadingStateWithoutErrorHandling = function LoadingStateWithoutErrorHandling() {
|
|
22
46
|
return (0, _react.jsx)("div", {
|
|
23
47
|
css: spinnerWrapperStyles,
|
|
24
48
|
"data-testid": "ConfigPanelLoading"
|
|
@@ -27,4 +51,7 @@ var LoadingState = function LoadingState() {
|
|
|
27
51
|
interactionName: "config-panel-spinner"
|
|
28
52
|
}));
|
|
29
53
|
};
|
|
54
|
+
var LoadingState = function LoadingState(props) {
|
|
55
|
+
return (0, _experiments.editorExperiment)('platform_editor_offline_editing_web', true) ? LoadingStateWithErrorHandling(props) : LoadingStateWithoutErrorHandling();
|
|
56
|
+
};
|
|
30
57
|
var _default = exports.default = LoadingState;
|
|
@@ -16,7 +16,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
var _extensions = require("@atlaskit/editor-common/extensions");
|
|
18
18
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
19
|
-
var
|
|
19
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
20
|
var _commands = require("../editor-commands/commands");
|
|
21
21
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
22
22
|
var _utils = require("../pm-plugins/utils");
|
|
@@ -203,7 +203,7 @@ var getContextPanelBodyComponent = exports.getContextPanelBodyComponent = functi
|
|
|
203
203
|
nodeKey = _getExtensionKeyAndNo4[1];
|
|
204
204
|
var configParams = processParametersBefore ? processParametersBefore(parameters || {}) : parameters;
|
|
205
205
|
return function () {
|
|
206
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
206
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
207
207
|
padding: "space.200"
|
|
208
208
|
}, /*#__PURE__*/_react.default.createElement(_SaveIndicator.SaveIndicator, {
|
|
209
209
|
duration: 5000,
|
|
@@ -170,7 +170,7 @@ export const extensionPlugin = ({
|
|
|
170
170
|
hoverDecoration: api === null || api === void 0 ? void 0 : (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration,
|
|
171
171
|
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel5 = api.contextPanel) === null || _api$contextPanel5 === void 0 ? void 0 : _api$contextPanel5.actions.applyChange,
|
|
172
172
|
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions,
|
|
173
|
-
extensionApi: editorExperiment('platform_editor_controls', 'variant1') ? api : undefined
|
|
173
|
+
extensionApi: editorExperiment('platform_editor_controls', 'variant1') || editorExperiment('platform_editor_offline_editing_web', true) ? api : undefined
|
|
174
174
|
}),
|
|
175
175
|
contextPanel:
|
|
176
176
|
// if showContextPanel action is not available, or platform_editor_ai_object_sidebar_injection feature flag is off
|
|
@@ -184,7 +184,7 @@ const breakoutDropdownOptions = (state, formatMessage, breakoutEnabled, editorAn
|
|
|
184
184
|
const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI) => {
|
|
185
185
|
return editorExperiment('platform_editor_controls', 'variant1') ? breakoutDropdownOptions(state, formatMessage, breakoutEnabled, editorAnalyticsAPI) : breakoutButtonListOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
|
|
186
186
|
};
|
|
187
|
-
const editButton = (formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI) => {
|
|
187
|
+
const editButton = (formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI, isDisabled = false) => {
|
|
188
188
|
if (!extensionState.showEditButton) {
|
|
189
189
|
return [];
|
|
190
190
|
}
|
|
@@ -205,7 +205,8 @@ const editButton = (formatMessage, extensionState, applyChangeToContextPanel, ed
|
|
|
205
205
|
},
|
|
206
206
|
title: formatMessage(messages.edit),
|
|
207
207
|
tabIndex: null,
|
|
208
|
-
focusEditoronEnter: true
|
|
208
|
+
focusEditoronEnter: true,
|
|
209
|
+
disabled: isDisabled
|
|
209
210
|
}];
|
|
210
211
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
211
212
|
editButtonItems.push({
|
|
@@ -267,7 +268,7 @@ export const getToolbarConfig = ({
|
|
|
267
268
|
editorAnalyticsAPI,
|
|
268
269
|
extensionApi
|
|
269
270
|
}) => (state, intl) => {
|
|
270
|
-
var _hoverDecoration5, _hoverDecoration6, _hoverDecoration7, _hoverDecoration8;
|
|
271
|
+
var _extensionApi$connect, _extensionApi$connect2, _extensionApi$connect3, _hoverDecoration5, _hoverDecoration6, _hoverDecoration7, _hoverDecoration8;
|
|
271
272
|
const {
|
|
272
273
|
formatMessage
|
|
273
274
|
} = intl;
|
|
@@ -283,7 +284,7 @@ export const getToolbarConfig = ({
|
|
|
283
284
|
return;
|
|
284
285
|
}
|
|
285
286
|
const nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
|
|
286
|
-
const editButtonItems = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
|
|
287
|
+
const editButtonItems = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI, editorExperiment('platform_editor_offline_editing_web', true) && (extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$connect = extensionApi.connectivity) === null || _extensionApi$connect === void 0 ? void 0 : (_extensionApi$connect2 = _extensionApi$connect.sharedState) === null || _extensionApi$connect2 === void 0 ? void 0 : (_extensionApi$connect3 = _extensionApi$connect2.currentState()) === null || _extensionApi$connect3 === void 0 ? void 0 : _extensionApi$connect3.mode) === 'offline');
|
|
287
288
|
const breakoutItems = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
|
|
288
289
|
const extensionObj = getSelectedExtension(state, true);
|
|
289
290
|
|
|
@@ -43,11 +43,9 @@ export const getSelectedDomElement = (schema, domAtPos, selectedExtensionNode) =
|
|
|
43
43
|
const isContentExtension = selectedExtensionNode.node.type !== schema.nodes.bodiedExtension;
|
|
44
44
|
return (
|
|
45
45
|
// Content extension can be nested in bodied-extension, the following check is necessary for that case
|
|
46
|
-
(isContentExtension
|
|
47
|
-
//
|
|
48
|
-
selectedExtensionDomNode.querySelector('.extension-container')
|
|
49
|
-
// Try searching up and then down
|
|
50
|
-
closestElement(selectedExtensionDomNode, '.extension-container') || selectedExtensionDomNode.querySelector('.extension-container')) || selectedExtensionDomNode
|
|
46
|
+
(isContentExtension // Search down
|
|
47
|
+
? selectedExtensionDomNode.querySelector('.extension-container') // Try searching up and then down
|
|
48
|
+
: closestElement(selectedExtensionDomNode, '.extension-container') || selectedExtensionDomNode.querySelector('.extension-container')) || selectedExtensionDomNode
|
|
51
49
|
);
|
|
52
50
|
};
|
|
53
51
|
export const getDataConsumerMark = newNode => {
|
|
@@ -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
|
}
|
|
@@ -2,7 +2,7 @@ import React, { Fragment, useMemo } from 'react';
|
|
|
2
2
|
import { injectIntl } from 'react-intl-next';
|
|
3
3
|
import { configPanelMessages as messages } from '@atlaskit/editor-common/extensions';
|
|
4
4
|
import { ErrorMessage, HelperMessage } from '@atlaskit/form';
|
|
5
|
-
import { Text } from '@atlaskit/primitives';
|
|
5
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
6
6
|
import { FieldTypeError, ValidationError } from './types';
|
|
7
7
|
|
|
8
8
|
// sidestep XSS issues
|
|
@@ -9,7 +9,7 @@ import React, { Fragment } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { Checkbox as AKCheckbox } from '@atlaskit/checkbox';
|
|
11
11
|
import { Field } from '@atlaskit/form';
|
|
12
|
-
import { Text } from '@atlaskit/primitives';
|
|
12
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
13
13
|
import AKToggle from '@atlaskit/toggle';
|
|
14
14
|
import FieldMessages from '../FieldMessages';
|
|
15
15
|
import { ValidationError } from '../types';
|
|
@@ -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,
|
|
@@ -9,7 +9,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
9
9
|
import { chartsColorPaletteTooltipMessages, DEFAULT_BORDER_COLOR } from '@atlaskit/editor-common/ui-color';
|
|
10
10
|
import { ColorPickerButton } from '@atlaskit/editor-common/ui-menu';
|
|
11
11
|
import { Field } from '@atlaskit/form';
|
|
12
|
-
import { Text } from '@atlaskit/primitives';
|
|
12
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
13
13
|
import FieldMessages from '../FieldMessages';
|
|
14
14
|
import { validate } from '../utils';
|
|
15
15
|
|
|
@@ -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,7 +4,7 @@ import { injectIntl } from 'react-intl-next';
|
|
|
4
4
|
import { withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, editorAnalyticsChannel, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { configPanelMessages as messages } from '@atlaskit/editor-common/extensions';
|
|
7
|
-
import { Stack, Text } from '@atlaskit/primitives';
|
|
7
|
+
import { Stack, Text } from '@atlaskit/primitives/compiled';
|
|
8
8
|
import SectionMessage from '@atlaskit/section-message';
|
|
9
9
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
10
10
|
class FormErrorBoundaryInner extends React.Component {
|
|
@@ -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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { getExtensionKeyAndNodeKey } from '@atlaskit/editor-common/extensions';
|
|
3
3
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
-
import { Box } from '@atlaskit/primitives';
|
|
4
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
5
5
|
import { clearEditingContext, forceAutoSave } from '../editor-commands/commands';
|
|
6
6
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
7
7
|
import { getSelectedExtension } from '../pm-plugins/utils';
|
|
@@ -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
|