@atlaskit/editor-plugin-card 0.4.6 → 0.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 0.4.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`24e27147cbd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24e27147cbd) - Added atlaskit docs to all existing plugins.
8
+
9
+ ## 0.4.7
10
+
11
+ ### Patch Changes
12
+
13
+ - [`9c86163d326`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9c86163d326) - [ux] Adds ability to edit Assets datasource modal from inserted table
14
+
3
15
  ## 0.4.6
4
16
 
5
17
  ### Patch Changes
@@ -19,11 +19,11 @@ var _hooks = require("@atlaskit/editor-common/hooks");
19
19
  var _link = require("@atlaskit/editor-common/link");
20
20
  var _messages = require("@atlaskit/editor-common/messages");
21
21
  var _ui = require("@atlaskit/editor-common/ui");
22
+ var _utils = require("@atlaskit/editor-common/utils");
22
23
  var _state = require("@atlaskit/editor-prosemirror/state");
23
- var _linkDatasource = require("@atlaskit/link-datasource");
24
24
  var _actions = require("../pm-plugins/actions");
25
25
  var _doc = require("../pm-plugins/doc");
26
- var _utils = require("../utils");
26
+ var _utils2 = require("../utils");
27
27
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
28
28
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
29
29
  function HyperlinkAddToolbarWithState(_ref) {
@@ -176,7 +176,7 @@ var buildEditLinkToolbar = function buildEditLinkToolbar(_ref2) {
176
176
  if (!view || !providerFactory) {
177
177
  return null;
178
178
  }
179
- var displayInfo = (0, _utils.displayInfoForCard)(node, (0, _utils.findCardInfo)(view.state));
179
+ var displayInfo = (0, _utils2.displayInfoForCard)(node, (0, _utils2.findCardInfo)(view.state));
180
180
  return /*#__PURE__*/_react.default.createElement(EditLinkToolbar, {
181
181
  pluginInjectionApi: pluginInjectionApi,
182
182
  key: idx,
@@ -223,7 +223,7 @@ exports.editLinkToolbarConfig = editLinkToolbarConfig;
223
223
  var editDatasource = function editDatasource(node, editorAnalyticsApi) {
224
224
  return function (state, dispatch) {
225
225
  var _node$attrs;
226
- var modalType = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource.id) === _linkDatasource.JIRA_LIST_OF_LINKS_DATASOURCE_ID ? 'jira' : undefined;
226
+ var modalType = (0, _utils.getDatasourceType)((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource.id);
227
227
  if (dispatch && modalType) {
228
228
  var tr = state.tr;
229
229
  (0, _actions.showDatasourceModal)(modalType)(tr);
@@ -5,8 +5,8 @@ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
5
  import { HyperlinkAddToolbar as HyperlinkToolbar } from '@atlaskit/editor-common/link';
6
6
  import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
7
7
  import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
8
+ import { getDatasourceType } from '@atlaskit/editor-common/utils';
8
9
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
9
- import { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
10
10
  import { hideLinkToolbar, showDatasourceModal, showLinkToolbar } from '../pm-plugins/actions';
11
11
  import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
12
12
  import { displayInfoForCard, findCardInfo } from '../utils';
@@ -194,7 +194,7 @@ export const editLinkToolbarConfig = (showLinkingToolbar, lpLinkPicker) => {
194
194
  };
195
195
  export const editDatasource = (node, editorAnalyticsApi) => (state, dispatch) => {
196
196
  var _node$attrs;
197
- const modalType = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource.id) === JIRA_LIST_OF_LINKS_DATASOURCE_ID ? 'jira' : undefined;
197
+ const modalType = getDatasourceType((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource.id);
198
198
  if (dispatch && modalType) {
199
199
  const {
200
200
  tr
@@ -12,8 +12,8 @@ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
12
12
  import { HyperlinkAddToolbar as HyperlinkToolbar } from '@atlaskit/editor-common/link';
13
13
  import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
14
14
  import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
15
+ import { getDatasourceType } from '@atlaskit/editor-common/utils';
15
16
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
16
- import { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
17
17
  import { hideLinkToolbar as _hideLinkToolbar, showDatasourceModal, showLinkToolbar } from '../pm-plugins/actions';
18
18
  import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
19
19
  import { displayInfoForCard, findCardInfo } from '../utils';
@@ -210,7 +210,7 @@ export var editLinkToolbarConfig = function editLinkToolbarConfig(showLinkingToo
210
210
  export var editDatasource = function editDatasource(node, editorAnalyticsApi) {
211
211
  return function (state, dispatch) {
212
212
  var _node$attrs;
213
- var modalType = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource.id) === JIRA_LIST_OF_LINKS_DATASOURCE_ID ? 'jira' : undefined;
213
+ var modalType = getDatasourceType((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource.id);
214
214
  if (dispatch && modalType) {
215
215
  var tr = state.tr;
216
216
  showDatasourceModal(modalType)(tr);
@@ -1,2 +1,3 @@
1
1
  export { cardPlugin } from './plugin';
2
+ export type { CardPlugin } from './plugin';
2
3
  export type { Request } from './types';
@@ -1,24 +1,25 @@
1
1
  import type { CardPluginActions } from '@atlaskit/editor-common/card';
2
2
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
- import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
- import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
3
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
+ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
+ import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
6
6
  import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
7
- import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
8
- import type { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
9
- import type { widthPlugin } from '@atlaskit/editor-plugin-width';
7
+ import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
8
+ import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
9
+ import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
10
10
  import type { CardPluginOptions, CardPluginState } from './types';
11
- export declare const cardPlugin: NextEditorPlugin<'card', {
11
+ export type CardPlugin = NextEditorPlugin<'card', {
12
12
  pluginConfiguration: CardPluginOptions;
13
13
  dependencies: [
14
- typeof featureFlagsPlugin,
15
- OptionalPlugin<typeof analyticsPlugin>,
16
- typeof widthPlugin,
17
- typeof decorationsPlugin,
18
- typeof gridPlugin,
14
+ FeatureFlagsPlugin,
15
+ OptionalPlugin<AnalyticsPlugin>,
16
+ WidthPlugin,
17
+ DecorationsPlugin,
18
+ GridPlugin,
19
19
  FloatingToolbarPlugin,
20
- typeof hyperlinkPlugin
20
+ HyperlinkPlugin
21
21
  ];
22
22
  sharedState: CardPluginState | null;
23
23
  actions: CardPluginActions;
24
24
  }>;
25
+ export declare const cardPlugin: CardPlugin;
@@ -1,7 +1,7 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { CardOptions } from '@atlaskit/editor-common/card';
3
3
  import type { Command, ExtractInjectionAPI, FeatureFlags, FloatingToolbarHandler, LinkPickerOptions } from '@atlaskit/editor-common/types';
4
- import { CardPlatform } from '@atlaskit/smart-card';
4
+ import type { CardPlatform } from '@atlaskit/smart-card';
5
5
  import type { cardPlugin } from './index';
6
6
  export declare const removeCard: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
7
7
  export declare const visitCardLink: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
@@ -1,13 +1,12 @@
1
1
  import React from 'react';
2
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
- import { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
5
- import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
6
- import type { Command, ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarItem, LinkInputType, LinkPickerOptions } from '@atlaskit/editor-common/types';
7
- import { FeatureFlags } from '@atlaskit/editor-common/types';
2
+ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
+ import type { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
5
+ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
6
+ import type { Command, ExtractInjectionAPI, FeatureFlags, FloatingToolbarConfig, FloatingToolbarItem, LinkInputType, LinkPickerOptions } from '@atlaskit/editor-common/types';
8
7
  import type { ForceFocusSelector } from '@atlaskit/editor-plugin-floating-toolbar';
9
- import { Node } from '@atlaskit/editor-prosemirror/model';
10
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
8
+ import type { Node } from '@atlaskit/editor-prosemirror/model';
9
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
11
10
  import type { cardPlugin } from '../plugin';
12
11
  interface InjectionAPI {
13
12
  pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
@@ -1,2 +1,3 @@
1
1
  export { cardPlugin } from './plugin';
2
+ export type { CardPlugin } from './plugin';
2
3
  export type { Request } from './types';
@@ -1,24 +1,25 @@
1
1
  import type { CardPluginActions } from '@atlaskit/editor-common/card';
2
2
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
- import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
- import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
3
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
+ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
+ import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
6
6
  import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
7
- import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
8
- import type { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
9
- import type { widthPlugin } from '@atlaskit/editor-plugin-width';
7
+ import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
8
+ import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
9
+ import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
10
10
  import type { CardPluginOptions, CardPluginState } from './types';
11
- export declare const cardPlugin: NextEditorPlugin<'card', {
11
+ export type CardPlugin = NextEditorPlugin<'card', {
12
12
  pluginConfiguration: CardPluginOptions;
13
13
  dependencies: [
14
- typeof featureFlagsPlugin,
15
- OptionalPlugin<typeof analyticsPlugin>,
16
- typeof widthPlugin,
17
- typeof decorationsPlugin,
18
- typeof gridPlugin,
14
+ FeatureFlagsPlugin,
15
+ OptionalPlugin<AnalyticsPlugin>,
16
+ WidthPlugin,
17
+ DecorationsPlugin,
18
+ GridPlugin,
19
19
  FloatingToolbarPlugin,
20
- typeof hyperlinkPlugin
20
+ HyperlinkPlugin
21
21
  ];
22
22
  sharedState: CardPluginState | null;
23
23
  actions: CardPluginActions;
24
24
  }>;
25
+ export declare const cardPlugin: CardPlugin;
@@ -1,7 +1,7 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { CardOptions } from '@atlaskit/editor-common/card';
3
3
  import type { Command, ExtractInjectionAPI, FeatureFlags, FloatingToolbarHandler, LinkPickerOptions } from '@atlaskit/editor-common/types';
4
- import { CardPlatform } from '@atlaskit/smart-card';
4
+ import type { CardPlatform } from '@atlaskit/smart-card';
5
5
  import type { cardPlugin } from './index';
6
6
  export declare const removeCard: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
7
7
  export declare const visitCardLink: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
@@ -1,13 +1,12 @@
1
1
  import React from 'react';
2
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
- import { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
5
- import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
6
- import type { Command, ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarItem, LinkInputType, LinkPickerOptions } from '@atlaskit/editor-common/types';
7
- import { FeatureFlags } from '@atlaskit/editor-common/types';
2
+ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
+ import type { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
5
+ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
6
+ import type { Command, ExtractInjectionAPI, FeatureFlags, FloatingToolbarConfig, FloatingToolbarItem, LinkInputType, LinkPickerOptions } from '@atlaskit/editor-common/types';
8
7
  import type { ForceFocusSelector } from '@atlaskit/editor-plugin-floating-toolbar';
9
- import { Node } from '@atlaskit/editor-prosemirror/model';
10
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
8
+ import type { Node } from '@atlaskit/editor-prosemirror/model';
9
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
11
10
  import type { cardPlugin } from '../plugin';
12
11
  interface InjectionAPI {
13
12
  pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "28.1.2",
35
35
  "@atlaskit/analytics-next": "^9.1.0",
36
- "@atlaskit/editor-common": "^74.51.0",
36
+ "@atlaskit/editor-common": "^74.52.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^0.1.0",
38
38
  "@atlaskit/editor-plugin-decorations": "^0.1.0",
39
39
  "@atlaskit/editor-plugin-feature-flags": "^0.1.0",
@@ -47,9 +47,9 @@
47
47
  "@atlaskit/link-analytics": "^8.2.0",
48
48
  "@atlaskit/link-datasource": "^1.0.0",
49
49
  "@atlaskit/platform-feature-flags": "^0.2.0",
50
- "@atlaskit/smart-card": "^26.15.0",
50
+ "@atlaskit/smart-card": "^26.16.0",
51
51
  "@atlaskit/theme": "^12.5.0",
52
- "@atlaskit/tokens": "^1.15.0",
52
+ "@atlaskit/tokens": "^1.16.0",
53
53
  "@babel/runtime": "^7.0.0",
54
54
  "@emotion/react": "^11.7.1",
55
55
  "lodash": "^4.17.21",
@@ -63,7 +63,6 @@
63
63
  },
64
64
  "devDependencies": {
65
65
  "@atlaskit/activity-provider": "^2.4.0",
66
- "@atlaskit/editor-test-helpers": "^18.11.0",
67
66
  "@atlaskit/link-test-helpers": "^6.0.0",
68
67
  "@atlaskit/media-test-helpers": "^33.0.0",
69
68
  "@atlaskit/ssr": "*",
package/report.api.md CHANGED
@@ -16,26 +16,26 @@
16
16
 
17
17
  ```ts
18
18
  import { ACTION } from '@atlaskit/editor-common/analytics';
19
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
19
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
20
20
  import { CardAppearance } from '@atlaskit/editor-common/provider-factory';
21
21
  import type { CardOptions } from '@atlaskit/editor-common/card';
22
22
  import type { CardPluginActions } from '@atlaskit/editor-common/card';
23
23
  import { CardProvider } from '@atlaskit/editor-common/provider-factory';
24
24
  import type { CardReplacementInputMethod } from '@atlaskit/editor-common/card';
25
25
  import type { DatasourceModalType } from '@atlaskit/editor-common/types';
26
- import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
26
+ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
27
27
  import type { EditorAppearance } from '@atlaskit/editor-common/types';
28
- import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
28
+ import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
29
29
  import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
30
- import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
31
- import type { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
30
+ import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
31
+ import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
32
32
  import type { LinkPickerOptions } from '@atlaskit/editor-common/types';
33
33
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
34
34
  import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
35
35
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
36
36
  import { SmartLinkEvents } from '@atlaskit/smart-card';
37
37
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
38
- import type { widthPlugin } from '@atlaskit/editor-plugin-width';
38
+ import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
39
39
 
40
40
  // @public (undocumented)
41
41
  type CardInfo = {
@@ -45,24 +45,27 @@ type CardInfo = {
45
45
  };
46
46
 
47
47
  // @public (undocumented)
48
- export const cardPlugin: NextEditorPlugin<
48
+ export type CardPlugin = NextEditorPlugin<
49
49
  'card',
50
50
  {
51
51
  pluginConfiguration: CardPluginOptions;
52
52
  dependencies: [
53
- typeof featureFlagsPlugin,
54
- OptionalPlugin<typeof analyticsPlugin>,
55
- typeof widthPlugin,
56
- typeof decorationsPlugin,
57
- typeof gridPlugin,
53
+ FeatureFlagsPlugin,
54
+ OptionalPlugin<AnalyticsPlugin>,
55
+ WidthPlugin,
56
+ DecorationsPlugin,
57
+ GridPlugin,
58
58
  FloatingToolbarPlugin,
59
- typeof hyperlinkPlugin,
59
+ HyperlinkPlugin,
60
60
  ];
61
61
  sharedState: CardPluginState | null;
62
62
  actions: CardPluginActions;
63
63
  }
64
64
  >;
65
65
 
66
+ // @public (undocumented)
67
+ export const cardPlugin: CardPlugin;
68
+
66
69
  // @public (undocumented)
67
70
  type CardPluginEvent = DatasourceEvent | LinkEvent;
68
71
 
@@ -1,190 +0,0 @@
1
- ## API Report File for "@atlaskit/editor-plugin-card"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- import { ACTION } from '@atlaskit/editor-common/analytics';
8
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
9
- import { CardAppearance } from '@atlaskit/editor-common/provider-factory';
10
- import type { CardOptions } from '@atlaskit/editor-common/card';
11
- import type { CardPluginActions } from '@atlaskit/editor-common/card';
12
- import { CardProvider } from '@atlaskit/editor-common/provider-factory';
13
- import type { CardReplacementInputMethod } from '@atlaskit/editor-common/card';
14
- import type { DatasourceModalType } from '@atlaskit/editor-common/types';
15
- import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
16
- import type { EditorAppearance } from '@atlaskit/editor-common/types';
17
- import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
18
- import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
19
- import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
20
- import type { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
21
- import type { LinkPickerOptions } from '@atlaskit/editor-common/types';
22
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
23
- import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
24
- import type { OptionalPlugin } from '@atlaskit/editor-common/types';
25
- import { SmartLinkEvents } from '@atlaskit/smart-card';
26
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
27
- import type { widthPlugin } from '@atlaskit/editor-plugin-width';
28
-
29
- // @public (undocumented)
30
- type CardInfo = {
31
- title?: string;
32
- url?: string;
33
- pos: number;
34
- };
35
-
36
- // @public (undocumented)
37
- export const cardPlugin: NextEditorPlugin<'card', {
38
- pluginConfiguration: CardPluginOptions;
39
- dependencies: [
40
- typeof featureFlagsPlugin,
41
- OptionalPlugin<typeof analyticsPlugin>,
42
- typeof widthPlugin,
43
- typeof decorationsPlugin,
44
- typeof gridPlugin,
45
- FloatingToolbarPlugin,
46
- typeof hyperlinkPlugin
47
- ];
48
- sharedState: CardPluginState | null;
49
- actions: CardPluginActions;
50
- }>;
51
-
52
- // @public (undocumented)
53
- type CardPluginEvent = DatasourceEvent | LinkEvent;
54
-
55
- // @public (undocumented)
56
- type CardPluginOptions = CardOptions & {
57
- editorAppearance?: EditorAppearance;
58
- platform: 'mobile' | 'web';
59
- fullWidthMode?: boolean;
60
- linkPicker?: LinkPickerOptions;
61
- cardPluginEvents?: EditorCardPluginEvents<CardPluginEvent>;
62
- };
63
-
64
- // @public (undocumented)
65
- type CardPluginState = {
66
- requests: Request_2[];
67
- provider: CardProvider | null;
68
- cards: CardInfo[];
69
- showLinkingToolbar: boolean;
70
- smartLinkEvents?: SmartLinkEvents;
71
- editorAppearance?: EditorAppearance;
72
- showDatasourceModal: boolean;
73
- datasourceModalType?: DatasourceModalType;
74
- datasourceTableRef?: HTMLElement;
75
- layout?: DatasourceTableLayout;
76
- };
77
-
78
- // @public (undocumented)
79
- type DatasourceCreatedEvent = {
80
- event: EVENT.CREATED;
81
- subject: EVENT_SUBJECT.DATASOURCE;
82
- data: Metadata_2;
83
- };
84
-
85
- // @public (undocumented)
86
- type DatasourceDeletedEvent = {
87
- event: EVENT.DELETED;
88
- subject: EVENT_SUBJECT.DATASOURCE;
89
- data: Metadata_2;
90
- };
91
-
92
- // @public (undocumented)
93
- type DatasourceEvent = DatasourceCreatedEvent | DatasourceDeletedEvent | DatasourceUpdatedEvent;
94
-
95
- // @public (undocumented)
96
- type DatasourceTableLayout = 'center' | 'full-width' | 'wide';
97
-
98
- // @public (undocumented)
99
- type DatasourceUpdatedEvent = {
100
- event: EVENT.UPDATED;
101
- subject: EVENT_SUBJECT.DATASOURCE;
102
- data: Metadata_2<UpdateMetadata>;
103
- };
104
-
105
- // @public (undocumented)
106
- type EditorCardPluginEvents<T> = {
107
- push: (...events: T[]) => void;
108
- subscribe: (listener: Subscriber<T>) => () => void;
109
- flush: () => void;
110
- getSize: () => number;
111
- };
112
-
113
- // @public (undocumented)
114
- enum EVENT {
115
- // (undocumented)
116
- CREATED = "created",
117
- // (undocumented)
118
- DELETED = "deleted",
119
- // (undocumented)
120
- UPDATED = "updated"
121
- }
122
-
123
- // @public (undocumented)
124
- enum EVENT_SUBJECT {
125
- // (undocumented)
126
- DATASOURCE = "datasource",
127
- // (undocumented)
128
- LINK = "link"
129
- }
130
-
131
- // @public
132
- type LinkCreatedEvent = {
133
- event: EVENT.CREATED;
134
- subject: EVENT_SUBJECT.LINK;
135
- data: Metadata_2;
136
- };
137
-
138
- // @public (undocumented)
139
- type LinkDeletedEvent = {
140
- event: EVENT.DELETED;
141
- subject: EVENT_SUBJECT.LINK;
142
- data: Metadata_2;
143
- };
144
-
145
- // @public (undocumented)
146
- type LinkEvent = LinkCreatedEvent | LinkDeletedEvent | LinkUpdatedEvent;
147
-
148
- // @public (undocumented)
149
- type LinkUpdatedEvent = {
150
- event: EVENT.UPDATED;
151
- subject: EVENT_SUBJECT.LINK;
152
- data: Metadata_2<UpdateMetadata>;
153
- };
154
-
155
- // @public (undocumented)
156
- type Metadata_2<T = {}> = {
157
- node: Node_2;
158
- isUndo?: boolean;
159
- isRedo?: boolean;
160
- action?: string;
161
- inputMethod?: string;
162
- sourceEvent?: unknown;
163
- nodeContext?: string;
164
- } & T;
165
-
166
- // @public (undocumented)
167
- type Request_2 = {
168
- pos: number;
169
- url: string;
170
- appearance: CardAppearance;
171
- compareLinkText: boolean;
172
- source: CardReplacementInputMethod;
173
- previousAppearance?: 'url' | CardAppearance;
174
- analyticsAction?: ACTION;
175
- shouldReplaceLink?: boolean;
176
- sourceEvent?: UIAnalyticsEvent | null | undefined;
177
- };
178
- export { Request_2 as Request }
179
-
180
- // @public (undocumented)
181
- type Subscriber<T> = (event: T) => void;
182
-
183
- // @public (undocumented)
184
- type UpdateMetadata = {
185
- previousDisplay?: string;
186
- };
187
-
188
- // (No @packageDocumentation comment for this package)
189
-
190
- ```