@atlaskit/editor-plugin-card 0.1.2 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`6bacee18c2d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6bacee18c2d) - [ux] Add new allowDatasource prop for enabling datasource in editor and add inlineCard fallback render for blockCard with datasource
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
3
13
  ## 0.1.2
4
14
 
5
15
  ### Patch Changes
@@ -53,12 +53,13 @@ var cardPlugin = function cardPlugin(options, api) {
53
53
  return nodes;
54
54
  },
55
55
  pmPlugins: function pmPlugins() {
56
- var _options$allowBlockCa, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme;
56
+ var _options$allowBlockCa, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme, _options$allowDatasou;
57
57
  var allowBlockCards = (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
58
58
  var allowResizing = (_options$allowResizin = options.allowResizing) !== null && _options$allowResizin !== void 0 ? _options$allowResizin : true;
59
59
  var useAlternativePreloader = (_options$useAlternati = options.useAlternativePreloader) !== null && _options$useAlternati !== void 0 ? _options$useAlternati : true;
60
60
  var allowWrapping = (_options$allowWrappin = options.allowWrapping) !== null && _options$allowWrappin !== void 0 ? _options$allowWrappin : true;
61
61
  var allowAlignment = (_options$allowAlignme = options.allowAlignment) !== null && _options$allowAlignme !== void 0 ? _options$allowAlignme : true;
62
+ var allowDatasource = (_options$allowDatasou = options.allowDatasource) !== null && _options$allowDatasou !== void 0 ? _options$allowDatasou : false;
62
63
  var plugins = [{
63
64
  name: 'card',
64
65
  plugin: (0, _main.createPlugin)(_objectSpread(_objectSpread({}, options), {}, {
@@ -66,7 +67,8 @@ var cardPlugin = function cardPlugin(options, api) {
66
67
  allowResizing: allowResizing,
67
68
  useAlternativePreloader: useAlternativePreloader,
68
69
  allowWrapping: allowWrapping,
69
- allowAlignment: allowAlignment
70
+ allowAlignment: allowAlignment,
71
+ allowDatasource: allowDatasource
70
72
  }), api)
71
73
  }, {
72
74
  name: 'cardHyperlink',
@@ -114,7 +116,7 @@ var cardPlugin = function cardPlugin(options, api) {
114
116
  floatingToolbar: (0, _toolbar.floatingToolbar)(options, featureFlags, options.platform, options.linkPicker, api),
115
117
  quickInsert: function quickInsert(_ref3) {
116
118
  var formatMessage = _ref3.formatMessage;
117
- if ((0, _utils.canRenderDatasource)(_linkDatasource.JIRA_LIST_OF_LINKS_DATASOURCE_ID)) {
119
+ if (options.allowDatasource && (0, _utils.canRenderDatasource)(_linkDatasource.JIRA_LIST_OF_LINKS_DATASOURCE_ID)) {
118
120
  return [{
119
121
  id: 'datasource',
120
122
  title: formatMessage(_messages.messages.datasourceJiraIssue),
@@ -172,7 +172,7 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
172
172
  var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
173
173
  if (isDatasource) {
174
174
  var _node$attrs4, _node$attrs4$datasour;
175
- if (platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
175
+ if (options.allowDatasource && platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
176
176
  return new _datasource.Datasource({
177
177
  node: node,
178
178
  view: view,
@@ -23,11 +23,14 @@ var resolveWithProvider = function resolveWithProvider(view, provider, request,
23
23
  };
24
24
  exports.resolveWithProvider = resolveWithProvider;
25
25
  var updateCardType = function updateCardType(resolvedCard, options) {
26
- if ((resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'blockCard' && !options.allowBlockCards || (resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'embedCard' && !options.allowEmbeds) {
26
+ var isDatasource = resolvedCard.type === 'blockCard' && 'datasource' in resolvedCard.attrs;
27
+ if ((resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'blockCard' && !options.allowBlockCards || (resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'embedCard' && !options.allowEmbeds || isDatasource && !options.allowDatasource) {
27
28
  // clean out the 'layout' attr from an embedCard type that should be transformed into the inlineCard type.
28
29
  if (resolvedCard.type === 'embedCard') {
29
30
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
31
  delete resolvedCard.attrs.layout;
32
+ } else if (isDatasource) {
33
+ delete resolvedCard.attrs.datasource;
31
34
  }
32
35
  resolvedCard.type = 'inlineCard';
33
36
  }
@@ -197,7 +197,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
197
197
  var isDatasource = currentAppearance === 'block' && (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
198
198
  var shouldRenderDatasourceToolbar = isDatasource &&
199
199
  // not showing toolbar in mobile for now since not sure what our plans are for it
200
- platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$datasour = _node$attrs2.datasource) === null || _node$attrs2$datasour === void 0 ? void 0 : _node$attrs2$datasour.id);
200
+ platform !== 'mobile' && cardOptions.allowDatasource && (0, _utils.canRenderDatasource)(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$datasour = _node$attrs2.datasource) === null || _node$attrs2$datasour === void 0 ? void 0 : _node$attrs2$datasour.id);
201
201
 
202
202
  /* mobile builds toolbar natively using toolbarItems */
203
203
  if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -43,12 +43,13 @@ export const cardPlugin = (options, api) => {
43
43
  return nodes;
44
44
  },
45
45
  pmPlugins() {
46
- var _options$allowBlockCa, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme;
46
+ var _options$allowBlockCa, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme, _options$allowDatasou;
47
47
  const allowBlockCards = (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
48
48
  const allowResizing = (_options$allowResizin = options.allowResizing) !== null && _options$allowResizin !== void 0 ? _options$allowResizin : true;
49
49
  const useAlternativePreloader = (_options$useAlternati = options.useAlternativePreloader) !== null && _options$useAlternati !== void 0 ? _options$useAlternati : true;
50
50
  const allowWrapping = (_options$allowWrappin = options.allowWrapping) !== null && _options$allowWrappin !== void 0 ? _options$allowWrappin : true;
51
51
  const allowAlignment = (_options$allowAlignme = options.allowAlignment) !== null && _options$allowAlignme !== void 0 ? _options$allowAlignme : true;
52
+ const allowDatasource = (_options$allowDatasou = options.allowDatasource) !== null && _options$allowDatasou !== void 0 ? _options$allowDatasou : false;
52
53
  const plugins = [{
53
54
  name: 'card',
54
55
  plugin: createPlugin({
@@ -57,7 +58,8 @@ export const cardPlugin = (options, api) => {
57
58
  allowResizing,
58
59
  useAlternativePreloader,
59
60
  allowWrapping,
60
- allowAlignment
61
+ allowAlignment,
62
+ allowDatasource
61
63
  }, api)
62
64
  }, {
63
65
  name: 'cardHyperlink',
@@ -108,7 +110,7 @@ export const cardPlugin = (options, api) => {
108
110
  quickInsert: ({
109
111
  formatMessage
110
112
  }) => {
111
- if (canRenderDatasource(JIRA_LIST_OF_LINKS_DATASOURCE_ID)) {
113
+ if (options.allowDatasource && canRenderDatasource(JIRA_LIST_OF_LINKS_DATASOURCE_ID)) {
112
114
  return [{
113
115
  id: 'datasource',
114
116
  title: formatMessage(messages.datasourceJiraIssue),
@@ -168,7 +168,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
168
168
  const isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
169
169
  if (isDatasource) {
170
170
  var _node$attrs4, _node$attrs4$datasour;
171
- if (platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
171
+ if (options.allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
172
172
  return new Datasource({
173
173
  node,
174
174
  view,
@@ -17,11 +17,14 @@ export const resolveWithProvider = (view, provider, request, options, editorAnal
17
17
  return handleResolve;
18
18
  };
19
19
  const updateCardType = (resolvedCard, options) => {
20
- if ((resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'blockCard' && !options.allowBlockCards || (resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'embedCard' && !options.allowEmbeds) {
20
+ const isDatasource = resolvedCard.type === 'blockCard' && 'datasource' in resolvedCard.attrs;
21
+ if ((resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'blockCard' && !options.allowBlockCards || (resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'embedCard' && !options.allowEmbeds || isDatasource && !options.allowDatasource) {
21
22
  // clean out the 'layout' attr from an embedCard type that should be transformed into the inlineCard type.
22
23
  if (resolvedCard.type === 'embedCard') {
23
24
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
25
  delete resolvedCard.attrs.layout;
26
+ } else if (isDatasource) {
27
+ delete resolvedCard.attrs.datasource;
25
28
  }
26
29
  resolvedCard.type = 'inlineCard';
27
30
  }
@@ -189,7 +189,7 @@ const generateToolbarItems = (state, featureFlags, intl, providerFactory, cardOp
189
189
  const isDatasource = currentAppearance === 'block' && (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
190
190
  const shouldRenderDatasourceToolbar = isDatasource &&
191
191
  // not showing toolbar in mobile for now since not sure what our plans are for it
192
- platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$datasour = _node$attrs2.datasource) === null || _node$attrs2$datasour === void 0 ? void 0 : _node$attrs2$datasour.id);
192
+ platform !== 'mobile' && cardOptions.allowDatasource && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$datasour = _node$attrs2.datasource) === null || _node$attrs2$datasour === void 0 ? void 0 : _node$attrs2$datasour.id);
193
193
 
194
194
  /* mobile builds toolbar natively using toolbarItems */
195
195
  if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -46,12 +46,13 @@ export var cardPlugin = function cardPlugin(options, api) {
46
46
  return nodes;
47
47
  },
48
48
  pmPlugins: function pmPlugins() {
49
- var _options$allowBlockCa, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme;
49
+ var _options$allowBlockCa, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme, _options$allowDatasou;
50
50
  var allowBlockCards = (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
51
51
  var allowResizing = (_options$allowResizin = options.allowResizing) !== null && _options$allowResizin !== void 0 ? _options$allowResizin : true;
52
52
  var useAlternativePreloader = (_options$useAlternati = options.useAlternativePreloader) !== null && _options$useAlternati !== void 0 ? _options$useAlternati : true;
53
53
  var allowWrapping = (_options$allowWrappin = options.allowWrapping) !== null && _options$allowWrappin !== void 0 ? _options$allowWrappin : true;
54
54
  var allowAlignment = (_options$allowAlignme = options.allowAlignment) !== null && _options$allowAlignme !== void 0 ? _options$allowAlignme : true;
55
+ var allowDatasource = (_options$allowDatasou = options.allowDatasource) !== null && _options$allowDatasou !== void 0 ? _options$allowDatasou : false;
55
56
  var plugins = [{
56
57
  name: 'card',
57
58
  plugin: createPlugin(_objectSpread(_objectSpread({}, options), {}, {
@@ -59,7 +60,8 @@ export var cardPlugin = function cardPlugin(options, api) {
59
60
  allowResizing: allowResizing,
60
61
  useAlternativePreloader: useAlternativePreloader,
61
62
  allowWrapping: allowWrapping,
62
- allowAlignment: allowAlignment
63
+ allowAlignment: allowAlignment,
64
+ allowDatasource: allowDatasource
63
65
  }), api)
64
66
  }, {
65
67
  name: 'cardHyperlink',
@@ -107,7 +109,7 @@ export var cardPlugin = function cardPlugin(options, api) {
107
109
  floatingToolbar: floatingToolbar(options, featureFlags, options.platform, options.linkPicker, api),
108
110
  quickInsert: function quickInsert(_ref3) {
109
111
  var formatMessage = _ref3.formatMessage;
110
- if (canRenderDatasource(JIRA_LIST_OF_LINKS_DATASOURCE_ID)) {
112
+ if (options.allowDatasource && canRenderDatasource(JIRA_LIST_OF_LINKS_DATASOURCE_ID)) {
111
113
  return [{
112
114
  id: 'datasource',
113
115
  title: formatMessage(messages.datasourceJiraIssue),
@@ -160,7 +160,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
160
160
  var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
161
161
  if (isDatasource) {
162
162
  var _node$attrs4, _node$attrs4$datasour;
163
- if (platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
163
+ if (options.allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
164
164
  return new Datasource({
165
165
  node: node,
166
166
  view: view,
@@ -17,11 +17,14 @@ export var resolveWithProvider = function resolveWithProvider(view, provider, re
17
17
  return handleResolve;
18
18
  };
19
19
  var updateCardType = function updateCardType(resolvedCard, options) {
20
- if ((resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'blockCard' && !options.allowBlockCards || (resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'embedCard' && !options.allowEmbeds) {
20
+ var isDatasource = resolvedCard.type === 'blockCard' && 'datasource' in resolvedCard.attrs;
21
+ if ((resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'blockCard' && !options.allowBlockCards || (resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'embedCard' && !options.allowEmbeds || isDatasource && !options.allowDatasource) {
21
22
  // clean out the 'layout' attr from an embedCard type that should be transformed into the inlineCard type.
22
23
  if (resolvedCard.type === 'embedCard') {
23
24
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
25
  delete resolvedCard.attrs.layout;
26
+ } else if (isDatasource) {
27
+ delete resolvedCard.attrs.datasource;
25
28
  }
26
29
  resolvedCard.type = 'inlineCard';
27
30
  }
@@ -183,7 +183,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
183
183
  var isDatasource = currentAppearance === 'block' && (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
184
184
  var shouldRenderDatasourceToolbar = isDatasource &&
185
185
  // not showing toolbar in mobile for now since not sure what our plans are for it
186
- platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$datasour = _node$attrs2.datasource) === null || _node$attrs2$datasour === void 0 ? void 0 : _node$attrs2$datasour.id);
186
+ platform !== 'mobile' && cardOptions.allowDatasource && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$datasour = _node$attrs2.datasource) === null || _node$attrs2$datasour === void 0 ? void 0 : _node$attrs2$datasour.id);
187
187
 
188
188
  /* mobile builds toolbar natively using toolbarItems */
189
189
  if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
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": "^26.1.0",
35
35
  "@atlaskit/analytics-next": "^9.1.0",
36
- "@atlaskit/editor-common": "^74.23.0",
36
+ "@atlaskit/editor-common": "^74.25.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",
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/link-datasource": "^0.28.0",
49
49
  "@atlaskit/smart-card": "^26.9.0",
50
50
  "@atlaskit/theme": "^12.5.0",
51
- "@atlaskit/tokens": "^1.11.0",
51
+ "@atlaskit/tokens": "^1.13.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "@emotion/react": "^11.7.1",
54
54
  "lodash": "^4.17.21",
@@ -0,0 +1,117 @@
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 type { OptionalPlugin } from '@atlaskit/editor-common/types';
24
+ import { SmartLinkEvents } from '@atlaskit/smart-card';
25
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
26
+ import type { widthPlugin } from '@atlaskit/editor-plugin-width';
27
+
28
+ // @public (undocumented)
29
+ type CardInfo = {
30
+ title?: string;
31
+ url?: string;
32
+ pos: number;
33
+ };
34
+
35
+ // @public (undocumented)
36
+ export const cardPlugin: NextEditorPlugin<'card', {
37
+ pluginConfiguration: CardPluginOptions;
38
+ dependencies: [
39
+ typeof featureFlagsPlugin,
40
+ OptionalPlugin<typeof analyticsPlugin>,
41
+ typeof widthPlugin,
42
+ typeof decorationsPlugin,
43
+ typeof gridPlugin,
44
+ FloatingToolbarPlugin,
45
+ typeof hyperlinkPlugin
46
+ ];
47
+ sharedState: CardPluginState | null;
48
+ actions: CardPluginActions;
49
+ }>;
50
+
51
+ // @public (undocumented)
52
+ type CardPluginOptions = CardOptions & {
53
+ editorAppearance?: EditorAppearance;
54
+ platform: 'mobile' | 'web';
55
+ fullWidthMode?: boolean;
56
+ linkPicker?: LinkPickerOptions;
57
+ };
58
+
59
+ // @public (undocumented)
60
+ type CardPluginState = {
61
+ requests: Request_2[];
62
+ provider: CardProvider | null;
63
+ cards: CardInfo[];
64
+ showLinkingToolbar: boolean;
65
+ smartLinkEvents?: SmartLinkEvents;
66
+ smartLinkEventsNext?: SmartLinkEventsNext;
67
+ editorAppearance?: EditorAppearance;
68
+ showDatasourceModal: boolean;
69
+ datasourceModalType?: DatasourceModalType;
70
+ datasourceTableRef?: HTMLElement;
71
+ layout?: DatasourceTableLayout;
72
+ };
73
+
74
+ // @public (undocumented)
75
+ type DatasourceTableLayout = 'center' | 'full-width' | 'wide';
76
+
77
+ // @public (undocumented)
78
+ type Metadata_2<T = {}> = {
79
+ url: string;
80
+ display: string;
81
+ isUndo?: boolean;
82
+ isRedo?: boolean;
83
+ action?: string;
84
+ inputMethod?: string;
85
+ sourceEvent?: unknown;
86
+ nodeContext?: string;
87
+ } & T;
88
+
89
+ // @public (undocumented)
90
+ type Request_2 = {
91
+ pos: number;
92
+ url: string;
93
+ appearance: CardAppearance;
94
+ compareLinkText: boolean;
95
+ source: CardReplacementInputMethod;
96
+ previousAppearance?: 'url' | CardAppearance;
97
+ analyticsAction?: ACTION;
98
+ shouldReplaceLink?: boolean;
99
+ sourceEvent?: UIAnalyticsEvent | null | undefined;
100
+ };
101
+ export { Request_2 as Request }
102
+
103
+ // @public (undocumented)
104
+ type SmartLinkEventsNext = {
105
+ created: (metadata: Metadata_2) => void;
106
+ updated: (metadata: Metadata_2<UpdateMetadata>) => void;
107
+ deleted: (metadata: Metadata_2) => void;
108
+ };
109
+
110
+ // @public (undocumented)
111
+ type UpdateMetadata = {
112
+ previousDisplay?: string;
113
+ };
114
+
115
+ // (No @packageDocumentation comment for this package)
116
+
117
+ ```