@atlaskit/editor-plugin-card 2.0.5 → 2.0.7

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 (63) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/nodeviews/datasource.js +1 -1
  3. package/dist/cjs/plugin.js +3 -3
  4. package/dist/cjs/pm-plugins/doc.js +1 -109
  5. package/dist/cjs/toolbar.js +92 -6
  6. package/dist/cjs/ui/AwarenessWrapper/index.js +2 -0
  7. package/dist/cjs/ui/DatasourceAppearanceButton.js +2 -0
  8. package/dist/cjs/ui/EditDatasourceButton.js +51 -25
  9. package/dist/cjs/ui/EditToolbarButton.js +31 -28
  10. package/dist/cjs/ui/HyperlinkToolbarAppearance.js +2 -2
  11. package/dist/cjs/ui/InlineCardOverlay/index.js +1 -0
  12. package/dist/cjs/ui/LayoutButton/index.js +1 -1
  13. package/dist/cjs/ui/LeftIconOverlay/index.js +1 -0
  14. package/dist/cjs/ui/ResizableEmbedCard.js +1 -1
  15. package/dist/cjs/ui/useFetchDatasourceInfo.js +13 -6
  16. package/dist/cjs/utils.js +11 -1
  17. package/dist/es2019/nodeviews/datasource.js +2 -0
  18. package/dist/es2019/plugin.js +2 -2
  19. package/dist/es2019/pm-plugins/doc.js +2 -106
  20. package/dist/es2019/toolbar.js +88 -6
  21. package/dist/es2019/ui/AwarenessWrapper/index.js +2 -0
  22. package/dist/es2019/ui/DatasourceAppearanceButton.js +2 -0
  23. package/dist/es2019/ui/EditDatasourceButton.js +42 -14
  24. package/dist/es2019/ui/EditToolbarButton.js +26 -22
  25. package/dist/es2019/ui/HyperlinkToolbarAppearance.js +2 -2
  26. package/dist/es2019/ui/InlineCardOverlay/index.js +2 -0
  27. package/dist/es2019/ui/LayoutButton/index.js +2 -0
  28. package/dist/es2019/ui/LeftIconOverlay/index.js +2 -0
  29. package/dist/es2019/ui/ResizableEmbedCard.js +2 -0
  30. package/dist/es2019/ui/useFetchDatasourceInfo.js +5 -1
  31. package/dist/es2019/utils.js +10 -0
  32. package/dist/esm/nodeviews/datasource.js +2 -0
  33. package/dist/esm/plugin.js +2 -2
  34. package/dist/esm/pm-plugins/doc.js +2 -110
  35. package/dist/esm/toolbar.js +92 -6
  36. package/dist/esm/ui/AwarenessWrapper/index.js +2 -0
  37. package/dist/esm/ui/DatasourceAppearanceButton.js +2 -0
  38. package/dist/esm/ui/EditDatasourceButton.js +42 -16
  39. package/dist/esm/ui/EditToolbarButton.js +33 -28
  40. package/dist/esm/ui/HyperlinkToolbarAppearance.js +2 -2
  41. package/dist/esm/ui/InlineCardOverlay/index.js +2 -0
  42. package/dist/esm/ui/LayoutButton/index.js +2 -0
  43. package/dist/esm/ui/LeftIconOverlay/index.js +2 -0
  44. package/dist/esm/ui/ResizableEmbedCard.js +2 -0
  45. package/dist/esm/ui/useFetchDatasourceInfo.js +13 -6
  46. package/dist/esm/utils.js +10 -0
  47. package/dist/types/pm-plugins/doc.d.ts +3 -11
  48. package/dist/types/toolbar.d.ts +7 -0
  49. package/dist/types/types.d.ts +1 -0
  50. package/dist/types/ui/EditDatasourceButton.d.ts +6 -5
  51. package/dist/types/ui/EditLinkToolbar.d.ts +1 -1
  52. package/dist/types/ui/EditToolbarButton.d.ts +3 -1
  53. package/dist/types/ui/useFetchDatasourceInfo.d.ts +1 -0
  54. package/dist/types/utils.d.ts +6 -0
  55. package/dist/types-ts4.5/pm-plugins/doc.d.ts +3 -11
  56. package/dist/types-ts4.5/toolbar.d.ts +7 -0
  57. package/dist/types-ts4.5/types.d.ts +1 -0
  58. package/dist/types-ts4.5/ui/EditDatasourceButton.d.ts +6 -5
  59. package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +1 -1
  60. package/dist/types-ts4.5/ui/EditToolbarButton.d.ts +3 -1
  61. package/dist/types-ts4.5/ui/useFetchDatasourceInfo.d.ts +1 -0
  62. package/dist/types-ts4.5/utils.d.ts +6 -0
  63. package/package.json +37 -19
@@ -22,6 +22,10 @@ export var useFetchDatasourceInfo = function useFetchDatasourceInfo(_ref) {
22
22
  _useState6 = _slicedToArray(_useState5, 2),
23
23
  ready = _useState6[0],
24
24
  setReady = _useState6[1];
25
+ var _useState7 = useState(undefined),
26
+ _useState8 = _slicedToArray(_useState7, 2),
27
+ extensionKey = _useState8[0],
28
+ setExtensionKey = _useState8[1];
25
29
  useEffect(function () {
26
30
  var fetchDatasource = /*#__PURE__*/function () {
27
31
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
@@ -43,24 +47,26 @@ export var useFetchDatasourceInfo = function useFetchDatasourceInfo(_ref) {
43
47
  case 6:
44
48
  response = _context.sent;
45
49
  datasources = response && response.datasources || [];
50
+ setExtensionKey(response === null || response === void 0 ? void 0 : response.meta.key);
46
51
  setDatasourceId((_datasources$ = datasources[0]) === null || _datasources$ === void 0 ? void 0 : _datasources$.id);
47
52
  setParameters((_datasources$2 = datasources[0]) === null || _datasources$2 === void 0 ? void 0 : _datasources$2.parameters);
48
53
  setReady(true);
49
- _context.next = 18;
54
+ _context.next = 20;
50
55
  break;
51
- case 13:
52
- _context.prev = 13;
56
+ case 14:
57
+ _context.prev = 14;
53
58
  _context.t0 = _context["catch"](0);
54
59
  setDatasourceId(undefined);
55
60
  setParameters(undefined);
61
+ setExtensionKey(undefined);
56
62
  // If fetch somehow errors, still set ready as true so we don't block the rendering of the modal.
57
63
  // It will just open with empty params.
58
64
  setReady(true);
59
- case 18:
65
+ case 20:
60
66
  case "end":
61
67
  return _context.stop();
62
68
  }
63
- }, _callee, null, [[0, 13]]);
69
+ }, _callee, null, [[0, 14]]);
64
70
  }));
65
71
  return function fetchDatasource() {
66
72
  return _ref2.apply(this, arguments);
@@ -73,6 +79,7 @@ export var useFetchDatasourceInfo = function useFetchDatasourceInfo(_ref) {
73
79
  return {
74
80
  datasourceId: datasourceId,
75
81
  parameters: parameters,
76
- ready: ready
82
+ ready: ready,
83
+ extensionKey: extensionKey
77
84
  };
78
85
  };
package/dist/esm/utils.js CHANGED
@@ -115,4 +115,14 @@ export var isDatasourceNode = function isDatasourceNode(node) {
115
115
  return false;
116
116
  }
117
117
  return node.type.name === 'blockCard' && isDatasourceAdfAttributes(node.attrs);
118
+ };
119
+
120
+ /**
121
+ * Focuses the editorView if it's not already focused.
122
+ * @param editorView The editor view to focus.
123
+ */
124
+ export var focusEditorView = function focusEditorView(editorView) {
125
+ if (!editorView.hasFocus()) {
126
+ editorView.focus();
127
+ }
118
128
  };
@@ -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;
@@ -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.5",
3
+ "version": "2.0.7",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -20,7 +20,10 @@
20
20
  "types": "dist/types/index.d.ts",
21
21
  "typesVersions": {
22
22
  ">=4.5 <4.9": {
23
- "*": ["dist/types-ts4.5/*", "dist/types-ts4.5/index.d.ts"]
23
+ "*": [
24
+ "dist/types-ts4.5/*",
25
+ "dist/types-ts4.5/index.d.ts"
26
+ ]
24
27
  }
25
28
  },
26
29
  "sideEffects": false,
@@ -31,33 +34,33 @@
31
34
  "dependencies": {
32
35
  "@atlaskit/adf-schema": "^36.10.7",
33
36
  "@atlaskit/analytics-next": "^9.3.0",
34
- "@atlaskit/button": "^17.17.1",
37
+ "@atlaskit/button": "^17.18.0",
35
38
  "@atlaskit/custom-steps": "^0.2.0",
36
- "@atlaskit/dropdown-menu": "^12.10.2",
37
- "@atlaskit/editor-common": "^82.6.0",
39
+ "@atlaskit/dropdown-menu": "^12.12.0",
40
+ "@atlaskit/editor-common": "^82.8.0",
38
41
  "@atlaskit/editor-plugin-analytics": "^1.2.0",
39
42
  "@atlaskit/editor-plugin-decorations": "^1.1.0",
40
43
  "@atlaskit/editor-plugin-editor-viewmode": "^1.2.0",
41
44
  "@atlaskit/editor-plugin-feature-flags": "^1.1.0",
42
- "@atlaskit/editor-plugin-floating-toolbar": "^1.6.0",
45
+ "@atlaskit/editor-plugin-floating-toolbar": "^1.7.0",
43
46
  "@atlaskit/editor-plugin-grid": "^1.1.0",
44
47
  "@atlaskit/editor-plugin-width": "^1.1.0",
45
48
  "@atlaskit/editor-prosemirror": "4.0.1",
46
49
  "@atlaskit/editor-shared-styles": "^2.12.0",
47
50
  "@atlaskit/frontend-utilities": "^2.7.0",
48
- "@atlaskit/icon": "^22.3.0",
51
+ "@atlaskit/icon": "^22.4.0",
49
52
  "@atlaskit/link-analytics": "^8.3.0",
50
53
  "@atlaskit/link-client-extension": "^1.9.0",
51
54
  "@atlaskit/link-datasource": "^2.3.0",
52
55
  "@atlaskit/linking-common": "^5.7.0",
53
56
  "@atlaskit/linking-types": "^8.9.0",
54
- "@atlaskit/menu": "2.4.1",
57
+ "@atlaskit/menu": "2.5.0",
55
58
  "@atlaskit/platform-feature-flags": "^0.2.0",
56
- "@atlaskit/primitives": "^7.2.0",
59
+ "@atlaskit/primitives": "^7.4.0",
57
60
  "@atlaskit/smart-card": "^27.6.0",
58
- "@atlaskit/theme": "^12.9.0",
59
- "@atlaskit/tokens": "^1.50.0",
60
- "@atlaskit/tooltip": "^18.4.0",
61
+ "@atlaskit/theme": "^12.10.0",
62
+ "@atlaskit/tokens": "^1.51.0",
63
+ "@atlaskit/tooltip": "^18.5.0",
61
64
  "@babel/runtime": "^7.0.0",
62
65
  "@emotion/react": "^11.7.1",
63
66
  "lodash": "^4.17.21",
@@ -74,17 +77,32 @@
74
77
  },
75
78
  "techstack": {
76
79
  "@atlassian/frontend": {
77
- "import-structure": ["atlassian-conventions"],
78
- "circular-dependencies": ["file-and-folder-level"]
80
+ "import-structure": [
81
+ "atlassian-conventions"
82
+ ],
83
+ "circular-dependencies": [
84
+ "file-and-folder-level"
85
+ ]
79
86
  },
80
87
  "@repo/internal": {
81
88
  "dom-events": "use-bind-event-listener",
82
- "analytics": ["analytics-next"],
83
- "design-tokens": ["color"],
84
- "theming": ["react-context"],
85
- "ui-components": ["lite-mode"],
89
+ "analytics": [
90
+ "analytics-next"
91
+ ],
92
+ "design-tokens": [
93
+ "color"
94
+ ],
95
+ "theming": [
96
+ "react-context"
97
+ ],
98
+ "ui-components": [
99
+ "lite-mode"
100
+ ],
86
101
  "deprecation": "no-deprecated-imports",
87
- "styling": ["emotion", "emotion"]
102
+ "styling": [
103
+ "emotion",
104
+ "emotion"
105
+ ]
88
106
  }
89
107
  },
90
108
  "platform-feature-flags": {