@atlaskit/editor-common 78.27.1 → 78.28.1

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 (66) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/cjs/analytics/types/enums.js +1 -0
  3. package/dist/cjs/clipboard/index.js +29 -1
  4. package/dist/cjs/extensions/module-helpers.js +1 -0
  5. package/dist/cjs/media/messages/comments.js +1 -1
  6. package/dist/cjs/media-single/CommentBadge.js +23 -3
  7. package/dist/cjs/messages/insert-block.js +4 -4
  8. package/dist/cjs/monitoring/error.js +1 -1
  9. package/dist/cjs/preset/{core-plugin.js → core-plugin/index.js} +15 -1
  10. package/dist/cjs/preset/core-plugin/requestDocument.js +62 -0
  11. package/dist/cjs/preset/core-plugin/types.js +5 -0
  12. package/dist/cjs/ui/DropList/index.js +1 -1
  13. package/dist/cjs/ui/MultiBodiedExtension/index.js +0 -3
  14. package/dist/es2019/analytics/types/enums.js +1 -0
  15. package/dist/es2019/clipboard/index.js +29 -1
  16. package/dist/es2019/extensions/module-helpers.js +1 -0
  17. package/dist/es2019/media/messages/comments.js +1 -1
  18. package/dist/es2019/media-single/CommentBadge.js +23 -4
  19. package/dist/es2019/messages/insert-block.js +4 -4
  20. package/dist/es2019/monitoring/error.js +1 -1
  21. package/dist/es2019/preset/{core-plugin.js → core-plugin/index.js} +15 -1
  22. package/dist/es2019/preset/core-plugin/requestDocument.js +51 -0
  23. package/dist/es2019/preset/core-plugin/types.js +1 -0
  24. package/dist/es2019/ui/DropList/index.js +1 -1
  25. package/dist/es2019/ui/MultiBodiedExtension/index.js +0 -3
  26. package/dist/esm/analytics/types/enums.js +1 -0
  27. package/dist/esm/clipboard/index.js +29 -1
  28. package/dist/esm/extensions/module-helpers.js +1 -0
  29. package/dist/esm/media/messages/comments.js +1 -1
  30. package/dist/esm/media-single/CommentBadge.js +24 -4
  31. package/dist/esm/messages/insert-block.js +4 -4
  32. package/dist/esm/monitoring/error.js +1 -1
  33. package/dist/esm/preset/{core-plugin.js → core-plugin/index.js} +15 -1
  34. package/dist/esm/preset/core-plugin/requestDocument.js +54 -0
  35. package/dist/esm/preset/core-plugin/types.js +1 -0
  36. package/dist/esm/ui/DropList/index.js +1 -1
  37. package/dist/esm/ui/MultiBodiedExtension/index.js +0 -3
  38. package/dist/types/analytics/types/cut-copy-events.d.ts +7 -2
  39. package/dist/types/analytics/types/enums.d.ts +2 -1
  40. package/dist/types/analytics/types/extension-events.d.ts +6 -1
  41. package/dist/types/analytics/types/insert-events.d.ts +1 -0
  42. package/dist/types/card/cardOptions.d.ts +6 -0
  43. package/dist/types/card/index.d.ts +1 -1
  44. package/dist/types/extensions/types/utils.d.ts +2 -1
  45. package/dist/types/media-single/CommentBadge.d.ts +4 -1
  46. package/dist/types/preset/core-plugin/index.d.ts +6 -0
  47. package/dist/types/preset/core-plugin/requestDocument.d.ts +7 -0
  48. package/dist/types/preset/core-plugin/types.d.ts +59 -0
  49. package/dist/types/preset/plugin-injection-api.d.ts +1 -1
  50. package/dist/types/types/next-editor-plugin.d.ts +2 -2
  51. package/dist/types-ts4.5/analytics/types/cut-copy-events.d.ts +7 -2
  52. package/dist/types-ts4.5/analytics/types/enums.d.ts +2 -1
  53. package/dist/types-ts4.5/analytics/types/extension-events.d.ts +6 -1
  54. package/dist/types-ts4.5/analytics/types/insert-events.d.ts +1 -0
  55. package/dist/types-ts4.5/card/cardOptions.d.ts +6 -0
  56. package/dist/types-ts4.5/card/index.d.ts +1 -1
  57. package/dist/types-ts4.5/extensions/types/utils.d.ts +2 -1
  58. package/dist/types-ts4.5/media-single/CommentBadge.d.ts +4 -1
  59. package/dist/types-ts4.5/preset/core-plugin/index.d.ts +6 -0
  60. package/dist/types-ts4.5/preset/core-plugin/requestDocument.d.ts +7 -0
  61. package/dist/types-ts4.5/preset/core-plugin/types.d.ts +59 -0
  62. package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +2 -2
  63. package/dist/types-ts4.5/types/next-editor-plugin.d.ts +2 -2
  64. package/package.json +4 -4
  65. package/dist/types/preset/core-plugin.d.ts +0 -39
  66. package/dist/types-ts4.5/preset/core-plugin.d.ts +0 -39
@@ -1,8 +1,9 @@
1
1
  import type { ADFEntity } from '@atlaskit/adf-utils/types';
2
- import { ExtensionModuleActionHandler, ExtensionType, Icon } from './extension-manifest';
2
+ import type { ExtensionKey, ExtensionModuleActionHandler, ExtensionType, Icon } from './extension-manifest';
3
3
  export type MenuItem = {
4
4
  key: string;
5
5
  extensionType: ExtensionType;
6
+ extensionKey: ExtensionKey;
6
7
  title: string;
7
8
  description?: string;
8
9
  summary?: string;
@@ -5,8 +5,11 @@ export type CommentBadgeProps = {
5
5
  intl: IntlShape;
6
6
  width?: number;
7
7
  height?: number;
8
+ status?: 'default' | 'entered' | 'active';
8
9
  mediaElement?: HTMLElement | null;
9
10
  onClick: (e: React.MouseEvent) => void;
11
+ onMouseEnter?: (e: React.MouseEvent) => void;
12
+ onMouseLeave?: (e: React.MouseEvent) => void;
10
13
  isEditor?: boolean;
11
14
  };
12
- export declare const CommentBadge: ({ intl, width, height, mediaElement, onClick, isEditor, }: CommentBadgeProps) => jsx.JSX.Element;
15
+ export declare const CommentBadge: ({ intl, width, height, status, mediaElement, onClick, onMouseEnter, onMouseLeave, isEditor, }: CommentBadgeProps) => jsx.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { CorePlugin } from './types';
2
+ /**
3
+ * Core plugin that is always included in the preset.
4
+ * Allows for executing `EditorCommand` and other core functionality.
5
+ */
6
+ export declare const corePlugin: CorePlugin;
@@ -0,0 +1,7 @@
1
+ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
2
+ import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ import type { Transformer } from '../../types';
5
+ import type { InferTransformerResultCallback } from './types';
6
+ export declare function toJSON(node: PMNode): JSONDocNode;
7
+ export declare const scheduleDocumentRequest: <GenericTransformer extends Transformer<any> | undefined>(editorView: EditorView | null, callback: InferTransformerResultCallback<Transformer<any>>, transformer?: Transformer<any> | undefined) => void;
@@ -0,0 +1,59 @@
1
+ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
2
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ import type { EditorCommand, NextEditorPlugin, Transformer } from '../../types';
5
+ export type CorePlugin = NextEditorPlugin<'core', {
6
+ pluginConfiguration: {
7
+ getEditorView: () => EditorView | undefined;
8
+ };
9
+ actions: {
10
+ /**
11
+ * Dispatches an EditorCommand to ProseMirror
12
+ *
13
+ * @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
14
+ * is successful or `null` if it shouldn't be dispatched.
15
+ * @returns (boolean) if the command was successful in dispatching
16
+ */
17
+ execute: (command: EditorCommand | undefined) => boolean;
18
+ /**
19
+ * Focuses the editor.
20
+ *
21
+ * Calls the focus method of the `EditorView` and scrolls the
22
+ * current selection into view.
23
+ *
24
+ * @returns (boolean) if the focus was successful
25
+ */
26
+ focus: () => boolean;
27
+ /**
28
+ * Blurs the editor.
29
+ *
30
+ * Calls blur on the editor DOM element.
31
+ *
32
+ * @returns (boolean) if the blur was successful
33
+ */
34
+ blur: () => boolean;
35
+ /**
36
+ * Request the editor document.
37
+ * The document will return when available. If called multiple times it will throttle and return the
38
+ * latest document when ready.
39
+ *
40
+ * A transformer can be created using `createTransformer`.
41
+ *
42
+ * @param onReceive Callback to handle the document. Document type based on the transformer.
43
+ * @param options Pass a transformer for the document to be transformed into a different format.
44
+ */
45
+ requestDocument<GenericTransformer extends Transformer<any> = Transformer<JSONDocNode>>(onReceive: (document: TransformerResult<GenericTransformer> | undefined) => void, options?: {
46
+ transformer?: GenericTransformer;
47
+ }): void;
48
+ /**
49
+ * Create a transformer
50
+ *
51
+ * @param schema Schema of the document
52
+ * @returns Transformer which can be used to request a document
53
+ */
54
+ createTransformer<Format>(cb: (schema: Schema) => Transformer<Format>): Transformer<Format> | undefined;
55
+ };
56
+ }>;
57
+ export type TransformerResult<GenericTransformer = Transformer<JSONDocNode>> = GenericTransformer extends Transformer<infer Content> ? Content : JSONDocNode;
58
+ export type InferTransformerResultCallback<T extends Transformer<any> | undefined> = (doc: T extends Transformer<infer U> ? TransformerResult<U> : TransformerResult<JSONDocNode>) => void;
59
+ export type DefaultTransformerResultCallback = (doc: TransformerResult<JSONDocNode> | undefined) => void;
@@ -40,8 +40,8 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
40
40
  private plugins;
41
41
  constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
42
42
  api<T extends NextEditorPlugin<any, any>>(): import("../types/next-editor-plugin").PublicPluginAPI<[
43
- NextEditorPlugin<T extends import("./core-plugin").CorePlugin<infer Name extends string, any, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>,
44
- ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"] extends (import("./core-plugin").CorePlugin<any, any, any> | import("../types/next-editor-plugin").OptionalPlugin<import("./core-plugin").CorePlugin<any, any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"], undefined> : [
43
+ NextEditorPlugin<T extends import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<infer Name extends string, any, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>,
44
+ ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"] extends (import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any> | import("../types/next-editor-plugin").OptionalPlugin<import("../types/next-editor-plugin").NextEditorPluginFunctionOptionalConfigDefinition<any, any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"], undefined> : [
45
45
  ] : [
46
46
  ]
47
47
  ]>;
@@ -5,7 +5,7 @@
5
5
  * are put together - but for now `Builder` & `Preset` aim to beinterchangeable.
6
6
  */
7
7
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
8
- import type { CorePlugin } from '../preset/core-plugin';
8
+ import type { CorePlugin } from '../preset/core-plugin/types';
9
9
  import type { EditorCommand, EditorCommandWithMetadata } from './editor-command';
10
10
  import type { EditorPlugin } from './editor-plugin';
11
11
  type IsAny<T> = 0 extends 1 & T ? true : false;
@@ -103,7 +103,7 @@ export type PluginDependenciesAPI<Plugin extends NextEditorPlugin<any, any>> = {
103
103
  commands: Plugin extends NextEditorPlugin<any, infer Metadata> ? ExtractCommandsFromMetadata<Metadata> : never;
104
104
  };
105
105
  export type CreatePluginDependenciesAPI<PluginList extends NextEditorPlugin<any, any>[]> = {
106
- [Plugin in PluginList[number] as `${ExtractPluginName<Plugin>}`]: Plugin extends OptionalPlugin<NextEditorPlugin<any, any>> ? PluginDependenciesAPI<Plugin> | undefined : Plugin extends NextEditorPlugin<any, any> ? PluginDependenciesAPI<Plugin> | undefined : never;
106
+ [Plugin in PluginList[number] as `${ExtractPluginName<Plugin>}`]: Plugin extends OptionalPlugin<NextEditorPlugin<any, any>> ? PluginDependenciesAPI<Plugin> | undefined : Plugin extends NextEditorPlugin<'core', any> ? PluginDependenciesAPI<Plugin> : Plugin extends NextEditorPlugin<any, any> ? PluginDependenciesAPI<Plugin> | undefined : never;
107
107
  };
108
108
  export type PluginWithConfiguration<Plugin> = undefined extends ExtractPluginConfiguration<Plugin> ? [
109
109
  Plugin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "78.27.1",
3
+ "version": "78.28.1",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -94,7 +94,7 @@
94
94
  },
95
95
  "dependencies": {
96
96
  "@atlaskit/activity-provider": "^2.4.0",
97
- "@atlaskit/adf-schema": "^35.8.0",
97
+ "@atlaskit/adf-schema": "^35.9.0",
98
98
  "@atlaskit/adf-utils": "^19.0.0",
99
99
  "@atlaskit/analytics-listeners": "^8.9.0",
100
100
  "@atlaskit/analytics-namespaced-context": "^6.9.0",
@@ -103,7 +103,7 @@
103
103
  "@atlaskit/button": "^17.12.0",
104
104
  "@atlaskit/code": "^15.1.0",
105
105
  "@atlaskit/codemod-utils": "^4.2.0",
106
- "@atlaskit/custom-steps": "^0.0.17",
106
+ "@atlaskit/custom-steps": "^0.0.18",
107
107
  "@atlaskit/editor-json-transformer": "^8.10.0",
108
108
  "@atlaskit/editor-palette": "1.5.3",
109
109
  "@atlaskit/editor-prosemirror": "3.0.0",
@@ -129,7 +129,7 @@
129
129
  "@atlaskit/primitives": "^5.5.0",
130
130
  "@atlaskit/profilecard": "^19.11.0",
131
131
  "@atlaskit/section-message": "^6.4.0",
132
- "@atlaskit/smart-card": "^26.55.0",
132
+ "@atlaskit/smart-card": "^26.56.0",
133
133
  "@atlaskit/smart-user-picker": "^6.9.0",
134
134
  "@atlaskit/spinner": "^16.0.0",
135
135
  "@atlaskit/task-decision": "^17.9.0",
@@ -1,39 +0,0 @@
1
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- import type { EditorCommand, NextEditorPlugin } from '../types';
3
- export type CorePlugin = NextEditorPlugin<'core', {
4
- pluginConfiguration: {
5
- getEditorView: () => EditorView | undefined;
6
- };
7
- actions: {
8
- /**
9
- * Dispatches an EditorCommand to ProseMirror
10
- *
11
- * @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
12
- * is successful or `null` if it shouldn't be dispatched.
13
- * @returns (boolean) if the command was successful in dispatching
14
- */
15
- execute: (command: EditorCommand | undefined) => boolean;
16
- /**
17
- * Focuses the editor.
18
- *
19
- * Calls the focus method of the `EditorView` and scrolls the
20
- * current selection into view.
21
- *
22
- * @returns (boolean) if the focus was successful
23
- */
24
- focus: () => boolean;
25
- /**
26
- * Blurs the editor.
27
- *
28
- * Calls blur on the editor DOM element.
29
- *
30
- * @returns (boolean) if the blur was successful
31
- */
32
- blur: () => boolean;
33
- };
34
- }>;
35
- /**
36
- * Core plugin that is always included in the preset.
37
- * Allows for executing `EditorCommand` and other core functionality.
38
- */
39
- export declare const corePlugin: CorePlugin;
@@ -1,39 +0,0 @@
1
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- import type { EditorCommand, NextEditorPlugin } from '../types';
3
- export type CorePlugin = NextEditorPlugin<'core', {
4
- pluginConfiguration: {
5
- getEditorView: () => EditorView | undefined;
6
- };
7
- actions: {
8
- /**
9
- * Dispatches an EditorCommand to ProseMirror
10
- *
11
- * @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
12
- * is successful or `null` if it shouldn't be dispatched.
13
- * @returns (boolean) if the command was successful in dispatching
14
- */
15
- execute: (command: EditorCommand | undefined) => boolean;
16
- /**
17
- * Focuses the editor.
18
- *
19
- * Calls the focus method of the `EditorView` and scrolls the
20
- * current selection into view.
21
- *
22
- * @returns (boolean) if the focus was successful
23
- */
24
- focus: () => boolean;
25
- /**
26
- * Blurs the editor.
27
- *
28
- * Calls blur on the editor DOM element.
29
- *
30
- * @returns (boolean) if the blur was successful
31
- */
32
- blur: () => boolean;
33
- };
34
- }>;
35
- /**
36
- * Core plugin that is always included in the preset.
37
- * Allows for executing `EditorCommand` and other core functionality.
38
- */
39
- export declare const corePlugin: CorePlugin;