@atlaskit/editor-plugin-card 1.14.4 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/.eslintrc.js +12 -12
  2. package/CHANGELOG.md +692 -681
  3. package/LICENSE.md +6 -8
  4. package/dist/cjs/nodeviews/datasource.js +1 -0
  5. package/dist/cjs/nodeviews/inlineCardWithAwareness.js +4 -1
  6. package/dist/cjs/pm-plugins/doc.js +21 -1
  7. package/dist/cjs/toolbar.js +36 -6
  8. package/dist/cjs/ui/AwarenessWrapper/index.js +20 -18
  9. package/dist/cjs/ui/DatasourceModal/index.js +4 -5
  10. package/dist/cjs/ui/EditDatasourceButton.js +5 -26
  11. package/dist/cjs/ui/EditToolbarButton.js +139 -0
  12. package/dist/cjs/ui/InlineCardOverlay/index.js +9 -3
  13. package/dist/cjs/ui/{NewInlineCardOverlay → LeftIconOverlay}/index.js +60 -101
  14. package/dist/cjs/ui/ResizableEmbedCard.js +3 -0
  15. package/dist/cjs/utils.js +4 -1
  16. package/dist/es2019/nodeviews/datasource.js +1 -0
  17. package/dist/es2019/nodeviews/inlineCardWithAwareness.js +4 -1
  18. package/dist/es2019/pm-plugins/doc.js +22 -2
  19. package/dist/es2019/toolbar.js +33 -7
  20. package/dist/es2019/ui/AwarenessWrapper/index.js +20 -18
  21. package/dist/es2019/ui/DatasourceModal/index.js +4 -5
  22. package/dist/es2019/ui/EditDatasourceButton.js +1 -22
  23. package/dist/es2019/ui/EditToolbarButton.js +123 -0
  24. package/dist/es2019/ui/InlineCardOverlay/index.js +9 -3
  25. package/dist/es2019/ui/{NewInlineCardOverlay → LeftIconOverlay}/index.js +51 -94
  26. package/dist/es2019/ui/ResizableEmbedCard.js +4 -0
  27. package/dist/es2019/utils.js +3 -0
  28. package/dist/esm/nodeviews/datasource.js +1 -0
  29. package/dist/esm/nodeviews/inlineCardWithAwareness.js +4 -1
  30. package/dist/esm/pm-plugins/doc.js +22 -2
  31. package/dist/esm/toolbar.js +38 -8
  32. package/dist/esm/ui/AwarenessWrapper/index.js +20 -18
  33. package/dist/esm/ui/DatasourceModal/index.js +4 -5
  34. package/dist/esm/ui/EditDatasourceButton.js +1 -22
  35. package/dist/esm/ui/EditToolbarButton.js +131 -0
  36. package/dist/esm/ui/InlineCardOverlay/index.js +9 -3
  37. package/dist/esm/ui/{NewInlineCardOverlay → LeftIconOverlay}/index.js +62 -103
  38. package/dist/esm/ui/ResizableEmbedCard.js +3 -0
  39. package/dist/esm/utils.js +3 -0
  40. package/dist/types/pm-plugins/doc.d.ts +1 -0
  41. package/dist/types/ui/EditDatasourceButton.d.ts +0 -2
  42. package/dist/types/ui/EditToolbarButton.d.ts +15 -0
  43. package/dist/types/ui/EditorAnalyticsContext.d.ts +1 -1
  44. package/dist/types/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.d.ts +1 -1
  45. package/dist/types/ui/EditorLinkingPlatformAnalytics/LinkEvents.d.ts +1 -1
  46. package/dist/types/ui/EditorSmartCardEvents.d.ts +1 -1
  47. package/dist/types/ui/LeftIconOverlay/index.d.ts +10 -0
  48. package/dist/types/utils.d.ts +2 -0
  49. package/dist/types-ts4.5/pm-plugins/doc.d.ts +1 -0
  50. package/dist/types-ts4.5/ui/EditDatasourceButton.d.ts +0 -2
  51. package/dist/types-ts4.5/ui/EditToolbarButton.d.ts +15 -0
  52. package/dist/types-ts4.5/ui/EditorAnalyticsContext.d.ts +1 -1
  53. package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.d.ts +1 -1
  54. package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/LinkEvents.d.ts +1 -1
  55. package/dist/types-ts4.5/ui/EditorSmartCardEvents.d.ts +1 -1
  56. package/dist/types-ts4.5/ui/LeftIconOverlay/index.d.ts +10 -0
  57. package/dist/types-ts4.5/utils.d.ts +2 -0
  58. package/package.json +9 -6
  59. package/report.api.md +94 -96
  60. package/dist/types/ui/NewInlineCardOverlay/index.d.ts +0 -6
  61. package/dist/types-ts4.5/ui/NewInlineCardOverlay/index.d.ts +0 -6
@@ -2,6 +2,7 @@ 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
4
  import type { CardContext } from '@atlaskit/link-provider';
5
+ import type { CardPlatform } from '@atlaskit/smart-card';
5
6
  import type { CardInfo, DatasourceNode } from './types';
6
7
  export declare const appearanceForNodeType: (spec: NodeType) => CardAppearance | undefined;
7
8
  export declare const selectedCardAppearance: (state: EditorState) => CardAppearance | undefined;
@@ -22,6 +23,7 @@ export declare const isEmbedSupportedAtPosition: (currentNodePosition: number, e
22
23
  export declare const isBlockSupportedAtPosition: (currentNodePosition: number, editorState: EditorState, currentAppearance?: CardAppearance) => boolean;
23
24
  export declare const getResolvedAttributesFromStore: (url: string, display: string | null, store?: CardContext['store']) => {};
24
25
  export declare const isDatasourceConfigEditable: (datasourceId: string) => boolean;
26
+ export declare const isEditDropdownEnabled: (platform?: CardPlatform) => boolean;
25
27
  /**
26
28
  * Typeguard that checks node attributes are datasource node attributes
27
29
  * ** WARNING ** Typeguards are not a guarantee, if the asserted type changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "1.14.4",
3
+ "version": "1.15.0",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/adf-schema": "^36.10.7",
36
36
  "@atlaskit/analytics-next": "^9.3.0",
37
37
  "@atlaskit/custom-steps": "^0.2.0",
38
- "@atlaskit/editor-common": "^81.0.0",
38
+ "@atlaskit/editor-common": "^81.2.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.2.0",
40
40
  "@atlaskit/editor-plugin-decorations": "^1.1.0",
41
41
  "@atlaskit/editor-plugin-editor-viewmode": "^1.1.0",
@@ -53,11 +53,13 @@
53
53
  "@atlaskit/link-datasource": "^2.3.0",
54
54
  "@atlaskit/linking-common": "^5.7.0",
55
55
  "@atlaskit/linking-types": "^8.9.0",
56
+ "@atlaskit/menu": "2.3.0",
56
57
  "@atlaskit/platform-feature-flags": "^0.2.0",
57
- "@atlaskit/primitives": "^6.3.0",
58
- "@atlaskit/smart-card": "^27.0.0",
58
+ "@atlaskit/primitives": "^6.4.0",
59
+ "@atlaskit/smart-card": "^27.4.0",
59
60
  "@atlaskit/theme": "^12.8.0",
60
61
  "@atlaskit/tokens": "^1.49.0",
62
+ "@atlaskit/tooltip": "^18.4.0",
61
63
  "@babel/runtime": "^7.0.0",
62
64
  "@emotion/react": "^11.7.1",
63
65
  "lodash": "^4.17.21",
@@ -70,7 +72,6 @@
70
72
  "react-intl-next": "npm:react-intl@^5.18.1"
71
73
  },
72
74
  "devDependencies": {
73
- "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
74
75
  "typescript": "~5.4.2"
75
76
  },
76
77
  "techstack": {
@@ -103,8 +104,10 @@
103
104
  ]
104
105
  }
105
106
  },
106
- "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
107
107
  "platform-feature-flags": {
108
+ "platform.linking-platform.enable-datasource-edit-dropdown-toolbar": {
109
+ "type": "boolean"
110
+ },
108
111
  "platform.linking-platform.smart-links-in-live-pages": {
109
112
  "type": "boolean"
110
113
  },
package/report.api.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## API Report File for "@atlaskit/editor-plugin-card"
4
4
 
5
- > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using
6
+ > [API Extractor](https://api-extractor.com/).
6
7
  > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
8
 
8
9
  ### Table of contents
@@ -39,28 +40,28 @@ import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
39
40
 
40
41
  // @public (undocumented)
41
42
  type CardInfo = {
42
- title?: string;
43
- url?: string;
44
- pos: number;
43
+ title?: string;
44
+ url?: string;
45
+ pos: number;
45
46
  };
46
47
 
47
48
  // @public (undocumented)
48
49
  export type CardPlugin = NextEditorPlugin<
49
- 'card',
50
- {
51
- pluginConfiguration: CardPluginOptions;
52
- dependencies: [
53
- OptionalPlugin<FeatureFlagsPlugin>,
54
- OptionalPlugin<AnalyticsPlugin>,
55
- WidthPlugin,
56
- DecorationsPlugin,
57
- GridPlugin,
58
- FloatingToolbarPlugin,
59
- HyperlinkPlugin,
60
- ];
61
- sharedState: CardPluginState | null;
62
- actions: CardPluginActions;
63
- }
50
+ 'card',
51
+ {
52
+ pluginConfiguration: CardPluginOptions;
53
+ dependencies: [
54
+ OptionalPlugin<FeatureFlagsPlugin>,
55
+ OptionalPlugin<AnalyticsPlugin>,
56
+ WidthPlugin,
57
+ DecorationsPlugin,
58
+ GridPlugin,
59
+ FloatingToolbarPlugin,
60
+ HyperlinkPlugin,
61
+ ];
62
+ sharedState: CardPluginState | null;
63
+ actions: CardPluginActions;
64
+ }
64
65
  >;
65
66
 
66
67
  // @public
@@ -71,101 +72,98 @@ type CardPluginEvent = DatasourceEvent | LinkEvent;
71
72
 
72
73
  // @public (undocumented)
73
74
  type CardPluginOptions = CardOptions & {
74
- editorAppearance?: EditorAppearance;
75
- platform: 'mobile' | 'web';
76
- fullWidthMode?: boolean;
77
- linkPicker?: LinkPickerOptions;
78
- cardPluginEvents?: EditorCardPluginEvents<CardPluginEvent>;
75
+ editorAppearance?: EditorAppearance;
76
+ platform: 'mobile' | 'web';
77
+ fullWidthMode?: boolean;
78
+ linkPicker?: LinkPickerOptions;
79
+ cardPluginEvents?: EditorCardPluginEvents<CardPluginEvent>;
79
80
  };
80
81
 
81
82
  // @public (undocumented)
82
83
  type CardPluginState = {
83
- requests: Request_2[];
84
- provider: CardProvider | null;
85
- cards: CardInfo[];
86
- showLinkingToolbar: boolean;
87
- smartLinkEvents?: SmartLinkEvents;
88
- editorAppearance?: EditorAppearance;
89
- showDatasourceModal: boolean;
90
- datasourceModalType?: DatasourceModalType;
91
- datasourceTableRef?: HTMLElement;
92
- layout?: DatasourceTableLayout;
93
- inlineCardAwarenessCandidatePosition?: number;
94
- overlayCandidatePosition?: number;
95
- removeOverlay?: () => void;
96
- selectedInlineLinkPosition?: number;
97
- allowEmbeds?: boolean;
98
- allowBlockCards?: boolean;
84
+ requests: Request_2[];
85
+ provider: CardProvider | null;
86
+ cards: CardInfo[];
87
+ showLinkingToolbar: boolean;
88
+ smartLinkEvents?: SmartLinkEvents;
89
+ editorAppearance?: EditorAppearance;
90
+ showDatasourceModal: boolean;
91
+ datasourceModalType?: DatasourceModalType;
92
+ datasourceTableRef?: HTMLElement;
93
+ layout?: DatasourceTableLayout;
94
+ inlineCardAwarenessCandidatePosition?: number;
95
+ overlayCandidatePosition?: number;
96
+ removeOverlay?: () => void;
97
+ selectedInlineLinkPosition?: number;
98
+ allowEmbeds?: boolean;
99
+ allowBlockCards?: boolean;
99
100
  };
100
101
 
101
102
  // @public (undocumented)
102
103
  type DatasourceCreatedEvent = {
103
- event: EVENT.CREATED;
104
- subject: EVENT_SUBJECT.DATASOURCE;
105
- data: Metadata_2;
104
+ event: EVENT.CREATED;
105
+ subject: EVENT_SUBJECT.DATASOURCE;
106
+ data: Metadata_2;
106
107
  };
107
108
 
108
109
  // @public (undocumented)
109
110
  type DatasourceDeletedEvent = {
110
- event: EVENT.DELETED;
111
- subject: EVENT_SUBJECT.DATASOURCE;
112
- data: Metadata_2;
111
+ event: EVENT.DELETED;
112
+ subject: EVENT_SUBJECT.DATASOURCE;
113
+ data: Metadata_2;
113
114
  };
114
115
 
115
116
  // @public (undocumented)
116
- type DatasourceEvent =
117
- | DatasourceCreatedEvent
118
- | DatasourceDeletedEvent
119
- | DatasourceUpdatedEvent;
117
+ type DatasourceEvent = DatasourceCreatedEvent | DatasourceDeletedEvent | DatasourceUpdatedEvent;
120
118
 
121
119
  // @public (undocumented)
122
120
  type DatasourceTableLayout = 'center' | 'full-width' | 'wide';
123
121
 
124
122
  // @public (undocumented)
125
123
  type DatasourceUpdatedEvent = {
126
- event: EVENT.UPDATED;
127
- subject: EVENT_SUBJECT.DATASOURCE;
128
- data: Metadata_2<UpdateMetadata>;
124
+ event: EVENT.UPDATED;
125
+ subject: EVENT_SUBJECT.DATASOURCE;
126
+ data: Metadata_2<UpdateMetadata>;
129
127
  };
130
128
 
131
129
  // @public (undocumented)
132
130
  type EditorCardPluginEvents<T> = {
133
- push: (...events: T[]) => void;
134
- subscribe: (listener: Subscriber<T>) => () => void;
135
- flush: () => void;
136
- getSize: () => number;
131
+ push: (...events: T[]) => void;
132
+ subscribe: (listener: Subscriber<T>) => () => void;
133
+ flush: () => void;
134
+ getSize: () => number;
137
135
  };
138
136
 
139
137
  // @public (undocumented)
140
138
  enum EVENT {
141
- // (undocumented)
142
- CREATED = 'created',
143
- // (undocumented)
144
- DELETED = 'deleted',
145
- // (undocumented)
146
- UPDATED = 'updated',
139
+ // (undocumented)
140
+ CREATED = 'created',
141
+ // (undocumented)
142
+ DELETED = 'deleted',
143
+ // (undocumented)
144
+ UPDATED = 'updated',
147
145
  }
148
146
 
149
147
  // @public (undocumented)
150
148
  enum EVENT_SUBJECT {
151
- // (undocumented)
152
- DATASOURCE = 'datasource',
153
- // (undocumented)
154
- LINK = 'link',
149
+ // (undocumented)
150
+ DATASOURCE = 'datasource',
151
+ // (undocumented)
152
+ LINK = 'link',
155
153
  }
156
154
 
157
155
  // @public
158
156
  type LinkCreatedEvent = {
159
- event: EVENT.CREATED;
160
- subject: EVENT_SUBJECT.LINK;
161
- data: Metadata_2;
157
+ event: EVENT.CREATED;
158
+ subject: EVENT_SUBJECT.LINK;
159
+ data: Metadata_2;
162
160
  };
163
161
 
164
162
  // @public (undocumented)
165
163
  type LinkDeletedEvent = {
166
- event: EVENT.DELETED;
167
- subject: EVENT_SUBJECT.LINK;
168
- data: Metadata_2;
164
+ event: EVENT.DELETED;
165
+ subject: EVENT_SUBJECT.LINK;
166
+ data: Metadata_2;
169
167
  };
170
168
 
171
169
  // @public (undocumented)
@@ -173,33 +171,33 @@ type LinkEvent = LinkCreatedEvent | LinkDeletedEvent | LinkUpdatedEvent;
173
171
 
174
172
  // @public (undocumented)
175
173
  type LinkUpdatedEvent = {
176
- event: EVENT.UPDATED;
177
- subject: EVENT_SUBJECT.LINK;
178
- data: Metadata_2<UpdateMetadata>;
174
+ event: EVENT.UPDATED;
175
+ subject: EVENT_SUBJECT.LINK;
176
+ data: Metadata_2<UpdateMetadata>;
179
177
  };
180
178
 
181
179
  // @public (undocumented)
182
180
  type Metadata_2<T = {}> = {
183
- node: Node_2;
184
- isUndo?: boolean;
185
- isRedo?: boolean;
186
- action?: string;
187
- inputMethod?: string;
188
- sourceEvent?: unknown;
189
- nodeContext?: string;
181
+ node: Node_2;
182
+ isUndo?: boolean;
183
+ isRedo?: boolean;
184
+ action?: string;
185
+ inputMethod?: string;
186
+ sourceEvent?: unknown;
187
+ nodeContext?: string;
190
188
  } & T;
191
189
 
192
190
  // @public (undocumented)
193
191
  type Request_2 = {
194
- pos: number;
195
- url: string;
196
- appearance: CardAppearance;
197
- compareLinkText: boolean;
198
- source: CardReplacementInputMethod;
199
- previousAppearance?: 'url' | CardAppearance;
200
- analyticsAction?: ACTION;
201
- shouldReplaceLink?: boolean;
202
- sourceEvent?: UIAnalyticsEvent | null | undefined;
192
+ pos: number;
193
+ url: string;
194
+ appearance: CardAppearance;
195
+ compareLinkText: boolean;
196
+ source: CardReplacementInputMethod;
197
+ previousAppearance?: 'url' | CardAppearance;
198
+ analyticsAction?: ACTION;
199
+ shouldReplaceLink?: boolean;
200
+ sourceEvent?: UIAnalyticsEvent | null | undefined;
203
201
  };
204
202
  export { Request_2 as Request };
205
203
 
@@ -208,7 +206,7 @@ type Subscriber<T> = (event: T) => void;
208
206
 
209
207
  // @public (undocumented)
210
208
  type UpdateMetadata = {
211
- previousDisplay?: string;
209
+ previousDisplay?: string;
212
210
  };
213
211
 
214
212
  // (No @packageDocumentation comment for this package)
@@ -222,9 +220,9 @@ type UpdateMetadata = {
222
220
 
223
221
  ```json
224
222
  {
225
- "@atlaskit/link-provider": "^1.6.2",
226
- "react": "^16.8.0",
227
- "react-intl-next": "npm:react-intl@^5.18.1"
223
+ "@atlaskit/link-provider": "^1.6.2",
224
+ "react": "^16.8.0",
225
+ "react-intl-next": "npm:react-intl@^5.18.1"
228
226
  }
229
227
  ```
230
228
 
@@ -1,6 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx } from '@emotion/react';
4
- import type { InlineCardOverlayProps } from '../InlineCardOverlay/types';
5
- declare const NarrowInlineCardOverlay: ({ children, isSelected, isVisible, testId, url, ...props }: React.PropsWithChildren<InlineCardOverlayProps>) => jsx.JSX.Element;
6
- export default NarrowInlineCardOverlay;
@@ -1,6 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx } from '@emotion/react';
4
- import type { InlineCardOverlayProps } from '../InlineCardOverlay/types';
5
- declare const NarrowInlineCardOverlay: ({ children, isSelected, isVisible, testId, url, ...props }: React.PropsWithChildren<InlineCardOverlayProps>) => jsx.JSX.Element;
6
- export default NarrowInlineCardOverlay;