@atlaskit/editor-plugin-loom 2.8.3 → 3.0.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/commands.js +109 -2
  3. package/dist/cjs/plugin.js +12 -58
  4. package/dist/cjs/pm-plugin.js +2 -78
  5. package/dist/cjs/types.js +5 -1
  6. package/dist/cjs/ui/PrimaryToolbarButton.js +99 -0
  7. package/dist/cjs/ui/{ToolbarButton.js → ToolbarButtonComponent.js} +43 -24
  8. package/dist/cjs/ui/quickInsert.js +56 -0
  9. package/dist/es2019/commands.js +93 -0
  10. package/dist/es2019/plugin.js +15 -57
  11. package/dist/es2019/pm-plugin.js +3 -64
  12. package/dist/es2019/types.js +1 -0
  13. package/dist/es2019/ui/PrimaryToolbarButton.js +84 -0
  14. package/dist/es2019/ui/{ToolbarButton.js → ToolbarButtonComponent.js} +40 -22
  15. package/dist/es2019/ui/quickInsert.js +44 -0
  16. package/dist/esm/commands.js +107 -1
  17. package/dist/esm/plugin.js +13 -58
  18. package/dist/esm/pm-plugin.js +3 -79
  19. package/dist/esm/types.js +1 -0
  20. package/dist/esm/ui/PrimaryToolbarButton.js +90 -0
  21. package/dist/esm/ui/{ToolbarButton.js → ToolbarButtonComponent.js} +39 -21
  22. package/dist/esm/ui/quickInsert.js +49 -0
  23. package/dist/types/commands.d.ts +5 -1
  24. package/dist/types/index.d.ts +1 -1
  25. package/dist/types/plugin.d.ts +14 -3
  26. package/dist/types/types.d.ts +32 -1
  27. package/dist/types/ui/PrimaryToolbarButton.d.ts +4 -0
  28. package/dist/types/ui/ToolbarButtonComponent.d.ts +20 -0
  29. package/dist/types/ui/quickInsert.d.ts +3 -0
  30. package/dist/types-ts4.5/commands.d.ts +5 -1
  31. package/dist/types-ts4.5/index.d.ts +1 -1
  32. package/dist/types-ts4.5/plugin.d.ts +14 -3
  33. package/dist/types-ts4.5/types.d.ts +32 -1
  34. package/dist/types-ts4.5/ui/PrimaryToolbarButton.d.ts +4 -0
  35. package/dist/types-ts4.5/ui/ToolbarButtonComponent.d.ts +20 -0
  36. package/dist/types-ts4.5/ui/quickInsert.d.ts +3 -0
  37. package/package.json +5 -3
  38. package/.eslintrc.js +0 -6
  39. package/dist/types/ui/ToolbarButton.d.ts +0 -798
  40. package/dist/types-ts4.5/ui/ToolbarButton.d.ts +0 -956
@@ -1,3 +1,5 @@
1
+ import type React from 'react';
2
+ import { type ButtonProps as AKButtonProps } from '@atlaskit/button';
1
3
  export type VideoMeta = {
2
4
  sharedUrl: string;
3
5
  title: string;
@@ -23,8 +25,37 @@ export type GetClient = Promise<GetClientResult>;
23
25
  export type LoomProviderOptions = {
24
26
  getClient: () => GetClient;
25
27
  };
26
- export type LoomPluginOptions = {
28
+ export interface ButtonComponentProps extends Pick<AKButtonProps, 'selected' | 'isDisabled' | 'onBlur' | 'onFocus' | 'onKeyDown' | 'onMouseEnter' | 'onMouseLeave' | 'aria-controls' | 'aria-expanded' | 'aria-haspopup' | 'href' | 'target'> {
29
+ 'data-ds--level'?: string;
30
+ /**
31
+ * on click handler that will only be called before the Loom SDK is initialised.
32
+ * Once the SDK is initialised, onClick will be handled by editor to start recording.
33
+ */
34
+ onClickBeforeInit?: (event: React.MouseEvent<HTMLElement>) => void;
35
+ }
36
+ export type ButtonComponent = React.ForwardRefExoticComponent<ButtonComponentProps & React.RefAttributes<HTMLElement>>;
37
+ export type RenderButton = (ButtonComponent: ButtonComponent) => JSX.Element | null;
38
+ type LoomPluginOptionsWithProvider = {
27
39
  loomProvider: LoomProviderOptions;
40
+ /**
41
+ * Customize the button component, e.g. adding pulse, a11y.
42
+ * @note When this is provided, `shouldShowToolbarButton` can be skipped and the button will still show. \
43
+ * If `shouldShowToolbarButton` is false, the button will not show regardless of this prop.
44
+ * @param ButtonComponent Loom toolbar button component (mainly UI)
45
+ */
46
+ renderButton?: RenderButton;
28
47
  shouldShowToolbarButton?: boolean;
29
48
  };
49
+ type LoomPluginOptionsWithoutProvider = {
50
+ loomProvider?: LoomProviderOptions;
51
+ /**
52
+ * Customize the button component, e.g. adding pulse, a11y.
53
+ * @note When this is provided, `shouldShowToolbarButton` can be skipped and the button will still show. \
54
+ * If `shouldShowToolbarButton` is false, the button will not show regardless of this prop.
55
+ * @param ButtonComponent Loom toolbar button component (mainly UI)
56
+ */
57
+ renderButton: RenderButton;
58
+ shouldShowToolbarButton?: boolean;
59
+ };
60
+ export type LoomPluginOptions = LoomPluginOptionsWithProvider | LoomPluginOptionsWithoutProvider;
30
61
  export {};
@@ -0,0 +1,4 @@
1
+ import type { ExtractInjectionAPI, ToolbarUIComponentFactory } from '@atlaskit/editor-common/types';
2
+ import type { LoomPlugin } from '../plugin';
3
+ import { type LoomPluginOptions } from '../types';
4
+ export declare const loomPrimaryToolbarComponent: (config: LoomPluginOptions, api: ExtractInjectionAPI<LoomPlugin> | undefined) => ToolbarUIComponentFactory;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React from 'react';
6
+ import type { WrappedComponentProps } from 'react-intl-next';
7
+ import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
8
+ import type { LoomPlugin } from '../plugin';
9
+ import { type ButtonComponentProps } from '../types';
10
+ interface Props extends Omit<ButtonComponentProps, 'onClickBeforeInit'> {
11
+ disabled: boolean;
12
+ appearance: EditorAppearance;
13
+ api: ExtractInjectionAPI<LoomPlugin> | undefined;
14
+ onClick: (event: React.MouseEvent<HTMLElement>) => void;
15
+ hideTooltip?: boolean;
16
+ }
17
+ declare const _default: React.ForwardRefExoticComponent<Pick<import("react-intl-next").WithIntlProps<React.PropsWithChildren<Props & WrappedComponentProps & React.RefAttributes<HTMLElement>>>, "children" | "key" | keyof Props | "forwardedRef"> & React.RefAttributes<any>> & {
18
+ WrappedComponent: React.ComponentType<Props & WrappedComponentProps & React.RefAttributes<HTMLElement>>;
19
+ };
20
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { QuickInsertHandlerFn } from '@atlaskit/editor-common/types';
3
+ export declare const getQuickInsertItem: (editorAnalyticsAPI?: EditorAnalyticsAPI) => QuickInsertHandlerFn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-loom",
3
- "version": "2.8.3",
3
+ "version": "3.0.0",
4
4
  "description": "Loom plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,10 +34,12 @@
34
34
  ".": "./src/index.ts"
35
35
  },
36
36
  "dependencies": {
37
- "@atlaskit/editor-common": "^89.0.0",
37
+ "@atlaskit/button": "^20.1.0",
38
+ "@atlaskit/editor-common": "^90.2.0",
38
39
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
39
40
  "@atlaskit/editor-plugin-hyperlink": "^2.9.0",
40
41
  "@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
42
+ "@atlaskit/editor-plugin-quick-insert": "^1.4.0",
41
43
  "@atlaskit/editor-plugin-width": "^1.3.0",
42
44
  "@atlaskit/editor-prosemirror": "6.0.0",
43
45
  "@atlaskit/logo": "^14.2.0",
@@ -62,7 +64,7 @@
62
64
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
63
65
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
64
66
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
65
- "@atlaskit/editor-plugin-floating-toolbar": "^1.12.0",
67
+ "@atlaskit/editor-plugin-floating-toolbar": "^1.13.0",
66
68
  "@atlaskit/editor-plugin-grid": "^1.2.0",
67
69
  "@testing-library/react": "^12.1.5",
68
70
  "@testing-library/user-event": "^14.4.3",
package/.eslintrc.js DELETED
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- '@typescript-eslint/no-duplicate-imports': 'error',
4
- '@typescript-eslint/no-explicit-any': 'error',
5
- },
6
- };