@atlaskit/editor-plugin-card 0.5.1 → 0.5.2
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 +6 -0
- package/dist/cjs/pm-plugins/util/resolve.js +10 -4
- package/dist/es2019/pm-plugins/util/resolve.js +10 -4
- package/dist/esm/pm-plugins/util/resolve.js +10 -4
- package/dist/types/pm-plugins/util/resolve.d.ts +6 -6
- package/dist/types-ts4.5/pm-plugins/util/resolve.d.ts +6 -6
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 0.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`386b8378aeb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/386b8378aeb) - Datasource ADF no longer included when feature flag call from canRenderDatasource returns false
|
|
8
|
+
|
|
3
9
|
## 0.5.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.resolveWithProvider = exports.handleProvider = void 0;
|
|
7
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
7
8
|
var _actions = require("../actions");
|
|
8
9
|
var _doc = require("../doc");
|
|
9
10
|
// ============================================================================ //
|
|
@@ -23,14 +24,19 @@ var resolveWithProvider = function resolveWithProvider(view, provider, request,
|
|
|
23
24
|
};
|
|
24
25
|
exports.resolveWithProvider = resolveWithProvider;
|
|
25
26
|
var updateCardType = function updateCardType(resolvedCard, options) {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
if (resolvedCard.type === 'blockCard' && 'datasource' in resolvedCard.attrs) {
|
|
28
|
+
var datasourceId = resolvedCard.attrs.datasource.id;
|
|
29
|
+
if (!options.allowDatasource || !(0, _utils.canRenderDatasource)(datasourceId)) {
|
|
30
|
+
delete resolvedCard.attrs.datasource;
|
|
31
|
+
resolvedCard.type = 'inlineCard';
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
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) {
|
|
28
36
|
// clean out the 'layout' attr from an embedCard type that should be transformed into the inlineCard type.
|
|
29
37
|
if (resolvedCard.type === 'embedCard') {
|
|
30
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
39
|
delete resolvedCard.attrs.layout;
|
|
32
|
-
} else if (isDatasource) {
|
|
33
|
-
delete resolvedCard.attrs.datasource;
|
|
34
40
|
}
|
|
35
41
|
resolvedCard.type = 'inlineCard';
|
|
36
42
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
1
2
|
import { setProvider } from '../actions';
|
|
2
3
|
import { handleFallbackWithAnalytics, replaceQueuedUrlWithCard } from '../doc';
|
|
3
4
|
|
|
@@ -17,14 +18,19 @@ export const resolveWithProvider = (view, provider, request, options, editorAnal
|
|
|
17
18
|
return handleResolve;
|
|
18
19
|
};
|
|
19
20
|
const updateCardType = (resolvedCard, options) => {
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
if (resolvedCard.type === 'blockCard' && 'datasource' in resolvedCard.attrs) {
|
|
22
|
+
const datasourceId = resolvedCard.attrs.datasource.id;
|
|
23
|
+
if (!options.allowDatasource || !canRenderDatasource(datasourceId)) {
|
|
24
|
+
delete resolvedCard.attrs.datasource;
|
|
25
|
+
resolvedCard.type = 'inlineCard';
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
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) {
|
|
22
30
|
// clean out the 'layout' attr from an embedCard type that should be transformed into the inlineCard type.
|
|
23
31
|
if (resolvedCard.type === 'embedCard') {
|
|
24
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
33
|
delete resolvedCard.attrs.layout;
|
|
26
|
-
} else if (isDatasource) {
|
|
27
|
-
delete resolvedCard.attrs.datasource;
|
|
28
34
|
}
|
|
29
35
|
resolvedCard.type = 'inlineCard';
|
|
30
36
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
1
2
|
import { setProvider } from '../actions';
|
|
2
3
|
import { handleFallbackWithAnalytics, replaceQueuedUrlWithCard } from '../doc';
|
|
3
4
|
|
|
@@ -17,14 +18,19 @@ export var resolveWithProvider = function resolveWithProvider(view, provider, re
|
|
|
17
18
|
return handleResolve;
|
|
18
19
|
};
|
|
19
20
|
var updateCardType = function updateCardType(resolvedCard, options) {
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
if (resolvedCard.type === 'blockCard' && 'datasource' in resolvedCard.attrs) {
|
|
22
|
+
var datasourceId = resolvedCard.attrs.datasource.id;
|
|
23
|
+
if (!options.allowDatasource || !canRenderDatasource(datasourceId)) {
|
|
24
|
+
delete resolvedCard.attrs.datasource;
|
|
25
|
+
resolvedCard.type = 'inlineCard';
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
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) {
|
|
22
30
|
// clean out the 'layout' attr from an embedCard type that should be transformed into the inlineCard type.
|
|
23
31
|
if (resolvedCard.type === 'embedCard') {
|
|
24
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
33
|
delete resolvedCard.attrs.layout;
|
|
26
|
-
} else if (isDatasource) {
|
|
27
|
-
delete resolvedCard.attrs.datasource;
|
|
28
34
|
}
|
|
29
35
|
resolvedCard.type = 'inlineCard';
|
|
30
36
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
-
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { CardOptions } from '@atlaskit/editor-common/card';
|
|
4
|
-
import { CardProvider, DatasourceAdf } from '@atlaskit/editor-common/provider-factory';
|
|
5
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import { Request } from '../../types';
|
|
1
|
+
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
4
|
+
import type { CardProvider, DatasourceAdf } from '@atlaskit/editor-common/provider-factory';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { Request } from '../../types';
|
|
7
7
|
export declare const resolveWithProvider: (view: EditorView, provider: CardProvider, request: Request, options: CardOptions, editorAnalyticsApi: EditorAnalyticsAPI | undefined, createAnalyticsEvent: CreateUIAnalyticsEvent | undefined) => Promise<void | import("@atlaskit/linking-common").InlineCardAdf | import("@atlaskit/linking-common").BlockCardAdf | import("@atlaskit/linking-common").EmbedCardAdf | DatasourceAdf>;
|
|
8
8
|
export declare const handleProvider: (_: 'cardProvider', provider: Promise<CardProvider> | undefined, view: EditorView) => void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
-
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { CardOptions } from '@atlaskit/editor-common/card';
|
|
4
|
-
import { CardProvider, DatasourceAdf } from '@atlaskit/editor-common/provider-factory';
|
|
5
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import { Request } from '../../types';
|
|
1
|
+
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
4
|
+
import type { CardProvider, DatasourceAdf } from '@atlaskit/editor-common/provider-factory';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { Request } from '../../types';
|
|
7
7
|
export declare const resolveWithProvider: (view: EditorView, provider: CardProvider, request: Request, options: CardOptions, editorAnalyticsApi: EditorAnalyticsAPI | undefined, createAnalyticsEvent: CreateUIAnalyticsEvent | undefined) => Promise<void | import("@atlaskit/linking-common").InlineCardAdf | import("@atlaskit/linking-common").BlockCardAdf | import("@atlaskit/linking-common").EmbedCardAdf | DatasourceAdf>;
|
|
8
8
|
export declare const handleProvider: (_: 'cardProvider', provider: Promise<CardProvider> | undefined, view: EditorView) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.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.
|
|
51
|
-
"@atlaskit/theme": "^12.
|
|
52
|
-
"@atlaskit/tokens": "^1.
|
|
50
|
+
"@atlaskit/smart-card": "^26.20.0",
|
|
51
|
+
"@atlaskit/theme": "^12.6.0",
|
|
52
|
+
"@atlaskit/tokens": "^1.20.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|
|
54
54
|
"@emotion/react": "^11.7.1",
|
|
55
55
|
"lodash": "^4.17.21",
|