@atlaskit/editor-plugin-extension 5.5.2 → 5.5.4
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 +18 -0
- package/dist/cjs/editor-commands/commands.js +3 -4
- package/dist/cjs/extensionPlugin.js +6 -2
- package/dist/cjs/ui/useConfigPanelPluginHook.js +11 -8
- package/dist/es2019/editor-commands/commands.js +3 -4
- package/dist/es2019/extensionPlugin.js +6 -2
- package/dist/es2019/ui/useConfigPanelPluginHook.js +12 -9
- package/dist/esm/editor-commands/commands.js +3 -4
- package/dist/esm/extensionPlugin.js +6 -2
- package/dist/esm/ui/useConfigPanelPluginHook.js +12 -9
- package/dist/types/ui/useConfigPanelPluginHook.d.ts +5 -3
- package/dist/types-ts4.5/ui/useConfigPanelPluginHook.d.ts +5 -3
- package/package.json +7 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-extension
|
|
2
2
|
|
|
3
|
+
## 5.5.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#165113](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/165113)
|
|
8
|
+
[`867bcb05452bf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/867bcb05452bf) -
|
|
9
|
+
Cleaned up platform_editor_controls_patch_analytics and platform_editor_controls_patch_analytics_2
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 5.5.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#162483](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/162483)
|
|
17
|
+
[`ad07dec30b65c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ad07dec30b65c) -
|
|
18
|
+
EDITOR-817 Extension right rail not opening when Legacy Content Extension is in page bug fixed.
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 5.5.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -13,7 +13,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
13
13
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
15
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
16
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
16
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
18
17
|
var _utils3 = require("../pm-plugins/utils");
|
|
19
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -129,7 +128,7 @@ var removeSelectedNodeWithAnalytics = exports.removeSelectedNodeWithAnalytics =
|
|
|
129
128
|
extensionType: node.attrs.extensionType,
|
|
130
129
|
extensionKey: node.attrs.extensionKey,
|
|
131
130
|
localId: node.attrs.localId,
|
|
132
|
-
inputMethod:
|
|
131
|
+
inputMethod: inputMethod
|
|
133
132
|
}
|
|
134
133
|
})(tr);
|
|
135
134
|
}
|
|
@@ -151,7 +150,7 @@ var checkAndRemoveExtensionNode = exports.checkAndRemoveExtensionNode = function
|
|
|
151
150
|
extensionKey: maybeMBENode.node.attrs.extensionKey,
|
|
152
151
|
localId: maybeMBENode.node.attrs.localId,
|
|
153
152
|
currentFramesCount: maybeMBENode.node.content.childCount,
|
|
154
|
-
inputMethod:
|
|
153
|
+
inputMethod: inputMethod
|
|
155
154
|
}
|
|
156
155
|
})(tr);
|
|
157
156
|
}
|
|
@@ -168,7 +167,7 @@ var checkAndRemoveExtensionNode = exports.checkAndRemoveExtensionNode = function
|
|
|
168
167
|
extensionType: bodiedExtensionNode.node.attrs.extensionType,
|
|
169
168
|
extensionKey: bodiedExtensionNode.node.attrs.extensionKey,
|
|
170
169
|
localId: bodiedExtensionNode.node.attrs.localId,
|
|
171
|
-
inputMethod:
|
|
170
|
+
inputMethod: inputMethod
|
|
172
171
|
}
|
|
173
172
|
})(tr);
|
|
174
173
|
}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.extensionPlugin = void 0;
|
|
8
|
+
var _v = _interopRequireDefault(require("uuid/v4"));
|
|
8
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
9
10
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -19,6 +20,7 @@ var _pluginKey = require("./pm-plugins/plugin-key");
|
|
|
19
20
|
var _bodiedExtension = require("./pm-plugins/toDOM-fixes/bodiedExtension");
|
|
20
21
|
var _toolbar = require("./pm-plugins/toolbar");
|
|
21
22
|
var _uniqueId = require("./pm-plugins/unique-id");
|
|
23
|
+
var _constants = require("./ui/ConfigPanel/constants");
|
|
22
24
|
var _contextPanel = require("./ui/context-panel");
|
|
23
25
|
var _useConfigPanelPluginHook = require("./ui/useConfigPanelPluginHook");
|
|
24
26
|
// Remove below line when cleaning up platform_editor_ai_object_sidebar_injection feature flag
|
|
@@ -28,6 +30,7 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
|
28
30
|
var _ref$config = _ref.config,
|
|
29
31
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
30
32
|
_api = _ref.api;
|
|
33
|
+
var configPanelId = "".concat(_constants.CONFIG_PANEL_ID, "-").concat((0, _v.default)());
|
|
31
34
|
var featureFlags = (_api === null || _api === void 0 || (_api$featureFlags = _api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
32
35
|
//Note: This is a hack to get the editor view reference in the plugin. Copied from table plugin.
|
|
33
36
|
//This is needed to get the current selection in the editor
|
|
@@ -189,8 +192,9 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
|
189
192
|
usePluginHook: showContextPanel && (0, _platformFeatureFlags.fg)('platform_editor_ai_object_sidebar_injection') ? function (_ref6) {
|
|
190
193
|
var editorView = _ref6.editorView;
|
|
191
194
|
(0, _useConfigPanelPluginHook.useConfigPanelPluginHook)({
|
|
192
|
-
|
|
193
|
-
|
|
195
|
+
api: _api,
|
|
196
|
+
configPanelId: configPanelId,
|
|
197
|
+
editorView: editorView
|
|
194
198
|
});
|
|
195
199
|
} : undefined
|
|
196
200
|
};
|
|
@@ -48,6 +48,7 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
|
|
|
48
48
|
});
|
|
49
49
|
function useConfigPanelPluginHook(_ref) {
|
|
50
50
|
var editorView = _ref.editorView,
|
|
51
|
+
configPanelId = _ref.configPanelId,
|
|
51
52
|
api = _ref.api;
|
|
52
53
|
var editorState = editorView.state;
|
|
53
54
|
var _useSharedState = useSharedState(api),
|
|
@@ -58,36 +59,38 @@ function useConfigPanelPluginHook(_ref) {
|
|
|
58
59
|
var nodeWithPos = (0, _utils.getSelectedExtension)(editorState, true);
|
|
59
60
|
// Adding checks to bail out early
|
|
60
61
|
if (!nodeWithPos) {
|
|
61
|
-
hideConfigPanel(api);
|
|
62
|
+
hideConfigPanel(configPanelId, api);
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
64
65
|
if (showContextPanel && extensionProvider && processParametersAfter) {
|
|
65
66
|
showConfigPanel({
|
|
66
67
|
api: api,
|
|
68
|
+
configPanelId: configPanelId,
|
|
67
69
|
editorView: editorView,
|
|
68
70
|
extensionProvider: extensionProvider,
|
|
69
71
|
nodeWithPos: nodeWithPos
|
|
70
72
|
});
|
|
71
73
|
} else {
|
|
72
|
-
hideConfigPanel(api);
|
|
74
|
+
hideConfigPanel(configPanelId, api);
|
|
73
75
|
}
|
|
74
|
-
}, [api, editorState, editorView, showContextPanel, extensionProvider, processParametersAfter]);
|
|
76
|
+
}, [api, configPanelId, editorState, editorView, showContextPanel, extensionProvider, processParametersAfter]);
|
|
75
77
|
(0, _react.useEffect)(function () {
|
|
76
78
|
return function () {
|
|
77
|
-
hideConfigPanel(api);
|
|
79
|
+
hideConfigPanel(configPanelId, api);
|
|
78
80
|
};
|
|
79
|
-
}, [api]);
|
|
81
|
+
}, [api, configPanelId]);
|
|
80
82
|
}
|
|
81
|
-
function hideConfigPanel(api) {
|
|
83
|
+
function hideConfigPanel(configPanelId, api) {
|
|
82
84
|
var _api$contextPanel;
|
|
83
85
|
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;
|
|
84
86
|
if (closePanelById) {
|
|
85
|
-
closePanelById(
|
|
87
|
+
closePanelById(configPanelId);
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
function showConfigPanel(_ref2) {
|
|
89
91
|
var _api$contextPanel2;
|
|
90
92
|
var api = _ref2.api,
|
|
93
|
+
configPanelId = _ref2.configPanelId,
|
|
91
94
|
editorView = _ref2.editorView,
|
|
92
95
|
extensionProvider = _ref2.extensionProvider,
|
|
93
96
|
nodeWithPos = _ref2.nodeWithPos;
|
|
@@ -128,7 +131,7 @@ function showConfigPanel(_ref2) {
|
|
|
128
131
|
nodeWithPos: nodeWithPos
|
|
129
132
|
});
|
|
130
133
|
showContextPanel({
|
|
131
|
-
id:
|
|
134
|
+
id: configPanelId,
|
|
132
135
|
headerComponentElements: {
|
|
133
136
|
HeaderIcon: HeadeIconWrapper,
|
|
134
137
|
HeaderAfterIconElement: HeaderAfterIconElementWrapper
|
|
@@ -2,7 +2,6 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, TARGET_SELECTION
|
|
|
2
2
|
import { removeConnectedNodes } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { createCommand } from '../pm-plugins/plugin-factory';
|
|
7
6
|
import { getSelectedExtension } from '../pm-plugins/utils';
|
|
8
7
|
|
|
@@ -106,7 +105,7 @@ export const removeSelectedNodeWithAnalytics = (state, tr, analyticsApi, inputMe
|
|
|
106
105
|
extensionType: node.attrs.extensionType,
|
|
107
106
|
extensionKey: node.attrs.extensionKey,
|
|
108
107
|
localId: node.attrs.localId,
|
|
109
|
-
inputMethod:
|
|
108
|
+
inputMethod: inputMethod
|
|
110
109
|
}
|
|
111
110
|
})(tr);
|
|
112
111
|
}
|
|
@@ -128,7 +127,7 @@ export const checkAndRemoveExtensionNode = (state, tr, analyticsApi, inputMethod
|
|
|
128
127
|
extensionKey: maybeMBENode.node.attrs.extensionKey,
|
|
129
128
|
localId: maybeMBENode.node.attrs.localId,
|
|
130
129
|
currentFramesCount: maybeMBENode.node.content.childCount,
|
|
131
|
-
inputMethod
|
|
130
|
+
inputMethod
|
|
132
131
|
}
|
|
133
132
|
})(tr);
|
|
134
133
|
}
|
|
@@ -145,7 +144,7 @@ export const checkAndRemoveExtensionNode = (state, tr, analyticsApi, inputMethod
|
|
|
145
144
|
extensionType: bodiedExtensionNode.node.attrs.extensionType,
|
|
146
145
|
extensionKey: bodiedExtensionNode.node.attrs.extensionKey,
|
|
147
146
|
localId: bodiedExtensionNode.node.attrs.localId,
|
|
148
|
-
inputMethod
|
|
147
|
+
inputMethod
|
|
149
148
|
}
|
|
150
149
|
})(tr);
|
|
151
150
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import uuid from 'uuid/v4';
|
|
1
2
|
import { extension, extensionFrame, inlineExtension, multiBodiedExtension } from '@atlaskit/adf-schema';
|
|
2
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -13,6 +14,7 @@ import { bodiedExtensionSpecWithFixedToDOM } from './pm-plugins/toDOM-fixes/bodi
|
|
|
13
14
|
import { getToolbarConfig } from './pm-plugins/toolbar';
|
|
14
15
|
import { createPlugin as createUniqueIdPlugin } from './pm-plugins/unique-id';
|
|
15
16
|
// Remove below line when cleaning up platform_editor_ai_object_sidebar_injection feature flag
|
|
17
|
+
import { CONFIG_PANEL_ID } from './ui/ConfigPanel/constants';
|
|
16
18
|
import { getContextPanel } from './ui/context-panel';
|
|
17
19
|
import { useConfigPanelPluginHook } from './ui/useConfigPanelPluginHook';
|
|
18
20
|
export const extensionPlugin = ({
|
|
@@ -20,6 +22,7 @@ export const extensionPlugin = ({
|
|
|
20
22
|
api
|
|
21
23
|
}) => {
|
|
22
24
|
var _api$featureFlags, _api$contextPanel, _api$contextPanel$act, _api$analytics2, _api$analytics3, _api$contextPanel4;
|
|
25
|
+
const configPanelId = `${CONFIG_PANEL_ID}-${uuid()}`;
|
|
23
26
|
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
24
27
|
//Note: This is a hack to get the editor view reference in the plugin. Copied from table plugin.
|
|
25
28
|
//This is needed to get the current selection in the editor
|
|
@@ -178,8 +181,9 @@ export const extensionPlugin = ({
|
|
|
178
181
|
editorView
|
|
179
182
|
}) => {
|
|
180
183
|
useConfigPanelPluginHook({
|
|
181
|
-
|
|
182
|
-
|
|
184
|
+
api,
|
|
185
|
+
configPanelId,
|
|
186
|
+
editorView
|
|
183
187
|
});
|
|
184
188
|
} : undefined
|
|
185
189
|
};
|
|
@@ -7,7 +7,7 @@ import { clearEditingContext, forceAutoSave } from '../editor-commands/commands'
|
|
|
7
7
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
8
8
|
import { getSelectedExtension } from '../pm-plugins/utils';
|
|
9
9
|
import ConfigPanelLoader from './ConfigPanel/ConfigPanelLoader';
|
|
10
|
-
import {
|
|
10
|
+
import { CONFIG_PANEL_WIDTH } from './ConfigPanel/constants';
|
|
11
11
|
import HeaderAfterIconElement from './ConfigPanel/Header/HeaderAfterIconElement';
|
|
12
12
|
import HeaderIcon from './ConfigPanel/Header/HeaderIcon';
|
|
13
13
|
import { onChangeAction } from './context-panel';
|
|
@@ -33,6 +33,7 @@ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
|
33
33
|
});
|
|
34
34
|
export function useConfigPanelPluginHook({
|
|
35
35
|
editorView,
|
|
36
|
+
configPanelId,
|
|
36
37
|
api
|
|
37
38
|
}) {
|
|
38
39
|
const editorState = editorView.state;
|
|
@@ -45,35 +46,37 @@ export function useConfigPanelPluginHook({
|
|
|
45
46
|
const nodeWithPos = getSelectedExtension(editorState, true);
|
|
46
47
|
// Adding checks to bail out early
|
|
47
48
|
if (!nodeWithPos) {
|
|
48
|
-
hideConfigPanel(api);
|
|
49
|
+
hideConfigPanel(configPanelId, api);
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
52
|
if (showContextPanel && extensionProvider && processParametersAfter) {
|
|
52
53
|
showConfigPanel({
|
|
53
54
|
api,
|
|
55
|
+
configPanelId,
|
|
54
56
|
editorView,
|
|
55
57
|
extensionProvider,
|
|
56
58
|
nodeWithPos
|
|
57
59
|
});
|
|
58
60
|
} else {
|
|
59
|
-
hideConfigPanel(api);
|
|
61
|
+
hideConfigPanel(configPanelId, api);
|
|
60
62
|
}
|
|
61
|
-
}, [api, editorState, editorView, showContextPanel, extensionProvider, processParametersAfter]);
|
|
63
|
+
}, [api, configPanelId, editorState, editorView, showContextPanel, extensionProvider, processParametersAfter]);
|
|
62
64
|
useEffect(() => {
|
|
63
65
|
return () => {
|
|
64
|
-
hideConfigPanel(api);
|
|
66
|
+
hideConfigPanel(configPanelId, api);
|
|
65
67
|
};
|
|
66
|
-
}, [api]);
|
|
68
|
+
}, [api, configPanelId]);
|
|
67
69
|
}
|
|
68
|
-
export function hideConfigPanel(api) {
|
|
70
|
+
export function hideConfigPanel(configPanelId, api) {
|
|
69
71
|
var _api$contextPanel, _api$contextPanel$act;
|
|
70
72
|
const closePanelById = api === null || api === void 0 ? void 0 : (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 ? void 0 : (_api$contextPanel$act = _api$contextPanel.actions) === null || _api$contextPanel$act === void 0 ? void 0 : _api$contextPanel$act.closePanelById;
|
|
71
73
|
if (closePanelById) {
|
|
72
|
-
closePanelById(
|
|
74
|
+
closePanelById(configPanelId);
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
export function showConfigPanel({
|
|
76
78
|
api,
|
|
79
|
+
configPanelId,
|
|
77
80
|
editorView,
|
|
78
81
|
extensionProvider,
|
|
79
82
|
nodeWithPos
|
|
@@ -113,7 +116,7 @@ export function showConfigPanel({
|
|
|
113
116
|
nodeWithPos
|
|
114
117
|
});
|
|
115
118
|
showContextPanel({
|
|
116
|
-
id:
|
|
119
|
+
id: configPanelId,
|
|
117
120
|
headerComponentElements: {
|
|
118
121
|
HeaderIcon: HeadeIconWrapper,
|
|
119
122
|
HeaderAfterIconElement: HeaderAfterIconElementWrapper
|
|
@@ -5,7 +5,6 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, TARGET_SELECTION
|
|
|
5
5
|
import { removeConnectedNodes } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { createCommand } from '../pm-plugins/plugin-factory';
|
|
10
9
|
import { getSelectedExtension } from '../pm-plugins/utils';
|
|
11
10
|
|
|
@@ -120,7 +119,7 @@ export var removeSelectedNodeWithAnalytics = function removeSelectedNodeWithAnal
|
|
|
120
119
|
extensionType: node.attrs.extensionType,
|
|
121
120
|
extensionKey: node.attrs.extensionKey,
|
|
122
121
|
localId: node.attrs.localId,
|
|
123
|
-
inputMethod:
|
|
122
|
+
inputMethod: inputMethod
|
|
124
123
|
}
|
|
125
124
|
})(tr);
|
|
126
125
|
}
|
|
@@ -142,7 +141,7 @@ export var checkAndRemoveExtensionNode = function checkAndRemoveExtensionNode(st
|
|
|
142
141
|
extensionKey: maybeMBENode.node.attrs.extensionKey,
|
|
143
142
|
localId: maybeMBENode.node.attrs.localId,
|
|
144
143
|
currentFramesCount: maybeMBENode.node.content.childCount,
|
|
145
|
-
inputMethod:
|
|
144
|
+
inputMethod: inputMethod
|
|
146
145
|
}
|
|
147
146
|
})(tr);
|
|
148
147
|
}
|
|
@@ -159,7 +158,7 @@ export var checkAndRemoveExtensionNode = function checkAndRemoveExtensionNode(st
|
|
|
159
158
|
extensionType: bodiedExtensionNode.node.attrs.extensionType,
|
|
160
159
|
extensionKey: bodiedExtensionNode.node.attrs.extensionKey,
|
|
161
160
|
localId: bodiedExtensionNode.node.attrs.localId,
|
|
162
|
-
inputMethod:
|
|
161
|
+
inputMethod: inputMethod
|
|
163
162
|
}
|
|
164
163
|
})(tr);
|
|
165
164
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import uuid from 'uuid/v4';
|
|
1
2
|
import { extension, extensionFrame, inlineExtension, multiBodiedExtension } from '@atlaskit/adf-schema';
|
|
2
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -13,6 +14,7 @@ import { bodiedExtensionSpecWithFixedToDOM } from './pm-plugins/toDOM-fixes/bodi
|
|
|
13
14
|
import { getToolbarConfig } from './pm-plugins/toolbar';
|
|
14
15
|
import { createPlugin as createUniqueIdPlugin } from './pm-plugins/unique-id';
|
|
15
16
|
// Remove below line when cleaning up platform_editor_ai_object_sidebar_injection feature flag
|
|
17
|
+
import { CONFIG_PANEL_ID } from './ui/ConfigPanel/constants';
|
|
16
18
|
import { getContextPanel } from './ui/context-panel';
|
|
17
19
|
import { useConfigPanelPluginHook } from './ui/useConfigPanelPluginHook';
|
|
18
20
|
export var extensionPlugin = function extensionPlugin(_ref) {
|
|
@@ -20,6 +22,7 @@ export var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
20
22
|
var _ref$config = _ref.config,
|
|
21
23
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
22
24
|
_api = _ref.api;
|
|
25
|
+
var configPanelId = "".concat(CONFIG_PANEL_ID, "-").concat(uuid());
|
|
23
26
|
var featureFlags = (_api === null || _api === void 0 || (_api$featureFlags = _api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
24
27
|
//Note: This is a hack to get the editor view reference in the plugin. Copied from table plugin.
|
|
25
28
|
//This is needed to get the current selection in the editor
|
|
@@ -181,8 +184,9 @@ export var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
181
184
|
usePluginHook: showContextPanel && fg('platform_editor_ai_object_sidebar_injection') ? function (_ref6) {
|
|
182
185
|
var editorView = _ref6.editorView;
|
|
183
186
|
useConfigPanelPluginHook({
|
|
184
|
-
|
|
185
|
-
|
|
187
|
+
api: _api,
|
|
188
|
+
configPanelId: configPanelId,
|
|
189
|
+
editorView: editorView
|
|
186
190
|
});
|
|
187
191
|
} : undefined
|
|
188
192
|
};
|
|
@@ -10,7 +10,7 @@ import { clearEditingContext, forceAutoSave } from '../editor-commands/commands'
|
|
|
10
10
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
11
11
|
import { getSelectedExtension } from '../pm-plugins/utils';
|
|
12
12
|
import ConfigPanelLoader from './ConfigPanel/ConfigPanelLoader';
|
|
13
|
-
import {
|
|
13
|
+
import { CONFIG_PANEL_WIDTH } from './ConfigPanel/constants';
|
|
14
14
|
import HeaderAfterIconElement from './ConfigPanel/Header/HeaderAfterIconElement';
|
|
15
15
|
import HeaderIcon from './ConfigPanel/Header/HeaderIcon';
|
|
16
16
|
import { onChangeAction } from './context-panel';
|
|
@@ -35,6 +35,7 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
|
35
35
|
});
|
|
36
36
|
export function useConfigPanelPluginHook(_ref) {
|
|
37
37
|
var editorView = _ref.editorView,
|
|
38
|
+
configPanelId = _ref.configPanelId,
|
|
38
39
|
api = _ref.api;
|
|
39
40
|
var editorState = editorView.state;
|
|
40
41
|
var _useSharedState = useSharedState(api),
|
|
@@ -45,36 +46,38 @@ export function useConfigPanelPluginHook(_ref) {
|
|
|
45
46
|
var nodeWithPos = getSelectedExtension(editorState, true);
|
|
46
47
|
// Adding checks to bail out early
|
|
47
48
|
if (!nodeWithPos) {
|
|
48
|
-
hideConfigPanel(api);
|
|
49
|
+
hideConfigPanel(configPanelId, api);
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
52
|
if (showContextPanel && extensionProvider && processParametersAfter) {
|
|
52
53
|
showConfigPanel({
|
|
53
54
|
api: api,
|
|
55
|
+
configPanelId: configPanelId,
|
|
54
56
|
editorView: editorView,
|
|
55
57
|
extensionProvider: extensionProvider,
|
|
56
58
|
nodeWithPos: nodeWithPos
|
|
57
59
|
});
|
|
58
60
|
} else {
|
|
59
|
-
hideConfigPanel(api);
|
|
61
|
+
hideConfigPanel(configPanelId, api);
|
|
60
62
|
}
|
|
61
|
-
}, [api, editorState, editorView, showContextPanel, extensionProvider, processParametersAfter]);
|
|
63
|
+
}, [api, configPanelId, editorState, editorView, showContextPanel, extensionProvider, processParametersAfter]);
|
|
62
64
|
useEffect(function () {
|
|
63
65
|
return function () {
|
|
64
|
-
hideConfigPanel(api);
|
|
66
|
+
hideConfigPanel(configPanelId, api);
|
|
65
67
|
};
|
|
66
|
-
}, [api]);
|
|
68
|
+
}, [api, configPanelId]);
|
|
67
69
|
}
|
|
68
|
-
export function hideConfigPanel(api) {
|
|
70
|
+
export function hideConfigPanel(configPanelId, api) {
|
|
69
71
|
var _api$contextPanel;
|
|
70
72
|
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;
|
|
71
73
|
if (closePanelById) {
|
|
72
|
-
closePanelById(
|
|
74
|
+
closePanelById(configPanelId);
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
export function showConfigPanel(_ref2) {
|
|
76
78
|
var _api$contextPanel2;
|
|
77
79
|
var api = _ref2.api,
|
|
80
|
+
configPanelId = _ref2.configPanelId,
|
|
78
81
|
editorView = _ref2.editorView,
|
|
79
82
|
extensionProvider = _ref2.extensionProvider,
|
|
80
83
|
nodeWithPos = _ref2.nodeWithPos;
|
|
@@ -115,7 +118,7 @@ export function showConfigPanel(_ref2) {
|
|
|
115
118
|
nodeWithPos: nodeWithPos
|
|
116
119
|
});
|
|
117
120
|
showContextPanel({
|
|
118
|
-
id:
|
|
121
|
+
id: configPanelId,
|
|
119
122
|
headerComponentElements: {
|
|
120
123
|
HeaderIcon: HeadeIconWrapper,
|
|
121
124
|
HeaderAfterIconElement: HeaderAfterIconElementWrapper
|
|
@@ -4,13 +4,15 @@ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { type ExtensionPlugin } from '../extensionPluginType';
|
|
7
|
-
export declare function useConfigPanelPluginHook({ editorView, api, }: {
|
|
7
|
+
export declare function useConfigPanelPluginHook({ editorView, configPanelId, api, }: {
|
|
8
8
|
editorView: EditorView;
|
|
9
|
+
configPanelId: string;
|
|
9
10
|
api?: ExtractInjectionAPI<ExtensionPlugin>;
|
|
10
11
|
}): void;
|
|
11
|
-
export declare function hideConfigPanel(api: ExtractInjectionAPI<ExtensionPlugin> | undefined): void;
|
|
12
|
-
export declare function showConfigPanel({ api, editorView, extensionProvider, nodeWithPos, }: {
|
|
12
|
+
export declare function hideConfigPanel(configPanelId: string, api: ExtractInjectionAPI<ExtensionPlugin> | undefined): void;
|
|
13
|
+
export declare function showConfigPanel({ api, configPanelId, editorView, extensionProvider, nodeWithPos, }: {
|
|
13
14
|
api: ExtractInjectionAPI<ExtensionPlugin> | undefined;
|
|
15
|
+
configPanelId: string;
|
|
14
16
|
editorView: EditorView;
|
|
15
17
|
extensionProvider: ExtensionProvider;
|
|
16
18
|
nodeWithPos: ContentNodeWithPos;
|
|
@@ -4,13 +4,15 @@ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { type ExtensionPlugin } from '../extensionPluginType';
|
|
7
|
-
export declare function useConfigPanelPluginHook({ editorView, api, }: {
|
|
7
|
+
export declare function useConfigPanelPluginHook({ editorView, configPanelId, api, }: {
|
|
8
8
|
editorView: EditorView;
|
|
9
|
+
configPanelId: string;
|
|
9
10
|
api?: ExtractInjectionAPI<ExtensionPlugin>;
|
|
10
11
|
}): void;
|
|
11
|
-
export declare function hideConfigPanel(api: ExtractInjectionAPI<ExtensionPlugin> | undefined): void;
|
|
12
|
-
export declare function showConfigPanel({ api, editorView, extensionProvider, nodeWithPos, }: {
|
|
12
|
+
export declare function hideConfigPanel(configPanelId: string, api: ExtractInjectionAPI<ExtensionPlugin> | undefined): void;
|
|
13
|
+
export declare function showConfigPanel({ api, configPanelId, editorView, extensionProvider, nodeWithPos, }: {
|
|
13
14
|
api: ExtractInjectionAPI<ExtensionPlugin> | undefined;
|
|
15
|
+
configPanelId: string;
|
|
14
16
|
editorView: EditorView;
|
|
15
17
|
extensionProvider: ExtensionProvider;
|
|
16
18
|
nodeWithPos: ContentNodeWithPos;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-extension",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.4",
|
|
4
4
|
"description": "editor-plugin-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@atlaskit/button": "^23.2.0",
|
|
33
33
|
"@atlaskit/checkbox": "^17.1.0",
|
|
34
34
|
"@atlaskit/datetime-picker": "^17.0.0",
|
|
35
|
-
"@atlaskit/editor-common": "^106.
|
|
35
|
+
"@atlaskit/editor-common": "^106.3.0",
|
|
36
36
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
@@ -60,17 +60,18 @@
|
|
|
60
60
|
"@atlaskit/textarea": "^8.0.0",
|
|
61
61
|
"@atlaskit/textfield": "^8.0.0",
|
|
62
62
|
"@atlaskit/theme": "^18.0.0",
|
|
63
|
-
"@atlaskit/tmp-editor-statsig": "^5.
|
|
63
|
+
"@atlaskit/tmp-editor-statsig": "^5.14.0",
|
|
64
64
|
"@atlaskit/toggle": "^15.0.0",
|
|
65
|
-
"@atlaskit/tokens": "^5.
|
|
66
|
-
"@atlaskit/tooltip": "^20.
|
|
65
|
+
"@atlaskit/tokens": "^5.1.0",
|
|
66
|
+
"@atlaskit/tooltip": "^20.3.0",
|
|
67
67
|
"@babel/runtime": "^7.0.0",
|
|
68
68
|
"@emotion/react": "^11.7.1",
|
|
69
69
|
"bind-event-listener": "^3.0.0",
|
|
70
70
|
"is-number": "^7.0.0",
|
|
71
71
|
"lodash": "^4.17.21",
|
|
72
72
|
"memoize-one": "^6.0.0",
|
|
73
|
-
"react-loadable": "^5.1.0"
|
|
73
|
+
"react-loadable": "^5.1.0",
|
|
74
|
+
"uuid": "^3.1.0"
|
|
74
75
|
},
|
|
75
76
|
"peerDependencies": {
|
|
76
77
|
"react": "^18.2.0",
|
|
@@ -126,9 +127,6 @@
|
|
|
126
127
|
"platform_editor_controls_patch_2": {
|
|
127
128
|
"type": "boolean"
|
|
128
129
|
},
|
|
129
|
-
"platform_editor_controls_patch_analytics_2": {
|
|
130
|
-
"type": "boolean"
|
|
131
|
-
},
|
|
132
130
|
"platform_editor_controls_patch_8": {
|
|
133
131
|
"type": "boolean"
|
|
134
132
|
},
|