@atlaskit/editor-plugin-extension 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/editor-actions/actions.js +16 -14
- package/dist/cjs/extensionPlugin.js +4 -1
- package/dist/cjs/pm-plugins/keymap.js +6 -3
- package/dist/cjs/pm-plugins/macro/index.js +0 -24
- package/dist/cjs/pm-plugins/main.js +19 -25
- package/dist/cjs/pm-plugins/toolbar.js +15 -5
- package/dist/cjs/pm-plugins/utils.js +2 -0
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +4 -1
- package/dist/cjs/ui/ConfigPanel/Fields/Boolean.js +8 -2
- package/dist/cjs/ui/ConfigPanel/Fields/CheckboxGroup.js +8 -1
- package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +4 -1
- package/dist/cjs/ui/ConfigPanel/Fields/Date.js +4 -1
- package/dist/cjs/ui/ConfigPanel/Fields/DateRange.js +16 -4
- package/dist/cjs/ui/ConfigPanel/Fields/Fieldset.js +4 -1
- package/dist/cjs/ui/ConfigPanel/Fields/Number.js +4 -1
- package/dist/cjs/ui/ConfigPanel/Fields/RadioGroup.js +4 -1
- package/dist/cjs/ui/ConfigPanel/Fields/Select.js +6 -1
- package/dist/cjs/ui/ConfigPanel/Fields/String.js +8 -2
- package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +7 -3
- package/dist/cjs/ui/ConfigPanel/Header.js +4 -1
- package/dist/cjs/ui/ConfigPanel/utils.js +3 -0
- package/dist/cjs/ui/SaveIndicator/SaveIndicator.js +4 -1
- package/dist/cjs/ui/context-panel.js +8 -6
- package/dist/es2019/editor-actions/actions.js +13 -5
- package/dist/es2019/extensionPlugin.js +4 -1
- package/dist/es2019/pm-plugins/keymap.js +5 -2
- package/dist/es2019/pm-plugins/macro/index.js +0 -1
- package/dist/es2019/pm-plugins/main.js +20 -8
- package/dist/es2019/pm-plugins/toolbar.js +13 -3
- package/dist/es2019/pm-plugins/utils.js +2 -0
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +4 -1
- package/dist/es2019/ui/ConfigPanel/Fields/Boolean.js +8 -2
- package/dist/es2019/ui/ConfigPanel/Fields/CheckboxGroup.js +8 -1
- package/dist/es2019/ui/ConfigPanel/Fields/CustomSelect.js +4 -1
- package/dist/es2019/ui/ConfigPanel/Fields/Date.js +4 -1
- package/dist/es2019/ui/ConfigPanel/Fields/DateRange.js +16 -4
- package/dist/es2019/ui/ConfigPanel/Fields/Fieldset.js +4 -1
- package/dist/es2019/ui/ConfigPanel/Fields/Number.js +4 -1
- package/dist/es2019/ui/ConfigPanel/Fields/RadioGroup.js +4 -1
- package/dist/es2019/ui/ConfigPanel/Fields/Select.js +6 -1
- package/dist/es2019/ui/ConfigPanel/Fields/String.js +8 -2
- package/dist/es2019/ui/ConfigPanel/Fields/UserSelect.js +7 -3
- package/dist/es2019/ui/ConfigPanel/Header.js +4 -1
- package/dist/es2019/ui/ConfigPanel/transformers.js +8 -2
- package/dist/es2019/ui/ConfigPanel/utils.js +3 -0
- package/dist/es2019/ui/SaveIndicator/SaveIndicator.js +4 -1
- package/dist/es2019/ui/context-panel.js +3 -1
- package/dist/esm/editor-actions/actions.js +13 -5
- package/dist/esm/extensionPlugin.js +4 -1
- package/dist/esm/pm-plugins/keymap.js +5 -2
- package/dist/esm/pm-plugins/macro/index.js +0 -1
- package/dist/esm/pm-plugins/main.js +21 -9
- package/dist/esm/pm-plugins/toolbar.js +13 -3
- package/dist/esm/pm-plugins/utils.js +2 -0
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +4 -1
- package/dist/esm/ui/ConfigPanel/Fields/Boolean.js +8 -2
- package/dist/esm/ui/ConfigPanel/Fields/CheckboxGroup.js +8 -1
- package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +4 -1
- package/dist/esm/ui/ConfigPanel/Fields/Date.js +4 -1
- package/dist/esm/ui/ConfigPanel/Fields/DateRange.js +16 -4
- package/dist/esm/ui/ConfigPanel/Fields/Fieldset.js +4 -1
- package/dist/esm/ui/ConfigPanel/Fields/Number.js +4 -1
- package/dist/esm/ui/ConfigPanel/Fields/RadioGroup.js +4 -1
- package/dist/esm/ui/ConfigPanel/Fields/Select.js +6 -1
- package/dist/esm/ui/ConfigPanel/Fields/String.js +8 -2
- package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +7 -3
- package/dist/esm/ui/ConfigPanel/Header.js +4 -1
- package/dist/esm/ui/ConfigPanel/utils.js +3 -0
- package/dist/esm/ui/SaveIndicator/SaveIndicator.js +4 -1
- package/dist/esm/ui/context-panel.js +3 -1
- package/dist/types/editor-actions/actions.d.ts +1 -1
- package/dist/types/pm-plugins/macro/index.d.ts +0 -4
- package/dist/types/pm-plugins/main.d.ts +1 -4
- package/dist/types-ts4.5/editor-actions/actions.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/macro/index.d.ts +0 -4
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -4
- package/example-utils/config-panel/ConfigPanelWithExtensionPicker.tsx +2 -0
- package/example-utils/config-panel/ConfigPanelWithProviders.tsx +1 -1
- package/example-utils/config-panel/ExtensionNodePicker.tsx +3 -1
- package/example-utils/config-panel/example-manifest-all-fields.ts +2 -0
- package/example-utils/config-panel/example-manifest-individual-fields.ts +6 -0
- package/package.json +5 -5
- package/dist/cjs/ui/ConfigPanel/index.js +0 -9
- package/dist/es2019/ui/ConfigPanel/index.js +0 -2
- package/dist/esm/ui/ConfigPanel/index.js +0 -2
- package/dist/types/ui/ConfigPanel/index.d.ts +0 -2
- package/dist/types-ts4.5/ui/ConfigPanel/index.d.ts +0 -2
|
@@ -18,7 +18,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
18
18
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
19
19
|
var _actions = require("../editor-actions/actions");
|
|
20
20
|
var _commands = require("../editor-commands/commands");
|
|
21
|
-
var
|
|
21
|
+
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
22
22
|
var _utils = require("../pm-plugins/utils");
|
|
23
23
|
var _ConfigPanelLoader = _interopRequireDefault(require("./ConfigPanel/ConfigPanelLoader"));
|
|
24
24
|
var _SaveIndicator = require("./SaveIndicator/SaveIndicator");
|
|
@@ -56,7 +56,7 @@ var getContextPanel = exports.getContextPanel = function getContextPanel(getEdit
|
|
|
56
56
|
if (!nodeWithPos) {
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
var extensionState = (0,
|
|
59
|
+
var extensionState = (0, _pluginFactory.getPluginState)(state);
|
|
60
60
|
var autoSaveResolve = extensionState.autoSaveResolve,
|
|
61
61
|
autoSaveReject = extensionState.autoSaveReject,
|
|
62
62
|
showContextPanel = extensionState.showContextPanel,
|
|
@@ -152,6 +152,8 @@ var getContextPanel = exports.getContextPanel = function getContextPanel(getEdit
|
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
// Added this interface to handle the macroParams on Parameters
|
|
155
|
+
// Ignored via go/ees005
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
155
157
|
function onChangeAction(_x2) {
|
|
156
158
|
return _onChangeAction.apply(this, arguments);
|
|
157
159
|
}
|
|
@@ -187,7 +189,7 @@ function _onChangeAction() {
|
|
|
187
189
|
nodeWithPos = _args3.length > 3 ? _args3[3] : undefined;
|
|
188
190
|
onSaving = _args3.length > 4 ? _args3[4] : undefined;
|
|
189
191
|
// WARNING: editorView.state stales quickly, do not unpack
|
|
190
|
-
_ref4 = (0,
|
|
192
|
+
_ref4 = (0, _pluginFactory.getPluginState)(editorView.state), processParametersAfter = _ref4.processParametersAfter, processParametersBefore = _ref4.processParametersBefore;
|
|
191
193
|
if (processParametersAfter) {
|
|
192
194
|
_context3.next = 7;
|
|
193
195
|
break;
|
|
@@ -205,7 +207,7 @@ function _onChangeAction() {
|
|
|
205
207
|
onSaving();
|
|
206
208
|
}
|
|
207
209
|
key = Date.now();
|
|
208
|
-
_ref5 = (0,
|
|
210
|
+
_ref5 = (0, _pluginFactory.getPluginState)(editorView.state), previousPositions = _ref5.positions;
|
|
209
211
|
_context3.next = 15;
|
|
210
212
|
return (0, _commands.updateState)({
|
|
211
213
|
positions: _objectSpread(_objectSpread({}, previousPositions), {}, (0, _defineProperty2.default)({}, key, nodeWithPos.pos))
|
|
@@ -215,7 +217,7 @@ function _onChangeAction() {
|
|
|
215
217
|
return processParametersAfter(updatedParameters);
|
|
216
218
|
case 17:
|
|
217
219
|
newParameters = _context3.sent;
|
|
218
|
-
_ref6 = (0,
|
|
220
|
+
_ref6 = (0, _pluginFactory.getPluginState)(editorView.state), positions = _ref6.positions;
|
|
219
221
|
if (positions) {
|
|
220
222
|
_context3.next = 21;
|
|
221
223
|
break;
|
|
@@ -248,7 +250,7 @@ function _onChangeAction() {
|
|
|
248
250
|
transaction.setSelection(selection);
|
|
249
251
|
}
|
|
250
252
|
}
|
|
251
|
-
positionsLess = _objectSpread({}, (0,
|
|
253
|
+
positionsLess = _objectSpread({}, (0, _pluginFactory.getPluginState)(editorView.state).positions);
|
|
252
254
|
delete positionsLess[key];
|
|
253
255
|
_context3.next = 35;
|
|
254
256
|
return (0, _commands.updateState)({
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TARGET_SELECTION_SOURCE } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
export { transformSliceToRemoveOpenBodiedExtension } from '@atlaskit/editor-common/transforms';
|
|
3
2
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
3
|
import { findSelectedNodeOfType, replaceParentNodeOfType, replaceSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
5
4
|
import { createExtensionAPI, getEditInLegacyMacroBrowser } from '../pm-plugins/extension-api';
|
|
6
|
-
import { getPluginState } from '../pm-plugins/
|
|
5
|
+
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
7
6
|
import { findExtensionWithLocalId } from '../pm-plugins/utils';
|
|
8
|
-
export const buildExtensionNode = (type, schema, attrs, content, marks
|
|
7
|
+
export const buildExtensionNode = (type, schema, attrs, content, marks
|
|
8
|
+
// Ignored via go/ees005
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
10
|
+
) => {
|
|
9
11
|
switch (type) {
|
|
10
12
|
case 'extension':
|
|
11
13
|
return schema.nodes.extension.createChecked(attrs, content, marks);
|
|
@@ -17,7 +19,10 @@ export const buildExtensionNode = (type, schema, attrs, content, marks) => {
|
|
|
17
19
|
return schema.nodes.multiBodiedExtension.create(attrs, content, marks);
|
|
18
20
|
}
|
|
19
21
|
};
|
|
20
|
-
export const performNodeUpdate = editorAnalyticsAPI => (type, newAttrs, content, marks, shouldScrollIntoView
|
|
22
|
+
export const performNodeUpdate = editorAnalyticsAPI => (type, newAttrs, content, marks, shouldScrollIntoView
|
|
23
|
+
// Ignored via go/ees005
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
25
|
+
) => (_state, _dispatch, view) => {
|
|
21
26
|
if (!view) {
|
|
22
27
|
throw Error('EditorView is required to perform node update!');
|
|
23
28
|
}
|
|
@@ -147,7 +152,10 @@ const updateExtensionParams = editorAnalyticsAPI => (updateExtension, node, acti
|
|
|
147
152
|
} catch {}
|
|
148
153
|
return true;
|
|
149
154
|
};
|
|
150
|
-
export const editExtension = (macroProvider, applyChangeToContextPanel, editorAnalyticsAPI, updateExtension
|
|
155
|
+
export const editExtension = (macroProvider, applyChangeToContextPanel, editorAnalyticsAPI, updateExtension
|
|
156
|
+
// Ignored via go/ees005
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
158
|
+
) => (state, dispatch, view) => {
|
|
151
159
|
if (!view) {
|
|
152
160
|
return false;
|
|
153
161
|
}
|
|
@@ -6,7 +6,8 @@ import { createExtensionAPI } from './pm-plugins/extension-api';
|
|
|
6
6
|
import keymapPlugin from './pm-plugins/keymap';
|
|
7
7
|
import { createPlugin as createMacroPlugin } from './pm-plugins/macro';
|
|
8
8
|
import { insertMacroFromMacroBrowser, runMacroAutoConvert } from './pm-plugins/macro/actions';
|
|
9
|
-
import { createPlugin
|
|
9
|
+
import { createPlugin } from './pm-plugins/main';
|
|
10
|
+
import { pluginKey } from './pm-plugins/plugin-key';
|
|
10
11
|
import { bodiedExtensionSpecWithFixedToDOM } from './pm-plugins/toDOM-fixes/bodiedExtension';
|
|
11
12
|
import { getToolbarConfig } from './pm-plugins/toolbar';
|
|
12
13
|
import { createPlugin as createUniqueIdPlugin } from './pm-plugins/unique-id';
|
|
@@ -103,6 +104,8 @@ export const extensionPlugin = ({
|
|
|
103
104
|
api: () => {
|
|
104
105
|
var _api$contextPanel2, _api$analytics;
|
|
105
106
|
return createExtensionAPI({
|
|
107
|
+
// Ignored via go/ees005
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
106
109
|
editorView: editorViewRef.current,
|
|
107
110
|
applyChange: api === null || api === void 0 ? void 0 : (_api$contextPanel2 = api.contextPanel) === null || _api$contextPanel2 === void 0 ? void 0 : _api$contextPanel2.actions.applyChange,
|
|
108
111
|
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { bindKeymapWithCommand, escape } from '@atlaskit/editor-common/keymaps';
|
|
2
2
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
3
3
|
import { clearEditingContext } from '../editor-commands/commands';
|
|
4
|
-
import { getPluginState } from './
|
|
4
|
+
import { getPluginState } from './plugin-factory';
|
|
5
5
|
export default function keymapPlugin(applyChange) {
|
|
6
6
|
const list = {};
|
|
7
|
-
bindKeymapWithCommand(
|
|
7
|
+
bindKeymapWithCommand(
|
|
8
|
+
// Ignored via go/ees005
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10
|
+
escape.common, (state, dispatch) => {
|
|
8
11
|
const extensionState = getPluginState(state);
|
|
9
12
|
if (!extensionState.showContextPanel) {
|
|
10
13
|
return false;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { setMacroProvider } from './actions';
|
|
3
3
|
import { pluginKey } from './plugin-key';
|
|
4
|
-
export { insertMacroFromMacroBrowser, resolveMacro, runMacroAutoConvert, setMacroProvider } from './actions';
|
|
5
4
|
export const createPlugin = (dispatch, providerFactory) => new SafePlugin({
|
|
6
5
|
state: {
|
|
7
6
|
init: () => ({
|
|
@@ -5,7 +5,7 @@ import { findParentNodeOfTypeClosestToPos, findSelectedNodeOfType } from '@atlas
|
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { clearEditingContext, updateState } from '../editor-commands/commands';
|
|
7
7
|
import { lazyExtensionNodeView } from '../nodeviews/lazyExtension';
|
|
8
|
-
import {
|
|
8
|
+
import { createPluginState, getPluginState } from './plugin-factory';
|
|
9
9
|
import { pluginKey } from './plugin-key';
|
|
10
10
|
import { updateEditButton } from './update-edit-button';
|
|
11
11
|
import { getSelectedDomElement, getSelectedExtension } from './utils';
|
|
@@ -115,7 +115,10 @@ export const handleUpdate = ({
|
|
|
115
115
|
}
|
|
116
116
|
return true;
|
|
117
117
|
};
|
|
118
|
-
const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}, featureFlags, allowDragAndDrop = true, __rendererExtensionOptions
|
|
118
|
+
export const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}, featureFlags, allowDragAndDrop = true, __rendererExtensionOptions
|
|
119
|
+
// Ignored via go/ees005
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
121
|
+
) => {
|
|
119
122
|
var _featureFlags$macroIn;
|
|
120
123
|
const state = createPluginState(dispatch, {
|
|
121
124
|
showEditButton: false,
|
|
@@ -155,11 +158,19 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
|
|
|
155
158
|
handleDOMEvents: {
|
|
156
159
|
blur: (view, event) => {
|
|
157
160
|
if (fg('platform_editor_legacy_content_macro')) {
|
|
158
|
-
const
|
|
159
|
-
const
|
|
161
|
+
const currentSelection = event.relatedTarget;
|
|
162
|
+
const previousSelection = event.target;
|
|
163
|
+
if (!(currentSelection instanceof HTMLElement) || !(previousSelection instanceof HTMLElement)) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const wasPreviousSelectionInsideExtensionEditableArea = !!previousSelection.closest('.extension-editable-area');
|
|
167
|
+
const isCurrentSelectionInsideExtensionEditableArea = !!currentSelection.closest('.extension-editable-area');
|
|
168
|
+
const maybeFromPopup = !!currentSelection.closest('[data-editor-popup="true"]');
|
|
160
169
|
|
|
161
|
-
//
|
|
162
|
-
if
|
|
170
|
+
// We want to reset the user's selection if they are entering or exiting the extension editable area.
|
|
171
|
+
// To do so, we check if there previous selection was inside or outside, and if they are now inside or outside.
|
|
172
|
+
// We want to ignore this if a blur event is originating from an editor popup.
|
|
173
|
+
if (!maybeFromPopup && wasPreviousSelectionInsideExtensionEditableArea !== isCurrentSelectionInsideExtensionEditableArea) {
|
|
163
174
|
const emptySelection = new TextSelection(view.state.doc.resolve(0));
|
|
164
175
|
const tr = view.state.tr.setSelection(emptySelection);
|
|
165
176
|
view.dispatch(tr);
|
|
@@ -283,6 +294,8 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
|
|
|
283
294
|
{
|
|
284
295
|
useLongPressSelection
|
|
285
296
|
}),
|
|
297
|
+
// Ignored via go/ees005
|
|
298
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
286
299
|
handleDrop(view, event, slice, moved) {
|
|
287
300
|
if (fg('platform_editor_legacy_content_macro')) {
|
|
288
301
|
if (!allowDragAndDrop) {
|
|
@@ -297,5 +310,4 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
|
|
|
297
310
|
}
|
|
298
311
|
}
|
|
299
312
|
});
|
|
300
|
-
};
|
|
301
|
-
export { pluginKey, createPlugin, createCommand, getPluginState };
|
|
313
|
+
};
|
|
@@ -17,7 +17,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
17
17
|
import { editExtension } from '../editor-actions/actions';
|
|
18
18
|
import { removeDescendantNodes, removeExtension, updateExtensionLayout } from '../editor-commands/commands';
|
|
19
19
|
import { pluginKey as macroPluginKey } from './macro/plugin-key';
|
|
20
|
-
import { getPluginState } from './
|
|
20
|
+
import { getPluginState } from './plugin-factory';
|
|
21
21
|
import { getSelectedExtension } from './utils';
|
|
22
22
|
const isLayoutSupported = (state, selectedExtNode) => {
|
|
23
23
|
const {
|
|
@@ -44,7 +44,10 @@ const isLayoutSupported = (state, selectedExtNode) => {
|
|
|
44
44
|
// and not inside a layoutSection
|
|
45
45
|
return !!((isMultiBodiedExtension || isNonEmbeddedBodiedExtension || isNonEmbeddedExtension) && !hasParentNodeOfType([layoutSection])(selection));
|
|
46
46
|
};
|
|
47
|
-
const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI
|
|
47
|
+
const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI
|
|
48
|
+
// Ignored via go/ees005
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
50
|
+
) => {
|
|
48
51
|
const nodeWithPos = getSelectedExtension(state, true);
|
|
49
52
|
|
|
50
53
|
// we should only return breakout options when breakouts are enabled and the node supports them
|
|
@@ -80,7 +83,10 @@ const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled,
|
|
|
80
83
|
}
|
|
81
84
|
return [];
|
|
82
85
|
};
|
|
83
|
-
const editButton = (formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI
|
|
86
|
+
const editButton = (formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI
|
|
87
|
+
// Ignored via go/ees005
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
89
|
+
) => {
|
|
84
90
|
if (!extensionState.showEditButton) {
|
|
85
91
|
return [];
|
|
86
92
|
}
|
|
@@ -140,6 +146,8 @@ export const getToolbarConfig = ({
|
|
|
140
146
|
}
|
|
141
147
|
return {
|
|
142
148
|
title: 'Extension floating controls',
|
|
149
|
+
// Ignored via go/ees005
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
143
151
|
getDomRef: () => extensionState.element.parentElement || undefined,
|
|
144
152
|
nodeType,
|
|
145
153
|
onPositionCalculated: (editorView, nextPos) => {
|
|
@@ -157,6 +165,8 @@ export const getToolbarConfig = ({
|
|
|
157
165
|
return nextPos;
|
|
158
166
|
}
|
|
159
167
|
const scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
|
|
168
|
+
// Ignored via go/ees005
|
|
169
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
160
170
|
const nestedBodiedExtensionDomElement = editorView.nodeDOM(extensionNode.pos);
|
|
161
171
|
const nestedBodiedExtensionRect = nestedBodiedExtensionDomElement === null || nestedBodiedExtensionDomElement === void 0 ? void 0 : nestedBodiedExtensionDomElement.getBoundingClientRect();
|
|
162
172
|
const wrapperBounds = scrollWrapper.getBoundingClientRect();
|
|
@@ -37,6 +37,8 @@ export const findExtensionWithLocalId = (state, localId) => {
|
|
|
37
37
|
return matched;
|
|
38
38
|
};
|
|
39
39
|
export const getSelectedDomElement = (schema, domAtPos, selectedExtensionNode) => {
|
|
40
|
+
// Ignored via go/ees005
|
|
41
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
40
42
|
const selectedExtensionDomNode = findDomRefAtPos(selectedExtensionNode.pos, domAtPos);
|
|
41
43
|
const isContentExtension = selectedExtensionNode.node.type !== schema.nodes.bodiedExtension;
|
|
42
44
|
return (
|
|
@@ -124,7 +124,10 @@ class ConfigPanel extends React.Component {
|
|
|
124
124
|
// https://product-fabric.atlassian.net/browse/DST-2697
|
|
125
125
|
// workaround for DST-2697, remove this function once fix.
|
|
126
126
|
_defineProperty(this, "backfillTabFormData", (fields, formData, currentParameters) => {
|
|
127
|
-
const getRelevantData = (field, formParams, currentParams, backfill
|
|
127
|
+
const getRelevantData = (field, formParams, currentParams, backfill
|
|
128
|
+
// Ignored via go/ees005
|
|
129
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
130
|
+
) => {
|
|
128
131
|
if (field.hasGroupedValues && !(field.name in backfill)) {
|
|
129
132
|
backfill[field.name] = {};
|
|
130
133
|
}
|
|
@@ -67,7 +67,10 @@ function Checkbox({
|
|
|
67
67
|
value: isChecked,
|
|
68
68
|
...restFieldProps
|
|
69
69
|
} = fieldProps;
|
|
70
|
-
return jsx(Fragment, null, jsx(AKCheckbox
|
|
70
|
+
return jsx(Fragment, null, jsx(AKCheckbox
|
|
71
|
+
// Ignored via go/ees005
|
|
72
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
73
|
+
, _extends({}, restFieldProps, {
|
|
71
74
|
label: label,
|
|
72
75
|
onChange: event => handleOnChange(fieldProps.onChange, onFieldChange, event),
|
|
73
76
|
isChecked: parseBoolean(isChecked)
|
|
@@ -112,7 +115,10 @@ function Toggle({
|
|
|
112
115
|
}, label, isRequired ? jsx(Text, {
|
|
113
116
|
color: "color.text.danger",
|
|
114
117
|
"aria-hidden": "true"
|
|
115
|
-
}, "*") : null), jsx(AKToggle
|
|
118
|
+
}, "*") : null), jsx(AKToggle
|
|
119
|
+
// Ignored via go/ees005
|
|
120
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
121
|
+
, _extends({}, restFieldProps, {
|
|
116
122
|
onChange: event => handleOnChange(fieldProps.onChange, onFieldChange, event),
|
|
117
123
|
isChecked: parseBoolean(isChecked)
|
|
118
124
|
}))), jsx(FieldMessages, {
|
|
@@ -53,8 +53,13 @@ function CheckboxGroupInner({
|
|
|
53
53
|
const onOptionChange = event => {
|
|
54
54
|
_onChange(optionValue, event.target.checked);
|
|
55
55
|
};
|
|
56
|
-
return jsx(AKCheckbox
|
|
56
|
+
return jsx(AKCheckbox
|
|
57
|
+
// Ignored via go/ees005
|
|
58
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
59
|
+
, _extends({
|
|
57
60
|
key: i
|
|
61
|
+
// Ignored via go/ees005
|
|
62
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
58
63
|
}, restFieldProps, {
|
|
59
64
|
isRequired: false,
|
|
60
65
|
label: optionLabel,
|
|
@@ -96,6 +101,8 @@ export default function CheckboxGroup({
|
|
|
96
101
|
description: description,
|
|
97
102
|
options: options,
|
|
98
103
|
onFieldChange: _onFieldChange
|
|
104
|
+
// Ignored via go/ees005
|
|
105
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
99
106
|
}, props));
|
|
100
107
|
});
|
|
101
108
|
}
|
|
@@ -100,7 +100,10 @@ function CustomSelect({
|
|
|
100
100
|
}, ({
|
|
101
101
|
fieldProps,
|
|
102
102
|
error
|
|
103
|
-
}) => /*#__PURE__*/React.createElement(React.Fragment, null, resolver && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AsyncCreatableSelect
|
|
103
|
+
}) => /*#__PURE__*/React.createElement(React.Fragment, null, resolver && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AsyncCreatableSelect
|
|
104
|
+
// Ignored via go/ees005
|
|
105
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
106
|
+
, _extends({}, fieldProps, {
|
|
104
107
|
onChange: value => {
|
|
105
108
|
fieldProps.onChange(value);
|
|
106
109
|
// We assume onChange is called whenever values actually changed
|
|
@@ -30,7 +30,10 @@ function Date({
|
|
|
30
30
|
fieldProps,
|
|
31
31
|
error
|
|
32
32
|
}) => {
|
|
33
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DatePicker
|
|
33
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DatePicker
|
|
34
|
+
// Ignored via go/ees005
|
|
35
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
36
|
+
, _extends({}, fieldProps, {
|
|
34
37
|
autoFocus: autoFocus,
|
|
35
38
|
onBlur: () => {
|
|
36
39
|
fieldProps.onBlur();
|
|
@@ -54,7 +54,10 @@ const DateField = ({
|
|
|
54
54
|
}, ({
|
|
55
55
|
fieldProps,
|
|
56
56
|
error
|
|
57
|
-
}) => jsx(Fragment, null, jsx(DatePicker
|
|
57
|
+
}) => jsx(Fragment, null, jsx(DatePicker
|
|
58
|
+
// Ignored via go/ees005
|
|
59
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
60
|
+
, _extends({}, fieldProps, {
|
|
58
61
|
onChange: date => {
|
|
59
62
|
fieldProps.onChange(date);
|
|
60
63
|
onFieldChange(parentField.name, true);
|
|
@@ -93,7 +96,10 @@ const DateRange = function ({
|
|
|
93
96
|
defaultValue: 'date-range'
|
|
94
97
|
}, ({
|
|
95
98
|
fieldProps
|
|
96
|
-
}) => jsx(TextField
|
|
99
|
+
}) => jsx(TextField
|
|
100
|
+
// Ignored via go/ees005
|
|
101
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
102
|
+
, _extends({}, fieldProps, {
|
|
97
103
|
type: "hidden"
|
|
98
104
|
})))), jsx(Field, {
|
|
99
105
|
name: `${name}.value`,
|
|
@@ -105,7 +111,10 @@ const DateRange = function ({
|
|
|
105
111
|
}, ({
|
|
106
112
|
fieldProps,
|
|
107
113
|
error
|
|
108
|
-
}) => jsx(Fragment, null, jsx(RadioGroup
|
|
114
|
+
}) => jsx(Fragment, null, jsx(RadioGroup
|
|
115
|
+
// Ignored via go/ees005
|
|
116
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
117
|
+
, _extends({}, fieldProps, {
|
|
109
118
|
options: items,
|
|
110
119
|
onChange: event => {
|
|
111
120
|
fieldProps.onChange(event.target.value);
|
|
@@ -120,7 +129,10 @@ const DateRange = function ({
|
|
|
120
129
|
defaultValue: currentValue
|
|
121
130
|
}, ({
|
|
122
131
|
fieldProps
|
|
123
|
-
}) => jsx(TextField
|
|
132
|
+
}) => jsx(TextField
|
|
133
|
+
// Ignored via go/ees005
|
|
134
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
135
|
+
, _extends({}, fieldProps, {
|
|
124
136
|
type: "hidden"
|
|
125
137
|
})))) : jsx("div", {
|
|
126
138
|
css: horizontalFieldsStyles
|
|
@@ -167,7 +167,10 @@ class FieldsetField extends React.Component {
|
|
|
167
167
|
}) : jsx(Button, {
|
|
168
168
|
testId: "add-more",
|
|
169
169
|
appearance: "subtle",
|
|
170
|
-
iconBefore: iconProps => jsx(AddCircleIcon
|
|
170
|
+
iconBefore: iconProps => jsx(AddCircleIcon
|
|
171
|
+
// Ignored via go/ees005
|
|
172
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
173
|
+
, _extends({}, iconProps, {
|
|
171
174
|
size: "small",
|
|
172
175
|
label: intl.formatMessage(messages.addField)
|
|
173
176
|
})),
|
|
@@ -44,7 +44,10 @@ export default function Number({
|
|
|
44
44
|
error,
|
|
45
45
|
meta
|
|
46
46
|
}) => {
|
|
47
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextField
|
|
47
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextField
|
|
48
|
+
// Ignored via go/ees005
|
|
49
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
50
|
+
, _extends({}, fieldProps, {
|
|
48
51
|
autoFocus: autoFocus,
|
|
49
52
|
onBlur: () => {
|
|
50
53
|
fieldProps.onBlur();
|
|
@@ -25,7 +25,10 @@ export default function RadioField({
|
|
|
25
25
|
}, ({
|
|
26
26
|
fieldProps,
|
|
27
27
|
error
|
|
28
|
-
}) => /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(RadioGroup
|
|
28
|
+
}) => /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(RadioGroup
|
|
29
|
+
// Ignored via go/ees005
|
|
30
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
31
|
+
, _extends({}, fieldProps, {
|
|
29
32
|
options: (field.items || []).map(option => ({
|
|
30
33
|
...option,
|
|
31
34
|
name: field.name
|
|
@@ -23,12 +23,17 @@ export default function SelectField({
|
|
|
23
23
|
testId: `config-panel-select-${name}`,
|
|
24
24
|
isRequired: field.isRequired,
|
|
25
25
|
validate: value => {
|
|
26
|
+
// Ignored via go/ees005
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
26
28
|
return validate(field, value);
|
|
27
29
|
}
|
|
28
30
|
}, ({
|
|
29
31
|
fieldProps,
|
|
30
32
|
error
|
|
31
|
-
}) => /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Select
|
|
33
|
+
}) => /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Select
|
|
34
|
+
// Ignored via go/ees005
|
|
35
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
36
|
+
, _extends({}, fieldProps, {
|
|
32
37
|
// Pass `id` as `inputId` so that the input gets the correct id, and make sure there are no duplicate ids
|
|
33
38
|
inputId: fieldProps.id,
|
|
34
39
|
id: undefined,
|
|
@@ -38,7 +38,10 @@ export default function String({
|
|
|
38
38
|
const {
|
|
39
39
|
options
|
|
40
40
|
} = field;
|
|
41
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(TextArea
|
|
41
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(TextArea
|
|
42
|
+
// Ignored via go/ees005
|
|
43
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
44
|
+
, _extends({}, restFieldProps, options, {
|
|
42
45
|
onChange: e => onChange(e.currentTarget.value),
|
|
43
46
|
onBlur: () => {
|
|
44
47
|
fieldProps.onBlur();
|
|
@@ -51,7 +54,10 @@ export default function String({
|
|
|
51
54
|
description: description
|
|
52
55
|
}));
|
|
53
56
|
}
|
|
54
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(TextField
|
|
57
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(TextField
|
|
58
|
+
// Ignored via go/ees005
|
|
59
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
60
|
+
, _extends({}, fieldProps, {
|
|
55
61
|
type: "text",
|
|
56
62
|
autoFocus: autoFocus,
|
|
57
63
|
onBlur: () => {
|
|
@@ -90,7 +90,10 @@ function SafeSmartUserPicker({
|
|
|
90
90
|
cancel = true;
|
|
91
91
|
};
|
|
92
92
|
}, [safeValue, productKey]);
|
|
93
|
-
return /*#__PURE__*/React.createElement(SmartUserPicker
|
|
93
|
+
return /*#__PURE__*/React.createElement(SmartUserPicker
|
|
94
|
+
// Ignored via go/ees005
|
|
95
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
96
|
+
, _extends({}, formFieldPropsRest, {
|
|
94
97
|
onChange: onChangeUnsafe,
|
|
95
98
|
autoFocus: autoFocus,
|
|
96
99
|
onBlur: onBlur,
|
|
@@ -165,7 +168,8 @@ export default function UserSelect({
|
|
|
165
168
|
testId: `config-panel-user-select-${name}`
|
|
166
169
|
}, ({
|
|
167
170
|
fieldProps,
|
|
168
|
-
error
|
|
171
|
+
error,
|
|
172
|
+
meta
|
|
169
173
|
}) => {
|
|
170
174
|
// if any of these don't exists, the provider is missing
|
|
171
175
|
if (!siteId || !principalId || !fieldId || !productKey) {
|
|
@@ -184,7 +188,7 @@ export default function UserSelect({
|
|
|
184
188
|
field: field,
|
|
185
189
|
formFieldProps: fieldProps,
|
|
186
190
|
autoFocus: autoFocus || false,
|
|
187
|
-
onBlur: () => onFieldChange(name,
|
|
191
|
+
onBlur: () => onFieldChange(name, meta.dirty),
|
|
188
192
|
onChange: onChange
|
|
189
193
|
}), /*#__PURE__*/React.createElement(FieldMessages, {
|
|
190
194
|
error: error,
|
|
@@ -135,7 +135,10 @@ const Header = ({
|
|
|
135
135
|
}, jsx(Text, {
|
|
136
136
|
as: "p",
|
|
137
137
|
testId: "config-panel-header-description"
|
|
138
|
-
}, description && jsx(Fragment, null,
|
|
138
|
+
}, description && jsx(Fragment, null,
|
|
139
|
+
// Ignored via go/ees005
|
|
140
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
141
|
+
description.replace(/([^.])$/, '$1.'), ' '), documentationUrl && (enableHelpCTA ? jsx(Box, {
|
|
139
142
|
xcss: helpLinkStyles
|
|
140
143
|
}, jsx(Text, {
|
|
141
144
|
as: "p"
|
|
@@ -43,7 +43,10 @@ const findDuplicateFieldsInternal = fields => {
|
|
|
43
43
|
return;
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
|
-
export const serialize = async (manifest, data, fields, options = {}
|
|
46
|
+
export const serialize = async (manifest, data, fields, options = {}
|
|
47
|
+
// Ignored via go/ees005
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
49
|
+
) => {
|
|
47
50
|
const result = [];
|
|
48
51
|
const {
|
|
49
52
|
depth = 0,
|
|
@@ -298,7 +301,10 @@ const flattenFields = fields => {
|
|
|
298
301
|
};
|
|
299
302
|
return fields.reduce(flattenAccumulator, []);
|
|
300
303
|
};
|
|
301
|
-
export const deserialize = async (manifest, data, fields, depth = 0
|
|
304
|
+
export const deserialize = async (manifest, data, fields, depth = 0
|
|
305
|
+
// Ignored via go/ees005
|
|
306
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
307
|
+
) => {
|
|
302
308
|
const dataArray = convertToParametersArray(data);
|
|
303
309
|
let result = [];
|
|
304
310
|
const errors = [];
|
|
@@ -45,6 +45,9 @@ export const getSafeParentedName = (name, parentName) => {
|
|
|
45
45
|
}
|
|
46
46
|
return name;
|
|
47
47
|
};
|
|
48
|
+
|
|
49
|
+
// Ignored via go/ees005
|
|
50
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
48
51
|
const duplicateFieldRegex = /:[0-9]+$/;
|
|
49
52
|
export const isDuplicateField = key => duplicateFieldRegex.test(key);
|
|
50
53
|
export const getNameFromDuplicateField = key => key.replace(duplicateFieldRegex, '');
|
|
@@ -67,5 +67,8 @@ export const SaveIndicator = ({
|
|
|
67
67
|
size: "small"
|
|
68
68
|
}), jsx(Box, {
|
|
69
69
|
xcss: saveIndicatorTextStyles
|
|
70
|
-
}, jsx(Text, null, jsx(FormattedMessage
|
|
70
|
+
}, jsx(Text, null, jsx(FormattedMessage
|
|
71
|
+
// Ignored via go/ees005
|
|
72
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
73
|
+
, messages.saveIndicator))))));
|
|
71
74
|
};
|
|
@@ -5,7 +5,7 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
|
|
|
5
5
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
6
6
|
import { buildExtensionNode } from '../editor-actions/actions';
|
|
7
7
|
import { clearEditingContext, forceAutoSave, updateState } from '../editor-commands/commands';
|
|
8
|
-
import { getPluginState } from '../pm-plugins/
|
|
8
|
+
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
9
9
|
import { getSelectedExtension } from '../pm-plugins/utils';
|
|
10
10
|
import ConfigPanelLoader from './ConfigPanel/ConfigPanelLoader';
|
|
11
11
|
import { SaveIndicator } from './SaveIndicator/SaveIndicator';
|
|
@@ -104,6 +104,8 @@ export const getContextPanel = getEditorView => (api, featureFlags) => state =>
|
|
|
104
104
|
|
|
105
105
|
// Added this interface to handle the macroParams on Parameters
|
|
106
106
|
|
|
107
|
+
// Ignored via go/ees005
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
107
109
|
export async function onChangeAction(editorView, updatedParameters = {}, oldParameters = {}, nodeWithPos, onSaving) {
|
|
108
110
|
// WARNING: editorView.state stales quickly, do not unpack
|
|
109
111
|
const {
|