@atlaskit/editor-plugin-card 7.1.0 → 7.2.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 +27 -0
- package/dist/cjs/nodeviews/embedCard.js +51 -4
- package/dist/cjs/nodeviews/genericCard.js +2 -19
- package/dist/cjs/nodeviews/inlineCard.js +1 -45
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +34 -18
- package/dist/cjs/pm-plugins/main.js +4 -24
- package/dist/cjs/ui/{OpenButtonOverlay → HoverLinkOverlay}/index.js +26 -14
- package/dist/cjs/ui/toolbar.js +8 -1
- package/dist/es2019/nodeviews/embedCard.js +49 -4
- package/dist/es2019/nodeviews/genericCard.js +2 -19
- package/dist/es2019/nodeviews/inlineCard.js +2 -42
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +34 -18
- package/dist/es2019/pm-plugins/main.js +1 -23
- package/dist/es2019/ui/{OpenButtonOverlay → HoverLinkOverlay}/index.js +25 -14
- package/dist/es2019/ui/toolbar.js +8 -1
- package/dist/esm/nodeviews/embedCard.js +51 -4
- package/dist/esm/nodeviews/genericCard.js +2 -19
- package/dist/esm/nodeviews/inlineCard.js +2 -46
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +34 -18
- package/dist/esm/pm-plugins/main.js +3 -23
- package/dist/esm/ui/{OpenButtonOverlay → HoverLinkOverlay}/index.js +26 -14
- package/dist/esm/ui/toolbar.js +8 -1
- package/dist/types/nodeviews/embedCard.d.ts +2 -1
- package/dist/types/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +0 -2
- package/dist/types/ui/HoverLinkOverlay/index.d.ts +9 -0
- package/dist/types/ui/{OpenButtonOverlay → HoverLinkOverlay}/types.d.ts +3 -1
- package/dist/types/ui/datasourceErrorBoundary.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/embedCard.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -2
- package/dist/types-ts4.5/ui/HoverLinkOverlay/index.d.ts +9 -0
- package/dist/types-ts4.5/ui/{OpenButtonOverlay → HoverLinkOverlay}/types.d.ts +3 -1
- package/dist/types-ts4.5/ui/datasourceErrorBoundary.d.ts +1 -1
- package/package.json +6 -8
- package/dist/cjs/ui/PanelButtonOverlay/index.js +0 -171
- package/dist/cjs/ui/PanelButtonOverlay/types.js +0 -5
- package/dist/es2019/ui/PanelButtonOverlay/index.js +0 -148
- package/dist/esm/ui/OpenButtonOverlay/types.js +0 -1
- package/dist/esm/ui/PanelButtonOverlay/index.js +0 -158
- package/dist/esm/ui/PanelButtonOverlay/types.js +0 -1
- package/dist/types/ui/OpenButtonOverlay/index.d.ts +0 -9
- package/dist/types/ui/PanelButtonOverlay/index.d.ts +0 -9
- package/dist/types/ui/PanelButtonOverlay/types.d.ts +0 -7
- package/dist/types-ts4.5/ui/OpenButtonOverlay/index.d.ts +0 -9
- package/dist/types-ts4.5/ui/PanelButtonOverlay/index.d.ts +0 -9
- package/dist/types-ts4.5/ui/PanelButtonOverlay/types.d.ts +0 -7
- /package/dist/cjs/ui/{OpenButtonOverlay → HoverLinkOverlay}/types.js +0 -0
- /package/dist/es2019/ui/{OpenButtonOverlay → HoverLinkOverlay}/types.js +0 -0
- /package/dist/{es2019/ui/PanelButtonOverlay → esm/ui/HoverLinkOverlay}/types.js +0 -0
|
@@ -7,11 +7,15 @@ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
|
7
7
|
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
8
8
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
9
9
|
import { findOverflowScrollParent, MediaSingle as RichMediaWrapper, UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
10
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
10
11
|
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
11
|
-
import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
12
|
+
import { akEditorFullPageNarrowBreakout, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
13
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
12
14
|
import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
|
|
15
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
16
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
14
17
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
18
|
+
import { BlockCardComponent } from './blockCard';
|
|
15
19
|
import { Card } from './genericCard';
|
|
16
20
|
const selector = states => {
|
|
17
21
|
var _states$widthState, _states$widthState2, _states$editorDisable;
|
|
@@ -40,7 +44,6 @@ const CardInner = ({
|
|
|
40
44
|
getLineLength,
|
|
41
45
|
view,
|
|
42
46
|
smartCard,
|
|
43
|
-
eventDispatcher,
|
|
44
47
|
updateSize,
|
|
45
48
|
getPos,
|
|
46
49
|
aspectRatio,
|
|
@@ -363,7 +366,49 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
363
366
|
}));
|
|
364
367
|
}
|
|
365
368
|
}
|
|
366
|
-
const
|
|
369
|
+
export const EmbedOrBlockCardComponent = props => {
|
|
370
|
+
const width = useSharedPluginStateSelector(props.pluginInjectionApi, 'width.width');
|
|
371
|
+
const viewAsBlockCard = width && width <= akEditorFullPageNarrowBreakout;
|
|
372
|
+
return viewAsBlockCard ? /*#__PURE__*/React.createElement(BlockCardComponent, {
|
|
373
|
+
id: props.id,
|
|
374
|
+
node: props.node,
|
|
375
|
+
view: props.view,
|
|
376
|
+
getPos: props.getPos,
|
|
377
|
+
pluginInjectionApi: props.pluginInjectionApi,
|
|
378
|
+
actionOptions: props.actionOptions,
|
|
379
|
+
onClick: props.onClick,
|
|
380
|
+
CompetitorPrompt: props.CompetitorPrompt,
|
|
381
|
+
allowResizing: props.allowResizing,
|
|
382
|
+
fullWidthMode: props.fullWidthMode,
|
|
383
|
+
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
384
|
+
eventDispatcher: props.eventDispatcher,
|
|
385
|
+
cardContext: props.cardContext,
|
|
386
|
+
smartCard: props.smartCard,
|
|
387
|
+
hasPreview: props.hasPreview,
|
|
388
|
+
liveHeight: props.liveHeight,
|
|
389
|
+
initialAspectRatio: props.initialAspectRatio
|
|
390
|
+
}) : /*#__PURE__*/React.createElement(EmbedCardComponent, {
|
|
391
|
+
id: props.id,
|
|
392
|
+
node: props.node,
|
|
393
|
+
view: props.view,
|
|
394
|
+
getPos: props.getPos,
|
|
395
|
+
pluginInjectionApi: props.pluginInjectionApi,
|
|
396
|
+
actionOptions: props.actionOptions,
|
|
397
|
+
onClick: props.onClick,
|
|
398
|
+
CompetitorPrompt: props.CompetitorPrompt,
|
|
399
|
+
allowResizing: props.allowResizing,
|
|
400
|
+
fullWidthMode: props.fullWidthMode,
|
|
401
|
+
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
402
|
+
eventDispatcher: props.eventDispatcher,
|
|
403
|
+
cardContext: props.cardContext,
|
|
404
|
+
smartCard: props.smartCard,
|
|
405
|
+
hasPreview: props.hasPreview,
|
|
406
|
+
liveHeight: props.liveHeight,
|
|
407
|
+
initialAspectRatio: props.initialAspectRatio
|
|
408
|
+
});
|
|
409
|
+
};
|
|
410
|
+
const WrappedEmbedCardWithCondition = componentWithCondition(() => expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true), EmbedOrBlockCardComponent, EmbedCardComponent);
|
|
411
|
+
const WrappedEmbedCard = Card(WrappedEmbedCardWithCondition, UnsupportedBlock);
|
|
367
412
|
export class EmbedCard extends ReactNodeView {
|
|
368
413
|
constructor(...args) {
|
|
369
414
|
super(...args);
|
|
@@ -399,7 +444,7 @@ export class EmbedCard extends ReactNodeView {
|
|
|
399
444
|
onClickCallback,
|
|
400
445
|
CompetitorPrompt
|
|
401
446
|
} = this.reactComponentProps;
|
|
402
|
-
return /*#__PURE__*/React.createElement(
|
|
447
|
+
return /*#__PURE__*/React.createElement(WrappedEmbedCard, {
|
|
403
448
|
node: this.node,
|
|
404
449
|
view: this.view,
|
|
405
450
|
eventDispatcher: eventDispatcher,
|
|
@@ -31,8 +31,7 @@ const WithClickHandler = ({
|
|
|
31
31
|
pluginInjectionApi,
|
|
32
32
|
url,
|
|
33
33
|
onClickCallback,
|
|
34
|
-
children
|
|
35
|
-
__livePage
|
|
34
|
+
children
|
|
36
35
|
}) => {
|
|
37
36
|
const {
|
|
38
37
|
mode
|
|
@@ -47,21 +46,6 @@ const WithClickHandler = ({
|
|
|
47
46
|
} catch {}
|
|
48
47
|
}
|
|
49
48
|
}, [url, onClickCallback]);
|
|
50
|
-
if (fg('linking_platform_smart_links_in_live_pages')) {
|
|
51
|
-
// Ignored via go/ees007
|
|
52
|
-
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
53
|
-
/**
|
|
54
|
-
* @todo: Add a check to determine if we're currently in a live page once ED-23920 and plugin
|
|
55
|
-
* is complete. The logic for which should allow navigation if we're in a live page and no callback
|
|
56
|
-
* has been provided. E.g.
|
|
57
|
-
*
|
|
58
|
-
* const allowNavigation = isLivePage && !onClickCallback;
|
|
59
|
-
*/
|
|
60
|
-
const allowNavigation = __livePage && !onClickCallback;
|
|
61
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children({
|
|
62
|
-
onClick: allowNavigation ? undefined : onClick
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
49
|
|
|
66
50
|
// Setting `onClick` to `undefined` ensures clicks on smartcards navigate to the URL.
|
|
67
51
|
// If in view mode and not overriding with onClickCallback option, then allow smartlinks to navigate on click.
|
|
@@ -130,8 +114,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
130
114
|
}, /*#__PURE__*/React.createElement(WithClickHandler, {
|
|
131
115
|
pluginInjectionApi: pluginInjectionApi,
|
|
132
116
|
onClickCallback: onClickCallback,
|
|
133
|
-
url: url
|
|
134
|
-
__livePage: this.props.__livePage
|
|
117
|
+
url: url
|
|
135
118
|
}, ({
|
|
136
119
|
onClick
|
|
137
120
|
}) => /*#__PURE__*/React.createElement(WithCardContext, null, cardContext => /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { memo, useCallback, useEffect, useMemo, useRef
|
|
2
|
+
import React, { memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import rafSchedule from 'raf-schd';
|
|
4
4
|
import uuid from 'uuid/v4';
|
|
5
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
7
|
-
import { handleNavigation } from '@atlaskit/editor-common/link';
|
|
8
7
|
import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
9
|
-
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
9
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
12
10
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
13
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
12
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
15
13
|
import { getAwarenessProps } from '../pm-plugins/utils';
|
|
16
|
-
import OverlayWrapper from '../ui/ConfigureOverlay';
|
|
17
14
|
import { visitCardLinkAnalytics } from '../ui/toolbar';
|
|
18
15
|
import { Card } from './genericCard';
|
|
19
16
|
import { InlineCardWithAwareness } from './inlineCardWithAwareness';
|
|
@@ -148,7 +145,6 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
148
145
|
}, card) : data ? card : null;
|
|
149
146
|
});
|
|
150
147
|
const WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
|
|
151
|
-
const WrappedInlineCard = Card(InlineCard, UnsupportedInline);
|
|
152
148
|
const selector = states => {
|
|
153
149
|
var _states$editorViewMod, _states$selectionStat;
|
|
154
150
|
return {
|
|
@@ -186,53 +182,17 @@ export function InlineCardNodeView(props) {
|
|
|
186
182
|
enableInlineUpgradeFeatures,
|
|
187
183
|
pluginInjectionApi,
|
|
188
184
|
onClickCallback,
|
|
189
|
-
__livePage,
|
|
190
185
|
isPageSSRed,
|
|
191
186
|
CompetitorPrompt
|
|
192
187
|
} = props;
|
|
193
|
-
const [isOverlayHovered, setIsOverlayHovered] = useState(false);
|
|
194
188
|
const {
|
|
195
|
-
mode
|
|
196
|
-
selection
|
|
189
|
+
mode
|
|
197
190
|
} = useSharedState(pluginInjectionApi);
|
|
198
|
-
const floatingToolbarNode = selection instanceof NodeSelection && selection.node;
|
|
199
191
|
const url = node.attrs.url;
|
|
200
192
|
const CompetitorPromptComponent = CompetitorPrompt && url ? /*#__PURE__*/React.createElement(CompetitorPrompt, {
|
|
201
193
|
sourceUrl: url,
|
|
202
194
|
linkType: "inline"
|
|
203
195
|
}) : null;
|
|
204
|
-
if (__livePage && fg('linking_platform_smart_links_in_live_pages')) {
|
|
205
|
-
const showHoverPreview = floatingToolbarNode !== node;
|
|
206
|
-
const livePagesHoverCardFadeInDelay = 800;
|
|
207
|
-
const inlineCard = /*#__PURE__*/React.createElement(WrappedInlineCard, {
|
|
208
|
-
isHovered: isOverlayHovered,
|
|
209
|
-
node: node,
|
|
210
|
-
view: view,
|
|
211
|
-
getPos: getPos,
|
|
212
|
-
actionOptions: actionOptions,
|
|
213
|
-
useAlternativePreloader: useAlternativePreloader,
|
|
214
|
-
onClickCallback: onClickCallback,
|
|
215
|
-
showHoverPreview: showHoverPreview,
|
|
216
|
-
hoverPreviewOptions: {
|
|
217
|
-
fadeInDelay: livePagesHoverCardFadeInDelay
|
|
218
|
-
},
|
|
219
|
-
isPageSSRed: isPageSSRed
|
|
220
|
-
});
|
|
221
|
-
return mode === 'view' ? inlineCard : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(OverlayWrapper, {
|
|
222
|
-
targetElementPos: getPos(),
|
|
223
|
-
view: view,
|
|
224
|
-
isHoveredCallback: setIsOverlayHovered,
|
|
225
|
-
onOpenLinkClick: event => {
|
|
226
|
-
var _pluginInjectionApi$a2;
|
|
227
|
-
handleNavigation({
|
|
228
|
-
fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions.fireAnalyticsEvent,
|
|
229
|
-
onClickCallback,
|
|
230
|
-
url,
|
|
231
|
-
event
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
}, inlineCard), fg('prompt_whiteboard_competitor_link_gate') && CompetitorPromptComponent);
|
|
235
|
-
}
|
|
236
196
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(WrappedInlineCardWithAwareness, _extends({
|
|
237
197
|
node: node,
|
|
238
198
|
view: view,
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { getObjectAri, getObjectName, getObjectIconUrl } from '@atlaskit/smart-card';
|
|
5
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
7
|
import { registerRemoveOverlay } from '../pm-plugins/actions';
|
|
7
8
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
8
9
|
import { AwarenessWrapper } from '../ui/AwarenessWrapper';
|
|
9
|
-
import
|
|
10
|
-
import PanelButtonOverlay from '../ui/PanelButtonOverlay';
|
|
10
|
+
import HoverLinkOverlay from '../ui/HoverLinkOverlay';
|
|
11
11
|
import { InlineCard } from './inlineCard';
|
|
12
12
|
const selector = states => {
|
|
13
|
-
var _states$editorViewMod;
|
|
13
|
+
var _states$editorViewMod, _states$selectionStat;
|
|
14
14
|
return {
|
|
15
|
-
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
15
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
|
|
16
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
19
|
-
return useSharedPluginStateWithSelector(pluginInjectionApi, ['editorViewMode'], selector);
|
|
20
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['selection', 'editorViewMode'], selector);
|
|
20
21
|
}, pluginInjectionApi => {
|
|
21
22
|
const {
|
|
23
|
+
selectionState,
|
|
22
24
|
editorViewModeState
|
|
23
|
-
} = useSharedPluginState(pluginInjectionApi, ['editorViewMode']);
|
|
25
|
+
} = useSharedPluginState(pluginInjectionApi, ['selection', 'editorViewMode']);
|
|
24
26
|
return {
|
|
25
|
-
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
27
|
+
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
28
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
26
29
|
};
|
|
27
30
|
});
|
|
28
31
|
export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
@@ -67,11 +70,14 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
67
70
|
}
|
|
68
71
|
}, [isOverlayEnabled]);
|
|
69
72
|
const {
|
|
70
|
-
mode
|
|
73
|
+
mode,
|
|
74
|
+
selection
|
|
71
75
|
} = useSharedState(pluginInjectionApi);
|
|
76
|
+
const floatingToolbarNode = selection instanceof NodeSelection && selection.node;
|
|
77
|
+
const showHoverPreview = floatingToolbarNode !== node && fg('platform_editor_preview_panel_linking');
|
|
72
78
|
const innerCardWithOpenButtonOverlay = useMemo(() => {
|
|
73
79
|
var _pluginInjectionApi$a;
|
|
74
|
-
return /*#__PURE__*/React.createElement(
|
|
80
|
+
return /*#__PURE__*/React.createElement(HoverLinkOverlay, {
|
|
75
81
|
isVisible: isResolvedViewRendered,
|
|
76
82
|
url: node.attrs.url,
|
|
77
83
|
editorAppearance: editorAppearance,
|
|
@@ -88,9 +94,10 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
88
94
|
cardContext: cardContext,
|
|
89
95
|
isHovered: isHovered,
|
|
90
96
|
isPageSSRed: isPageSSRed,
|
|
91
|
-
pluginInjectionApi: pluginInjectionApi
|
|
97
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
98
|
+
showHoverPreview: showHoverPreview
|
|
92
99
|
}));
|
|
93
|
-
}, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, pluginInjectionApi]);
|
|
100
|
+
}, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, pluginInjectionApi, showHoverPreview]);
|
|
94
101
|
const innerCardOriginal = useMemo(() => /*#__PURE__*/React.createElement(InlineCard, {
|
|
95
102
|
node: node,
|
|
96
103
|
view: view,
|
|
@@ -102,18 +109,19 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
102
109
|
cardContext: cardContext,
|
|
103
110
|
isHovered: isHovered,
|
|
104
111
|
isPageSSRed: isPageSSRed,
|
|
105
|
-
pluginInjectionApi: pluginInjectionApi
|
|
106
|
-
|
|
112
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
113
|
+
showHoverPreview: showHoverPreview
|
|
114
|
+
}), [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi, showHoverPreview]);
|
|
107
115
|
const shouldShowOpenButtonOverlay = useMemo(() => {
|
|
108
116
|
const shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless';
|
|
109
|
-
return (mode === 'edit' || editorAppearance === 'comment' || shouldShowOpenButtonOverlayInChomeless) && editorExperiment('platform_editor_controls', 'variant1');
|
|
117
|
+
return (mode === 'edit' || editorAppearance === 'comment' || shouldShowOpenButtonOverlayInChomeless) && (editorExperiment('platform_editor_controls', 'variant1') || fg('platform_editor_preview_panel_linking'));
|
|
110
118
|
}, [mode, editorAppearance]);
|
|
111
119
|
let innerCard = shouldShowOpenButtonOverlay ? innerCardWithOpenButtonOverlay : innerCardOriginal;
|
|
112
120
|
if (fg('platform_editor_preview_panel_linking')) {
|
|
113
121
|
var _cardContext$value, _cardContext$value$st;
|
|
114
122
|
const cardState = cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : (_cardContext$value$st = _cardContext$value.store) === null || _cardContext$value$st === void 0 ? void 0 : _cardContext$value$st.getState()[node.attrs.url];
|
|
115
123
|
if (cardState) {
|
|
116
|
-
var _cardContext$value2, _cardContext$value2$i, _cardContext$value3;
|
|
124
|
+
var _cardContext$value2, _cardContext$value2$i, _cardContext$value3, _pluginInjectionApi$a2;
|
|
117
125
|
const ari = getObjectAri(cardState.details);
|
|
118
126
|
const name = getObjectName(cardState.details);
|
|
119
127
|
const iconUrl = getObjectIconUrl(cardState.details);
|
|
@@ -121,8 +129,11 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
121
129
|
ari
|
|
122
130
|
}));
|
|
123
131
|
const openPreviewPanel = cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value3 = cardContext.value) === null || _cardContext$value3 === void 0 ? void 0 : _cardContext$value3.openPreviewPanel;
|
|
124
|
-
const handleOpenGlancePanelClick =
|
|
132
|
+
const handleOpenGlancePanelClick = event => {
|
|
125
133
|
if (openPreviewPanel && isPanelAvailable) {
|
|
134
|
+
// Prevent anchor default behaviour(click to open the anchor link)
|
|
135
|
+
// When glance panel is available, let openPreviewPanel handle it
|
|
136
|
+
event.preventDefault();
|
|
126
137
|
openPreviewPanel({
|
|
127
138
|
url: node.attrs.url,
|
|
128
139
|
ari,
|
|
@@ -131,9 +142,13 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
131
142
|
});
|
|
132
143
|
}
|
|
133
144
|
};
|
|
134
|
-
const innerCardWithPanelButtonOverlay = /*#__PURE__*/React.createElement(
|
|
145
|
+
const innerCardWithPanelButtonOverlay = /*#__PURE__*/React.createElement(HoverLinkOverlay, {
|
|
135
146
|
isVisible: isResolvedViewRendered,
|
|
147
|
+
url: node.attrs.url,
|
|
136
148
|
editorAppearance: editorAppearance,
|
|
149
|
+
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions,
|
|
150
|
+
view: view,
|
|
151
|
+
showPanelButton: !!isPanelAvailable,
|
|
137
152
|
onClick: handleOpenGlancePanelClick
|
|
138
153
|
}, /*#__PURE__*/React.createElement(InlineCard, {
|
|
139
154
|
node: node,
|
|
@@ -146,7 +161,8 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
146
161
|
cardContext: cardContext,
|
|
147
162
|
isHovered: isHovered,
|
|
148
163
|
isPageSSRed: isPageSSRed,
|
|
149
|
-
pluginInjectionApi: pluginInjectionApi
|
|
164
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
165
|
+
showHoverPreview: showHoverPreview
|
|
150
166
|
}));
|
|
151
167
|
innerCard = isPanelAvailable && openPreviewPanel ? innerCardWithPanelButtonOverlay : innerCard;
|
|
152
168
|
}
|
|
@@ -5,7 +5,6 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/st
|
|
|
5
5
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { InlineCardNodeView } from '../nodeviews/inlineCard';
|
|
10
9
|
import { lazyBlockCardView } from '../nodeviews/lazy-block-card';
|
|
11
10
|
import { lazyEmbedCardView } from '../nodeviews/lazy-embed-card';
|
|
@@ -20,19 +19,6 @@ import { handleProvider, resolveWithProvider } from './util/resolve';
|
|
|
20
19
|
import { getNewRequests, getPluginState, getPluginStateWithUpdatedPos } from './util/state';
|
|
21
20
|
import { isBlockSupportedAtPosition, isEmbedSupportedAtPosition } from './utils';
|
|
22
21
|
const LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
|
|
23
|
-
export const ALLOW_EVENTS_CLASSNAME = 'card-plugin-element-allow-events';
|
|
24
|
-
export const stopEvent = event => {
|
|
25
|
-
if (!fg('linking_platform_smart_links_in_live_pages')) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
const target = event.target;
|
|
29
|
-
// Stop events from propogating to prose-mirror and selecting the node and/or
|
|
30
|
-
// opening the toolbar, unless a parent of the target has a defined className
|
|
31
|
-
if (target instanceof HTMLElement && target.closest(`.${ALLOW_EVENTS_CLASSNAME}`)) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
return true;
|
|
35
|
-
};
|
|
36
22
|
const handleAwarenessOverlay = view => {
|
|
37
23
|
const currentState = getPluginState(view.state);
|
|
38
24
|
const overlayCandidatePos = currentState === null || currentState === void 0 ? void 0 : currentState.overlayCandidatePosition;
|
|
@@ -56,8 +42,6 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
56
42
|
allowEmbeds,
|
|
57
43
|
allowBlockCards,
|
|
58
44
|
onClickCallback,
|
|
59
|
-
// @ts-ignore Temporary solution to check for Live Page editor.
|
|
60
|
-
__livePage,
|
|
61
45
|
isPageSSRed,
|
|
62
46
|
CompetitorPrompt
|
|
63
47
|
} = options;
|
|
@@ -73,15 +57,9 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
73
57
|
allowBlockCards,
|
|
74
58
|
pluginInjectionApi,
|
|
75
59
|
onClickCallback,
|
|
76
|
-
__livePage,
|
|
77
60
|
isPageSSRed,
|
|
78
61
|
CompetitorPrompt
|
|
79
|
-
}
|
|
80
|
-
...(__livePage && fg('linking_platform_smart_links_in_live_pages') && {
|
|
81
|
-
extraNodeViewProps: {
|
|
82
|
-
stopEvent
|
|
83
|
-
}
|
|
84
|
-
})
|
|
62
|
+
}
|
|
85
63
|
});
|
|
86
64
|
return new SafePlugin({
|
|
87
65
|
state: {
|
|
@@ -11,6 +11,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
11
11
|
import { cardMessages } from '@atlaskit/editor-common/messages';
|
|
12
12
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
13
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
14
|
+
import PanelRightIcon from '@atlaskit/icon/core/panel-right';
|
|
14
15
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
15
16
|
import { Anchor, Box, Text, xcss } from '@atlaskit/primitives';
|
|
16
17
|
import { visitCardLinkAnalytics } from '../toolbar';
|
|
@@ -57,31 +58,33 @@ const MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY = 45;
|
|
|
57
58
|
const ICON_WIDTH = 16;
|
|
58
59
|
const DEFAULT_OPEN_TEXT_WIDTH = 28; // Default open text width in English
|
|
59
60
|
|
|
60
|
-
const
|
|
61
|
+
const HoverLinkOverlay = ({
|
|
61
62
|
children,
|
|
62
63
|
isVisible = false,
|
|
63
64
|
url,
|
|
64
65
|
editorAppearance,
|
|
65
66
|
editorAnalyticsApi,
|
|
66
|
-
view
|
|
67
|
+
view,
|
|
68
|
+
onClick,
|
|
69
|
+
showPanelButton = false
|
|
67
70
|
}) => {
|
|
68
71
|
const {
|
|
69
72
|
formatMessage
|
|
70
73
|
} = useIntl();
|
|
71
|
-
const label = formatMessage(cardMessages.openButtonTitle);
|
|
74
|
+
const label = showPanelButton ? formatMessage(cardMessages.panelButtonTitle) : formatMessage(cardMessages.openButtonTitle);
|
|
72
75
|
const containerRef = useRef(null);
|
|
73
|
-
const
|
|
76
|
+
const hoverLinkButtonRef = useRef(null);
|
|
74
77
|
const hiddenTextRef = useRef(null);
|
|
75
78
|
const [showLabel, setShowLabel] = useState(true);
|
|
76
79
|
const [isHovered, setHovered] = useState(false);
|
|
77
80
|
const openTextWidthRef = useRef(null);
|
|
78
81
|
useLayoutEffect(() => {
|
|
79
|
-
var _containerRef$current,
|
|
82
|
+
var _containerRef$current, _hoverLinkButtonRef$c;
|
|
80
83
|
if (!isVisible || !isHovered) {
|
|
81
84
|
return;
|
|
82
85
|
}
|
|
83
86
|
const cardWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth;
|
|
84
|
-
const openButtonWidth = (
|
|
87
|
+
const openButtonWidth = (_hoverLinkButtonRef$c = hoverLinkButtonRef.current) === null || _hoverLinkButtonRef$c === void 0 ? void 0 : _hoverLinkButtonRef$c.offsetWidth;
|
|
85
88
|
|
|
86
89
|
// Get the hidden text width
|
|
87
90
|
if (!openTextWidthRef.current) {
|
|
@@ -116,13 +119,19 @@ const OpenButtonOverlay = ({
|
|
|
116
119
|
}
|
|
117
120
|
};
|
|
118
121
|
const handleDoubleClick = () => {
|
|
119
|
-
|
|
122
|
+
if (!showPanelButton) {
|
|
123
|
+
sendVisitLinkAnalytics(INPUT_METHOD.DOUBLE_CLICK);
|
|
120
124
|
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
// Double click opens the link in a new tab
|
|
126
|
+
window.open(url, '_blank');
|
|
127
|
+
}
|
|
123
128
|
};
|
|
124
|
-
const handleClick =
|
|
125
|
-
|
|
129
|
+
const handleClick = event => {
|
|
130
|
+
if (showPanelButton && onClick) {
|
|
131
|
+
onClick(event);
|
|
132
|
+
} else {
|
|
133
|
+
sendVisitLinkAnalytics(INPUT_METHOD.BUTTON);
|
|
134
|
+
}
|
|
126
135
|
};
|
|
127
136
|
return (
|
|
128
137
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
@@ -140,7 +149,7 @@ const OpenButtonOverlay = ({
|
|
|
140
149
|
size: "small",
|
|
141
150
|
maxLines: 1
|
|
142
151
|
}, label)), isHovered && jsx(Anchor, {
|
|
143
|
-
ref:
|
|
152
|
+
ref: hoverLinkButtonRef,
|
|
144
153
|
xcss: linkStyles,
|
|
145
154
|
href: url,
|
|
146
155
|
target: "_blank",
|
|
@@ -151,7 +160,9 @@ const OpenButtonOverlay = ({
|
|
|
151
160
|
}, jsx(Box, {
|
|
152
161
|
xcss: iconWrapperStyles,
|
|
153
162
|
"data-inlinecard-button-overlay": "icon-wrapper-line-height"
|
|
154
|
-
}, jsx(
|
|
163
|
+
}, showPanelButton ? jsx(PanelRightIcon, {
|
|
164
|
+
label: ""
|
|
165
|
+
}) : jsx(LinkExternalIcon, {
|
|
155
166
|
label: ""
|
|
156
167
|
})), showLabel && jsx(Text, {
|
|
157
168
|
size: "small",
|
|
@@ -160,4 +171,4 @@ const OpenButtonOverlay = ({
|
|
|
160
171
|
}, label)))
|
|
161
172
|
);
|
|
162
173
|
};
|
|
163
|
-
export default
|
|
174
|
+
export default HoverLinkOverlay;
|
|
@@ -23,6 +23,7 @@ import OpenIcon from '@atlaskit/icon/core/migration/link-external--shortcut';
|
|
|
23
23
|
import CogIcon from '@atlaskit/icon/core/migration/settings--editor-settings';
|
|
24
24
|
import SettingsIcon from '@atlaskit/icon/core/settings';
|
|
25
25
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
26
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
26
27
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
27
28
|
import { changeSelectedCardToText } from '../pm-plugins/doc';
|
|
28
29
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
@@ -141,7 +142,13 @@ export const floatingToolbar = (cardOptions, lpLinkPicker, linkPickerOptions, pl
|
|
|
141
142
|
if (isEmbedCard) {
|
|
142
143
|
// Ignored via go/ees005
|
|
143
144
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
144
|
-
|
|
145
|
+
const richMediaElement = element.querySelector(`.${richMediaClassName}`);
|
|
146
|
+
if (!expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
|
|
147
|
+
return richMediaElement;
|
|
148
|
+
}
|
|
149
|
+
if (richMediaElement) {
|
|
150
|
+
return richMediaElement;
|
|
151
|
+
}
|
|
145
152
|
}
|
|
146
153
|
return element;
|
|
147
154
|
},
|
|
@@ -18,11 +18,15 @@ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
|
18
18
|
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
19
19
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
20
20
|
import { findOverflowScrollParent, MediaSingle as RichMediaWrapper, UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
21
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
21
22
|
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
22
|
-
import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
23
|
+
import { akEditorFullPageNarrowBreakout, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
24
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
23
25
|
import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
|
|
26
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
24
27
|
import { registerCard, removeCard as _removeCard } from '../pm-plugins/actions';
|
|
25
28
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
29
|
+
import { BlockCardComponent } from './blockCard';
|
|
26
30
|
import { Card } from './genericCard';
|
|
27
31
|
var selector = function selector(states) {
|
|
28
32
|
var _states$widthState, _states$widthState2, _states$editorDisable;
|
|
@@ -50,7 +54,6 @@ var CardInner = function CardInner(_ref) {
|
|
|
50
54
|
getLineLength = _ref.getLineLength,
|
|
51
55
|
view = _ref.view,
|
|
52
56
|
smartCard = _ref.smartCard,
|
|
53
|
-
eventDispatcher = _ref.eventDispatcher,
|
|
54
57
|
updateSize = _ref.updateSize,
|
|
55
58
|
getPos = _ref.getPos,
|
|
56
59
|
aspectRatio = _ref.aspectRatio,
|
|
@@ -365,7 +368,51 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
365
368
|
}
|
|
366
369
|
}]);
|
|
367
370
|
}(React.PureComponent);
|
|
368
|
-
var
|
|
371
|
+
export var EmbedOrBlockCardComponent = function EmbedOrBlockCardComponent(props) {
|
|
372
|
+
var width = useSharedPluginStateSelector(props.pluginInjectionApi, 'width.width');
|
|
373
|
+
var viewAsBlockCard = width && width <= akEditorFullPageNarrowBreakout;
|
|
374
|
+
return viewAsBlockCard ? /*#__PURE__*/React.createElement(BlockCardComponent, {
|
|
375
|
+
id: props.id,
|
|
376
|
+
node: props.node,
|
|
377
|
+
view: props.view,
|
|
378
|
+
getPos: props.getPos,
|
|
379
|
+
pluginInjectionApi: props.pluginInjectionApi,
|
|
380
|
+
actionOptions: props.actionOptions,
|
|
381
|
+
onClick: props.onClick,
|
|
382
|
+
CompetitorPrompt: props.CompetitorPrompt,
|
|
383
|
+
allowResizing: props.allowResizing,
|
|
384
|
+
fullWidthMode: props.fullWidthMode,
|
|
385
|
+
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
386
|
+
eventDispatcher: props.eventDispatcher,
|
|
387
|
+
cardContext: props.cardContext,
|
|
388
|
+
smartCard: props.smartCard,
|
|
389
|
+
hasPreview: props.hasPreview,
|
|
390
|
+
liveHeight: props.liveHeight,
|
|
391
|
+
initialAspectRatio: props.initialAspectRatio
|
|
392
|
+
}) : /*#__PURE__*/React.createElement(EmbedCardComponent, {
|
|
393
|
+
id: props.id,
|
|
394
|
+
node: props.node,
|
|
395
|
+
view: props.view,
|
|
396
|
+
getPos: props.getPos,
|
|
397
|
+
pluginInjectionApi: props.pluginInjectionApi,
|
|
398
|
+
actionOptions: props.actionOptions,
|
|
399
|
+
onClick: props.onClick,
|
|
400
|
+
CompetitorPrompt: props.CompetitorPrompt,
|
|
401
|
+
allowResizing: props.allowResizing,
|
|
402
|
+
fullWidthMode: props.fullWidthMode,
|
|
403
|
+
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
404
|
+
eventDispatcher: props.eventDispatcher,
|
|
405
|
+
cardContext: props.cardContext,
|
|
406
|
+
smartCard: props.smartCard,
|
|
407
|
+
hasPreview: props.hasPreview,
|
|
408
|
+
liveHeight: props.liveHeight,
|
|
409
|
+
initialAspectRatio: props.initialAspectRatio
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
var WrappedEmbedCardWithCondition = componentWithCondition(function () {
|
|
413
|
+
return expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true);
|
|
414
|
+
}, EmbedOrBlockCardComponent, EmbedCardComponent);
|
|
415
|
+
var WrappedEmbedCard = Card(WrappedEmbedCardWithCondition, UnsupportedBlock);
|
|
369
416
|
export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
370
417
|
function EmbedCard() {
|
|
371
418
|
var _this2;
|
|
@@ -416,7 +463,7 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
416
463
|
pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
|
|
417
464
|
onClickCallback = _this$reactComponentP3.onClickCallback,
|
|
418
465
|
CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt;
|
|
419
|
-
return /*#__PURE__*/React.createElement(
|
|
466
|
+
return /*#__PURE__*/React.createElement(WrappedEmbedCard, {
|
|
420
467
|
node: this.node,
|
|
421
468
|
view: this.view,
|
|
422
469
|
eventDispatcher: eventDispatcher,
|
|
@@ -37,8 +37,7 @@ var WithClickHandler = function WithClickHandler(_ref) {
|
|
|
37
37
|
var pluginInjectionApi = _ref.pluginInjectionApi,
|
|
38
38
|
url = _ref.url,
|
|
39
39
|
onClickCallback = _ref.onClickCallback,
|
|
40
|
-
children = _ref.children
|
|
41
|
-
__livePage = _ref.__livePage;
|
|
40
|
+
children = _ref.children;
|
|
42
41
|
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
43
42
|
mode = _useSharedState.mode;
|
|
44
43
|
var onClick = useCallback(function (event) {
|
|
@@ -51,21 +50,6 @@ var WithClickHandler = function WithClickHandler(_ref) {
|
|
|
51
50
|
} catch (_unused) {}
|
|
52
51
|
}
|
|
53
52
|
}, [url, onClickCallback]);
|
|
54
|
-
if (fg('linking_platform_smart_links_in_live_pages')) {
|
|
55
|
-
// Ignored via go/ees007
|
|
56
|
-
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
57
|
-
/**
|
|
58
|
-
* @todo: Add a check to determine if we're currently in a live page once ED-23920 and plugin
|
|
59
|
-
* is complete. The logic for which should allow navigation if we're in a live page and no callback
|
|
60
|
-
* has been provided. E.g.
|
|
61
|
-
*
|
|
62
|
-
* const allowNavigation = isLivePage && !onClickCallback;
|
|
63
|
-
*/
|
|
64
|
-
var _allowNavigation = __livePage && !onClickCallback;
|
|
65
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children({
|
|
66
|
-
onClick: _allowNavigation ? undefined : onClick
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
53
|
|
|
70
54
|
// Setting `onClick` to `undefined` ensures clicks on smartcards navigate to the URL.
|
|
71
55
|
// If in view mode and not overriding with onClickCallback option, then allow smartlinks to navigate on click.
|
|
@@ -142,8 +126,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
142
126
|
}, /*#__PURE__*/React.createElement(WithClickHandler, {
|
|
143
127
|
pluginInjectionApi: pluginInjectionApi,
|
|
144
128
|
onClickCallback: onClickCallback,
|
|
145
|
-
url: url
|
|
146
|
-
__livePage: this.props.__livePage
|
|
129
|
+
url: url
|
|
147
130
|
}, function (_ref2) {
|
|
148
131
|
var onClick = _ref2.onClick;
|
|
149
132
|
return /*#__PURE__*/React.createElement(WithCardContext, null, function (cardContext) {
|