@atlaskit/editor-plugin-card 2.0.6 → 2.0.8

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 (42) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/plugin.js +3 -3
  3. package/dist/cjs/pm-plugins/doc.js +1 -109
  4. package/dist/cjs/toolbar.js +92 -6
  5. package/dist/cjs/ui/EditDatasourceButton.js +50 -25
  6. package/dist/cjs/ui/EditToolbarButton.js +30 -29
  7. package/dist/cjs/ui/HyperlinkToolbarAppearance.js +2 -2
  8. package/dist/cjs/ui/useFetchDatasourceInfo.js +13 -6
  9. package/dist/cjs/utils.js +11 -1
  10. package/dist/es2019/plugin.js +2 -2
  11. package/dist/es2019/pm-plugins/doc.js +2 -106
  12. package/dist/es2019/toolbar.js +88 -6
  13. package/dist/es2019/ui/EditDatasourceButton.js +41 -14
  14. package/dist/es2019/ui/EditToolbarButton.js +24 -22
  15. package/dist/es2019/ui/HyperlinkToolbarAppearance.js +2 -2
  16. package/dist/es2019/ui/useFetchDatasourceInfo.js +5 -1
  17. package/dist/es2019/utils.js +10 -0
  18. package/dist/esm/plugin.js +2 -2
  19. package/dist/esm/pm-plugins/doc.js +2 -110
  20. package/dist/esm/toolbar.js +92 -6
  21. package/dist/esm/ui/EditDatasourceButton.js +41 -16
  22. package/dist/esm/ui/EditToolbarButton.js +31 -28
  23. package/dist/esm/ui/HyperlinkToolbarAppearance.js +2 -2
  24. package/dist/esm/ui/useFetchDatasourceInfo.js +13 -6
  25. package/dist/esm/utils.js +10 -0
  26. package/dist/types/pm-plugins/doc.d.ts +3 -11
  27. package/dist/types/toolbar.d.ts +7 -0
  28. package/dist/types/types.d.ts +1 -0
  29. package/dist/types/ui/EditDatasourceButton.d.ts +6 -5
  30. package/dist/types/ui/EditLinkToolbar.d.ts +1 -1
  31. package/dist/types/ui/EditToolbarButton.d.ts +3 -1
  32. package/dist/types/ui/useFetchDatasourceInfo.d.ts +1 -0
  33. package/dist/types/utils.d.ts +6 -0
  34. package/dist/types-ts4.5/pm-plugins/doc.d.ts +3 -11
  35. package/dist/types-ts4.5/toolbar.d.ts +7 -0
  36. package/dist/types-ts4.5/types.d.ts +1 -0
  37. package/dist/types-ts4.5/ui/EditDatasourceButton.d.ts +6 -5
  38. package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +1 -1
  39. package/dist/types-ts4.5/ui/EditToolbarButton.d.ts +3 -1
  40. package/dist/types-ts4.5/ui/useFetchDatasourceInfo.d.ts +1 -0
  41. package/dist/types-ts4.5/utils.d.ts +6 -0
  42. package/package.json +6 -6
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
+ import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
4
  import type { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
5
5
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
6
6
  import type { Command, ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarItem, LinkInputType, LinkPickerOptions } from '@atlaskit/editor-common/types';
@@ -4,13 +4,15 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
4
  import type { Command } from '@atlaskit/editor-common/types';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { CardContext } from '@atlaskit/link-provider';
7
+ import { type CardType } from '../types';
7
8
  export interface EditDatasourceToolbarButtonProps {
8
9
  datasourceId?: string;
9
10
  intl: IntlShape;
11
+ onLinkEditClick: Command;
10
12
  editorAnalyticsApi?: EditorAnalyticsAPI;
11
13
  url?: string;
12
14
  editorView?: EditorView;
13
15
  cardContext?: CardContext;
14
- onLinkEditClick: Command;
16
+ currentAppearance?: CardType;
15
17
  }
16
18
  export declare const EditToolbarButton: (props: EditDatasourceToolbarButtonProps) => jsx.JSX.Element;
@@ -11,4 +11,5 @@ export declare const useFetchDatasourceInfo: ({ isRegularCardNode, url, cardCont
11
11
  datasourceId: string | undefined;
12
12
  parameters: DatasourceParameters | undefined;
13
13
  ready: boolean;
14
+ extensionKey: string | undefined;
14
15
  };
@@ -1,6 +1,7 @@
1
1
  import type { CardAppearance } from '@atlaskit/editor-common/provider-factory';
2
2
  import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
4
5
  import type { CardContext } from '@atlaskit/link-provider';
5
6
  import type { CardInfo, DatasourceNode } from './types';
6
7
  export declare const appearanceForNodeType: (spec: NodeType) => CardAppearance | undefined;
@@ -37,3 +38,8 @@ export declare const isDatasourceAdfAttributes: (attrs: Record<string, unknown>
37
38
  * this function will not be updated automatically
38
39
  */
39
40
  export declare const isDatasourceNode: (node?: Node) => node is DatasourceNode;
41
+ /**
42
+ * Focuses the editorView if it's not already focused.
43
+ * @param editorView The editor view to focus.
44
+ */
45
+ export declare const focusEditorView: (editorView: EditorView) => void;
@@ -1,16 +1,14 @@
1
- import { type IntlShape } from 'react-intl-next';
2
1
  import type { CreateUIAnalyticsEvent, UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
3
  import { ACTION } from '@atlaskit/editor-common/analytics';
5
4
  import type { CardReplacementInputMethod } from '@atlaskit/editor-common/card';
6
- import type { CardAdf, CardAppearance, DatasourceAdf, ProviderFactory } from '@atlaskit/editor-common/provider-factory';
7
- import type { Command, ExtractInjectionAPI, FloatingToolbarItem } from '@atlaskit/editor-common/types';
5
+ import type { CardAdf, CardAppearance, DatasourceAdf } from '@atlaskit/editor-common/provider-factory';
6
+ import type { Command } from '@atlaskit/editor-common/types';
8
7
  import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
9
8
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
10
9
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
11
10
  import type { InlineCardAdf } from '@atlaskit/smart-card';
12
- import { type cardPlugin } from '../plugin';
13
- import type { CardPluginOptions, Request } from '../types';
11
+ import type { Request } from '../types';
14
12
  export declare const replaceQueuedUrlWithCard: (url: string, cardData: CardAdf | DatasourceAdf, analyticsAction?: ACTION, editorAnalyticsApi?: EditorAnalyticsAPI, createAnalyticsEvent?: CreateUIAnalyticsEvent) => Command;
15
13
  export declare const handleFallbackWithAnalytics: (request: Request, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
16
14
  export declare const queueCardsFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined, appearance?: CardAppearance) => Transaction;
@@ -40,10 +38,4 @@ export declare const insertDatasource: (state: EditorState, adf: DatasourceAdf |
40
38
  * Get attributes for new Card Appearance
41
39
  */
42
40
  export declare const getAttrsForAppearance: (appearance: CardAppearance, selectedNode: Node) => import("prosemirror-model").Attrs;
43
- export declare const editDatasource: (datasourceId: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
44
- export declare const getStartingToolbarItems: (options: CardPluginOptions, api?: ExtractInjectionAPI<typeof cardPlugin> | undefined) => (intl: IntlShape, link: string, providerFactory: ProviderFactory, onEditLink: Command, metadata: {
45
- url: string;
46
- title: string;
47
- }) => FloatingToolbarItem<Command>[];
48
- export declare const getEndingToolbarItems: (options: CardPluginOptions, api?: ExtractInjectionAPI<typeof cardPlugin> | undefined) => (intl: IntlShape, link: string) => FloatingToolbarItem<Command>[];
49
41
  export {};
@@ -1,8 +1,10 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  import type { CardOptions } from '@atlaskit/editor-common/card';
4
+ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
5
  import type { Command, ExtractInjectionAPI, FloatingToolbarHandler, FloatingToolbarItem, LinkPickerOptions } from '@atlaskit/editor-common/types';
5
6
  import type { CardPlatform } from '@atlaskit/smart-card';
7
+ import type { CardPluginOptions } from './types';
6
8
  import type { cardPlugin } from './index';
7
9
  export declare const removeCard: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
8
10
  export declare const visitCardLink: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
@@ -12,3 +14,8 @@ export declare const getHyperlinkToolbarSettingsButton: (intl: IntlShape, editor
12
14
  export declare const getSettingsButton: (intl: IntlShape, editorAnalyticsApi: EditorAnalyticsAPI | undefined, userPreferencesLink: string | undefined) => FloatingToolbarItem<Command>;
13
15
  export declare const getSettingsButtonGroup: (intl: IntlShape, editorAnalyticsApi: EditorAnalyticsAPI | undefined, userPreferencesLink: string | undefined) => FloatingToolbarItem<Command>[];
14
16
  export declare const shouldRenderToolbarPulse: (embedEnabled: boolean, appearance: string, status: string, isDiscoverabilityEnabled: boolean) => boolean;
17
+ export declare const getStartingToolbarItems: (options: CardPluginOptions, api?: ExtractInjectionAPI<typeof cardPlugin> | undefined) => (intl: IntlShape, link: string, providerFactory: ProviderFactory, onEditLink: Command, metadata: {
18
+ url: string;
19
+ title: string;
20
+ }) => FloatingToolbarItem<Command>[];
21
+ export declare const getEndingToolbarItems: (options: CardPluginOptions, api?: ExtractInjectionAPI<typeof cardPlugin> | undefined) => (intl: IntlShape, link: string) => FloatingToolbarItem<Command>[];
@@ -10,6 +10,7 @@ import type { SmartLinkEvents } from '@atlaskit/smart-card';
10
10
  import type { EditorCardPluginEvents } from './analytics/create-events-queue';
11
11
  import type { CardPluginEvent } from './analytics/types';
12
12
  import type { DatasourceTableLayout } from './ui/LayoutButton/types';
13
+ export type CardType = CardAppearance | 'url' | 'datasource';
13
14
  export type DatasourceNode = Omit<Node, 'attrs'> & {
14
15
  readonly attrs: DatasourceAdf['attrs'] & Partial<RichMediaAttributes>;
15
16
  };
@@ -1,16 +1,17 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  import type { IntlShape } from 'react-intl-next';
4
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
+ import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
+ import { type Command } from '@atlaskit/editor-common/types';
6
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
6
  import type { CardContext } from '@atlaskit/link-provider';
7
+ import { type CardType } from '../types';
8
8
  export interface EditDatasourceButtonProps {
9
9
  intl: IntlShape;
10
10
  editorAnalyticsApi?: EditorAnalyticsAPI;
11
11
  url?: string;
12
12
  editorView?: EditorView;
13
- editorState: EditorState;
14
13
  cardContext?: CardContext;
14
+ currentAppearance?: CardType;
15
15
  }
16
- export declare const EditDatasourceButton: ({ intl, editorAnalyticsApi, url, editorView, editorState, }: EditDatasourceButtonProps) => jsx.JSX.Element;
16
+ export declare const EditDatasourceButton: ({ intl, editorAnalyticsApi, url, editorView, currentAppearance, }: EditDatasourceButtonProps) => jsx.JSX.Element;
17
+ export declare const editDatasource: (datasourceId: string, editorAnalyticsApi?: EditorAnalyticsAPI, appearance?: CardType, extensionKey?: string) => Command;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
+ import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
4
  import type { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
5
5
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
6
6
  import type { Command, ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarItem, LinkInputType, LinkPickerOptions } from '@atlaskit/editor-common/types';
@@ -4,13 +4,15 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
4
  import type { Command } from '@atlaskit/editor-common/types';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { CardContext } from '@atlaskit/link-provider';
7
+ import { type CardType } from '../types';
7
8
  export interface EditDatasourceToolbarButtonProps {
8
9
  datasourceId?: string;
9
10
  intl: IntlShape;
11
+ onLinkEditClick: Command;
10
12
  editorAnalyticsApi?: EditorAnalyticsAPI;
11
13
  url?: string;
12
14
  editorView?: EditorView;
13
15
  cardContext?: CardContext;
14
- onLinkEditClick: Command;
16
+ currentAppearance?: CardType;
15
17
  }
16
18
  export declare const EditToolbarButton: (props: EditDatasourceToolbarButtonProps) => jsx.JSX.Element;
@@ -11,4 +11,5 @@ export declare const useFetchDatasourceInfo: ({ isRegularCardNode, url, cardCont
11
11
  datasourceId: string | undefined;
12
12
  parameters: DatasourceParameters | undefined;
13
13
  ready: boolean;
14
+ extensionKey: string | undefined;
14
15
  };
@@ -1,6 +1,7 @@
1
1
  import type { CardAppearance } from '@atlaskit/editor-common/provider-factory';
2
2
  import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
4
5
  import type { CardContext } from '@atlaskit/link-provider';
5
6
  import type { CardInfo, DatasourceNode } from './types';
6
7
  export declare const appearanceForNodeType: (spec: NodeType) => CardAppearance | undefined;
@@ -37,3 +38,8 @@ export declare const isDatasourceAdfAttributes: (attrs: Record<string, unknown>
37
38
  * this function will not be updated automatically
38
39
  */
39
40
  export declare const isDatasourceNode: (node?: Node) => node is DatasourceNode;
41
+ /**
42
+ * Focuses the editorView if it's not already focused.
43
+ * @param editorView The editor view to focus.
44
+ */
45
+ export declare const focusEditorView: (editorView: EditorView) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,10 +34,10 @@
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^36.10.7",
36
36
  "@atlaskit/analytics-next": "^9.3.0",
37
- "@atlaskit/button": "^17.17.1",
37
+ "@atlaskit/button": "^17.22.0",
38
38
  "@atlaskit/custom-steps": "^0.2.0",
39
- "@atlaskit/dropdown-menu": "^12.12.0",
40
- "@atlaskit/editor-common": "^82.8.0",
39
+ "@atlaskit/dropdown-menu": "^12.13.0",
40
+ "@atlaskit/editor-common": "^82.9.0",
41
41
  "@atlaskit/editor-plugin-analytics": "^1.2.0",
42
42
  "@atlaskit/editor-plugin-decorations": "^1.1.0",
43
43
  "@atlaskit/editor-plugin-editor-viewmode": "^1.2.0",
@@ -54,9 +54,9 @@
54
54
  "@atlaskit/link-datasource": "^2.3.0",
55
55
  "@atlaskit/linking-common": "^5.7.0",
56
56
  "@atlaskit/linking-types": "^8.9.0",
57
- "@atlaskit/menu": "2.5.0",
57
+ "@atlaskit/menu": "2.5.1",
58
58
  "@atlaskit/platform-feature-flags": "^0.2.0",
59
- "@atlaskit/primitives": "^7.4.0",
59
+ "@atlaskit/primitives": "^8.0.0",
60
60
  "@atlaskit/smart-card": "^27.6.0",
61
61
  "@atlaskit/theme": "^12.10.0",
62
62
  "@atlaskit/tokens": "^1.51.0",