@atlaskit/editor-plugin-extension 5.5.1 → 5.5.3

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-plugin-extension
2
2
 
3
+ ## 5.5.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#162483](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/162483)
8
+ [`ad07dec30b65c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ad07dec30b65c) -
9
+ EDITOR-817 Extension right rail not opening when Legacy Content Extension is in page bug fixed.
10
+ - Updated dependencies
11
+
12
+ ## 5.5.2
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 5.5.1
4
19
 
5
20
  ### Patch Changes
@@ -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
- editorView: editorView,
193
- api: _api
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(_constants.CONFIG_PANEL_ID);
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: _constants.CONFIG_PANEL_ID,
134
+ id: configPanelId,
132
135
  headerComponentElements: {
133
136
  HeaderIcon: HeadeIconWrapper,
134
137
  HeaderAfterIconElement: HeaderAfterIconElementWrapper
@@ -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
- editorView,
182
- api
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 { CONFIG_PANEL_ID, CONFIG_PANEL_WIDTH } from './ConfigPanel/constants';
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(CONFIG_PANEL_ID);
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: CONFIG_PANEL_ID,
119
+ id: configPanelId,
117
120
  headerComponentElements: {
118
121
  HeaderIcon: HeadeIconWrapper,
119
122
  HeaderAfterIconElement: HeaderAfterIconElementWrapper
@@ -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
- editorView: editorView,
185
- api: _api
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 { CONFIG_PANEL_ID, CONFIG_PANEL_WIDTH } from './ConfigPanel/constants';
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(CONFIG_PANEL_ID);
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: CONFIG_PANEL_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.1",
3
+ "version": "5.5.3",
4
4
  "description": "editor-plugin-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@atlaskit/adf-schema": "^47.6.0",
29
29
  "@atlaskit/adf-utils": "^19.20.0",
30
- "@atlaskit/analytics-next": "^11.0.0",
30
+ "@atlaskit/analytics-next": "^11.1.0",
31
31
  "@atlaskit/avatar": "^25.1.0",
32
32
  "@atlaskit/button": "^23.2.0",
33
33
  "@atlaskit/checkbox": "^17.1.0",
@@ -60,9 +60,9 @@
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.6.0",
63
+ "@atlaskit/tmp-editor-statsig": "^5.8.0",
64
64
  "@atlaskit/toggle": "^15.0.0",
65
- "@atlaskit/tokens": "^4.9.0",
65
+ "@atlaskit/tokens": "^5.0.0",
66
66
  "@atlaskit/tooltip": "^20.2.0",
67
67
  "@babel/runtime": "^7.0.0",
68
68
  "@emotion/react": "^11.7.1",
@@ -70,7 +70,8 @@
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",