@atlaskit/editor-plugin-panel 2.3.7 → 2.5.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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/editor-plugin-panel
2
2
 
3
+ ## 2.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#141652](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141652)
8
+ [`1cbce9d217a8e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1cbce9d217a8e) -
9
+ [ux] EDF-1549 AI button added in floating toolbar of panel, table, layout and expand behind
10
+ experiment.
11
+
12
+ ## 2.4.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#140949](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/140949)
17
+ [`f0496e4dd21b2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f0496e4dd21b2) -
18
+ Make Panel Plugin use Emoji component from editor-plugin-emoji
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 2.3.7
4
25
 
5
26
  ### Patch Changes
@@ -11,6 +11,7 @@ var _react = _interopRequireDefault(require("react"));
11
11
  var _reactDom = _interopRequireDefault(require("react-dom"));
12
12
  var _adfSchema = require("@atlaskit/adf-schema");
13
13
  var _emoji = require("@atlaskit/editor-common/emoji");
14
+ var _hooks = require("@atlaskit/editor-common/hooks");
14
15
  var _icons = require("@atlaskit/editor-common/icons");
15
16
  var _panel = require("@atlaskit/editor-common/panel");
16
17
  var _model = require("@atlaskit/editor-prosemirror/model");
@@ -26,16 +27,24 @@ var panelIcons = exports.panelIcons = {
26
27
  error: _icons.PanelErrorIcon,
27
28
  custom: _icons.PanelInfoIcon
28
29
  };
30
+ var useEmojiProvider = function useEmojiProvider(pluginInjectionApi) {
31
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['emoji']),
32
+ emojiState = _useSharedPluginState.emojiState;
33
+ return emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider;
34
+ };
29
35
  var PanelIcon = exports.PanelIcon = function PanelIcon(props) {
30
36
  var allowCustomPanel = props.allowCustomPanel,
31
37
  providerFactory = props.providerFactory,
38
+ pluginInjectionApi = props.pluginInjectionApi,
32
39
  _props$panelAttribute = props.panelAttributes,
33
40
  panelType = _props$panelAttribute.panelType,
34
41
  panelIcon = _props$panelAttribute.panelIcon,
35
42
  panelIconId = _props$panelAttribute.panelIconId,
36
43
  panelIconText = _props$panelAttribute.panelIconText;
44
+ var emojiProvider = useEmojiProvider(pluginInjectionApi);
37
45
  if (allowCustomPanel && panelIcon && panelType === _adfSchema.PanelType.CUSTOM) {
38
46
  return /*#__PURE__*/_react.default.createElement(_emoji.Emoji, {
47
+ emojiProvider: emojiProvider,
39
48
  providers: providerFactory,
40
49
  shortName: panelIcon,
41
50
  id: panelIconId,
@@ -51,7 +60,7 @@ var PanelIcon = exports.PanelIcon = function PanelIcon(props) {
51
60
  });
52
61
  };
53
62
  var PanelNodeView = /*#__PURE__*/function () {
54
- function PanelNodeView(node, view, getPos, pluginOptions, providerFactory) {
63
+ function PanelNodeView(node, view, getPos, pluginOptions, api, providerFactory) {
55
64
  (0, _classCallCheck2.default)(this, PanelNodeView);
56
65
  this.providerFactory = providerFactory;
57
66
  this.pluginOptions = pluginOptions;
@@ -70,6 +79,7 @@ var PanelNodeView = /*#__PURE__*/function () {
70
79
  // set contentEditable as false to be able to select the custom panels with keyboard
71
80
  this.icon.contentEditable = 'false';
72
81
  _reactDom.default.render( /*#__PURE__*/_react.default.createElement(PanelIcon, {
82
+ pluginInjectionApi: api,
73
83
  allowCustomPanel: pluginOptions.allowCustomPanel,
74
84
  panelAttributes: node.attrs,
75
85
  providerFactory: this.providerFactory
@@ -90,8 +100,8 @@ var PanelNodeView = /*#__PURE__*/function () {
90
100
  }]);
91
101
  return PanelNodeView;
92
102
  }();
93
- var getPanelNodeView = exports.getPanelNodeView = function getPanelNodeView(pluginOptions, providerFactory) {
103
+ var getPanelNodeView = exports.getPanelNodeView = function getPanelNodeView(pluginOptions, api, providerFactory) {
94
104
  return function (node, view, getPos) {
95
- return new PanelNodeView(node, view, getPos, pluginOptions, providerFactory);
105
+ return new PanelNodeView(node, view, getPos, pluginOptions, api, providerFactory);
96
106
  };
97
107
  };
@@ -34,7 +34,7 @@ var panelPlugin = function panelPlugin(_ref) {
34
34
  plugin: function plugin(_ref2) {
35
35
  var providerFactory = _ref2.providerFactory,
36
36
  dispatch = _ref2.dispatch;
37
- return (0, _main.createPlugin)(dispatch, providerFactory, options);
37
+ return (0, _main.createPlugin)(dispatch, providerFactory, options, api);
38
38
  }
39
39
  }, {
40
40
  name: 'panelKeyMap',
@@ -10,7 +10,7 @@ var _selection = require("@atlaskit/editor-common/selection");
10
10
  var _panel2 = require("../nodeviews/panel");
11
11
  var _types = require("../types");
12
12
  var _utils = require("../utils");
13
- var createPlugin = exports.createPlugin = function createPlugin(dispatch, providerFactory, pluginOptions) {
13
+ var createPlugin = exports.createPlugin = function createPlugin(dispatch, providerFactory, pluginOptions, api) {
14
14
  var _pluginOptions$useLon = pluginOptions.useLongPressSelection,
15
15
  useLongPressSelection = _pluginOptions$useLon === void 0 ? false : _pluginOptions$useLon;
16
16
  return new _safePlugin.SafePlugin({
@@ -25,7 +25,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
25
25
  },
26
26
  props: {
27
27
  nodeViews: {
28
- panel: (0, _panel2.getPanelNodeView)(pluginOptions, providerFactory)
28
+ panel: (0, _panel2.getPanelNodeView)(pluginOptions, api, providerFactory)
29
29
  },
30
30
  handleClickOn: (0, _selection.createSelectionClickHandler)(['panel'], function (target) {
31
31
  return !!target.closest(".".concat(_panel.PanelSharedCssClassName.prefix));
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
  import { PanelType } from '@atlaskit/adf-schema';
4
4
  import { Emoji } from '@atlaskit/editor-common/emoji';
5
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
6
  import { PanelErrorIcon, PanelInfoIcon, PanelNoteIcon, PanelSuccessIcon, PanelWarningIcon } from '@atlaskit/editor-common/icons';
6
7
  import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
7
8
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
@@ -17,10 +18,17 @@ export const panelIcons = {
17
18
  error: PanelErrorIcon,
18
19
  custom: PanelInfoIcon
19
20
  };
21
+ const useEmojiProvider = pluginInjectionApi => {
22
+ const {
23
+ emojiState
24
+ } = useSharedPluginState(pluginInjectionApi, ['emoji']);
25
+ return emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider;
26
+ };
20
27
  export const PanelIcon = props => {
21
28
  const {
22
29
  allowCustomPanel,
23
30
  providerFactory,
31
+ pluginInjectionApi,
24
32
  panelAttributes: {
25
33
  panelType,
26
34
  panelIcon,
@@ -28,8 +36,10 @@ export const PanelIcon = props => {
28
36
  panelIconText
29
37
  }
30
38
  } = props;
39
+ const emojiProvider = useEmojiProvider(pluginInjectionApi);
31
40
  if (allowCustomPanel && panelIcon && panelType === PanelType.CUSTOM) {
32
41
  return /*#__PURE__*/React.createElement(Emoji, {
42
+ emojiProvider: emojiProvider,
33
43
  providers: providerFactory,
34
44
  shortName: panelIcon,
35
45
  id: panelIconId,
@@ -45,7 +55,7 @@ export const PanelIcon = props => {
45
55
  });
46
56
  };
47
57
  class PanelNodeView {
48
- constructor(node, view, getPos, pluginOptions, providerFactory) {
58
+ constructor(node, view, getPos, pluginOptions, api, providerFactory) {
49
59
  this.providerFactory = providerFactory;
50
60
  this.pluginOptions = pluginOptions;
51
61
  this.view = view;
@@ -64,6 +74,7 @@ class PanelNodeView {
64
74
  // set contentEditable as false to be able to select the custom panels with keyboard
65
75
  this.icon.contentEditable = 'false';
66
76
  ReactDOM.render( /*#__PURE__*/React.createElement(PanelIcon, {
77
+ pluginInjectionApi: api,
67
78
  allowCustomPanel: pluginOptions.allowCustomPanel,
68
79
  panelAttributes: node.attrs,
69
80
  providerFactory: this.providerFactory
@@ -80,6 +91,6 @@ class PanelNodeView {
80
91
  return isIcon || isInsideIcon;
81
92
  }
82
93
  }
83
- export const getPanelNodeView = (pluginOptions, providerFactory) => (node, view, getPos) => {
84
- return new PanelNodeView(node, view, getPos, pluginOptions, providerFactory);
94
+ export const getPanelNodeView = (pluginOptions, api, providerFactory) => (node, view, getPos) => {
95
+ return new PanelNodeView(node, view, getPos, pluginOptions, api, providerFactory);
85
96
  };
@@ -26,7 +26,7 @@ const panelPlugin = ({
26
26
  plugin: ({
27
27
  providerFactory,
28
28
  dispatch
29
- }) => createPlugin(dispatch, providerFactory, options)
29
+ }) => createPlugin(dispatch, providerFactory, options, api)
30
30
  }, {
31
31
  name: 'panelKeyMap',
32
32
  plugin: () => keymap()
@@ -4,7 +4,7 @@ import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
4
4
  import { getPanelNodeView } from '../nodeviews/panel';
5
5
  import { pluginKey } from '../types';
6
6
  import { handleCut } from '../utils';
7
- export const createPlugin = (dispatch, providerFactory, pluginOptions) => {
7
+ export const createPlugin = (dispatch, providerFactory, pluginOptions, api) => {
8
8
  const {
9
9
  useLongPressSelection = false
10
10
  } = pluginOptions;
@@ -18,7 +18,7 @@ export const createPlugin = (dispatch, providerFactory, pluginOptions) => {
18
18
  },
19
19
  props: {
20
20
  nodeViews: {
21
- panel: getPanelNodeView(pluginOptions, providerFactory)
21
+ panel: getPanelNodeView(pluginOptions, api, providerFactory)
22
22
  },
23
23
  handleClickOn: createSelectionClickHandler(['panel'], target => !!target.closest(`.${PanelSharedCssClassName.prefix}`), {
24
24
  useLongPressSelection
@@ -4,6 +4,7 @@ import React from 'react';
4
4
  import ReactDOM from 'react-dom';
5
5
  import { PanelType } from '@atlaskit/adf-schema';
6
6
  import { Emoji } from '@atlaskit/editor-common/emoji';
7
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
7
8
  import { PanelErrorIcon, PanelInfoIcon, PanelNoteIcon, PanelSuccessIcon, PanelWarningIcon } from '@atlaskit/editor-common/icons';
8
9
  import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
9
10
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
@@ -19,16 +20,24 @@ export var panelIcons = {
19
20
  error: PanelErrorIcon,
20
21
  custom: PanelInfoIcon
21
22
  };
23
+ var useEmojiProvider = function useEmojiProvider(pluginInjectionApi) {
24
+ var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['emoji']),
25
+ emojiState = _useSharedPluginState.emojiState;
26
+ return emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider;
27
+ };
22
28
  export var PanelIcon = function PanelIcon(props) {
23
29
  var allowCustomPanel = props.allowCustomPanel,
24
30
  providerFactory = props.providerFactory,
31
+ pluginInjectionApi = props.pluginInjectionApi,
25
32
  _props$panelAttribute = props.panelAttributes,
26
33
  panelType = _props$panelAttribute.panelType,
27
34
  panelIcon = _props$panelAttribute.panelIcon,
28
35
  panelIconId = _props$panelAttribute.panelIconId,
29
36
  panelIconText = _props$panelAttribute.panelIconText;
37
+ var emojiProvider = useEmojiProvider(pluginInjectionApi);
30
38
  if (allowCustomPanel && panelIcon && panelType === PanelType.CUSTOM) {
31
39
  return /*#__PURE__*/React.createElement(Emoji, {
40
+ emojiProvider: emojiProvider,
32
41
  providers: providerFactory,
33
42
  shortName: panelIcon,
34
43
  id: panelIconId,
@@ -44,7 +53,7 @@ export var PanelIcon = function PanelIcon(props) {
44
53
  });
45
54
  };
46
55
  var PanelNodeView = /*#__PURE__*/function () {
47
- function PanelNodeView(node, view, getPos, pluginOptions, providerFactory) {
56
+ function PanelNodeView(node, view, getPos, pluginOptions, api, providerFactory) {
48
57
  _classCallCheck(this, PanelNodeView);
49
58
  this.providerFactory = providerFactory;
50
59
  this.pluginOptions = pluginOptions;
@@ -63,6 +72,7 @@ var PanelNodeView = /*#__PURE__*/function () {
63
72
  // set contentEditable as false to be able to select the custom panels with keyboard
64
73
  this.icon.contentEditable = 'false';
65
74
  ReactDOM.render( /*#__PURE__*/React.createElement(PanelIcon, {
75
+ pluginInjectionApi: api,
66
76
  allowCustomPanel: pluginOptions.allowCustomPanel,
67
77
  panelAttributes: node.attrs,
68
78
  providerFactory: this.providerFactory
@@ -83,8 +93,8 @@ var PanelNodeView = /*#__PURE__*/function () {
83
93
  }]);
84
94
  return PanelNodeView;
85
95
  }();
86
- export var getPanelNodeView = function getPanelNodeView(pluginOptions, providerFactory) {
96
+ export var getPanelNodeView = function getPanelNodeView(pluginOptions, api, providerFactory) {
87
97
  return function (node, view, getPos) {
88
- return new PanelNodeView(node, view, getPos, pluginOptions, providerFactory);
98
+ return new PanelNodeView(node, view, getPos, pluginOptions, api, providerFactory);
89
99
  };
90
100
  };
@@ -27,7 +27,7 @@ var panelPlugin = function panelPlugin(_ref) {
27
27
  plugin: function plugin(_ref2) {
28
28
  var providerFactory = _ref2.providerFactory,
29
29
  dispatch = _ref2.dispatch;
30
- return createPlugin(dispatch, providerFactory, options);
30
+ return createPlugin(dispatch, providerFactory, options, api);
31
31
  }
32
32
  }, {
33
33
  name: 'panelKeyMap',
@@ -4,7 +4,7 @@ import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
4
4
  import { getPanelNodeView } from '../nodeviews/panel';
5
5
  import { pluginKey } from '../types';
6
6
  import { handleCut } from '../utils';
7
- export var createPlugin = function createPlugin(dispatch, providerFactory, pluginOptions) {
7
+ export var createPlugin = function createPlugin(dispatch, providerFactory, pluginOptions, api) {
8
8
  var _pluginOptions$useLon = pluginOptions.useLongPressSelection,
9
9
  useLongPressSelection = _pluginOptions$useLon === void 0 ? false : _pluginOptions$useLon;
10
10
  return new SafePlugin({
@@ -19,7 +19,7 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, plugi
19
19
  },
20
20
  props: {
21
21
  nodeViews: {
22
- panel: getPanelNodeView(pluginOptions, providerFactory)
22
+ panel: getPanelNodeView(pluginOptions, api, providerFactory)
23
23
  },
24
24
  handleClickOn: createSelectionClickHandler(['panel'], function (target) {
25
25
  return !!target.closest(".".concat(PanelSharedCssClassName.prefix));
@@ -1,3 +1,2 @@
1
1
  export { default as panelPlugin } from './plugin';
2
- export type { PanelPlugin } from './plugin';
3
- export type { PanelPluginConfig, PanelPluginOptions } from './types';
2
+ export type { PanelPlugin, PanelPluginConfig, PanelPluginOptions } from './types';
@@ -2,10 +2,10 @@ import React from 'react';
2
2
  import type { PanelAttributes } from '@atlaskit/adf-schema';
3
3
  import { PanelType } from '@atlaskit/adf-schema';
4
4
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
5
- import type { getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
5
+ import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
6
6
  import type { Node } from '@atlaskit/editor-prosemirror/model';
7
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
- import type { PanelPluginOptions } from '../types';
8
+ import type { PanelPlugin, PanelPluginOptions } from '../types';
9
9
  export declare const panelIcons: {
10
10
  [key in PanelType]: React.ComponentType<{
11
11
  label: string;
@@ -15,6 +15,7 @@ interface PanelIconAttributes {
15
15
  panelAttributes: PanelAttributes;
16
16
  providerFactory?: ProviderFactory;
17
17
  allowCustomPanel?: boolean;
18
+ pluginInjectionApi: ExtractInjectionAPI<PanelPlugin> | undefined;
18
19
  }
19
20
  export declare const PanelIcon: (props: PanelIconAttributes) => JSX.Element;
20
21
  declare class PanelNodeView {
@@ -26,11 +27,11 @@ declare class PanelNodeView {
26
27
  view: EditorView;
27
28
  providerFactory?: ProviderFactory;
28
29
  pluginOptions: PanelPluginOptions;
29
- constructor(node: Node, view: EditorView, getPos: getPosHandlerNode, pluginOptions: PanelPluginOptions, providerFactory?: ProviderFactory);
30
+ constructor(node: Node, view: EditorView, getPos: getPosHandlerNode, pluginOptions: PanelPluginOptions, api: ExtractInjectionAPI<PanelPlugin> | undefined, providerFactory?: ProviderFactory);
30
31
  ignoreMutation(mutation: MutationRecord | {
31
32
  type: 'selection';
32
33
  target: Element;
33
34
  }): boolean;
34
35
  }
35
- export declare const getPanelNodeView: (pluginOptions: PanelPluginOptions, providerFactory?: ProviderFactory) => (node: Node, view: EditorView, getPos: getPosHandler) => PanelNodeView;
36
+ export declare const getPanelNodeView: (pluginOptions: PanelPluginOptions, api: ExtractInjectionAPI<PanelPlugin> | undefined, providerFactory?: ProviderFactory) => (node: Node, view: EditorView, getPos: getPosHandler) => PanelNodeView;
36
37
  export {};
@@ -1,14 +1,3 @@
1
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
- import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
- import type { PanelPluginOptions } from './types';
6
- export type PanelPlugin = NextEditorPlugin<'panel', {
7
- pluginConfiguration: PanelPluginOptions | undefined;
8
- dependencies: [typeof decorationsPlugin, OptionalPlugin<typeof analyticsPlugin>];
9
- actions: {
10
- insertPanel: (inputMethod: INPUT_METHOD) => Command;
11
- };
12
- }>;
1
+ import { type PanelPlugin } from './types';
13
2
  declare const panelPlugin: PanelPlugin;
14
3
  export default panelPlugin;
@@ -1,11 +1,12 @@
1
1
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
2
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import type { PanelPluginOptions } from '../types';
4
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
+ import { type PanelPlugin, type PanelPluginOptions } from '../types';
5
6
  export type PanelOptions = {
6
7
  color?: string;
7
8
  emoji?: string;
8
9
  emojiId?: string;
9
10
  emojiText?: string;
10
11
  };
11
- export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, pluginOptions: PanelPluginOptions) => SafePlugin<any>;
12
+ export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, pluginOptions: PanelPluginOptions, api: ExtractInjectionAPI<PanelPlugin> | undefined) => SafePlugin<any>;
@@ -1,4 +1,8 @@
1
- import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
1
+ import { type INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
+ import type { Command, LongPressSelectionPluginOptions, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
+ import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
+ import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
+ import { type EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
2
6
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
7
  export declare const pluginKey: PluginKey<any>;
4
8
  export interface PanelPluginOptions extends LongPressSelectionPluginOptions, PanelPluginConfig {
@@ -20,3 +24,10 @@ export type EmojiInfo = {
20
24
  shortName: string;
21
25
  id: string;
22
26
  };
27
+ export type PanelPlugin = NextEditorPlugin<'panel', {
28
+ pluginConfiguration: PanelPluginOptions | undefined;
29
+ dependencies: [typeof decorationsPlugin, OptionalPlugin<typeof analyticsPlugin>, EmojiPlugin];
30
+ actions: {
31
+ insertPanel: (inputMethod: INPUT_METHOD) => Command;
32
+ };
33
+ }>;
@@ -1,3 +1,2 @@
1
1
  export { default as panelPlugin } from './plugin';
2
- export type { PanelPlugin } from './plugin';
3
- export type { PanelPluginConfig, PanelPluginOptions } from './types';
2
+ export type { PanelPlugin, PanelPluginConfig, PanelPluginOptions } from './types';
@@ -2,10 +2,10 @@ import React from 'react';
2
2
  import type { PanelAttributes } from '@atlaskit/adf-schema';
3
3
  import { PanelType } from '@atlaskit/adf-schema';
4
4
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
5
- import type { getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
5
+ import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
6
6
  import type { Node } from '@atlaskit/editor-prosemirror/model';
7
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
- import type { PanelPluginOptions } from '../types';
8
+ import type { PanelPlugin, PanelPluginOptions } from '../types';
9
9
  export declare const panelIcons: {
10
10
  [key in PanelType]: React.ComponentType<{
11
11
  label: string;
@@ -15,6 +15,7 @@ interface PanelIconAttributes {
15
15
  panelAttributes: PanelAttributes;
16
16
  providerFactory?: ProviderFactory;
17
17
  allowCustomPanel?: boolean;
18
+ pluginInjectionApi: ExtractInjectionAPI<PanelPlugin> | undefined;
18
19
  }
19
20
  export declare const PanelIcon: (props: PanelIconAttributes) => JSX.Element;
20
21
  declare class PanelNodeView {
@@ -26,11 +27,11 @@ declare class PanelNodeView {
26
27
  view: EditorView;
27
28
  providerFactory?: ProviderFactory;
28
29
  pluginOptions: PanelPluginOptions;
29
- constructor(node: Node, view: EditorView, getPos: getPosHandlerNode, pluginOptions: PanelPluginOptions, providerFactory?: ProviderFactory);
30
+ constructor(node: Node, view: EditorView, getPos: getPosHandlerNode, pluginOptions: PanelPluginOptions, api: ExtractInjectionAPI<PanelPlugin> | undefined, providerFactory?: ProviderFactory);
30
31
  ignoreMutation(mutation: MutationRecord | {
31
32
  type: 'selection';
32
33
  target: Element;
33
34
  }): boolean;
34
35
  }
35
- export declare const getPanelNodeView: (pluginOptions: PanelPluginOptions, providerFactory?: ProviderFactory) => (node: Node, view: EditorView, getPos: getPosHandler) => PanelNodeView;
36
+ export declare const getPanelNodeView: (pluginOptions: PanelPluginOptions, api: ExtractInjectionAPI<PanelPlugin> | undefined, providerFactory?: ProviderFactory) => (node: Node, view: EditorView, getPos: getPosHandler) => PanelNodeView;
36
37
  export {};
@@ -1,17 +1,3 @@
1
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
- import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
- import type { PanelPluginOptions } from './types';
6
- export type PanelPlugin = NextEditorPlugin<'panel', {
7
- pluginConfiguration: PanelPluginOptions | undefined;
8
- dependencies: [
9
- typeof decorationsPlugin,
10
- OptionalPlugin<typeof analyticsPlugin>
11
- ];
12
- actions: {
13
- insertPanel: (inputMethod: INPUT_METHOD) => Command;
14
- };
15
- }>;
1
+ import { type PanelPlugin } from './types';
16
2
  declare const panelPlugin: PanelPlugin;
17
3
  export default panelPlugin;
@@ -1,11 +1,12 @@
1
1
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
2
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import type { PanelPluginOptions } from '../types';
4
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
+ import { type PanelPlugin, type PanelPluginOptions } from '../types';
5
6
  export type PanelOptions = {
6
7
  color?: string;
7
8
  emoji?: string;
8
9
  emojiId?: string;
9
10
  emojiText?: string;
10
11
  };
11
- export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, pluginOptions: PanelPluginOptions) => SafePlugin<any>;
12
+ export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, pluginOptions: PanelPluginOptions, api: ExtractInjectionAPI<PanelPlugin> | undefined) => SafePlugin<any>;
@@ -1,4 +1,8 @@
1
- import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
1
+ import { type INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
+ import type { Command, LongPressSelectionPluginOptions, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
+ import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
+ import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
+ import { type EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
2
6
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
7
  export declare const pluginKey: PluginKey<any>;
4
8
  export interface PanelPluginOptions extends LongPressSelectionPluginOptions, PanelPluginConfig {
@@ -20,3 +24,14 @@ export type EmojiInfo = {
20
24
  shortName: string;
21
25
  id: string;
22
26
  };
27
+ export type PanelPlugin = NextEditorPlugin<'panel', {
28
+ pluginConfiguration: PanelPluginOptions | undefined;
29
+ dependencies: [
30
+ typeof decorationsPlugin,
31
+ OptionalPlugin<typeof analyticsPlugin>,
32
+ EmojiPlugin
33
+ ];
34
+ actions: {
35
+ insertPanel: (inputMethod: INPUT_METHOD) => Command;
36
+ };
37
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-panel",
3
- "version": "2.3.7",
3
+ "version": "2.5.0",
4
4
  "description": "Panel plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,14 +32,15 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^40.9.0",
35
- "@atlaskit/editor-common": "^89.0.0",
35
+ "@atlaskit/editor-common": "^89.3.0",
36
36
  "@atlaskit/editor-palette": "1.6.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
38
38
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
39
+ "@atlaskit/editor-plugin-emoji": "^2.6.0",
39
40
  "@atlaskit/editor-prosemirror": "6.0.0",
40
41
  "@atlaskit/editor-shared-styles": "^2.13.0",
41
42
  "@atlaskit/emoji": "^67.7.0",
42
- "@atlaskit/icon": "^22.16.0",
43
+ "@atlaskit/icon": "^22.18.0",
43
44
  "@atlaskit/theme": "^13.0.0",
44
45
  "@babel/runtime": "^7.0.0"
45
46
  },
@@ -49,8 +50,6 @@
49
50
  "react-intl-next": "npm:react-intl@^5.18.1"
50
51
  },
51
52
  "devDependencies": {
52
- "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
53
- "@atlaskit/util-data-test": "^17.9.0",
54
53
  "react-dom": "^16.8.0",
55
54
  "typescript": "~5.4.2"
56
55
  },