@atlaskit/editor-plugin-card 7.3.0 → 7.4.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 +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/ui/OpenPreviewButton/index.js +78 -0
- package/dist/cjs/ui/toolbar.js +14 -2
- 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/ui/OpenPreviewButton/index.js +73 -0
- package/dist/es2019/ui/toolbar.js +12 -2
- 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/ui/OpenPreviewButton/index.js +71 -0
- package/dist/esm/ui/toolbar.js +14 -2
- package/dist/types/nodeviews/blockCard.d.ts +4 -4
- package/dist/types/nodeviews/datasource.d.ts +1 -1
- package/dist/types/nodeviews/embedCard.d.ts +5 -5
- package/dist/types/nodeviews/toDOM-fixes/blockCard.d.ts +18 -18
- package/dist/types/nodeviews/toDOM-fixes/embedCard.d.ts +18 -18
- package/dist/types/nodeviews/toDOM-fixes/inlineCard.d.ts +18 -18
- package/dist/types/pm-plugins/actions.d.ts +1 -1
- package/dist/types/pm-plugins/doc.d.ts +1 -1
- package/dist/types/pm-plugins/util/resolve.d.ts +1 -1
- package/dist/types/pm-plugins/util/state.d.ts +18 -18
- package/dist/types/pm-plugins/utils.d.ts +2 -5
- package/dist/types/types/index.d.ts +0 -1
- package/dist/types/ui/AwarenessWrapper/index.d.ts +0 -1
- package/dist/types/ui/ConfigureOverlay/index.d.ts +0 -1
- package/dist/types/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types/ui/HyperlinkToolbarAppearanceDropdown.d.ts +2 -2
- package/dist/types/ui/InlineCardOverlay/types.d.ts +0 -1
- package/dist/types/ui/LayoutButton/index.d.ts +0 -1
- package/dist/types/ui/LayoutButton/utils.d.ts +2 -1
- package/dist/types/ui/LinkToolbarAppearanceDropdown.d.ts +1 -1
- package/dist/types/ui/OpenPreviewButton/index.d.ts +11 -0
- package/dist/types/ui/ResizableEmbedCard.d.ts +1 -1
- package/dist/types/ui/ToolbarViewedEvent.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/blockCard.d.ts +4 -4
- package/dist/types-ts4.5/nodeviews/datasource.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/embedCard.d.ts +5 -5
- package/dist/types-ts4.5/nodeviews/toDOM-fixes/blockCard.d.ts +18 -18
- package/dist/types-ts4.5/nodeviews/toDOM-fixes/embedCard.d.ts +18 -18
- package/dist/types-ts4.5/nodeviews/toDOM-fixes/inlineCard.d.ts +18 -18
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/doc.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/util/resolve.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/util/state.d.ts +18 -18
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +2 -5
- package/dist/types-ts4.5/types/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/AwarenessWrapper/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/ConfigureOverlay/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types-ts4.5/ui/HyperlinkToolbarAppearanceDropdown.d.ts +2 -2
- package/dist/types-ts4.5/ui/InlineCardOverlay/types.d.ts +0 -1
- package/dist/types-ts4.5/ui/LayoutButton/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/LayoutButton/utils.d.ts +2 -1
- package/dist/types-ts4.5/ui/LinkToolbarAppearanceDropdown.d.ts +1 -1
- package/dist/types-ts4.5/ui/OpenPreviewButton/index.d.ts +11 -0
- package/dist/types-ts4.5/ui/ResizableEmbedCard.d.ts +1 -1
- package/dist/types-ts4.5/ui/ToolbarViewedEvent.d.ts +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 7.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`bd14b2c6330ba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd14b2c6330ba) -
|
|
8
|
+
[https://product-fabric.atlassian.net/browse/ED-28981](ED-28981) - use `CardSSR` component for
|
|
9
|
+
smart card SSR
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 7.3.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`a32e07a545f72`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a32e07a545f72) -
|
|
20
|
+
[ux] Adds 'Open preview panel' button to the smartlink toolbar when the panel is supported.
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 7.3.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -19,6 +19,8 @@ var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/rea
|
|
|
19
19
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
20
20
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
21
21
|
var _smartCard = require("@atlaskit/smart-card");
|
|
22
|
+
var _ssr = require("@atlaskit/smart-card/ssr");
|
|
23
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
22
24
|
var _datasource = require("../nodeviews/datasource");
|
|
23
25
|
var _actions = require("../pm-plugins/actions");
|
|
24
26
|
var _utils2 = require("../pm-plugins/utils");
|
|
@@ -109,11 +111,23 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
|
|
|
109
111
|
cardContext = _this$props2.cardContext,
|
|
110
112
|
actionOptions = _this$props2.actionOptions,
|
|
111
113
|
onClick = _this$props2.onClick,
|
|
112
|
-
CompetitorPrompt = _this$props2.CompetitorPrompt
|
|
114
|
+
CompetitorPrompt = _this$props2.CompetitorPrompt,
|
|
115
|
+
isPageSSRed = _this$props2.isPageSSRed;
|
|
113
116
|
var _node$attrs = node.attrs,
|
|
114
117
|
url = _node$attrs.url,
|
|
115
118
|
data = _node$attrs.data;
|
|
116
|
-
var cardInner = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
119
|
+
var cardInner = isPageSSRed && (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
|
|
120
|
+
key: url,
|
|
121
|
+
url: url !== null && url !== void 0 ? url : data.url,
|
|
122
|
+
container: this.scrollContainer,
|
|
123
|
+
appearance: "block",
|
|
124
|
+
onClick: onClick,
|
|
125
|
+
onResolve: this.onResolve,
|
|
126
|
+
onError: this.onError,
|
|
127
|
+
platform: 'web',
|
|
128
|
+
actionOptions: actionOptions,
|
|
129
|
+
CompetitorPrompt: CompetitorPrompt
|
|
130
|
+
}), this.gapCursorSpan()) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
|
|
117
131
|
key: url,
|
|
118
132
|
url: url !== null && url !== void 0 ? url : data.url,
|
|
119
133
|
container: this.scrollContainer,
|
|
@@ -191,7 +205,8 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
191
205
|
actionOptions = _this$reactComponentP3.actionOptions,
|
|
192
206
|
pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
|
|
193
207
|
onClickCallback = _this$reactComponentP3.onClickCallback,
|
|
194
|
-
CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt
|
|
208
|
+
CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
|
|
209
|
+
isPageSSRed = _this$reactComponentP3.isPageSSRed;
|
|
195
210
|
return /*#__PURE__*/_react.default.createElement(WrappedBlockCard, {
|
|
196
211
|
node: this.node,
|
|
197
212
|
view: this.view,
|
|
@@ -200,7 +215,8 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
200
215
|
pluginInjectionApi: pluginInjectionApi,
|
|
201
216
|
onClickCallback: onClickCallback,
|
|
202
217
|
id: this.id,
|
|
203
|
-
CompetitorPrompt: CompetitorPrompt
|
|
218
|
+
CompetitorPrompt: CompetitorPrompt,
|
|
219
|
+
isPageSSRed: isPageSSRed
|
|
204
220
|
});
|
|
205
221
|
}
|
|
206
222
|
}, {
|
|
@@ -219,7 +235,8 @@ var blockCardNodeView = exports.blockCardNodeView = function blockCardNodeView(_
|
|
|
219
235
|
onClickCallback = _ref3.onClickCallback,
|
|
220
236
|
allowDatasource = _ref3.allowDatasource,
|
|
221
237
|
inlineCardViewProducer = _ref3.inlineCardViewProducer,
|
|
222
|
-
CompetitorPrompt = _ref3.CompetitorPrompt
|
|
238
|
+
CompetitorPrompt = _ref3.CompetitorPrompt,
|
|
239
|
+
isPageSSRed = _ref3.isPageSSRed;
|
|
223
240
|
return function (node, view, getPos, decorations) {
|
|
224
241
|
var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
|
|
225
242
|
eventDispatcher = pmPluginFactoryParams.eventDispatcher;
|
|
@@ -227,7 +244,8 @@ var blockCardNodeView = exports.blockCardNodeView = function blockCardNodeView(_
|
|
|
227
244
|
actionOptions: actionOptions,
|
|
228
245
|
pluginInjectionApi: pluginInjectionApi,
|
|
229
246
|
onClickCallback: onClickCallback,
|
|
230
|
-
CompetitorPrompt: CompetitorPrompt
|
|
247
|
+
CompetitorPrompt: CompetitorPrompt,
|
|
248
|
+
isPageSSRed: isPageSSRed
|
|
231
249
|
};
|
|
232
250
|
var isDatasource = (0, _utils2.isDatasourceNode)(node);
|
|
233
251
|
if (isDatasource) {
|
|
@@ -25,6 +25,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
25
25
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
26
26
|
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
27
27
|
var _smartCard = require("@atlaskit/smart-card");
|
|
28
|
+
var _ssr = require("@atlaskit/smart-card/ssr");
|
|
28
29
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
29
30
|
var _actions = require("../pm-plugins/actions");
|
|
30
31
|
var _ResizableEmbedCard = _interopRequireDefault(require("../ui/ResizableEmbedCard"));
|
|
@@ -311,7 +312,8 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
|
|
|
311
312
|
pluginInjectionApi = _this$props.pluginInjectionApi,
|
|
312
313
|
actionOptions = _this$props.actionOptions,
|
|
313
314
|
onClick = _this$props.onClick,
|
|
314
|
-
CompetitorPrompt = _this$props.CompetitorPrompt
|
|
315
|
+
CompetitorPrompt = _this$props.CompetitorPrompt,
|
|
316
|
+
isPageSSRed = _this$props.isPageSSRed;
|
|
315
317
|
var _node$attrs = node.attrs,
|
|
316
318
|
url = _node$attrs.url,
|
|
317
319
|
pctWidth = _node$attrs.width,
|
|
@@ -338,7 +340,21 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
|
|
|
338
340
|
pctWidth: pctWidth,
|
|
339
341
|
fullWidthMode: fullWidthMode
|
|
340
342
|
};
|
|
341
|
-
var smartCard = /*#__PURE__*/_react.default.createElement(
|
|
343
|
+
var smartCard = isPageSSRed && (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
|
|
344
|
+
key: url,
|
|
345
|
+
url: url,
|
|
346
|
+
appearance: "embed",
|
|
347
|
+
onClick: onClick,
|
|
348
|
+
onResolve: this.onResolve,
|
|
349
|
+
onError: this.onError,
|
|
350
|
+
frameStyle: "show",
|
|
351
|
+
inheritDimensions: true,
|
|
352
|
+
platform: 'web',
|
|
353
|
+
container: this.scrollContainer,
|
|
354
|
+
embedIframeRef: this.embedIframeRef,
|
|
355
|
+
actionOptions: actionOptions,
|
|
356
|
+
CompetitorPrompt: CompetitorPrompt
|
|
357
|
+
}) : /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
|
|
342
358
|
key: url,
|
|
343
359
|
url: url,
|
|
344
360
|
appearance: "embed",
|
|
@@ -395,7 +411,8 @@ var EmbedOrBlockCardComponent = exports.EmbedOrBlockCardComponent = function Emb
|
|
|
395
411
|
smartCard: props.smartCard,
|
|
396
412
|
hasPreview: props.hasPreview,
|
|
397
413
|
liveHeight: props.liveHeight,
|
|
398
|
-
initialAspectRatio: props.initialAspectRatio
|
|
414
|
+
initialAspectRatio: props.initialAspectRatio,
|
|
415
|
+
isPageSSRed: props.isPageSSRed
|
|
399
416
|
}) : /*#__PURE__*/_react.default.createElement(EmbedCardComponent, {
|
|
400
417
|
id: props.id,
|
|
401
418
|
node: props.node,
|
|
@@ -413,7 +430,8 @@ var EmbedOrBlockCardComponent = exports.EmbedOrBlockCardComponent = function Emb
|
|
|
413
430
|
smartCard: props.smartCard,
|
|
414
431
|
hasPreview: props.hasPreview,
|
|
415
432
|
liveHeight: props.liveHeight,
|
|
416
|
-
initialAspectRatio: props.initialAspectRatio
|
|
433
|
+
initialAspectRatio: props.initialAspectRatio,
|
|
434
|
+
isPageSSRed: props.isPageSSRed
|
|
417
435
|
});
|
|
418
436
|
};
|
|
419
437
|
var WrappedEmbedCardWithCondition = (0, _platformFeatureFlagsReact.componentWithCondition)(function () {
|
|
@@ -469,7 +487,8 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
469
487
|
dispatchAnalyticsEvent = _this$reactComponentP3.dispatchAnalyticsEvent,
|
|
470
488
|
pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
|
|
471
489
|
onClickCallback = _this$reactComponentP3.onClickCallback,
|
|
472
|
-
CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt
|
|
490
|
+
CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
|
|
491
|
+
isPageSSRed = _this$reactComponentP3.isPageSSRed;
|
|
473
492
|
return /*#__PURE__*/_react.default.createElement(WrappedEmbedCard, {
|
|
474
493
|
node: this.node,
|
|
475
494
|
view: this.view,
|
|
@@ -481,7 +500,8 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
481
500
|
pluginInjectionApi: pluginInjectionApi,
|
|
482
501
|
onClickCallback: onClickCallback,
|
|
483
502
|
id: this.id,
|
|
484
|
-
CompetitorPrompt: CompetitorPrompt
|
|
503
|
+
CompetitorPrompt: CompetitorPrompt,
|
|
504
|
+
isPageSSRed: isPageSSRed
|
|
485
505
|
});
|
|
486
506
|
}
|
|
487
507
|
}, {
|
|
@@ -500,7 +520,8 @@ var embedCardNodeView = exports.embedCardNodeView = function embedCardNodeView(_
|
|
|
500
520
|
pluginInjectionApi = _ref4.pluginInjectionApi,
|
|
501
521
|
actionOptions = _ref4.actionOptions,
|
|
502
522
|
onClickCallback = _ref4.onClickCallback,
|
|
503
|
-
CompetitorPrompt = _ref4.CompetitorPrompt
|
|
523
|
+
CompetitorPrompt = _ref4.CompetitorPrompt,
|
|
524
|
+
isPageSSRed = _ref4.isPageSSRed;
|
|
504
525
|
return function (node, view, getPos) {
|
|
505
526
|
var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
|
|
506
527
|
eventDispatcher = pmPluginFactoryParams.eventDispatcher,
|
|
@@ -513,7 +534,8 @@ var embedCardNodeView = exports.embedCardNodeView = function embedCardNodeView(_
|
|
|
513
534
|
pluginInjectionApi: pluginInjectionApi,
|
|
514
535
|
actionOptions: actionOptions,
|
|
515
536
|
onClickCallback: onClickCallback,
|
|
516
|
-
CompetitorPrompt: CompetitorPrompt
|
|
537
|
+
CompetitorPrompt: CompetitorPrompt,
|
|
538
|
+
isPageSSRed: isPageSSRed
|
|
517
539
|
};
|
|
518
540
|
return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
|
|
519
541
|
};
|
|
@@ -18,7 +18,6 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
18
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
19
|
var _smartCard = require("@atlaskit/smart-card");
|
|
20
20
|
var _ssr = require("@atlaskit/smart-card/ssr");
|
|
21
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
22
21
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
23
22
|
var _actions = require("../pm-plugins/actions");
|
|
24
23
|
var _utils = require("../pm-plugins/utils");
|
|
@@ -111,8 +110,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
111
110
|
exposure: true
|
|
112
111
|
}) ? handleOnClick : propsOnClick;
|
|
113
112
|
var card = (0, _react.useMemo)(function () {
|
|
114
|
-
|
|
115
|
-
if (isPageSSRed && url && !(0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true)) {
|
|
113
|
+
if (isPageSSRed && url) {
|
|
116
114
|
return /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
|
|
117
115
|
key: url,
|
|
118
116
|
url: url,
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.OpenPreviewPanelToolbarButton = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
10
|
+
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
11
|
+
var _ui = require("@atlaskit/editor-common/ui");
|
|
12
|
+
var _panelRight = _interopRequireDefault(require("@atlaskit/icon/core/panel-right"));
|
|
13
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
14
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
15
|
+
var _smartCard = require("@atlaskit/smart-card");
|
|
16
|
+
var OpenPreviewPanelToolbarButton = exports.OpenPreviewPanelToolbarButton = function OpenPreviewPanelToolbarButton(_ref) {
|
|
17
|
+
var node = _ref.node,
|
|
18
|
+
intl = _ref.intl;
|
|
19
|
+
var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
|
|
20
|
+
store = _useSmartLinkContext.store,
|
|
21
|
+
isPreviewPanelAvailable = _useSmartLinkContext.isPreviewPanelAvailable,
|
|
22
|
+
openPreviewPanel = _useSmartLinkContext.openPreviewPanel;
|
|
23
|
+
var url = node.attrs.url;
|
|
24
|
+
var cardState = store === null || store === void 0 ? void 0 : store.getState()[url];
|
|
25
|
+
if (cardState) {
|
|
26
|
+
var ari = (0, _smartCard.getObjectAri)(cardState.details);
|
|
27
|
+
var name = (0, _smartCard.getObjectName)(cardState.details);
|
|
28
|
+
var iconUrl = (0, _smartCard.getObjectIconUrl)(cardState.details);
|
|
29
|
+
var isPanelAvailable = ari && (isPreviewPanelAvailable === null || isPreviewPanelAvailable === void 0 ? void 0 : isPreviewPanelAvailable({
|
|
30
|
+
ari: ari
|
|
31
|
+
}));
|
|
32
|
+
var handleOpenGlancePanelClick = function handleOpenGlancePanelClick() {
|
|
33
|
+
if (openPreviewPanel && isPanelAvailable) {
|
|
34
|
+
openPreviewPanel({
|
|
35
|
+
url: url,
|
|
36
|
+
ari: ari,
|
|
37
|
+
name: name || '',
|
|
38
|
+
iconUrl: iconUrl
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var title = intl.formatMessage(_messages.linkMessages.openPreviewPanel);
|
|
43
|
+
var icon = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)() ? /*#__PURE__*/_react.default.createElement(_panelRight.default, {
|
|
44
|
+
label: "",
|
|
45
|
+
spacing: "spacious"
|
|
46
|
+
}) :
|
|
47
|
+
/*#__PURE__*/
|
|
48
|
+
// This is a hack required for Jira until areToolbarFlagsEnabled are enabled to ensure the icon has padding
|
|
49
|
+
// Padding is removed when areToolbarFlagsEnabed for a button with icon only in platform/packages/editor/editor-common/src/ui/FloatingToolbar/Button.tsx
|
|
50
|
+
_react.default.createElement(_compiled.Inline, {
|
|
51
|
+
as: "span",
|
|
52
|
+
space: "space.050",
|
|
53
|
+
alignBlock: "center"
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
55
|
+
as: "span",
|
|
56
|
+
"aria-hidden": true,
|
|
57
|
+
role: "presentation"
|
|
58
|
+
}), /*#__PURE__*/_react.default.createElement(_panelRight.default, {
|
|
59
|
+
label: "",
|
|
60
|
+
spacing: "spacious"
|
|
61
|
+
}), /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
62
|
+
as: "span",
|
|
63
|
+
"aria-hidden": true,
|
|
64
|
+
role: "presentation"
|
|
65
|
+
}));
|
|
66
|
+
if (openPreviewPanel && isPanelAvailable) {
|
|
67
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
|
|
68
|
+
gap: "space.050"
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarButton, {
|
|
70
|
+
testId: "open-preview-panel-floating-toolbar-button",
|
|
71
|
+
onClick: handleOpenGlancePanelClick,
|
|
72
|
+
icon: icon,
|
|
73
|
+
title: title
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
};
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -45,6 +45,7 @@ var _HyperlinkToolbarAppearance = require("./HyperlinkToolbarAppearance");
|
|
|
45
45
|
var _HyperlinkToolbarAppearanceDropdown = require("./HyperlinkToolbarAppearanceDropdown");
|
|
46
46
|
var _LinkToolbarAppearance = require("./LinkToolbarAppearance");
|
|
47
47
|
var _LinkToolbarAppearanceDropdown = require("./LinkToolbarAppearanceDropdown");
|
|
48
|
+
var _OpenPreviewButton = require("./OpenPreviewButton");
|
|
48
49
|
var _ToolbarViewedEvent = require("./ToolbarViewedEvent");
|
|
49
50
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
50
51
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -330,7 +331,18 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
330
331
|
testId: 'link-toolbar-edit-link-button',
|
|
331
332
|
onClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true)
|
|
332
333
|
}];
|
|
333
|
-
var
|
|
334
|
+
var openPreviewPanelItems = (0, _platformFeatureFlags.fg)('platform_editor_preview_panel_linking') ? [{
|
|
335
|
+
type: 'custom',
|
|
336
|
+
fallback: [],
|
|
337
|
+
render: function render() {
|
|
338
|
+
return /*#__PURE__*/_react.default.createElement(_OpenPreviewButton.OpenPreviewPanelToolbarButton, {
|
|
339
|
+
node: node,
|
|
340
|
+
intl: intl,
|
|
341
|
+
editorAnalyticsApi: editorAnalyticsApi
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
}] : [];
|
|
345
|
+
var toolbarItems = isNewEditorToolbarDisabled ? [].concat(editItems, commentItems, openPreviewPanelItems, [{
|
|
334
346
|
id: 'editor.link.openLink',
|
|
335
347
|
type: 'button',
|
|
336
348
|
icon: _linkExternal.default,
|
|
@@ -367,7 +379,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
367
379
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
368
380
|
title: intl.formatMessage(_messages.default.remove),
|
|
369
381
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
370
|
-
}]) : [].concat(editButtonItems, (0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_15') ? [].concat((0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
|
|
382
|
+
}]) : [].concat(openPreviewPanelItems, editButtonItems, (0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_15') ? [].concat((0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
|
|
371
383
|
type: 'separator',
|
|
372
384
|
fullHeight: true
|
|
373
385
|
}]) : getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
|
|
@@ -6,6 +6,8 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
|
6
6
|
import { findOverflowScrollParent, UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
7
7
|
import { browser, canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
9
|
+
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
10
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
11
|
import { Datasource } from '../nodeviews/datasource';
|
|
10
12
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
11
13
|
import { isDatasourceNode } from '../pm-plugins/utils';
|
|
@@ -90,13 +92,25 @@ export class BlockCardComponent extends React.PureComponent {
|
|
|
90
92
|
cardContext,
|
|
91
93
|
actionOptions,
|
|
92
94
|
onClick,
|
|
93
|
-
CompetitorPrompt
|
|
95
|
+
CompetitorPrompt,
|
|
96
|
+
isPageSSRed
|
|
94
97
|
} = this.props;
|
|
95
98
|
const {
|
|
96
99
|
url,
|
|
97
100
|
data
|
|
98
101
|
} = node.attrs;
|
|
99
|
-
const cardInner = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
102
|
+
const cardInner = isPageSSRed && expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardSSR, {
|
|
103
|
+
key: url,
|
|
104
|
+
url: url !== null && url !== void 0 ? url : data.url,
|
|
105
|
+
container: this.scrollContainer,
|
|
106
|
+
appearance: "block",
|
|
107
|
+
onClick: onClick,
|
|
108
|
+
onResolve: this.onResolve,
|
|
109
|
+
onError: this.onError,
|
|
110
|
+
platform: 'web',
|
|
111
|
+
actionOptions: actionOptions,
|
|
112
|
+
CompetitorPrompt: CompetitorPrompt
|
|
113
|
+
}), this.gapCursorSpan()) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SmartCard, {
|
|
100
114
|
key: url,
|
|
101
115
|
url: url !== null && url !== void 0 ? url : data.url,
|
|
102
116
|
container: this.scrollContainer,
|
|
@@ -154,7 +168,8 @@ export class BlockCard extends ReactNodeView {
|
|
|
154
168
|
actionOptions,
|
|
155
169
|
pluginInjectionApi,
|
|
156
170
|
onClickCallback,
|
|
157
|
-
CompetitorPrompt
|
|
171
|
+
CompetitorPrompt,
|
|
172
|
+
isPageSSRed
|
|
158
173
|
} = this.reactComponentProps;
|
|
159
174
|
return /*#__PURE__*/React.createElement(WrappedBlockCard, {
|
|
160
175
|
node: this.node,
|
|
@@ -164,7 +179,8 @@ export class BlockCard extends ReactNodeView {
|
|
|
164
179
|
pluginInjectionApi: pluginInjectionApi,
|
|
165
180
|
onClickCallback: onClickCallback,
|
|
166
181
|
id: this.id,
|
|
167
|
-
CompetitorPrompt: CompetitorPrompt
|
|
182
|
+
CompetitorPrompt: CompetitorPrompt,
|
|
183
|
+
isPageSSRed: isPageSSRed
|
|
168
184
|
});
|
|
169
185
|
}
|
|
170
186
|
destroy() {
|
|
@@ -180,7 +196,8 @@ export const blockCardNodeView = ({
|
|
|
180
196
|
onClickCallback,
|
|
181
197
|
allowDatasource,
|
|
182
198
|
inlineCardViewProducer,
|
|
183
|
-
CompetitorPrompt
|
|
199
|
+
CompetitorPrompt,
|
|
200
|
+
isPageSSRed
|
|
184
201
|
}) => (node, view, getPos, decorations) => {
|
|
185
202
|
const {
|
|
186
203
|
portalProviderAPI,
|
|
@@ -190,7 +207,8 @@ export const blockCardNodeView = ({
|
|
|
190
207
|
actionOptions,
|
|
191
208
|
pluginInjectionApi,
|
|
192
209
|
onClickCallback: onClickCallback,
|
|
193
|
-
CompetitorPrompt
|
|
210
|
+
CompetitorPrompt,
|
|
211
|
+
isPageSSRed
|
|
194
212
|
};
|
|
195
213
|
const isDatasource = isDatasourceNode(node);
|
|
196
214
|
if (isDatasource) {
|
|
@@ -12,6 +12,7 @@ import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-
|
|
|
12
12
|
import { akEditorFullPageNarrowBreakout, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
13
13
|
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
14
14
|
import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
|
|
15
|
+
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
15
16
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
16
17
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
17
18
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
@@ -300,7 +301,8 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
300
301
|
pluginInjectionApi,
|
|
301
302
|
actionOptions,
|
|
302
303
|
onClick,
|
|
303
|
-
CompetitorPrompt
|
|
304
|
+
CompetitorPrompt,
|
|
305
|
+
isPageSSRed
|
|
304
306
|
} = this.props;
|
|
305
307
|
const {
|
|
306
308
|
url,
|
|
@@ -330,7 +332,21 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
330
332
|
pctWidth,
|
|
331
333
|
fullWidthMode
|
|
332
334
|
};
|
|
333
|
-
const smartCard = /*#__PURE__*/React.createElement(
|
|
335
|
+
const smartCard = isPageSSRed && expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/React.createElement(CardSSR, {
|
|
336
|
+
key: url,
|
|
337
|
+
url: url,
|
|
338
|
+
appearance: "embed",
|
|
339
|
+
onClick: onClick,
|
|
340
|
+
onResolve: this.onResolve,
|
|
341
|
+
onError: this.onError,
|
|
342
|
+
frameStyle: "show",
|
|
343
|
+
inheritDimensions: true,
|
|
344
|
+
platform: 'web',
|
|
345
|
+
container: this.scrollContainer,
|
|
346
|
+
embedIframeRef: this.embedIframeRef,
|
|
347
|
+
actionOptions: actionOptions,
|
|
348
|
+
CompetitorPrompt: CompetitorPrompt
|
|
349
|
+
}) : /*#__PURE__*/React.createElement(SmartCard, {
|
|
334
350
|
key: url,
|
|
335
351
|
url: url,
|
|
336
352
|
appearance: "embed",
|
|
@@ -386,7 +402,8 @@ export const EmbedOrBlockCardComponent = props => {
|
|
|
386
402
|
smartCard: props.smartCard,
|
|
387
403
|
hasPreview: props.hasPreview,
|
|
388
404
|
liveHeight: props.liveHeight,
|
|
389
|
-
initialAspectRatio: props.initialAspectRatio
|
|
405
|
+
initialAspectRatio: props.initialAspectRatio,
|
|
406
|
+
isPageSSRed: props.isPageSSRed
|
|
390
407
|
}) : /*#__PURE__*/React.createElement(EmbedCardComponent, {
|
|
391
408
|
id: props.id,
|
|
392
409
|
node: props.node,
|
|
@@ -404,7 +421,8 @@ export const EmbedOrBlockCardComponent = props => {
|
|
|
404
421
|
smartCard: props.smartCard,
|
|
405
422
|
hasPreview: props.hasPreview,
|
|
406
423
|
liveHeight: props.liveHeight,
|
|
407
|
-
initialAspectRatio: props.initialAspectRatio
|
|
424
|
+
initialAspectRatio: props.initialAspectRatio,
|
|
425
|
+
isPageSSRed: props.isPageSSRed
|
|
408
426
|
});
|
|
409
427
|
};
|
|
410
428
|
const WrappedEmbedCardWithCondition = componentWithCondition(() => expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true), EmbedOrBlockCardComponent, EmbedCardComponent);
|
|
@@ -442,7 +460,8 @@ export class EmbedCard extends ReactNodeView {
|
|
|
442
460
|
dispatchAnalyticsEvent,
|
|
443
461
|
pluginInjectionApi,
|
|
444
462
|
onClickCallback,
|
|
445
|
-
CompetitorPrompt
|
|
463
|
+
CompetitorPrompt,
|
|
464
|
+
isPageSSRed
|
|
446
465
|
} = this.reactComponentProps;
|
|
447
466
|
return /*#__PURE__*/React.createElement(WrappedEmbedCard, {
|
|
448
467
|
node: this.node,
|
|
@@ -455,7 +474,8 @@ export class EmbedCard extends ReactNodeView {
|
|
|
455
474
|
pluginInjectionApi: pluginInjectionApi,
|
|
456
475
|
onClickCallback: onClickCallback,
|
|
457
476
|
id: this.id,
|
|
458
|
-
CompetitorPrompt: CompetitorPrompt
|
|
477
|
+
CompetitorPrompt: CompetitorPrompt,
|
|
478
|
+
isPageSSRed: isPageSSRed
|
|
459
479
|
});
|
|
460
480
|
}
|
|
461
481
|
destroy() {
|
|
@@ -471,7 +491,8 @@ export const embedCardNodeView = ({
|
|
|
471
491
|
pluginInjectionApi,
|
|
472
492
|
actionOptions,
|
|
473
493
|
onClickCallback,
|
|
474
|
-
CompetitorPrompt
|
|
494
|
+
CompetitorPrompt,
|
|
495
|
+
isPageSSRed
|
|
475
496
|
}) => (node, view, getPos) => {
|
|
476
497
|
const {
|
|
477
498
|
portalProviderAPI,
|
|
@@ -486,7 +507,8 @@ export const embedCardNodeView = ({
|
|
|
486
507
|
pluginInjectionApi,
|
|
487
508
|
actionOptions,
|
|
488
509
|
onClickCallback: onClickCallback,
|
|
489
|
-
CompetitorPrompt
|
|
510
|
+
CompetitorPrompt,
|
|
511
|
+
isPageSSRed
|
|
490
512
|
};
|
|
491
513
|
return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
|
|
492
514
|
};
|
|
@@ -8,7 +8,6 @@ import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-co
|
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
10
10
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
11
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
12
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
14
13
|
import { getAwarenessProps } from '../pm-plugins/utils';
|
|
@@ -107,8 +106,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
107
106
|
exposure: true
|
|
108
107
|
}) ? handleOnClick : propsOnClick;
|
|
109
108
|
const card = useMemo(() => {
|
|
110
|
-
|
|
111
|
-
if (isPageSSRed && url && !expValEquals('platform_editor_smart_card_otp', 'isEnabled', true)) {
|
|
109
|
+
if (isPageSSRed && url) {
|
|
112
110
|
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
113
111
|
key: url,
|
|
114
112
|
url: url,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { linkMessages } from '@atlaskit/editor-common/messages';
|
|
3
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
4
|
+
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
5
|
+
import PanelRightIcon from '@atlaskit/icon/core/panel-right';
|
|
6
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
|
+
import { Inline, Box, Flex } from '@atlaskit/primitives/compiled';
|
|
8
|
+
import { getObjectAri, getObjectIconUrl, getObjectName } from '@atlaskit/smart-card';
|
|
9
|
+
export const OpenPreviewPanelToolbarButton = ({
|
|
10
|
+
node,
|
|
11
|
+
intl
|
|
12
|
+
}) => {
|
|
13
|
+
const {
|
|
14
|
+
store,
|
|
15
|
+
isPreviewPanelAvailable,
|
|
16
|
+
openPreviewPanel
|
|
17
|
+
} = useSmartLinkContext();
|
|
18
|
+
const url = node.attrs.url;
|
|
19
|
+
const cardState = store === null || store === void 0 ? void 0 : store.getState()[url];
|
|
20
|
+
if (cardState) {
|
|
21
|
+
const ari = getObjectAri(cardState.details);
|
|
22
|
+
const name = getObjectName(cardState.details);
|
|
23
|
+
const iconUrl = getObjectIconUrl(cardState.details);
|
|
24
|
+
const isPanelAvailable = ari && (isPreviewPanelAvailable === null || isPreviewPanelAvailable === void 0 ? void 0 : isPreviewPanelAvailable({
|
|
25
|
+
ari
|
|
26
|
+
}));
|
|
27
|
+
const handleOpenGlancePanelClick = () => {
|
|
28
|
+
if (openPreviewPanel && isPanelAvailable) {
|
|
29
|
+
openPreviewPanel({
|
|
30
|
+
url,
|
|
31
|
+
ari,
|
|
32
|
+
name: name || '',
|
|
33
|
+
iconUrl
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const title = intl.formatMessage(linkMessages.openPreviewPanel);
|
|
38
|
+
const icon = areToolbarFlagsEnabled() ? /*#__PURE__*/React.createElement(PanelRightIcon, {
|
|
39
|
+
label: "",
|
|
40
|
+
spacing: "spacious"
|
|
41
|
+
}) :
|
|
42
|
+
/*#__PURE__*/
|
|
43
|
+
// This is a hack required for Jira until areToolbarFlagsEnabled are enabled to ensure the icon has padding
|
|
44
|
+
// Padding is removed when areToolbarFlagsEnabed for a button with icon only in platform/packages/editor/editor-common/src/ui/FloatingToolbar/Button.tsx
|
|
45
|
+
React.createElement(Inline, {
|
|
46
|
+
as: "span",
|
|
47
|
+
space: "space.050",
|
|
48
|
+
alignBlock: "center"
|
|
49
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
50
|
+
as: "span",
|
|
51
|
+
"aria-hidden": true,
|
|
52
|
+
role: "presentation"
|
|
53
|
+
}), /*#__PURE__*/React.createElement(PanelRightIcon, {
|
|
54
|
+
label: "",
|
|
55
|
+
spacing: "spacious"
|
|
56
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
57
|
+
as: "span",
|
|
58
|
+
"aria-hidden": true,
|
|
59
|
+
role: "presentation"
|
|
60
|
+
}));
|
|
61
|
+
if (openPreviewPanel && isPanelAvailable) {
|
|
62
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
63
|
+
gap: "space.050"
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
65
|
+
testId: "open-preview-panel-floating-toolbar-button",
|
|
66
|
+
onClick: handleOpenGlancePanelClick,
|
|
67
|
+
icon: icon,
|
|
68
|
+
title: title
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
};
|
|
@@ -35,6 +35,7 @@ import { HyperlinkToolbarAppearance } from './HyperlinkToolbarAppearance';
|
|
|
35
35
|
import { getCustomHyperlinkAppearanceDropdown } from './HyperlinkToolbarAppearanceDropdown';
|
|
36
36
|
import { LinkToolbarAppearance } from './LinkToolbarAppearance';
|
|
37
37
|
import { getLinkAppearanceDropdown } from './LinkToolbarAppearanceDropdown';
|
|
38
|
+
import { OpenPreviewPanelToolbarButton } from './OpenPreviewButton';
|
|
38
39
|
import { ToolbarViewedEvent } from './ToolbarViewedEvent';
|
|
39
40
|
export const removeCard = editorAnalyticsApi => commandWithMetadata((state, dispatch) => {
|
|
40
41
|
if (!(state.selection instanceof NodeSelection)) {
|
|
@@ -320,7 +321,16 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
320
321
|
testId: 'link-toolbar-edit-link-button',
|
|
321
322
|
onClick: getEditLinkCallback(editorAnalyticsApi, true)
|
|
322
323
|
}];
|
|
323
|
-
const
|
|
324
|
+
const openPreviewPanelItems = fg('platform_editor_preview_panel_linking') ? [{
|
|
325
|
+
type: 'custom',
|
|
326
|
+
fallback: [],
|
|
327
|
+
render: () => /*#__PURE__*/React.createElement(OpenPreviewPanelToolbarButton, {
|
|
328
|
+
node: node,
|
|
329
|
+
intl: intl,
|
|
330
|
+
editorAnalyticsApi: editorAnalyticsApi
|
|
331
|
+
})
|
|
332
|
+
}] : [];
|
|
333
|
+
const toolbarItems = isNewEditorToolbarDisabled ? [...editItems, ...commentItems, ...openPreviewPanelItems, {
|
|
324
334
|
id: 'editor.link.openLink',
|
|
325
335
|
type: 'button',
|
|
326
336
|
icon: LinkExternalIcon,
|
|
@@ -357,7 +367,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
357
367
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
358
368
|
title: intl.formatMessage(commonMessages.remove),
|
|
359
369
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
360
|
-
}] : [...editButtonItems, ...(fg('platform_editor_controls_patch_15') ? [...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi), {
|
|
370
|
+
}] : [...openPreviewPanelItems, ...editButtonItems, ...(fg('platform_editor_controls_patch_15') ? [...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi), {
|
|
361
371
|
type: 'separator',
|
|
362
372
|
fullHeight: true
|
|
363
373
|
}] : getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), {
|