@atlaskit/editor-plugin-extension 4.1.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/extensionPlugin.js +16 -4
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +9 -1
- package/dist/cjs/ui/ConfigPanel/DescriptionSummary.js +50 -0
- package/dist/cjs/ui/ConfigPanel/Header/HeaderAfterIconElement.js +50 -0
- package/dist/cjs/ui/ConfigPanel/Header/HeaderIcon.js +49 -0
- package/dist/cjs/ui/ConfigPanel/Header.js +3 -12
- package/dist/cjs/ui/ConfigPanel/HelpLink.js +22 -0
- package/dist/cjs/ui/ConfigPanel/constants.js +4 -2
- package/dist/cjs/ui/ConfigPanel/withExtensionManifest.js +33 -0
- package/dist/cjs/ui/useConfigPanelPluginHook.js +250 -0
- package/dist/es2019/extensionPlugin.js +16 -4
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +9 -1
- package/dist/es2019/ui/ConfigPanel/DescriptionSummary.js +45 -0
- package/dist/es2019/ui/ConfigPanel/Header/HeaderAfterIconElement.js +44 -0
- package/dist/es2019/ui/ConfigPanel/Header/HeaderIcon.js +39 -0
- package/dist/es2019/ui/ConfigPanel/Header.js +1 -11
- package/dist/es2019/ui/ConfigPanel/HelpLink.js +16 -0
- package/dist/es2019/ui/ConfigPanel/constants.js +3 -1
- package/dist/es2019/ui/ConfigPanel/withExtensionManifest.js +21 -0
- package/dist/es2019/ui/useConfigPanelPluginHook.js +201 -0
- package/dist/esm/extensionPlugin.js +15 -4
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +9 -1
- package/dist/esm/ui/ConfigPanel/DescriptionSummary.js +41 -0
- package/dist/esm/ui/ConfigPanel/Header/HeaderAfterIconElement.js +43 -0
- package/dist/esm/ui/ConfigPanel/Header/HeaderIcon.js +40 -0
- package/dist/esm/ui/ConfigPanel/Header.js +1 -10
- package/dist/esm/ui/ConfigPanel/HelpLink.js +15 -0
- package/dist/esm/ui/ConfigPanel/constants.js +3 -1
- package/dist/esm/ui/ConfigPanel/withExtensionManifest.js +26 -0
- package/dist/esm/ui/useConfigPanelPluginHook.js +236 -0
- package/dist/types/extensionPluginType.d.ts +2 -0
- package/dist/types/ui/ConfigPanel/DescriptionSummary.d.ts +7 -0
- package/dist/types/ui/ConfigPanel/Header/HeaderAfterIconElement.d.ts +7 -0
- package/dist/types/ui/ConfigPanel/Header/HeaderIcon.d.ts +7 -0
- package/dist/types/ui/ConfigPanel/HelpLink.d.ts +7 -0
- package/dist/types/ui/ConfigPanel/constants.d.ts +2 -0
- package/dist/types/ui/ConfigPanel/withExtensionManifest.d.ts +9 -0
- package/dist/types/ui/useConfigPanelPluginHook.d.ts +27 -0
- package/dist/types-ts4.5/extensionPluginType.d.ts +2 -0
- package/dist/types-ts4.5/ui/ConfigPanel/DescriptionSummary.d.ts +7 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Header/HeaderAfterIconElement.d.ts +7 -0
- package/dist/types-ts4.5/ui/ConfigPanel/Header/HeaderIcon.d.ts +7 -0
- package/dist/types-ts4.5/ui/ConfigPanel/HelpLink.d.ts +7 -0
- package/dist/types-ts4.5/ui/ConfigPanel/constants.d.ts +2 -0
- package/dist/types-ts4.5/ui/ConfigPanel/withExtensionManifest.d.ts +9 -0
- package/dist/types-ts4.5/ui/useConfigPanelPluginHook.d.ts +27 -0
- package/package.json +6 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export var HelpLink = function HelpLink(_ref) {
|
|
3
|
+
var documentationUrl = _ref.documentationUrl,
|
|
4
|
+
label = _ref.label;
|
|
5
|
+
return (
|
|
6
|
+
/*#__PURE__*/
|
|
7
|
+
// eslint-disable-next-line @atlaskit/design-system/no-html-anchor
|
|
8
|
+
React.createElement("a", {
|
|
9
|
+
target: "_blank",
|
|
10
|
+
rel: "noopener noreferrer",
|
|
11
|
+
href: documentationUrl,
|
|
12
|
+
"data-testid": "config-panel-header-documentation-link"
|
|
13
|
+
}, label)
|
|
14
|
+
);
|
|
15
|
+
};
|
|
@@ -4,4 +4,6 @@ export var ALLOWED_LOGGED_MACRO_PARAMS = {
|
|
|
4
4
|
'recently-updated': ['width', 'types', 'max', 'theme', 'showProfilePic', 'hideHeading'],
|
|
5
5
|
excerpt: ['hidden']
|
|
6
6
|
};
|
|
7
|
-
export var ALLOWED_PARAM_TYPES = ['enum', 'number', 'boolean'];
|
|
7
|
+
export var ALLOWED_PARAM_TYPES = ['enum', 'number', 'boolean'];
|
|
8
|
+
export var CONFIG_PANEL_WIDTH = 320;
|
|
9
|
+
export var CONFIG_PANEL_ID = 'extensions-panel';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["extensionKey", "extensionProvider", "extensionType"];
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { useStateFromPromise } from './use-state-from-promise';
|
|
7
|
+
export function withExtensionManifest(WrappedComponent) {
|
|
8
|
+
return function WithExtensionManifest(props) {
|
|
9
|
+
var extensionKey = props.extensionKey,
|
|
10
|
+
extensionProvider = props.extensionProvider,
|
|
11
|
+
extensionType = props.extensionType,
|
|
12
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
13
|
+
var _useStateFromPromise = useStateFromPromise(function () {
|
|
14
|
+
return extensionProvider.getExtension(extensionType, extensionKey);
|
|
15
|
+
}, [extensionProvider, extensionType, extensionKey]),
|
|
16
|
+
_useStateFromPromise2 = _slicedToArray(_useStateFromPromise, 1),
|
|
17
|
+
extensionManifest = _useStateFromPromise2[0];
|
|
18
|
+
return extensionManifest ?
|
|
19
|
+
/*#__PURE__*/
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, react/jsx-props-no-spreading
|
|
22
|
+
React.createElement(WrappedComponent, _extends({
|
|
23
|
+
extensionManifest: extensionManifest
|
|
24
|
+
}, restProps)) : null;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import React, { useEffect } from 'react';
|
|
5
|
+
import { configPanelMessages, getExtensionKeyAndNodeKey } from '@atlaskit/editor-common/extensions';
|
|
6
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
|
+
import { Box } from '@atlaskit/primitives';
|
|
8
|
+
import { clearEditingContext, forceAutoSave } from '../editor-commands/commands';
|
|
9
|
+
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
10
|
+
import { getSelectedExtension } from '../pm-plugins/utils';
|
|
11
|
+
import ConfigPanelLoader from './ConfigPanel/ConfigPanelLoader';
|
|
12
|
+
import { CONFIG_PANEL_ID, CONFIG_PANEL_WIDTH } from './ConfigPanel/constants';
|
|
13
|
+
import HeaderAfterIconElement from './ConfigPanel/Header/HeaderAfterIconElement';
|
|
14
|
+
import HeaderIcon from './ConfigPanel/Header/HeaderIcon';
|
|
15
|
+
import { onChangeAction } from './context-panel';
|
|
16
|
+
import { SaveIndicator } from './SaveIndicator/SaveIndicator';
|
|
17
|
+
export function useConfigPanelPluginHook(_ref) {
|
|
18
|
+
var editorView = _ref.editorView,
|
|
19
|
+
api = _ref.api;
|
|
20
|
+
var editorState = editorView.state;
|
|
21
|
+
var _useSharedPluginState = useSharedPluginState(api, ['extension']),
|
|
22
|
+
extensionState = _useSharedPluginState.extensionState;
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
var nodeWithPos = getSelectedExtension(editorState, true);
|
|
25
|
+
// Adding checks to bail out early
|
|
26
|
+
if (!nodeWithPos || !extensionState) {
|
|
27
|
+
hideConfigPanel(api);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (extensionState) {
|
|
31
|
+
var showContextPanel = extensionState.showContextPanel,
|
|
32
|
+
extensionProvider = extensionState.extensionProvider,
|
|
33
|
+
processParametersAfter = extensionState.processParametersAfter;
|
|
34
|
+
if (showContextPanel && extensionProvider && processParametersAfter) {
|
|
35
|
+
showConfigPanel({
|
|
36
|
+
api: api,
|
|
37
|
+
editorView: editorView,
|
|
38
|
+
extensionProvider: extensionProvider,
|
|
39
|
+
nodeWithPos: nodeWithPos
|
|
40
|
+
});
|
|
41
|
+
} else {
|
|
42
|
+
hideConfigPanel(api);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, [api, editorState, editorView, extensionState]);
|
|
46
|
+
}
|
|
47
|
+
export function hideConfigPanel(api) {
|
|
48
|
+
var _api$contextPanel;
|
|
49
|
+
var closePanelById = api === null || api === void 0 || (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 || (_api$contextPanel = _api$contextPanel.actions) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.closePanelById;
|
|
50
|
+
if (closePanelById) {
|
|
51
|
+
closePanelById(CONFIG_PANEL_ID);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function showConfigPanel(_ref2) {
|
|
55
|
+
var _api$contextPanel2;
|
|
56
|
+
var api = _ref2.api,
|
|
57
|
+
editorView = _ref2.editorView,
|
|
58
|
+
extensionProvider = _ref2.extensionProvider,
|
|
59
|
+
nodeWithPos = _ref2.nodeWithPos;
|
|
60
|
+
var showContextPanel = api === null || api === void 0 || (_api$contextPanel2 = api.contextPanel) === null || _api$contextPanel2 === void 0 || (_api$contextPanel2 = _api$contextPanel2.actions) === null || _api$contextPanel2 === void 0 ? void 0 : _api$contextPanel2.showPanel;
|
|
61
|
+
if (showContextPanel) {
|
|
62
|
+
var nodeAttrs = nodeWithPos === null || nodeWithPos === void 0 ? void 0 : nodeWithPos.node.attrs;
|
|
63
|
+
var extensionType = nodeAttrs === null || nodeAttrs === void 0 ? void 0 : nodeAttrs.extensionType;
|
|
64
|
+
var extensionKey = nodeAttrs === null || nodeAttrs === void 0 ? void 0 : nodeAttrs.extensionKey;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Loading extension manifest fails when using
|
|
68
|
+
* extensionKey directly from nodeAttrs.
|
|
69
|
+
* Always get extensionKey from getExtensionKeyAndNodeKey to load
|
|
70
|
+
* extension manifest successfully.
|
|
71
|
+
*/
|
|
72
|
+
var _getExtensionKeyAndNo = getExtensionKeyAndNodeKey(extensionKey, extensionType),
|
|
73
|
+
_getExtensionKeyAndNo2 = _slicedToArray(_getExtensionKeyAndNo, 2),
|
|
74
|
+
extKey = _getExtensionKeyAndNo2[0],
|
|
75
|
+
_ = _getExtensionKeyAndNo2[1];
|
|
76
|
+
var HeadeIconWrapper = function HeadeIconWrapper() {
|
|
77
|
+
return /*#__PURE__*/React.createElement(HeaderIcon, {
|
|
78
|
+
extensionProvider: extensionProvider,
|
|
79
|
+
extensionKey: extKey,
|
|
80
|
+
extensionType: extensionType
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
var HeaderAfterIconElementWrapper = function HeaderAfterIconElementWrapper() {
|
|
84
|
+
return /*#__PURE__*/React.createElement(HeaderAfterIconElement, {
|
|
85
|
+
extensionProvider: extensionProvider,
|
|
86
|
+
extensionKey: extKey,
|
|
87
|
+
extensionType: extensionType
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
var BodyComponent = getContextPanelBodyComponent({
|
|
91
|
+
api: api,
|
|
92
|
+
editorView: editorView,
|
|
93
|
+
extensionProvider: extensionProvider,
|
|
94
|
+
nodeWithPos: nodeWithPos
|
|
95
|
+
});
|
|
96
|
+
showContextPanel({
|
|
97
|
+
id: CONFIG_PANEL_ID,
|
|
98
|
+
headerComponentElements: {
|
|
99
|
+
HeaderIcon: HeadeIconWrapper,
|
|
100
|
+
headerLabel: configPanelMessages.objectSidebarPanelHeaderLabel,
|
|
101
|
+
HeaderAfterIconElement: HeaderAfterIconElementWrapper
|
|
102
|
+
},
|
|
103
|
+
BodyComponent: BodyComponent,
|
|
104
|
+
closeOptions: {
|
|
105
|
+
canClosePanel: function canClosePanel() {
|
|
106
|
+
var extensionState = getPluginState(editorView.state);
|
|
107
|
+
/**
|
|
108
|
+
* If context panel is open, then first update extension plugin state.
|
|
109
|
+
* Updating extension plugin state will trigger useEffect in useConfigPanelPluginHook,
|
|
110
|
+
* which will call hideConfigPanel.
|
|
111
|
+
*/
|
|
112
|
+
if (extensionState !== null && extensionState !== void 0 && extensionState.showContextPanel) {
|
|
113
|
+
startClosingConfigPanel({
|
|
114
|
+
api: api,
|
|
115
|
+
editorView: editorView
|
|
116
|
+
});
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Return true if extension plugin state has been updated and hideConfigPanel has been called.
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}, 'push', CONFIG_PANEL_WIDTH);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export function startClosingConfigPanel(_x) {
|
|
128
|
+
return _startClosingConfigPanel.apply(this, arguments);
|
|
129
|
+
}
|
|
130
|
+
function _startClosingConfigPanel() {
|
|
131
|
+
_startClosingConfigPanel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
132
|
+
var _api$contextPanel3;
|
|
133
|
+
var api, editorView, applyChange;
|
|
134
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
135
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
136
|
+
case 0:
|
|
137
|
+
api = _ref3.api, editorView = _ref3.editorView;
|
|
138
|
+
applyChange = api === null || api === void 0 || (_api$contextPanel3 = api.contextPanel) === null || _api$contextPanel3 === void 0 ? void 0 : _api$contextPanel3.actions.applyChange; // Even if the save failed, we should proceed with closing the panel
|
|
139
|
+
clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
|
|
140
|
+
_context2.prev = 3;
|
|
141
|
+
_context2.next = 6;
|
|
142
|
+
return new Promise(function (resolve, reject) {
|
|
143
|
+
forceAutoSave(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
|
|
144
|
+
});
|
|
145
|
+
case 6:
|
|
146
|
+
_context2.next = 11;
|
|
147
|
+
break;
|
|
148
|
+
case 8:
|
|
149
|
+
_context2.prev = 8;
|
|
150
|
+
_context2.t0 = _context2["catch"](3);
|
|
151
|
+
// Even if the save failed, we should proceed with closing the panel
|
|
152
|
+
// eslint-disable-next-line no-console
|
|
153
|
+
console.error("Autosave failed with error", _context2.t0);
|
|
154
|
+
case 11:
|
|
155
|
+
case "end":
|
|
156
|
+
return _context2.stop();
|
|
157
|
+
}
|
|
158
|
+
}, _callee2, null, [[3, 8]]);
|
|
159
|
+
}));
|
|
160
|
+
return _startClosingConfigPanel.apply(this, arguments);
|
|
161
|
+
}
|
|
162
|
+
export var getContextPanelBodyComponent = function getContextPanelBodyComponent(_ref4) {
|
|
163
|
+
var _api$featureFlags;
|
|
164
|
+
var api = _ref4.api,
|
|
165
|
+
editorView = _ref4.editorView,
|
|
166
|
+
extensionProvider = _ref4.extensionProvider,
|
|
167
|
+
nodeWithPos = _ref4.nodeWithPos;
|
|
168
|
+
var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
169
|
+
var editorState = editorView.state;
|
|
170
|
+
var extensionState = getPluginState(editorState);
|
|
171
|
+
var autoSaveResolve = extensionState.autoSaveResolve,
|
|
172
|
+
autoSaveReject = extensionState.autoSaveReject,
|
|
173
|
+
processParametersBefore = extensionState.processParametersBefore;
|
|
174
|
+
var _nodeWithPos$node$att = nodeWithPos.node.attrs,
|
|
175
|
+
extensionType = _nodeWithPos$node$att.extensionType,
|
|
176
|
+
extensionKey = _nodeWithPos$node$att.extensionKey,
|
|
177
|
+
parameters = _nodeWithPos$node$att.parameters;
|
|
178
|
+
var _getExtensionKeyAndNo3 = getExtensionKeyAndNodeKey(extensionKey, extensionType),
|
|
179
|
+
_getExtensionKeyAndNo4 = _slicedToArray(_getExtensionKeyAndNo3, 2),
|
|
180
|
+
extKey = _getExtensionKeyAndNo4[0],
|
|
181
|
+
nodeKey = _getExtensionKeyAndNo4[1];
|
|
182
|
+
var configParams = processParametersBefore ? processParametersBefore(parameters || {}) : parameters;
|
|
183
|
+
return function () {
|
|
184
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
185
|
+
padding: "space.200"
|
|
186
|
+
}, /*#__PURE__*/React.createElement(SaveIndicator, {
|
|
187
|
+
duration: 5000,
|
|
188
|
+
visible: true
|
|
189
|
+
}, function (_ref5) {
|
|
190
|
+
var onSaveStarted = _ref5.onSaveStarted,
|
|
191
|
+
onSaveEnded = _ref5.onSaveEnded;
|
|
192
|
+
return /*#__PURE__*/React.createElement(ConfigPanelLoader, {
|
|
193
|
+
api: api,
|
|
194
|
+
showHeader: true,
|
|
195
|
+
closeOnEsc: true,
|
|
196
|
+
extensionType: extensionType,
|
|
197
|
+
extensionKey: extKey,
|
|
198
|
+
nodeKey: nodeKey,
|
|
199
|
+
extensionParameters: parameters,
|
|
200
|
+
parameters: configParams,
|
|
201
|
+
extensionProvider: extensionProvider,
|
|
202
|
+
autoSaveTrigger: autoSaveResolve,
|
|
203
|
+
autoSaveReject: autoSaveReject,
|
|
204
|
+
onChange: ( /*#__PURE__*/function () {
|
|
205
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(updatedParameters) {
|
|
206
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
207
|
+
while (1) switch (_context.prev = _context.next) {
|
|
208
|
+
case 0:
|
|
209
|
+
_context.next = 2;
|
|
210
|
+
return onChangeAction(editorView, updatedParameters, parameters, nodeWithPos, onSaveStarted);
|
|
211
|
+
case 2:
|
|
212
|
+
onSaveEnded();
|
|
213
|
+
if (autoSaveResolve) {
|
|
214
|
+
autoSaveResolve();
|
|
215
|
+
}
|
|
216
|
+
case 4:
|
|
217
|
+
case "end":
|
|
218
|
+
return _context.stop();
|
|
219
|
+
}
|
|
220
|
+
}, _callee);
|
|
221
|
+
}));
|
|
222
|
+
return function (_x2) {
|
|
223
|
+
return _ref6.apply(this, arguments);
|
|
224
|
+
};
|
|
225
|
+
}()),
|
|
226
|
+
onCancel: function onCancel() {
|
|
227
|
+
return startClosingConfigPanel({
|
|
228
|
+
api: api,
|
|
229
|
+
editorView: editorView
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
featureFlags: featureFlags
|
|
233
|
+
});
|
|
234
|
+
}));
|
|
235
|
+
};
|
|
236
|
+
};
|
|
@@ -82,6 +82,8 @@ export type ExtensionPlugin = NextEditorPlugin<'extension', {
|
|
|
82
82
|
dependencies: ExtensionPluginDependencies;
|
|
83
83
|
sharedState: {
|
|
84
84
|
showContextPanel: boolean | undefined;
|
|
85
|
+
extensionProvider?: ExtensionState['extensionProvider'];
|
|
86
|
+
processParametersAfter?: ExtensionState['processParametersAfter'];
|
|
85
87
|
} | undefined;
|
|
86
88
|
actions: ExtensionPluginActions;
|
|
87
89
|
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtensionManifest } from '@atlaskit/editor-common/extensions';
|
|
3
|
+
type DescriptionSummaryProps = {
|
|
4
|
+
extensionManifest: ExtensionManifest;
|
|
5
|
+
};
|
|
6
|
+
export declare function DescriptionSummary({ extensionManifest }: DescriptionSummaryProps): React.JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtensionKey, ExtensionManifest, ExtensionProvider, ExtensionType } from '@atlaskit/editor-common/extensions';
|
|
3
|
+
export declare function withExtensionManifest(WrappedComponent: React.ComponentType<{
|
|
4
|
+
extensionManifest: ExtensionManifest;
|
|
5
|
+
}>): (props: {
|
|
6
|
+
extensionProvider: ExtensionProvider;
|
|
7
|
+
extensionType: ExtensionType;
|
|
8
|
+
extensionKey: ExtensionKey;
|
|
9
|
+
}) => React.JSX.Element | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ExtensionProvider } from '@atlaskit/editor-common/extensions';
|
|
3
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
+
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import { type ExtensionPlugin } from '../extensionPluginType';
|
|
7
|
+
export declare function useConfigPanelPluginHook({ editorView, api, }: {
|
|
8
|
+
editorView: EditorView;
|
|
9
|
+
api?: ExtractInjectionAPI<ExtensionPlugin>;
|
|
10
|
+
}): void;
|
|
11
|
+
export declare function hideConfigPanel(api: ExtractInjectionAPI<ExtensionPlugin> | undefined): void;
|
|
12
|
+
export declare function showConfigPanel({ api, editorView, extensionProvider, nodeWithPos, }: {
|
|
13
|
+
api: ExtractInjectionAPI<ExtensionPlugin> | undefined;
|
|
14
|
+
editorView: EditorView;
|
|
15
|
+
extensionProvider: ExtensionProvider;
|
|
16
|
+
nodeWithPos: ContentNodeWithPos;
|
|
17
|
+
}): void;
|
|
18
|
+
export declare function startClosingConfigPanel({ api, editorView, }: {
|
|
19
|
+
api: ExtractInjectionAPI<ExtensionPlugin> | undefined;
|
|
20
|
+
editorView: EditorView;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
export declare const getContextPanelBodyComponent: ({ api, editorView, extensionProvider, nodeWithPos, }: {
|
|
23
|
+
api: ExtractInjectionAPI<ExtensionPlugin> | undefined;
|
|
24
|
+
editorView: EditorView;
|
|
25
|
+
extensionProvider: ExtensionProvider;
|
|
26
|
+
nodeWithPos: ContentNodeWithPos;
|
|
27
|
+
}) => () => React.JSX.Element;
|
|
@@ -82,6 +82,8 @@ export type ExtensionPlugin = NextEditorPlugin<'extension', {
|
|
|
82
82
|
dependencies: ExtensionPluginDependencies;
|
|
83
83
|
sharedState: {
|
|
84
84
|
showContextPanel: boolean | undefined;
|
|
85
|
+
extensionProvider?: ExtensionState['extensionProvider'];
|
|
86
|
+
processParametersAfter?: ExtensionState['processParametersAfter'];
|
|
85
87
|
} | undefined;
|
|
86
88
|
actions: ExtensionPluginActions;
|
|
87
89
|
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtensionManifest } from '@atlaskit/editor-common/extensions';
|
|
3
|
+
type DescriptionSummaryProps = {
|
|
4
|
+
extensionManifest: ExtensionManifest;
|
|
5
|
+
};
|
|
6
|
+
export declare function DescriptionSummary({ extensionManifest }: DescriptionSummaryProps): React.JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtensionKey, ExtensionManifest, ExtensionProvider, ExtensionType } from '@atlaskit/editor-common/extensions';
|
|
3
|
+
export declare function withExtensionManifest(WrappedComponent: React.ComponentType<{
|
|
4
|
+
extensionManifest: ExtensionManifest;
|
|
5
|
+
}>): (props: {
|
|
6
|
+
extensionProvider: ExtensionProvider;
|
|
7
|
+
extensionType: ExtensionType;
|
|
8
|
+
extensionKey: ExtensionKey;
|
|
9
|
+
}) => React.JSX.Element | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ExtensionProvider } from '@atlaskit/editor-common/extensions';
|
|
3
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
+
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import { type ExtensionPlugin } from '../extensionPluginType';
|
|
7
|
+
export declare function useConfigPanelPluginHook({ editorView, api, }: {
|
|
8
|
+
editorView: EditorView;
|
|
9
|
+
api?: ExtractInjectionAPI<ExtensionPlugin>;
|
|
10
|
+
}): void;
|
|
11
|
+
export declare function hideConfigPanel(api: ExtractInjectionAPI<ExtensionPlugin> | undefined): void;
|
|
12
|
+
export declare function showConfigPanel({ api, editorView, extensionProvider, nodeWithPos, }: {
|
|
13
|
+
api: ExtractInjectionAPI<ExtensionPlugin> | undefined;
|
|
14
|
+
editorView: EditorView;
|
|
15
|
+
extensionProvider: ExtensionProvider;
|
|
16
|
+
nodeWithPos: ContentNodeWithPos;
|
|
17
|
+
}): void;
|
|
18
|
+
export declare function startClosingConfigPanel({ api, editorView, }: {
|
|
19
|
+
api: ExtractInjectionAPI<ExtensionPlugin> | undefined;
|
|
20
|
+
editorView: EditorView;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
export declare const getContextPanelBodyComponent: ({ api, editorView, extensionProvider, nodeWithPos, }: {
|
|
23
|
+
api: ExtractInjectionAPI<ExtensionPlugin> | undefined;
|
|
24
|
+
editorView: EditorView;
|
|
25
|
+
extensionProvider: ExtensionProvider;
|
|
26
|
+
nodeWithPos: ContentNodeWithPos;
|
|
27
|
+
}) => () => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-extension",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "editor-plugin-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"@atlaskit/avatar": "^24.0.0",
|
|
32
32
|
"@atlaskit/button": "^21.1.0",
|
|
33
33
|
"@atlaskit/checkbox": "^17.0.0",
|
|
34
|
-
"@atlaskit/datetime-picker": "^16.
|
|
34
|
+
"@atlaskit/datetime-picker": "^16.1.0",
|
|
35
35
|
"@atlaskit/editor-common": "^101.1.0",
|
|
36
36
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^2.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-context-identifier": "^2.0.0",
|
|
39
|
-
"@atlaskit/editor-plugin-context-panel": "^
|
|
39
|
+
"@atlaskit/editor-plugin-context-panel": "^4.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-feature-flags": "^1.3.0",
|
|
42
42
|
"@atlaskit/editor-plugin-width": "^3.0.0",
|
|
@@ -114,6 +114,9 @@
|
|
|
114
114
|
"platform-feature-flags": {
|
|
115
115
|
"platform_editor_legacy_content_macro": {
|
|
116
116
|
"type": "boolean"
|
|
117
|
+
},
|
|
118
|
+
"platform_editor_ai_object_sidebar_injection": {
|
|
119
|
+
"type": "boolean"
|
|
117
120
|
}
|
|
118
121
|
},
|
|
119
122
|
"stricter": {
|