@atlaskit/editor-plugin-card 7.3.1 → 7.4.1
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 +20 -0
- package/dist/cjs/nodeviews/blockCard.js +24 -6
- package/dist/cjs/nodeviews/embedCard.js +30 -8
- package/dist/cjs/nodeviews/inlineCard.js +1 -3
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +75 -42
- package/dist/cjs/ui/AwarenessWrapper/index.js +6 -8
- package/dist/cjs/ui/preview/PreviewInvoker.js +33 -0
- package/dist/es2019/nodeviews/blockCard.js +24 -6
- package/dist/es2019/nodeviews/embedCard.js +30 -8
- package/dist/es2019/nodeviews/inlineCard.js +1 -3
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +76 -42
- package/dist/es2019/ui/AwarenessWrapper/index.js +6 -8
- package/dist/es2019/ui/preview/PreviewInvoker.js +22 -0
- package/dist/esm/nodeviews/blockCard.js +24 -6
- package/dist/esm/nodeviews/embedCard.js +30 -8
- package/dist/esm/nodeviews/inlineCard.js +1 -3
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +75 -42
- package/dist/esm/ui/AwarenessWrapper/index.js +6 -8
- package/dist/esm/ui/preview/PreviewInvoker.js +25 -0
- package/dist/types/nodeviews/blockCard.d.ts +1 -1
- package/dist/types/nodeviews/embedCard.d.ts +1 -1
- package/dist/types/ui/preview/PreviewInvoker.d.ts +12 -0
- package/dist/types-ts4.5/nodeviews/blockCard.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/embedCard.d.ts +1 -1
- package/dist/types-ts4.5/ui/preview/PreviewInvoker.d.ts +12 -0
- package/package.json +6 -6
|
@@ -25,7 +25,7 @@ var loaderWrapperStyles = css({
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
export var AwarenessWrapper = function AwarenessWrapper(_ref) {
|
|
28
|
-
var _cardContext$
|
|
28
|
+
var _cardContext$value2;
|
|
29
29
|
var cardContext = _ref.cardContext,
|
|
30
30
|
children = _ref.children,
|
|
31
31
|
getPos = _ref.getPos,
|
|
@@ -77,10 +77,8 @@ export var AwarenessWrapper = function AwarenessWrapper(_ref) {
|
|
|
77
77
|
setIsHovered(isHovered);
|
|
78
78
|
setOverlayHoveredStyles(isHovered);
|
|
79
79
|
}, [setOverlayHoveredStyles]);
|
|
80
|
-
var isPreviewPanelAvailable = cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.isPreviewPanelAvailable;
|
|
81
|
-
var shouldShowGlancePanel = (isPreviewPanelAvailable || false) && fg('platform_editor_preview_panel_linking');
|
|
82
80
|
var cardWithOverlay = useMemo(function () {
|
|
83
|
-
if (shouldShowLinkOverlay && !
|
|
81
|
+
if (shouldShowLinkOverlay && !editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_preview_panel_linking')) {
|
|
84
82
|
return jsx(InlineCardOverlay, {
|
|
85
83
|
isSelected: isSelected,
|
|
86
84
|
isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
|
|
@@ -94,11 +92,11 @@ export var AwarenessWrapper = function AwarenessWrapper(_ref) {
|
|
|
94
92
|
}, children);
|
|
95
93
|
}
|
|
96
94
|
return children;
|
|
97
|
-
}, [shouldShowLinkOverlay, children, isSelected, isResolvedViewRendered, isInserted, isHovered, url, handleOverlayChange
|
|
95
|
+
}, [shouldShowLinkOverlay, children, isSelected, isResolvedViewRendered, isInserted, isHovered, url, handleOverlayChange]);
|
|
98
96
|
var isInline = appearance === 'inline';
|
|
99
97
|
var placeholderUniqId = linkPosition || 0;
|
|
100
98
|
return useMemo(function () {
|
|
101
|
-
var _cardContext$
|
|
99
|
+
var _cardContext$value;
|
|
102
100
|
return jsx("span", {
|
|
103
101
|
css: shouldShowLinkPulse && loaderWrapperStyles
|
|
104
102
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -109,7 +107,7 @@ export var AwarenessWrapper = function AwarenessWrapper(_ref) {
|
|
|
109
107
|
"data-ssr-placeholder-replace": "awareness-wrapper-".concat(placeholderUniqId)
|
|
110
108
|
}, jsx(AnalyticsContext, {
|
|
111
109
|
data: {
|
|
112
|
-
attributes: getResolvedAttributesFromStore(url, 'inline', cardContext === null || cardContext === void 0 || (_cardContext$
|
|
110
|
+
attributes: getResolvedAttributesFromStore(url, 'inline', cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
|
|
113
111
|
}
|
|
114
112
|
}, jsx(DiscoveryPulse, {
|
|
115
113
|
localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
@@ -119,5 +117,5 @@ export var AwarenessWrapper = function AwarenessWrapper(_ref) {
|
|
|
119
117
|
testId: "link-discovery-pulse",
|
|
120
118
|
isInline: isInline
|
|
121
119
|
}, cardWithOverlay)));
|
|
122
|
-
}, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$
|
|
120
|
+
}, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay, isInline, placeholderUniqId]);
|
|
123
121
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { useSmartLinkActions } from '@atlaskit/smart-card/hooks';
|
|
3
|
+
export var PreviewInvoker = function PreviewInvoker(_ref) {
|
|
4
|
+
var url = _ref.url,
|
|
5
|
+
appearance = _ref.appearance,
|
|
6
|
+
children = _ref.children;
|
|
7
|
+
var actions = useSmartLinkActions({
|
|
8
|
+
url: url,
|
|
9
|
+
appearance: appearance
|
|
10
|
+
});
|
|
11
|
+
var preview = useMemo(function () {
|
|
12
|
+
return actions.find(function (action) {
|
|
13
|
+
return action.id === 'preview-content';
|
|
14
|
+
});
|
|
15
|
+
}, [actions]);
|
|
16
|
+
var invokePreview = useCallback(function () {
|
|
17
|
+
try {
|
|
18
|
+
preview === null || preview === void 0 || preview.invoke();
|
|
19
|
+
} catch (_unused) {}
|
|
20
|
+
}, [preview]);
|
|
21
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children({
|
|
22
|
+
canPreview: !!preview,
|
|
23
|
+
invokePreview: invokePreview
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
@@ -49,4 +49,4 @@ export interface BlockCardNodeViewProperties {
|
|
|
49
49
|
linkType?: string;
|
|
50
50
|
}>;
|
|
51
51
|
}
|
|
52
|
-
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
|
|
52
|
+
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
|
|
@@ -64,4 +64,4 @@ export interface EmbedCardNodeViewProperties {
|
|
|
64
64
|
isPageSSRed: EmbedCardNodeViewProps['isPageSSRed'];
|
|
65
65
|
CompetitorPrompt?: EmbedCardNodeViewProps['CompetitorPrompt'];
|
|
66
66
|
}
|
|
67
|
-
export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
|
|
67
|
+
export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type PreviewInvokerProps = {
|
|
4
|
+
url: string;
|
|
5
|
+
appearance: 'inline' | 'block' | 'embed';
|
|
6
|
+
children: (api: {
|
|
7
|
+
canPreview: boolean;
|
|
8
|
+
invokePreview?: () => void;
|
|
9
|
+
}) => ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare const PreviewInvoker: ({ url, appearance, children }: PreviewInvokerProps) => React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -49,4 +49,4 @@ export interface BlockCardNodeViewProperties {
|
|
|
49
49
|
linkType?: string;
|
|
50
50
|
}>;
|
|
51
51
|
}
|
|
52
|
-
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
|
|
52
|
+
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
|
|
@@ -64,4 +64,4 @@ export interface EmbedCardNodeViewProperties {
|
|
|
64
64
|
isPageSSRed: EmbedCardNodeViewProps['isPageSSRed'];
|
|
65
65
|
CompetitorPrompt?: EmbedCardNodeViewProps['CompetitorPrompt'];
|
|
66
66
|
}
|
|
67
|
-
export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
|
|
67
|
+
export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type PreviewInvokerProps = {
|
|
4
|
+
url: string;
|
|
5
|
+
appearance: 'inline' | 'block' | 'embed';
|
|
6
|
+
children: (api: {
|
|
7
|
+
canPreview: boolean;
|
|
8
|
+
invokePreview?: () => void;
|
|
9
|
+
}) => ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare const PreviewInvoker: ({ url, appearance, children }: PreviewInvokerProps) => React.JSX.Element;
|
|
12
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.1",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,20 +49,20 @@
|
|
|
49
49
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
50
50
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
51
51
|
"@atlaskit/frontend-utilities": "^3.1.0",
|
|
52
|
-
"@atlaskit/icon": "^27.
|
|
52
|
+
"@atlaskit/icon": "^27.12.0",
|
|
53
53
|
"@atlaskit/link": "^3.2.0",
|
|
54
54
|
"@atlaskit/link-analytics": "^10.0.0",
|
|
55
55
|
"@atlaskit/link-client-extension": "^5.0.0",
|
|
56
56
|
"@atlaskit/link-datasource": "^4.19.0",
|
|
57
57
|
"@atlaskit/linking-common": "^9.2.0",
|
|
58
58
|
"@atlaskit/linking-types": "^14.0.0",
|
|
59
|
-
"@atlaskit/menu": "^8.
|
|
59
|
+
"@atlaskit/menu": "^8.3.0",
|
|
60
60
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
61
61
|
"@atlaskit/platform-feature-flags-react": "^0.2.0",
|
|
62
62
|
"@atlaskit/primitives": "^14.11.0",
|
|
63
|
-
"@atlaskit/smart-card": "^40.
|
|
63
|
+
"@atlaskit/smart-card": "^40.10.0",
|
|
64
64
|
"@atlaskit/theme": "^19.0.0",
|
|
65
|
-
"@atlaskit/tmp-editor-statsig": "^9.
|
|
65
|
+
"@atlaskit/tmp-editor-statsig": "^9.28.0",
|
|
66
66
|
"@atlaskit/tokens": "^6.0.0",
|
|
67
67
|
"@babel/runtime": "^7.0.0",
|
|
68
68
|
"@emotion/react": "^11.7.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"uuid": "^3.1.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@atlaskit/editor-common": "^107.
|
|
75
|
+
"@atlaskit/editor-common": "^107.23.0",
|
|
76
76
|
"@atlaskit/link-provider": "^3.4.0",
|
|
77
77
|
"react": "^18.2.0",
|
|
78
78
|
"react-intl-next": "npm:react-intl@^5.18.1"
|