@atlaskit/editor-core 185.2.23 → 185.2.25

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/editor-next/hooks/useProviderFactory.js +54 -5
  3. package/dist/cjs/labs/next/presets/universal.js +6 -5
  4. package/dist/cjs/plugins/extension/actions.js +6 -4
  5. package/dist/cjs/plugins/extension/commands.js +19 -16
  6. package/dist/cjs/plugins/extension/context-panel.js +4 -4
  7. package/dist/cjs/plugins/extension/extension-api.js +1 -1
  8. package/dist/cjs/plugins/extension/index.js +11 -4
  9. package/dist/cjs/plugins/extension/pm-plugins/keymap.js +2 -2
  10. package/dist/cjs/plugins/extension/pm-plugins/main.js +10 -5
  11. package/dist/cjs/plugins/extension/toolbar.js +8 -6
  12. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
  13. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -2
  14. package/dist/cjs/plugins/index.js +0 -7
  15. package/dist/cjs/ui/ContextPanel/index.js +9 -2
  16. package/dist/cjs/utils/action.js +1 -1
  17. package/dist/cjs/version-wrapper.js +1 -1
  18. package/dist/cjs/version.json +1 -1
  19. package/dist/es2019/editor-next/hooks/useProviderFactory.js +54 -5
  20. package/dist/es2019/labs/next/presets/universal.js +7 -6
  21. package/dist/es2019/plugins/extension/actions.js +6 -4
  22. package/dist/es2019/plugins/extension/commands.js +6 -7
  23. package/dist/es2019/plugins/extension/context-panel.js +4 -4
  24. package/dist/es2019/plugins/extension/extension-api.js +1 -1
  25. package/dist/es2019/plugins/extension/index.js +11 -4
  26. package/dist/es2019/plugins/extension/pm-plugins/keymap.js +2 -2
  27. package/dist/es2019/plugins/extension/pm-plugins/main.js +10 -5
  28. package/dist/es2019/plugins/extension/toolbar.js +8 -4
  29. package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
  30. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +5 -2
  31. package/dist/es2019/plugins/index.js +0 -1
  32. package/dist/es2019/ui/ContextPanel/index.js +8 -1
  33. package/dist/es2019/utils/action.js +1 -1
  34. package/dist/es2019/version-wrapper.js +1 -1
  35. package/dist/es2019/version.json +1 -1
  36. package/dist/esm/editor-next/hooks/useProviderFactory.js +54 -5
  37. package/dist/esm/labs/next/presets/universal.js +7 -6
  38. package/dist/esm/plugins/extension/actions.js +6 -4
  39. package/dist/esm/plugins/extension/commands.js +18 -15
  40. package/dist/esm/plugins/extension/context-panel.js +4 -4
  41. package/dist/esm/plugins/extension/extension-api.js +1 -1
  42. package/dist/esm/plugins/extension/index.js +11 -4
  43. package/dist/esm/plugins/extension/pm-plugins/keymap.js +2 -2
  44. package/dist/esm/plugins/extension/pm-plugins/main.js +10 -5
  45. package/dist/esm/plugins/extension/toolbar.js +8 -6
  46. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
  47. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +5 -2
  48. package/dist/esm/plugins/index.js +0 -1
  49. package/dist/esm/ui/ContextPanel/index.js +8 -1
  50. package/dist/esm/utils/action.js +1 -1
  51. package/dist/esm/version-wrapper.js +1 -1
  52. package/dist/esm/version.json +1 -1
  53. package/dist/types/editor-next/hooks/useProviderFactory.d.ts +0 -1
  54. package/dist/types/labs/next/presets/cxhtml.d.ts +18 -2
  55. package/dist/types/labs/next/presets/default.d.ts +36 -4
  56. package/dist/types/labs/next/presets/mobile.d.ts +18 -2
  57. package/dist/types/plugins/extension/actions.d.ts +2 -1
  58. package/dist/types/plugins/extension/commands.d.ts +4 -3
  59. package/dist/types/plugins/extension/context-panel.d.ts +2 -1
  60. package/dist/types/plugins/extension/extension-api.d.ts +2 -0
  61. package/dist/types/plugins/extension/index.d.ts +4 -2
  62. package/dist/types/plugins/extension/pm-plugins/keymap.d.ts +2 -1
  63. package/dist/types/plugins/extension/pm-plugins/main.d.ts +3 -1
  64. package/dist/types/plugins/extension/toolbar.d.ts +8 -1
  65. package/dist/types/plugins/extension/types.d.ts +2 -0
  66. package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
  67. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
  68. package/dist/types/plugins/index.d.ts +0 -1
  69. package/dist/types-ts4.5/editor-next/hooks/useProviderFactory.d.ts +0 -1
  70. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +20 -2
  71. package/dist/types-ts4.5/labs/next/presets/default.d.ts +40 -4
  72. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +20 -2
  73. package/dist/types-ts4.5/plugins/extension/actions.d.ts +2 -1
  74. package/dist/types-ts4.5/plugins/extension/commands.d.ts +4 -3
  75. package/dist/types-ts4.5/plugins/extension/context-panel.d.ts +2 -1
  76. package/dist/types-ts4.5/plugins/extension/extension-api.d.ts +2 -0
  77. package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
  78. package/dist/types-ts4.5/plugins/extension/pm-plugins/keymap.d.ts +2 -1
  79. package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +3 -1
  80. package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +8 -1
  81. package/dist/types-ts4.5/plugins/extension/types.d.ts +2 -0
  82. package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
  83. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
  84. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  85. package/package.json +4 -3
  86. package/dist/cjs/plugins/context-panel/index.js +0 -66
  87. package/dist/cjs/plugins/context-panel/transforms.js +0 -13
  88. package/dist/cjs/plugins/context-panel/types.js +0 -5
  89. package/dist/es2019/plugins/context-panel/index.js +0 -45
  90. package/dist/es2019/plugins/context-panel/transforms.js +0 -4
  91. package/dist/es2019/plugins/context-panel/types.js +0 -1
  92. package/dist/esm/plugins/context-panel/index.js +0 -57
  93. package/dist/esm/plugins/context-panel/transforms.js +0 -6
  94. package/dist/esm/plugins/context-panel/types.js +0 -1
  95. package/dist/types/plugins/context-panel/index.d.ts +0 -11
  96. package/dist/types/plugins/context-panel/transforms.d.ts +0 -2
  97. package/dist/types/plugins/context-panel/types.d.ts +0 -1
  98. package/dist/types-ts4.5/plugins/context-panel/index.d.ts +0 -11
  99. package/dist/types-ts4.5/plugins/context-panel/transforms.d.ts +0 -2
  100. package/dist/types-ts4.5/plugins/context-panel/types.d.ts +0 -1
@@ -1,9 +1,10 @@
1
1
  import { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
2
2
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
3
- import { NextEditorPlugin, EditorAppearance } from '../../types';
3
+ import { NextEditorPlugin, EditorAppearance, OptionalPlugin } from '@atlaskit/editor-common/types';
4
4
  import { LongPressSelectionPluginOptions } from '../selection/types';
5
5
  import type { widthPlugin } from '@atlaskit/editor-plugin-width';
6
6
  import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
7
+ import type { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
7
8
  interface ExtensionPluginOptions extends LongPressSelectionPluginOptions {
8
9
  allowAutoSave?: boolean;
9
10
  breakoutEnabled?: boolean;
@@ -15,7 +16,8 @@ declare const extensionPlugin: NextEditorPlugin<'extension', {
15
16
  dependencies: [
16
17
  typeof featureFlagsPlugin,
17
18
  typeof widthPlugin,
18
- typeof decorationsPlugin
19
+ typeof decorationsPlugin,
20
+ OptionalPlugin<typeof contextPanelPlugin>
19
21
  ];
20
22
  }>;
21
23
  export default extensionPlugin;
@@ -1,2 +1,3 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- export default function keymapPlugin(): SafePlugin;
2
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
3
+ export default function keymapPlugin(applyChange: ApplyChangeHandler | undefined): SafePlugin;
@@ -11,13 +11,15 @@ import { PortalProviderAPI } from '../../../ui/PortalProvider';
11
11
  import { getPluginState, createCommand } from '../plugin-factory';
12
12
  import { pluginKey } from '../plugin-key';
13
13
  import type extensionPlugin from '../index';
14
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
14
15
  export declare const createExtensionProviderHandler: (view: EditorView) => (name: string, provider?: Promise<ExtensionProvider>) => Promise<void>;
15
16
  export declare const createContextIdentifierProviderHandler: (view: EditorView) => (name: string, provider?: Promise<ContextIdentifierProvider>) => Promise<void>;
16
- export declare const handleUpdate: ({ view, prevState, domAtPos, extensionHandlers, }: {
17
+ export declare const handleUpdate: ({ view, prevState, domAtPos, extensionHandlers, applyChange, }: {
17
18
  view: EditorView;
18
19
  prevState: EditorState;
19
20
  domAtPos: EditorView['domAtPos'];
20
21
  extensionHandlers: ExtensionHandlers;
22
+ applyChange: ApplyChangeHandler | undefined;
21
23
  }) => true | undefined;
22
24
  declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginInjectionApi: ExtractInjectionAPI<typeof extensionPlugin> | undefined, useLongPressSelection?: boolean, options?: {
23
25
  appearance?: EditorAppearance;
@@ -1,5 +1,6 @@
1
1
  import { FloatingToolbarHandler } from '../floating-toolbar/types';
2
2
  import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
3
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
3
4
  export declare const messages: {
4
5
  edit: {
5
6
  id: string;
@@ -32,4 +33,10 @@ export declare const messages: {
32
33
  description: string;
33
34
  };
34
35
  };
35
- export declare const getToolbarConfig: (breakoutEnabled: boolean | undefined, hoverDecoration: HoverDecorationHandler | undefined) => FloatingToolbarHandler;
36
+ interface GetToolbarConfigProps {
37
+ breakoutEnabled: boolean | undefined;
38
+ hoverDecoration: HoverDecorationHandler | undefined;
39
+ applyChangeToContextPanel: ApplyChangeHandler | undefined;
40
+ }
41
+ export declare const getToolbarConfig: ({ breakoutEnabled, hoverDecoration, applyChangeToContextPanel, }: GetToolbarConfigProps) => FloatingToolbarHandler;
42
+ export {};
@@ -1,5 +1,6 @@
1
1
  import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
2
2
  import { UpdateExtension, ExtensionProvider, Parameters, TransformBefore, TransformAfter } from '@atlaskit/editor-common/extensions';
3
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
3
4
  export type ExtensionState<T extends Parameters = Parameters> = {
4
5
  localId?: string;
5
6
  autoSaveResolve?: () => void;
@@ -13,6 +14,7 @@ export type ExtensionState<T extends Parameters = Parameters> = {
13
14
  processParametersBefore?: TransformBefore<T>;
14
15
  processParametersAfter?: TransformAfter<T>;
15
16
  positions?: Record<number, number>;
17
+ applyChangeToContextPanel: ApplyChangeHandler | undefined;
16
18
  };
17
19
  export type ExtensionAction<T extends Parameters = Parameters> = {
18
20
  type: 'UPDATE_STATE';
@@ -2,11 +2,13 @@
2
2
  import { Node as PMNode } from 'prosemirror-model';
3
3
  import { EditorView } from 'prosemirror-view';
4
4
  import type { ExtensionProvider } from '@atlaskit/editor-common/extensions';
5
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
5
6
  interface Props {
6
7
  node: PMNode;
7
8
  extensionProvider: ExtensionProvider;
8
9
  editorView: EditorView;
9
10
  separator?: 'start' | 'end' | 'both';
11
+ applyChangeToContextPanel: ApplyChangeHandler | undefined;
10
12
  }
11
13
  export declare const ExtensionsPlaceholder: (props: Props) => JSX.Element | null;
12
14
  export {};
@@ -7,8 +7,9 @@ import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
7
7
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
8
8
  import { FloatingToolbarItem } from '../types';
9
9
  import { WrappedComponentProps } from 'react-intl-next';
10
- import { FeatureFlags, PluginInjectionAPIWithDependency } from '@atlaskit/editor-common/types';
11
- import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
10
+ import { FeatureFlags, PluginInjectionAPIWithDependencies, OptionalPlugin } from '@atlaskit/editor-common/types';
11
+ import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
12
+ import type { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
12
13
  export type Item = FloatingToolbarItem<Function>;
13
14
  export interface Props {
14
15
  items: Array<Item>;
@@ -26,7 +27,10 @@ export interface Props {
26
27
  extensionsProvider?: ExtensionProvider;
27
28
  scrollable?: boolean;
28
29
  featureFlags: FeatureFlags;
29
- api: PluginInjectionAPIWithDependency<typeof decorationsPlugin> | undefined;
30
+ api: PluginInjectionAPIWithDependencies<[
31
+ typeof decorationsPlugin,
32
+ OptionalPlugin<typeof contextPanelPlugin>
33
+ ]> | undefined;
30
34
  }
31
35
  export declare const isSameItem: (leftItem: Item, rightItem: Item) => boolean;
32
36
  export declare const areSameItems: (leftArr?: Array<Item>, rightArr?: Array<Item>) => boolean;
@@ -53,7 +53,6 @@ export { default as expandPlugin, isExpandInsertionEnabled } from './expand';
53
53
  export { default as scrollIntoViewPlugin } from './scroll-into-view';
54
54
  export { default as mobileDimensionsPlugin } from './mobile-dimensions';
55
55
  export { default as findReplacePlugin } from './find-replace';
56
- export { default as contextPanelPlugin } from './context-panel';
57
56
  export { default as selectionPlugin } from './selection';
58
57
  export { default as mobileSelectionPlugin } from './mobile-selection';
59
58
  export { default as clipboardPlugin } from './clipboard';
@@ -11,7 +11,6 @@ export type ProviderFactoryState = {
11
11
  /**
12
12
  *
13
13
  * This hook is used to create the provider factory object.
14
- * WARNING: Consider any changes to also make to `src/editor.tsx`
15
14
  *
16
15
  * @param props
17
16
  * @param editorActions
@@ -150,7 +150,16 @@ export declare function useCXHTMLPreset({ mentionProvider, mediaProvider, placeh
150
150
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
151
151
  removeDecoration: import("@atlaskit/editor-common/types").Command;
152
152
  };
153
- }>
153
+ }>,
154
+ import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
155
+ actions: {
156
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
157
+ };
158
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
159
+ actions: {
160
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
161
+ };
162
+ }>>
154
163
  ];
155
164
  actions: {
156
165
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
@@ -176,7 +185,16 @@ export declare function useCXHTMLPreset({ mentionProvider, mediaProvider, placeh
176
185
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
177
186
  removeDecoration: import("@atlaskit/editor-common/types").Command;
178
187
  };
179
- }>
188
+ }>,
189
+ import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
190
+ actions: {
191
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
192
+ };
193
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
194
+ actions: {
195
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
196
+ };
197
+ }>>
180
198
  ];
181
199
  actions: {
182
200
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
@@ -179,7 +179,16 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
179
179
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
180
180
  removeDecoration: import("@atlaskit/editor-common/types").Command;
181
181
  };
182
- }>
182
+ }>,
183
+ import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
184
+ actions: {
185
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
186
+ };
187
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
188
+ actions: {
189
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
190
+ };
191
+ }>>
183
192
  ];
184
193
  actions: {
185
194
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
@@ -205,7 +214,16 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
205
214
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
206
215
  removeDecoration: import("@atlaskit/editor-common/types").Command;
207
216
  };
208
- }>
217
+ }>,
218
+ import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
219
+ actions: {
220
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
221
+ };
222
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
223
+ actions: {
224
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
225
+ };
226
+ }>>
209
227
  ];
210
228
  actions: {
211
229
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
@@ -476,7 +494,16 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
476
494
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
477
495
  removeDecoration: import("@atlaskit/editor-common/types").Command;
478
496
  };
479
- }>
497
+ }>,
498
+ import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
499
+ actions: {
500
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
501
+ };
502
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
503
+ actions: {
504
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
505
+ };
506
+ }>>
480
507
  ];
481
508
  actions: {
482
509
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
@@ -502,7 +529,16 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
502
529
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
503
530
  removeDecoration: import("@atlaskit/editor-common/types").Command;
504
531
  };
505
- }>
532
+ }>,
533
+ import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
534
+ actions: {
535
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
536
+ };
537
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
538
+ actions: {
539
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
540
+ };
541
+ }>>
506
542
  ];
507
543
  actions: {
508
544
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
@@ -153,7 +153,16 @@ export declare function useMobilePreset({ media, placeholder, maxContentSize, cr
153
153
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
154
154
  removeDecoration: import("@atlaskit/editor-common/types").Command;
155
155
  };
156
- }>
156
+ }>,
157
+ import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
158
+ actions: {
159
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
160
+ };
161
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
162
+ actions: {
163
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
164
+ };
165
+ }>>
157
166
  ];
158
167
  actions: {
159
168
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
@@ -179,7 +188,16 @@ export declare function useMobilePreset({ media, placeholder, maxContentSize, cr
179
188
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
180
189
  removeDecoration: import("@atlaskit/editor-common/types").Command;
181
190
  };
182
- }>
191
+ }>,
192
+ import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
193
+ actions: {
194
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
195
+ };
196
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
197
+ actions: {
198
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
199
+ };
200
+ }>>
183
201
  ];
184
202
  actions: {
185
203
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
@@ -6,6 +6,7 @@ import { MacroProvider } from '@atlaskit/editor-common/provider-factory';
6
6
  export { transformSliceToRemoveOpenBodiedExtension } from '@atlaskit/editor-common/transforms';
7
7
  import { Command, CommandDispatch } from '../../types';
8
8
  import EditorActions from '../../actions';
9
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
9
10
  export declare const buildExtensionNode: <S extends Schema<any, any>>(type: 'inlineExtension' | 'extension' | 'bodiedExtension', schema: S, attrs: object, content?: Fragment, marks?: Mark<S>[] | undefined) => PmNode<Schema<any, any>>;
10
11
  export declare const performNodeUpdate: (type: 'inlineExtension' | 'extension' | 'bodiedExtension', newAttrs: object, content: Fragment<any>, marks: Mark[], shouldScrollIntoView: boolean) => Command;
11
12
  export declare const updateExtensionParams: (updateExtension: UpdateExtension<object>, node: {
@@ -13,4 +14,4 @@ export declare const updateExtensionParams: (updateExtension: UpdateExtension<ob
13
14
  pos: number;
14
15
  }, actions: ExtensionAPI) => (state: EditorState, dispatch?: CommandDispatch, view?: EditorView) => Promise<boolean>;
15
16
  export declare const editSelectedExtension: (editorActions: EditorActions) => boolean;
16
- export declare const editExtension: (macroProvider: MacroProvider | null, updateExtension?: Promise<UpdateExtension<object> | void>) => Command;
17
+ export declare const editExtension: (macroProvider: MacroProvider | null, applyChangeToContextPanel: ApplyChangeHandler | undefined, updateExtension?: Promise<UpdateExtension<object> | void>) => Command;
@@ -2,10 +2,11 @@ import { ExtensionLayout } from '@atlaskit/adf-schema';
2
2
  import { Node as PMNode } from 'prosemirror-model';
3
3
  import { ExtensionState } from './types';
4
4
  import { Parameters, TransformBefore, TransformAfter } from '@atlaskit/editor-common/src/extensions';
5
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
5
6
  export declare function updateState(state: Partial<ExtensionState>): import("@atlaskit/editor-common/types").Command;
6
- export declare function setEditingContextToContextPanel<T extends Parameters = Parameters>(processParametersBefore: TransformBefore<T>, processParametersAfter: TransformAfter<T>): import("@atlaskit/editor-common/types").Command;
7
- export declare const clearEditingContext: import("@atlaskit/editor-common/types").Command;
8
- export declare const forceAutoSave: (resolve: () => void, reject?: ((reason?: any) => void) | undefined) => import("@atlaskit/editor-common/types").Command;
7
+ export declare function setEditingContextToContextPanel<T extends Parameters = Parameters>(processParametersBefore: TransformBefore<T>, processParametersAfter: TransformAfter<T>, applyChangeToContextPanel: ApplyChangeHandler | undefined): import("@atlaskit/editor-common/types").Command;
8
+ export declare const clearEditingContext: (applyChangeToContextPanel: ApplyChangeHandler | undefined) => import("@atlaskit/editor-common/types").Command;
9
+ export declare const forceAutoSave: (applyChangeToContextPanel: ApplyChangeHandler | undefined) => (resolve: () => void, reject?: ((reason?: any) => void) | undefined) => import("@atlaskit/editor-common/types").Command;
9
10
  export declare const updateExtensionLayout: (layout: ExtensionLayout) => import("@atlaskit/editor-common/types").Command;
10
11
  export declare const removeExtension: () => import("@atlaskit/editor-common/types").Command;
11
12
  export declare const removeDescendantNodes: (sourceNode?: PMNode) => import("@atlaskit/editor-common/types").Command;
@@ -3,5 +3,6 @@ import { EditorState } from 'prosemirror-state';
3
3
  import { FeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import type { EditorView } from 'prosemirror-view';
5
5
  import type { ContentNodeWithPos } from 'prosemirror-utils';
6
- export declare const getContextPanel: (allowAutoSave?: boolean, featureFlags?: FeatureFlags) => (state: EditorState) => JSX.Element | undefined;
6
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
7
+ export declare const getContextPanel: (allowAutoSave?: boolean, featureFlags?: FeatureFlags, applyChange?: ApplyChangeHandler) => (state: EditorState) => JSX.Element | undefined;
7
8
  export declare function onChangeAction(editorView: EditorView, updatedParameters: object | undefined, oldParameters: object | undefined, nodeWithPos: ContentNodeWithPos, onSaving?: () => void): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  import { ExtensionAPI } from '@atlaskit/editor-common/extensions';
2
2
  import type { EditorView } from 'prosemirror-view';
3
3
  import { MacroProvider } from '../macro';
4
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
4
5
  interface EditInLegacyMacroBrowserArgs {
5
6
  view: EditorView;
6
7
  macroProvider?: MacroProvider;
@@ -8,6 +9,7 @@ interface EditInLegacyMacroBrowserArgs {
8
9
  export declare const getEditInLegacyMacroBrowser: ({ view, macroProvider, }: EditInLegacyMacroBrowserArgs) => () => void;
9
10
  interface CreateExtensionAPIOptions {
10
11
  editorView: EditorView;
12
+ applyChange: ApplyChangeHandler | undefined;
11
13
  editInLegacyMacroBrowser?: () => void;
12
14
  }
13
15
  export declare const createExtensionAPI: (options: CreateExtensionAPIOptions) => ExtensionAPI;
@@ -1,9 +1,10 @@
1
1
  import { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
2
2
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
3
- import { NextEditorPlugin, EditorAppearance } from '../../types';
3
+ import { NextEditorPlugin, EditorAppearance, OptionalPlugin } from '@atlaskit/editor-common/types';
4
4
  import { LongPressSelectionPluginOptions } from '../selection/types';
5
5
  import type { widthPlugin } from '@atlaskit/editor-plugin-width';
6
6
  import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
7
+ import type { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
7
8
  interface ExtensionPluginOptions extends LongPressSelectionPluginOptions {
8
9
  allowAutoSave?: boolean;
9
10
  breakoutEnabled?: boolean;
@@ -15,7 +16,8 @@ declare const extensionPlugin: NextEditorPlugin<'extension', {
15
16
  dependencies: [
16
17
  typeof featureFlagsPlugin,
17
18
  typeof widthPlugin,
18
- typeof decorationsPlugin
19
+ typeof decorationsPlugin,
20
+ OptionalPlugin<typeof contextPanelPlugin>
19
21
  ];
20
22
  }>;
21
23
  export default extensionPlugin;
@@ -1,2 +1,3 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- export default function keymapPlugin(): SafePlugin;
2
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
3
+ export default function keymapPlugin(applyChange: ApplyChangeHandler | undefined): SafePlugin;
@@ -11,13 +11,15 @@ import { PortalProviderAPI } from '../../../ui/PortalProvider';
11
11
  import { getPluginState, createCommand } from '../plugin-factory';
12
12
  import { pluginKey } from '../plugin-key';
13
13
  import type extensionPlugin from '../index';
14
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
14
15
  export declare const createExtensionProviderHandler: (view: EditorView) => (name: string, provider?: Promise<ExtensionProvider>) => Promise<void>;
15
16
  export declare const createContextIdentifierProviderHandler: (view: EditorView) => (name: string, provider?: Promise<ContextIdentifierProvider>) => Promise<void>;
16
- export declare const handleUpdate: ({ view, prevState, domAtPos, extensionHandlers, }: {
17
+ export declare const handleUpdate: ({ view, prevState, domAtPos, extensionHandlers, applyChange, }: {
17
18
  view: EditorView;
18
19
  prevState: EditorState;
19
20
  domAtPos: EditorView['domAtPos'];
20
21
  extensionHandlers: ExtensionHandlers;
22
+ applyChange: ApplyChangeHandler | undefined;
21
23
  }) => true | undefined;
22
24
  declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginInjectionApi: ExtractInjectionAPI<typeof extensionPlugin> | undefined, useLongPressSelection?: boolean, options?: {
23
25
  appearance?: EditorAppearance;
@@ -1,5 +1,6 @@
1
1
  import { FloatingToolbarHandler } from '../floating-toolbar/types';
2
2
  import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
3
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
3
4
  export declare const messages: {
4
5
  edit: {
5
6
  id: string;
@@ -32,4 +33,10 @@ export declare const messages: {
32
33
  description: string;
33
34
  };
34
35
  };
35
- export declare const getToolbarConfig: (breakoutEnabled: boolean | undefined, hoverDecoration: HoverDecorationHandler | undefined) => FloatingToolbarHandler;
36
+ interface GetToolbarConfigProps {
37
+ breakoutEnabled: boolean | undefined;
38
+ hoverDecoration: HoverDecorationHandler | undefined;
39
+ applyChangeToContextPanel: ApplyChangeHandler | undefined;
40
+ }
41
+ export declare const getToolbarConfig: ({ breakoutEnabled, hoverDecoration, applyChangeToContextPanel, }: GetToolbarConfigProps) => FloatingToolbarHandler;
42
+ export {};
@@ -1,5 +1,6 @@
1
1
  import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
2
2
  import { UpdateExtension, ExtensionProvider, Parameters, TransformBefore, TransformAfter } from '@atlaskit/editor-common/extensions';
3
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
3
4
  export type ExtensionState<T extends Parameters = Parameters> = {
4
5
  localId?: string;
5
6
  autoSaveResolve?: () => void;
@@ -13,6 +14,7 @@ export type ExtensionState<T extends Parameters = Parameters> = {
13
14
  processParametersBefore?: TransformBefore<T>;
14
15
  processParametersAfter?: TransformAfter<T>;
15
16
  positions?: Record<number, number>;
17
+ applyChangeToContextPanel: ApplyChangeHandler | undefined;
16
18
  };
17
19
  export type ExtensionAction<T extends Parameters = Parameters> = {
18
20
  type: 'UPDATE_STATE';
@@ -2,11 +2,13 @@
2
2
  import { Node as PMNode } from 'prosemirror-model';
3
3
  import { EditorView } from 'prosemirror-view';
4
4
  import type { ExtensionProvider } from '@atlaskit/editor-common/extensions';
5
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
5
6
  interface Props {
6
7
  node: PMNode;
7
8
  extensionProvider: ExtensionProvider;
8
9
  editorView: EditorView;
9
10
  separator?: 'start' | 'end' | 'both';
11
+ applyChangeToContextPanel: ApplyChangeHandler | undefined;
10
12
  }
11
13
  export declare const ExtensionsPlaceholder: (props: Props) => JSX.Element | null;
12
14
  export {};
@@ -7,8 +7,9 @@ import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
7
7
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
8
8
  import { FloatingToolbarItem } from '../types';
9
9
  import { WrappedComponentProps } from 'react-intl-next';
10
- import { FeatureFlags, PluginInjectionAPIWithDependency } from '@atlaskit/editor-common/types';
11
- import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
10
+ import { FeatureFlags, PluginInjectionAPIWithDependencies, OptionalPlugin } from '@atlaskit/editor-common/types';
11
+ import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
12
+ import type { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
12
13
  export type Item = FloatingToolbarItem<Function>;
13
14
  export interface Props {
14
15
  items: Array<Item>;
@@ -26,7 +27,10 @@ export interface Props {
26
27
  extensionsProvider?: ExtensionProvider;
27
28
  scrollable?: boolean;
28
29
  featureFlags: FeatureFlags;
29
- api: PluginInjectionAPIWithDependency<typeof decorationsPlugin> | undefined;
30
+ api: PluginInjectionAPIWithDependencies<[
31
+ typeof decorationsPlugin,
32
+ OptionalPlugin<typeof contextPanelPlugin>
33
+ ]> | undefined;
30
34
  }
31
35
  export declare const isSameItem: (leftItem: Item, rightItem: Item) => boolean;
32
36
  export declare const areSameItems: (leftArr?: Array<Item>, rightArr?: Array<Item>) => boolean;
@@ -53,7 +53,6 @@ export { default as expandPlugin, isExpandInsertionEnabled } from './expand';
53
53
  export { default as scrollIntoViewPlugin } from './scroll-into-view';
54
54
  export { default as mobileDimensionsPlugin } from './mobile-dimensions';
55
55
  export { default as findReplacePlugin } from './find-replace';
56
- export { default as contextPanelPlugin } from './context-panel';
57
56
  export { default as selectionPlugin } from './selection';
58
57
  export { default as mobileSelectionPlugin } from './mobile-selection';
59
58
  export { default as clipboardPlugin } from './clipboard';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "185.2.23",
3
+ "version": "185.2.25",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/analytics-next-stable-react-context": "1.0.1",
44
44
  "@atlaskit/avatar": "^21.3.0",
45
45
  "@atlaskit/avatar-group": "^9.3.0",
46
- "@atlaskit/button": "^16.7.0",
46
+ "@atlaskit/button": "^16.8.0",
47
47
  "@atlaskit/calendar": "^13.1.0",
48
48
  "@atlaskit/checkbox": "^12.6.0",
49
49
  "@atlaskit/code": "^14.6.0",
@@ -55,6 +55,7 @@
55
55
  "@atlaskit/editor-palette": "1.5.0",
56
56
  "@atlaskit/editor-plugin-analytics": "^0.0.2",
57
57
  "@atlaskit/editor-plugin-content-insertion": "^0.0.2",
58
+ "@atlaskit/editor-plugin-context-panel": "^0.1.0",
58
59
  "@atlaskit/editor-plugin-decorations": "^0.1.0",
59
60
  "@atlaskit/editor-plugin-feature-flags": "^0.1.0",
60
61
  "@atlaskit/editor-plugin-floating-toolbar": "^0.2.0",
@@ -157,7 +158,7 @@
157
158
  "@atlaskit/editor-card-provider": "^3.0.0",
158
159
  "@atlaskit/editor-extension-dropbox": "^0.4.0",
159
160
  "@atlaskit/editor-plugin-table": "^1.6.0",
160
- "@atlaskit/editor-test-helpers": "^18.6.0",
161
+ "@atlaskit/editor-test-helpers": "^18.7.0",
161
162
  "@atlaskit/flag": "^15.2.0",
162
163
  "@atlaskit/inline-dialog": "^13.6.0",
163
164
  "@atlaskit/link-provider": "^1.6.0",
@@ -1,66 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.pluginKey = exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
- var _prosemirrorState = require("prosemirror-state");
11
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
- var pluginKey = new _prosemirrorState.PluginKey('contextPanelPluginKey');
14
- exports.pluginKey = pluginKey;
15
- function contextPanelPluginFactory(contextPanels, dispatch) {
16
- return new _safePlugin.SafePlugin({
17
- key: pluginKey,
18
- state: {
19
- init: function init(_config, state) {
20
- return {
21
- handlers: contextPanels,
22
- contents: contextPanels.map(function (panelContent) {
23
- return panelContent(state);
24
- })
25
- };
26
- },
27
- apply: function apply(tr, pluginState, _oldState, newState) {
28
- var newPluginState = pluginState;
29
- var meta = tr.getMeta(pluginKey);
30
- if (tr.docChanged || tr.selectionSet || meta && meta.changed) {
31
- var newContents = pluginState.handlers.map(function (panelContent) {
32
- return panelContent(newState);
33
- });
34
- if (newContents.length !== newPluginState.contents.length || newContents.some(function (node) {
35
- return newPluginState.contents.indexOf(node) < 0;
36
- })) {
37
- newPluginState = _objectSpread(_objectSpread({}, newPluginState), {}, {
38
- contents: newContents
39
- });
40
- }
41
- }
42
- if (newPluginState !== pluginState) {
43
- dispatch(pluginKey, newPluginState);
44
- }
45
- return newPluginState;
46
- }
47
- }
48
- });
49
- }
50
- var contextPanelPlugin = function contextPanelPlugin() {
51
- return {
52
- name: 'contextPanel',
53
- pmPlugins: function pmPlugins() {
54
- var contextPanels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
55
- return [{
56
- name: 'contextPanel',
57
- plugin: function plugin(_ref) {
58
- var dispatch = _ref.dispatch;
59
- return contextPanelPluginFactory(contextPanels.filter(Boolean), dispatch);
60
- }
61
- }];
62
- }
63
- };
64
- };
65
- var _default = contextPanelPlugin;
66
- exports.default = _default;
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.applyChange = void 0;
7
- var _ = require("./");
8
- var applyChange = function applyChange(tr) {
9
- return tr.setMeta(_.pluginKey, {
10
- changed: true
11
- });
12
- };
13
- exports.applyChange = applyChange;
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });