@atlaskit/editor-plugin-card 38.0.0 → 39.0.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 +30 -0
- package/dist/cjs/nodeviews/datasource.js +15 -2
- package/dist/cjs/pm-plugins/doc.js +7 -0
- package/dist/cjs/ui/DatasourceAppearanceButton.js +4 -8
- package/dist/cjs/ui/EditToolbarButton/EditToolbarButtonPresentation.js +11 -26
- package/dist/cjs/ui/EditToolbarButton/index.js +12 -24
- package/dist/cjs/ui/HyperlinkToolbarAppearanceDropdown.js +6 -13
- package/dist/cjs/ui/LinkToolbarAppearanceDropdown.js +39 -13
- package/dist/cjs/ui/OpenLinkToolbarButton/index.js +1 -3
- package/dist/cjs/ui/OpenPreviewButton/index.js +3 -26
- package/dist/cjs/ui/toolbar.js +127 -364
- package/dist/es2019/nodeviews/datasource.js +14 -3
- package/dist/es2019/pm-plugins/doc.js +7 -0
- package/dist/es2019/ui/DatasourceAppearanceButton.js +4 -8
- package/dist/es2019/ui/EditToolbarButton/EditToolbarButtonPresentation.js +11 -26
- package/dist/es2019/ui/EditToolbarButton/index.js +12 -24
- package/dist/es2019/ui/HyperlinkToolbarAppearanceDropdown.js +6 -13
- package/dist/es2019/ui/LinkToolbarAppearanceDropdown.js +36 -10
- package/dist/es2019/ui/OpenLinkToolbarButton/index.js +1 -3
- package/dist/es2019/ui/OpenPreviewButton/index.js +3 -26
- package/dist/es2019/ui/toolbar.js +125 -352
- package/dist/esm/nodeviews/datasource.js +15 -2
- package/dist/esm/pm-plugins/doc.js +7 -0
- package/dist/esm/ui/DatasourceAppearanceButton.js +4 -8
- package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +11 -26
- package/dist/esm/ui/EditToolbarButton/index.js +12 -24
- package/dist/esm/ui/HyperlinkToolbarAppearanceDropdown.js +6 -13
- package/dist/esm/ui/LinkToolbarAppearanceDropdown.js +36 -10
- package/dist/esm/ui/OpenLinkToolbarButton/index.js +1 -3
- package/dist/esm/ui/OpenPreviewButton/index.js +3 -26
- package/dist/esm/ui/toolbar.js +126 -361
- package/dist/types/ui/DatasourceAppearanceButton.d.ts +1 -2
- package/dist/types/ui/EditToolbarButton/EditToolbarButtonPresentation.d.ts +1 -1
- package/dist/types/ui/EditToolbarButton/types.d.ts +0 -1
- package/dist/types/ui/HyperlinkToolbarAppearanceDropdown.d.ts +16 -1
- package/dist/types/ui/LinkToolbarAppearanceDropdown.d.ts +24 -2
- package/dist/types/ui/OpenLinkToolbarButton/index.d.ts +1 -2
- package/dist/types/ui/OpenPreviewButton/index.d.ts +1 -2
- package/dist/types/ui/toolbar.d.ts +1 -2
- package/package.json +19 -19
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +0 -162
- package/dist/cjs/ui/LinkToolbarAppearance.js +0 -174
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +0 -86
- package/dist/es2019/ui/LinkToolbarAppearance.js +0 -145
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +0 -153
- package/dist/esm/ui/LinkToolbarAppearance.js +0 -167
- package/dist/types/ui/HyperlinkToolbarAppearance.d.ts +0 -18
- package/dist/types/ui/LinkToolbarAppearance.d.ts +0 -25
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.visitCardLinkAnalytics = exports.
|
|
7
|
+
exports.visitCardLinkAnalytics = exports.removeCard = exports.openLinkSettings = exports.getStartingToolbarItems = exports.getSettingsButton = exports.getEndingToolbarItems = exports.floatingToolbar = void 0;
|
|
9
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
10
|
var _react = _interopRequireDefault(require("react"));
|
|
12
11
|
var _isSafeUrl = require("@atlaskit/adf-schema/is-safe-url");
|
|
13
12
|
var _linkingUtils = require("@atlaskit/editor-common/analytics/linking-utils");
|
|
14
13
|
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
15
|
-
var _MediaAndEmbedsToolbar =
|
|
14
|
+
var _MediaAndEmbedsToolbar = require("@atlaskit/editor-common/card/MediaAndEmbedsToolbar");
|
|
16
15
|
var _utils = require("@atlaskit/editor-common/card/utils");
|
|
17
16
|
var _isOfflineMode = require("@atlaskit/editor-common/connectivity/isOfflineMode");
|
|
18
17
|
var _utils2 = require("@atlaskit/editor-common/link/utils");
|
|
@@ -23,7 +22,6 @@ var _link2 = require("@atlaskit/editor-common/messages/link");
|
|
|
23
22
|
var _linkToolbar = require("@atlaskit/editor-common/messages/link-toolbar");
|
|
24
23
|
var _mediaSingle = require("@atlaskit/editor-common/styles/media-single");
|
|
25
24
|
var _smartCard = require("@atlaskit/editor-common/styles/smartCard");
|
|
26
|
-
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
27
25
|
var _datasource = require("@atlaskit/editor-common/utils/datasource");
|
|
28
26
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
29
27
|
var _utils3 = require("@atlaskit/editor-prosemirror/utils");
|
|
@@ -40,17 +38,13 @@ var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment"
|
|
|
40
38
|
var _doc = require("../pm-plugins/doc");
|
|
41
39
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
42
40
|
var _utils4 = require("../pm-plugins/utils");
|
|
43
|
-
var _DatasourceAppearanceButton = require("./DatasourceAppearanceButton");
|
|
44
41
|
var _EditLinkToolbar = require("./EditLinkToolbar");
|
|
45
42
|
var _EditToolbarButton = require("./EditToolbarButton");
|
|
46
|
-
var _HyperlinkToolbarAppearance = require("./HyperlinkToolbarAppearance");
|
|
47
43
|
var _HyperlinkToolbarAppearanceDropdown = require("./HyperlinkToolbarAppearanceDropdown");
|
|
48
|
-
var _LinkToolbarAppearance = require("./LinkToolbarAppearance");
|
|
49
44
|
var _LinkToolbarAppearanceDropdown = require("./LinkToolbarAppearanceDropdown");
|
|
50
45
|
var _OpenLinkToolbarButton = require("./OpenLinkToolbarButton");
|
|
51
46
|
var _OpenPreviewButton = require("./OpenPreviewButton");
|
|
52
47
|
var _ToolbarViewedEvent = require("./ToolbarViewedEvent");
|
|
53
|
-
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); }
|
|
54
48
|
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; }
|
|
55
49
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
56
50
|
var removeCard = exports.removeCard = function removeCard(editorAnalyticsApi) {
|
|
@@ -218,11 +212,8 @@ var unlinkCard = function unlinkCard(node, state, editorAnalyticsApi, pluginInje
|
|
|
218
212
|
};
|
|
219
213
|
}
|
|
220
214
|
};
|
|
221
|
-
var buildAlignmentOptions = function buildAlignmentOptions(state, intl, widthPluginDependencyApi, analyticsApi, cardOptions
|
|
222
|
-
|
|
223
|
-
return (0, _MediaAndEmbedsToolbar.buildLayoutDropdown)(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, analyticsApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
|
|
224
|
-
}
|
|
225
|
-
return (0, _MediaAndEmbedsToolbar.default)(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, analyticsApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
|
|
215
|
+
var buildAlignmentOptions = function buildAlignmentOptions(state, intl, widthPluginDependencyApi, analyticsApi, cardOptions) {
|
|
216
|
+
return (0, _MediaAndEmbedsToolbar.buildLayoutDropdown)(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, analyticsApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
|
|
226
217
|
};
|
|
227
218
|
var withToolbarMetadata = function withToolbarMetadata(command) {
|
|
228
219
|
return (0, _utils.commandWithMetadata)(command, {
|
|
@@ -264,7 +255,6 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
264
255
|
title: title
|
|
265
256
|
};
|
|
266
257
|
}
|
|
267
|
-
var areAllNewToolbarFlagsDisabled = !(0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
268
258
|
var currentAppearance = (0, _utils4.appearanceForNodeType)(node.type);
|
|
269
259
|
var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
|
|
270
260
|
hoverDecoration = _ref2.hoverDecoration;
|
|
@@ -309,33 +299,6 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
309
299
|
} else {
|
|
310
300
|
var _pluginInjectionApi$c2, _pluginState$resolved;
|
|
311
301
|
var inlineCard = state.schema.nodes.inlineCard;
|
|
312
|
-
var editItems = cardOptions.allowDatasource ? [{
|
|
313
|
-
type: 'custom',
|
|
314
|
-
fallback: [],
|
|
315
|
-
render: function render(editorView) {
|
|
316
|
-
return /*#__PURE__*/_react.default.createElement(_EditToolbarButton.EditToolbarButton, {
|
|
317
|
-
key: "edit-toolbar-item",
|
|
318
|
-
url: url,
|
|
319
|
-
intl: intl,
|
|
320
|
-
editorAnalyticsApi: editorAnalyticsApi,
|
|
321
|
-
editorView: editorView,
|
|
322
|
-
onLinkEditClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true),
|
|
323
|
-
currentAppearance: currentAppearance,
|
|
324
|
-
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
}] : [{
|
|
328
|
-
id: 'editor.link.edit',
|
|
329
|
-
type: 'button',
|
|
330
|
-
selected: false,
|
|
331
|
-
metadata: metadata,
|
|
332
|
-
title: intl.formatMessage(_linkToolbar.linkToolbarMessages.editLink),
|
|
333
|
-
showTitle: true,
|
|
334
|
-
testId: 'link-toolbar-edit-link-button',
|
|
335
|
-
onClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true)
|
|
336
|
-
}, {
|
|
337
|
-
type: 'separator'
|
|
338
|
-
}];
|
|
339
302
|
var commentItems = isCommentEnabled ? [{
|
|
340
303
|
id: 'editor.link.commentLink',
|
|
341
304
|
type: 'button',
|
|
@@ -361,8 +324,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
361
324
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
362
325
|
editorView: editorView,
|
|
363
326
|
onLinkEditClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true),
|
|
364
|
-
currentAppearance: currentAppearance
|
|
365
|
-
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
327
|
+
currentAppearance: currentAppearance
|
|
366
328
|
});
|
|
367
329
|
}
|
|
368
330
|
}] : [{
|
|
@@ -382,8 +344,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
382
344
|
return /*#__PURE__*/_react.default.createElement(_OpenPreviewButton.OpenPreviewPanelToolbarButton, {
|
|
383
345
|
node: node,
|
|
384
346
|
intl: intl,
|
|
385
|
-
editorAnalyticsApi: editorAnalyticsApi
|
|
386
|
-
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
347
|
+
editorAnalyticsApi: editorAnalyticsApi
|
|
387
348
|
});
|
|
388
349
|
}
|
|
389
350
|
}];
|
|
@@ -408,38 +369,11 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
408
369
|
url: url,
|
|
409
370
|
title: intl.formatMessage(_link2.linkMessages.openLink),
|
|
410
371
|
editorView: editorView,
|
|
411
|
-
onClick: fireOpenLinkToolbarAnalytics(editorAnalyticsApi, openLinkInputMethod, resolvedToolbarAttributes)
|
|
412
|
-
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
372
|
+
onClick: fireOpenLinkToolbarAnalytics(editorAnalyticsApi, openLinkInputMethod, resolvedToolbarAttributes)
|
|
413
373
|
}) : null;
|
|
414
374
|
}
|
|
415
375
|
};
|
|
416
|
-
var toolbarItems =
|
|
417
|
-
type: 'separator'
|
|
418
|
-
}], (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi, !areAllNewToolbarFlagsDisabled, pluginInjectionApi)), [{
|
|
419
|
-
type: 'copy-button',
|
|
420
|
-
items: [{
|
|
421
|
-
state: state,
|
|
422
|
-
formatMessage: intl.formatMessage,
|
|
423
|
-
nodeType: node.type
|
|
424
|
-
}]
|
|
425
|
-
}, {
|
|
426
|
-
type: 'separator'
|
|
427
|
-
}, getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink), {
|
|
428
|
-
type: 'separator'
|
|
429
|
-
}, {
|
|
430
|
-
id: 'editor.link.delete',
|
|
431
|
-
focusEditoronEnter: true,
|
|
432
|
-
type: 'button',
|
|
433
|
-
appearance: 'danger',
|
|
434
|
-
icon: _delete.default,
|
|
435
|
-
iconFallback: _delete.default,
|
|
436
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
437
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
438
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
439
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
440
|
-
title: intl.formatMessage(_messages.default.remove),
|
|
441
|
-
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
442
|
-
}]) : [].concat(editButtonItems, (0, _toConsumableArray2.default)([].concat((0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi, !areAllNewToolbarFlagsDisabled, pluginInjectionApi)), [{
|
|
376
|
+
var toolbarItems = [].concat(editButtonItems, (0, _toConsumableArray2.default)([].concat((0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi, pluginInjectionApi)), [{
|
|
443
377
|
type: 'separator',
|
|
444
378
|
fullHeight: true
|
|
445
379
|
}])), openPreviewPanelItems, [openLinkToolbarItem], (0, _toConsumableArray2.default)(commentItems.length > 1 ? [{
|
|
@@ -448,41 +382,16 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
448
382
|
}, commentItems[0]] : commentItems));
|
|
449
383
|
if (currentAppearance === 'embed') {
|
|
450
384
|
var _pluginInjectionApi$a4;
|
|
451
|
-
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions, cardOptions
|
|
452
|
-
if (alignmentOptions.length && areAllNewToolbarFlagsDisabled) {
|
|
453
|
-
alignmentOptions.push({
|
|
454
|
-
type: 'separator'
|
|
455
|
-
});
|
|
456
|
-
}
|
|
385
|
+
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions, cardOptions);
|
|
457
386
|
toolbarItems.unshift.apply(toolbarItems, (0, _toConsumableArray2.default)(alignmentOptions));
|
|
458
387
|
}
|
|
459
388
|
var allowBlockCards = cardOptions.allowBlockCards,
|
|
460
389
|
allowEmbeds = cardOptions.allowEmbeds,
|
|
461
|
-
allowDatasource = cardOptions.allowDatasource,
|
|
462
390
|
showUpgradeDiscoverability = cardOptions.showUpgradeDiscoverability;
|
|
463
391
|
// This code will be executed only for appearances such as "inline", "block" & "embed"
|
|
464
392
|
// For url appearance, please see HyperlinkToolbarAppearanceProps
|
|
465
393
|
if (currentAppearance) {
|
|
466
|
-
|
|
467
|
-
toolbarItems.unshift.apply(toolbarItems, (0, _toConsumableArray2.default)(getToolbarViewedItem(url, currentAppearance)).concat([areAllNewToolbarFlagsDisabled ? {
|
|
468
|
-
type: 'custom',
|
|
469
|
-
fallback: [],
|
|
470
|
-
render: function render(editorView) {
|
|
471
|
-
return /*#__PURE__*/_react.default.createElement(_LinkToolbarAppearance.LinkToolbarAppearance, {
|
|
472
|
-
key: "link-appearance",
|
|
473
|
-
url: url,
|
|
474
|
-
intl: intl,
|
|
475
|
-
currentAppearance: currentAppearance,
|
|
476
|
-
editorView: editorView,
|
|
477
|
-
editorState: state,
|
|
478
|
-
allowEmbeds: allowEmbeds,
|
|
479
|
-
allowBlockCards: allowBlockCards,
|
|
480
|
-
editorAnalyticsApi: editorAnalyticsApi,
|
|
481
|
-
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
482
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
} : (0, _LinkToolbarAppearanceDropdown.getLinkAppearanceDropdown)({
|
|
394
|
+
toolbarItems.unshift.apply(toolbarItems, (0, _toConsumableArray2.default)(getToolbarViewedItem(url, currentAppearance)).concat([(0, _LinkToolbarAppearanceDropdown.getLinkAppearanceDropdown)({
|
|
486
395
|
url: url,
|
|
487
396
|
intl: intl,
|
|
488
397
|
currentAppearance: currentAppearance,
|
|
@@ -493,69 +402,50 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
493
402
|
allowDatasource: cardOptions.allowDatasource,
|
|
494
403
|
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
495
404
|
settingsConfig: getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink),
|
|
496
|
-
isDatasourceView: isDatasource
|
|
497
|
-
|
|
498
|
-
})], (0, _toConsumableArray2.default)(showDatasourceAppearance && areAllNewToolbarFlagsDisabled ? [{
|
|
499
|
-
type: 'custom',
|
|
500
|
-
fallback: [],
|
|
501
|
-
render: function render(editorView) {
|
|
502
|
-
return /*#__PURE__*/_react.default.createElement(_DatasourceAppearanceButton.DatasourceAppearanceButton, {
|
|
503
|
-
intl: intl,
|
|
504
|
-
editorAnalyticsApi: editorAnalyticsApi,
|
|
505
|
-
url: url,
|
|
506
|
-
editorView: editorView,
|
|
507
|
-
editorState: state,
|
|
508
|
-
inputMethod: _enums.INPUT_METHOD.FLOATING_TB,
|
|
509
|
-
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
}] : []), (0, _toConsumableArray2.default)(!areAllNewToolbarFlagsDisabled ? [] : [{
|
|
513
|
-
type: 'separator'
|
|
514
|
-
}])));
|
|
405
|
+
isDatasourceView: isDatasource
|
|
406
|
+
})]));
|
|
515
407
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
|
|
523
|
-
};
|
|
408
|
+
var hoverDecorationProps = function hoverDecorationProps(nodeType, className) {
|
|
409
|
+
return {
|
|
410
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
411
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className),
|
|
412
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
413
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
|
|
524
414
|
};
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
}
|
|
551
|
-
}]
|
|
552
|
-
|
|
553
|
-
|
|
415
|
+
};
|
|
416
|
+
// testId is required to show focus on trigger button on ESC key press
|
|
417
|
+
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
418
|
+
var testId = 'card-overflow-dropdown-trigger';
|
|
419
|
+
var overflowMenuConfig = [{
|
|
420
|
+
type: 'separator',
|
|
421
|
+
fullHeight: true
|
|
422
|
+
}, {
|
|
423
|
+
type: 'overflow-dropdown',
|
|
424
|
+
testId: testId,
|
|
425
|
+
options: [_objectSpread({
|
|
426
|
+
title: intl.formatMessage(_messages.default.copyToClipboard),
|
|
427
|
+
onClick: function onClick() {
|
|
428
|
+
var _pluginInjectionApi$c3, _pluginInjectionApi$f;
|
|
429
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.core) === null || _pluginInjectionApi$c3 === void 0 || _pluginInjectionApi$c3.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.commands.copyNode(node.type, _enums.INPUT_METHOD.FLOATING_TB));
|
|
430
|
+
return true;
|
|
431
|
+
},
|
|
432
|
+
icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
|
|
433
|
+
label: intl.formatMessage(_messages.default.copyToClipboard)
|
|
434
|
+
})
|
|
435
|
+
}, hoverDecorationProps(node.type, _constants.akEditorSelectedNodeClassName)), _objectSpread({
|
|
436
|
+
title: intl.formatMessage(_messages.default.delete),
|
|
437
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
|
|
438
|
+
icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
|
|
439
|
+
label: intl.formatMessage(_messages.default.delete)
|
|
440
|
+
})
|
|
441
|
+
}, hoverDecorationProps(node.type))]
|
|
442
|
+
}];
|
|
443
|
+
toolbarItems.push.apply(toolbarItems, overflowMenuConfig);
|
|
554
444
|
return toolbarItems;
|
|
555
445
|
}
|
|
556
446
|
};
|
|
557
447
|
};
|
|
558
|
-
var getUnlinkButtonGroup = function getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi,
|
|
448
|
+
var getUnlinkButtonGroup = function getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi, pluginInjectionApi) {
|
|
559
449
|
return node.type === inlineCard ? [{
|
|
560
450
|
id: 'editor.link.unlink',
|
|
561
451
|
focusEditoronEnter: true,
|
|
@@ -564,9 +454,7 @@ var getUnlinkButtonGroup = function getUnlinkButtonGroup(state, intl, node, inli
|
|
|
564
454
|
icon: _linkBroken.default,
|
|
565
455
|
iconFallback: _linkBroken.default,
|
|
566
456
|
onClick: withToolbarMetadata(unlinkCard(node, state, editorAnalyticsApi, pluginInjectionApi))
|
|
567
|
-
}]
|
|
568
|
-
type: 'separator'
|
|
569
|
-
}])) : [];
|
|
457
|
+
}] : [];
|
|
570
458
|
};
|
|
571
459
|
var getSettingsButton = exports.getSettingsButton = function getSettingsButton(intl, editorAnalyticsApi, userPreferencesLink) {
|
|
572
460
|
return {
|
|
@@ -584,7 +472,6 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
584
472
|
var _node$attrs2, _node$attrs3;
|
|
585
473
|
var toolbarItems = [];
|
|
586
474
|
toolbarItems.push.apply(toolbarItems, (0, _toConsumableArray2.default)(getToolbarViewedItem(node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.url, currentAppearance !== null && currentAppearance !== void 0 ? currentAppearance : 'url')));
|
|
587
|
-
var areAllNewToolbarFlagsDisabled = !(0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
588
475
|
var canShowAppearanceSwitch = function canShowAppearanceSwitch() {
|
|
589
476
|
// we do not show smart-link or the datasource icons when the node does not have a url to resolve
|
|
590
477
|
if (!metadata.url) {
|
|
@@ -597,62 +484,21 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
597
484
|
allowEmbeds = cardOptions.allowEmbeds,
|
|
598
485
|
showUpgradeDiscoverability = cardOptions.showUpgradeDiscoverability;
|
|
599
486
|
var url = metadata.url;
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
616
|
-
isDatasourceView: true,
|
|
617
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
}, {
|
|
621
|
-
type: 'custom',
|
|
622
|
-
fallback: [],
|
|
623
|
-
render: function render(editorView) {
|
|
624
|
-
return /*#__PURE__*/_react.default.createElement(_DatasourceAppearanceButton.DatasourceAppearanceButton, {
|
|
625
|
-
intl: intl,
|
|
626
|
-
editorAnalyticsApi: editorAnalyticsApi,
|
|
627
|
-
url: url,
|
|
628
|
-
editorView: editorView,
|
|
629
|
-
editorState: state,
|
|
630
|
-
selected: true,
|
|
631
|
-
inputMethod: _enums.INPUT_METHOD.FLOATING_TB,
|
|
632
|
-
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
}, {
|
|
636
|
-
type: 'separator'
|
|
637
|
-
});
|
|
638
|
-
} else {
|
|
639
|
-
toolbarItems.push((0, _LinkToolbarAppearanceDropdown.getLinkAppearanceDropdown)({
|
|
640
|
-
url: url,
|
|
641
|
-
intl: intl,
|
|
642
|
-
currentAppearance: currentAppearance,
|
|
643
|
-
editorState: state,
|
|
644
|
-
allowEmbeds: allowEmbeds,
|
|
645
|
-
allowBlockCards: allowBlockCards,
|
|
646
|
-
editorAnalyticsApi: editorAnalyticsApi,
|
|
647
|
-
allowDatasource: cardOptions.allowDatasource,
|
|
648
|
-
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
649
|
-
settingsConfig: getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink),
|
|
650
|
-
isDatasourceView: true,
|
|
651
|
-
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
652
|
-
}), {
|
|
653
|
-
type: 'separator'
|
|
654
|
-
});
|
|
655
|
-
}
|
|
487
|
+
toolbarItems.push((0, _LinkToolbarAppearanceDropdown.getLinkAppearanceDropdown)({
|
|
488
|
+
url: url,
|
|
489
|
+
intl: intl,
|
|
490
|
+
currentAppearance: currentAppearance,
|
|
491
|
+
editorState: state,
|
|
492
|
+
allowEmbeds: allowEmbeds,
|
|
493
|
+
allowBlockCards: allowBlockCards,
|
|
494
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
495
|
+
allowDatasource: cardOptions.allowDatasource,
|
|
496
|
+
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
497
|
+
settingsConfig: getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink),
|
|
498
|
+
isDatasourceView: true
|
|
499
|
+
}), {
|
|
500
|
+
type: 'separator'
|
|
501
|
+
});
|
|
656
502
|
}
|
|
657
503
|
var openLinkInputMethod = _enums.INPUT_METHOD.FLOATING_TB;
|
|
658
504
|
var pluginState = _pluginKey.pluginKey.getState(state);
|
|
@@ -669,8 +515,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
669
515
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
670
516
|
editorView: editorView,
|
|
671
517
|
onLinkEditClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, false),
|
|
672
|
-
currentAppearance: "datasource"
|
|
673
|
-
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
518
|
+
currentAppearance: "datasource"
|
|
674
519
|
});
|
|
675
520
|
}
|
|
676
521
|
});
|
|
@@ -697,105 +542,68 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
697
542
|
url: node.attrs.url,
|
|
698
543
|
title: intl.formatMessage(_link2.linkMessages.openLink),
|
|
699
544
|
editorView: editorView,
|
|
700
|
-
onClick: fireOpenLinkToolbarAnalytics(editorAnalyticsApi, openLinkInputMethod, (_pluginState$resolved3 = pluginState === null || pluginState === void 0 ? void 0 : pluginState.resolvedToolbarAttributesByUrl[node.attrs.url]) !== null && _pluginState$resolved3 !== void 0 ? _pluginState$resolved3 : {})
|
|
701
|
-
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
545
|
+
onClick: fireOpenLinkToolbarAnalytics(editorAnalyticsApi, openLinkInputMethod, (_pluginState$resolved3 = pluginState === null || pluginState === void 0 ? void 0 : pluginState.resolvedToolbarAttributesByUrl[node.attrs.url]) !== null && _pluginState$resolved3 !== void 0 ? _pluginState$resolved3 : {})
|
|
702
546
|
}) : null;
|
|
703
547
|
}
|
|
704
548
|
});
|
|
705
|
-
if (areAllNewToolbarFlagsDisabled) {
|
|
706
|
-
toolbarItems.push({
|
|
707
|
-
type: 'separator'
|
|
708
|
-
});
|
|
709
|
-
}
|
|
710
549
|
}
|
|
711
|
-
|
|
550
|
+
|
|
551
|
+
// testId is required to show focus on trigger button on ESC key press
|
|
552
|
+
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
553
|
+
var testId = 'datasource-overflow-dropdown-trigger';
|
|
554
|
+
|
|
555
|
+
// When canShowAppearanceSwitch is true, the link appearance dropdown shows, which includes a link preference button
|
|
556
|
+
// So only add the link appearance button when canShowAppearanceSwitch is false
|
|
557
|
+
if (!canShowAppearanceSwitch()) {
|
|
558
|
+
var linkPreferenceButton = getSettingsButton(intl, editorAnalyticsApi, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.userPreferencesLink);
|
|
712
559
|
toolbarItems.push({
|
|
713
|
-
type: '
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
type: 'separator'
|
|
722
|
-
|
|
723
|
-
|
|
560
|
+
type: 'separator',
|
|
561
|
+
fullHeight: true
|
|
562
|
+
}, linkPreferenceButton, {
|
|
563
|
+
type: 'separator',
|
|
564
|
+
fullHeight: true
|
|
565
|
+
});
|
|
566
|
+
} else {
|
|
567
|
+
toolbarItems.push({
|
|
568
|
+
type: 'separator',
|
|
569
|
+
fullHeight: true
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
var overflowMenuConfig = [{
|
|
573
|
+
type: 'overflow-dropdown',
|
|
574
|
+
testId: testId,
|
|
575
|
+
options: [{
|
|
576
|
+
title: intl.formatMessage(_messages.default.copyToClipboard),
|
|
577
|
+
onClick: function onClick() {
|
|
578
|
+
var _pluginInjectionApi$c4, _pluginInjectionApi$f2;
|
|
579
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c4 = pluginInjectionApi.core) === null || _pluginInjectionApi$c4 === void 0 || _pluginInjectionApi$c4.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.commands.copyNode(node.type, _enums.INPUT_METHOD.FLOATING_TB));
|
|
580
|
+
return true;
|
|
581
|
+
},
|
|
582
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true, _constants.akEditorSelectedNodeClassName),
|
|
583
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false, _constants.akEditorSelectedNodeClassName),
|
|
584
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true, _constants.akEditorSelectedNodeClassName),
|
|
585
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false, _constants.akEditorSelectedNodeClassName),
|
|
586
|
+
icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
|
|
587
|
+
label: intl.formatMessage(_messages.default.copyToClipboard)
|
|
588
|
+
})
|
|
724
589
|
}, {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
type: 'button',
|
|
728
|
-
appearance: 'danger',
|
|
729
|
-
icon: _delete.default,
|
|
730
|
-
iconFallback: _delete.default,
|
|
590
|
+
title: intl.formatMessage(_messages.default.delete),
|
|
591
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
|
|
731
592
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
732
593
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
733
594
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
734
595
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
var testId = 'datasource-overflow-dropdown-trigger';
|
|
742
|
-
|
|
743
|
-
// When canShowAppearanceSwitch is true, the link appearance dropdown shows, which includes a link preference button
|
|
744
|
-
// So only add the link appearance button when canShowAppearanceSwitch is false
|
|
745
|
-
if (!canShowAppearanceSwitch()) {
|
|
746
|
-
var linkPreferenceButton = getSettingsButton(intl, editorAnalyticsApi, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.userPreferencesLink);
|
|
747
|
-
toolbarItems.push({
|
|
748
|
-
type: 'separator',
|
|
749
|
-
fullHeight: true
|
|
750
|
-
}, linkPreferenceButton, {
|
|
751
|
-
type: 'separator',
|
|
752
|
-
fullHeight: true
|
|
753
|
-
});
|
|
754
|
-
} else {
|
|
755
|
-
toolbarItems.push({
|
|
756
|
-
type: 'separator',
|
|
757
|
-
fullHeight: true
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
var overflowMenuConfig = [{
|
|
761
|
-
type: 'overflow-dropdown',
|
|
762
|
-
testId: testId,
|
|
763
|
-
options: [{
|
|
764
|
-
title: intl.formatMessage(_messages.default.copyToClipboard),
|
|
765
|
-
onClick: function onClick() {
|
|
766
|
-
var _pluginInjectionApi$c4, _pluginInjectionApi$f2;
|
|
767
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c4 = pluginInjectionApi.core) === null || _pluginInjectionApi$c4 === void 0 || _pluginInjectionApi$c4.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.commands.copyNode(node.type, _enums.INPUT_METHOD.FLOATING_TB));
|
|
768
|
-
return true;
|
|
769
|
-
},
|
|
770
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true, _constants.akEditorSelectedNodeClassName),
|
|
771
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false, _constants.akEditorSelectedNodeClassName),
|
|
772
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true, _constants.akEditorSelectedNodeClassName),
|
|
773
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false, _constants.akEditorSelectedNodeClassName),
|
|
774
|
-
icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
|
|
775
|
-
label: intl.formatMessage(_messages.default.copyToClipboard)
|
|
776
|
-
})
|
|
777
|
-
}, {
|
|
778
|
-
title: intl.formatMessage(_messages.default.delete),
|
|
779
|
-
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
|
|
780
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
781
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
782
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
783
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
784
|
-
icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
|
|
785
|
-
label: intl.formatMessage(_messages.default.delete)
|
|
786
|
-
})
|
|
787
|
-
}]
|
|
788
|
-
}];
|
|
789
|
-
toolbarItems.push.apply(toolbarItems, overflowMenuConfig);
|
|
790
|
-
}
|
|
596
|
+
icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
|
|
597
|
+
label: intl.formatMessage(_messages.default.delete)
|
|
598
|
+
})
|
|
599
|
+
}]
|
|
600
|
+
}];
|
|
601
|
+
toolbarItems.push.apply(toolbarItems, overflowMenuConfig);
|
|
791
602
|
return toolbarItems;
|
|
792
603
|
};
|
|
793
|
-
var shouldRenderToolbarPulse = exports.shouldRenderToolbarPulse = function shouldRenderToolbarPulse(embedEnabled, appearance, status, isDiscoverabilityEnabled) {
|
|
794
|
-
return embedEnabled && appearance === 'inline' && status === 'resolved' && isDiscoverabilityEnabled;
|
|
795
|
-
};
|
|
796
604
|
var getStartingToolbarItems = exports.getStartingToolbarItems = function getStartingToolbarItems(options, api) {
|
|
797
605
|
return function (intl, link, onEditLink, metadata, _state) {
|
|
798
|
-
var
|
|
606
|
+
var _api$analytics2, _api$analytics3;
|
|
799
607
|
var editLinkItem = options.allowDatasource ? [{
|
|
800
608
|
type: 'custom',
|
|
801
609
|
fallback: [],
|
|
@@ -811,8 +619,7 @@ var getStartingToolbarItems = exports.getStartingToolbarItems = function getStar
|
|
|
811
619
|
url: link,
|
|
812
620
|
editorView: editorView,
|
|
813
621
|
onLinkEditClick: onEditLink,
|
|
814
|
-
currentAppearance: "url"
|
|
815
|
-
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
622
|
+
currentAppearance: "url"
|
|
816
623
|
});
|
|
817
624
|
}
|
|
818
625
|
}] : [{
|
|
@@ -827,31 +634,16 @@ var getStartingToolbarItems = exports.getStartingToolbarItems = function getStar
|
|
|
827
634
|
}, {
|
|
828
635
|
type: 'separator'
|
|
829
636
|
}];
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
isDatasourceView: false
|
|
841
|
-
})];
|
|
842
|
-
return [{
|
|
843
|
-
type: 'custom',
|
|
844
|
-
fallback: [],
|
|
845
|
-
render: function render(editorView) {
|
|
846
|
-
return /*#__PURE__*/_react.default.createElement(_ToolbarViewedEvent.ToolbarViewedEvent, {
|
|
847
|
-
key: "edit.link.menu.viewed",
|
|
848
|
-
url: link,
|
|
849
|
-
display: "url",
|
|
850
|
-
editorView: editorView
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
}].concat(hyperlinkAppearance, editLinkItem);
|
|
854
|
-
}
|
|
637
|
+
var hyperlinkAppearance = [(0, _HyperlinkToolbarAppearanceDropdown.getCustomHyperlinkAppearanceDropdown)({
|
|
638
|
+
url: link,
|
|
639
|
+
intl: intl,
|
|
640
|
+
editorAnalyticsApi: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
641
|
+
allowDatasource: options.allowDatasource,
|
|
642
|
+
editorPluginApi: api,
|
|
643
|
+
cardOptions: options,
|
|
644
|
+
settingsConfig: getSettingsButton(intl, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, options.userPreferencesLink),
|
|
645
|
+
isDatasourceView: false
|
|
646
|
+
})];
|
|
855
647
|
return [{
|
|
856
648
|
type: 'custom',
|
|
857
649
|
fallback: [],
|
|
@@ -863,40 +655,11 @@ var getStartingToolbarItems = exports.getStartingToolbarItems = function getStar
|
|
|
863
655
|
editorView: editorView
|
|
864
656
|
});
|
|
865
657
|
}
|
|
866
|
-
},
|
|
867
|
-
type: 'custom',
|
|
868
|
-
fallback: [],
|
|
869
|
-
render: function render(editorView) {
|
|
870
|
-
var _api$analytics4;
|
|
871
|
-
if (!editorView) {
|
|
872
|
-
return null;
|
|
873
|
-
}
|
|
874
|
-
return /*#__PURE__*/_react.default.createElement(_HyperlinkToolbarAppearance.HyperlinkToolbarAppearance, {
|
|
875
|
-
key: "link-appearance",
|
|
876
|
-
url: link,
|
|
877
|
-
intl: intl,
|
|
878
|
-
editorView: editorView,
|
|
879
|
-
editorState: editorView.state,
|
|
880
|
-
cardOptions: options,
|
|
881
|
-
editorAnalyticsApi: api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions,
|
|
882
|
-
editorPluginApi: api
|
|
883
|
-
});
|
|
884
|
-
}
|
|
885
|
-
}].concat(editLinkItem);
|
|
658
|
+
}].concat(hyperlinkAppearance, editLinkItem);
|
|
886
659
|
};
|
|
887
660
|
};
|
|
888
|
-
var getEndingToolbarItems = exports.getEndingToolbarItems = function getEndingToolbarItems(
|
|
889
|
-
return function (
|
|
890
|
-
/**
|
|
891
|
-
* Require either provider to be supplied (controls link preferences)
|
|
892
|
-
* Or explicit user preferences config in order to enable button
|
|
893
|
-
*/
|
|
894
|
-
if ((options.provider || options.userPreferencesLink) && !(0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar))) {
|
|
895
|
-
var _api$analytics5;
|
|
896
|
-
return [{
|
|
897
|
-
type: 'separator'
|
|
898
|
-
}, getSettingsButton(intl, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions, options.userPreferencesLink)];
|
|
899
|
-
}
|
|
661
|
+
var getEndingToolbarItems = exports.getEndingToolbarItems = function getEndingToolbarItems(_options, _api) {
|
|
662
|
+
return function (_intl, _link) {
|
|
900
663
|
return [];
|
|
901
664
|
};
|
|
902
665
|
};
|