@atlaskit/editor-plugin-card 7.0.9 → 7.0.10
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 +9 -0
- package/dist/cjs/ui/EditToolbarButton/EditToolbarButtonPresentation.js +8 -8
- package/dist/cjs/ui/HyperlinkToolbarAppearanceDropdown.js +2 -2
- package/dist/cjs/ui/PanelButtonOverlay/index.js +2 -0
- package/dist/cjs/ui/toolbar.js +16 -14
- package/dist/es2019/ui/EditToolbarButton/EditToolbarButtonPresentation.js +8 -8
- package/dist/es2019/ui/HyperlinkToolbarAppearanceDropdown.js +2 -2
- package/dist/es2019/ui/PanelButtonOverlay/index.js +1 -0
- package/dist/es2019/ui/toolbar.js +16 -14
- package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +8 -8
- package/dist/esm/ui/HyperlinkToolbarAppearanceDropdown.js +2 -2
- package/dist/esm/ui/PanelButtonOverlay/index.js +1 -0
- package/dist/esm/ui/toolbar.js +16 -14
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 7.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#188597](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/188597)
|
|
8
|
+
[`4de5a96f3e24c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4de5a96f3e24c) -
|
|
9
|
+
[ED-28523] Enable new editor element toolbars UI for Jira
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 7.0.9
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -10,13 +10,13 @@ var _react = require("react");
|
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
var _reactIntlNext = require("react-intl-next");
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
+
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
13
14
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
14
15
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
15
16
|
var _edit = _interopRequireDefault(require("@atlaskit/icon/core/edit"));
|
|
16
17
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-down"));
|
|
17
18
|
var _menu = require("@atlaskit/menu");
|
|
18
19
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
19
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
20
20
|
var _utils = require("../../pm-plugins/utils");
|
|
21
21
|
var _editDatasourceAction = require("../editDatasourceAction");
|
|
22
22
|
/**
|
|
@@ -63,11 +63,11 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
63
63
|
(0, _utils.focusEditorView)(editorView);
|
|
64
64
|
}
|
|
65
65
|
}, [currentAppearance, datasourceId, editorAnalyticsApi, editorView, extensionKey]);
|
|
66
|
-
var
|
|
67
|
-
var icon =
|
|
66
|
+
var isNewEditorToolbarEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)();
|
|
67
|
+
var icon = isNewEditorToolbarEnabled ? (0, _react2.jsx)(_edit.default, {
|
|
68
68
|
label: ""
|
|
69
69
|
}) : undefined;
|
|
70
|
-
var tooltipContent =
|
|
70
|
+
var tooltipContent = isNewEditorToolbarEnabled ? intl.formatMessage(_messages.linkToolbarMessages.editLink) : undefined;
|
|
71
71
|
switch (editVariant) {
|
|
72
72
|
case 'edit-link':
|
|
73
73
|
{
|
|
@@ -78,10 +78,10 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
78
78
|
onClick: onEditLink,
|
|
79
79
|
icon: icon,
|
|
80
80
|
tooltipContent: tooltipContent
|
|
81
|
-
}, !
|
|
81
|
+
}, !isNewEditorToolbarEnabled && (0, _react2.jsx)(_reactIntlNext.FormattedMessage
|
|
82
82
|
// Ignored via go/ees005
|
|
83
83
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
84
|
-
, _messages.linkToolbarMessages.editLink)), !
|
|
84
|
+
, _messages.linkToolbarMessages.editLink)), !isNewEditorToolbarEnabled && (0, _react2.jsx)(_ui.FloatingToolbarSeparator, null));
|
|
85
85
|
}
|
|
86
86
|
case 'edit-datasource':
|
|
87
87
|
{
|
|
@@ -94,7 +94,7 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
94
94
|
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage
|
|
95
95
|
// Ignored via go/ees005
|
|
96
96
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
97
|
-
, _messages.linkToolbarMessages.editDatasourceStandalone)), !
|
|
97
|
+
, _messages.linkToolbarMessages.editDatasourceStandalone)), !isNewEditorToolbarEnabled && (0, _react2.jsx)(_ui.FloatingToolbarSeparator, null));
|
|
98
98
|
}
|
|
99
99
|
case 'edit-dropdown':
|
|
100
100
|
{
|
|
@@ -115,7 +115,7 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
115
115
|
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage
|
|
116
116
|
// Ignored via go/ees005
|
|
117
117
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
118
|
-
, _messages.cardMessages.editDropdownTriggerTitle)), !
|
|
118
|
+
, _messages.cardMessages.editDropdownTriggerTitle)), !isNewEditorToolbarEnabled && (0, _react2.jsx)(_ui.FloatingToolbarSeparator, null));
|
|
119
119
|
return (0, _react2.jsx)(_compiled.Flex, {
|
|
120
120
|
ref: containerRef
|
|
121
121
|
}, (0, _react2.jsx)(_uiMenu.DropdownContainer, {
|
|
@@ -11,12 +11,12 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _card = require("@atlaskit/editor-common/card");
|
|
14
|
+
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
14
15
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
15
16
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
16
17
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-down"));
|
|
17
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
19
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
20
20
|
var _LinkToolbarAppearanceDropdown = require("./LinkToolbarAppearanceDropdown");
|
|
21
21
|
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); }
|
|
22
22
|
var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
@@ -208,7 +208,7 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
208
208
|
allowDatasource: allowDatasource,
|
|
209
209
|
dispatchCommand: dispatchCommand,
|
|
210
210
|
settingsConfig: settingsConfig
|
|
211
|
-
})), !((0,
|
|
211
|
+
})), !((0, _toolbarFlagCheck.areToolbarFlagsEnabled)() && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_15')) && /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarSeparator, null));
|
|
212
212
|
};
|
|
213
213
|
var getCustomHyperlinkAppearanceDropdown = exports.getCustomHyperlinkAppearanceDropdown = function getCustomHyperlinkAppearanceDropdown(_ref3) {
|
|
214
214
|
var url = _ref3.url,
|
|
@@ -25,6 +25,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
25
25
|
|
|
26
26
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
27
27
|
|
|
28
|
+
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
29
|
+
|
|
28
30
|
var containerStyles = (0, _react2.css)({
|
|
29
31
|
position: 'relative'
|
|
30
32
|
});
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -15,6 +15,7 @@ var _card = require("@atlaskit/editor-common/card");
|
|
|
15
15
|
var _link = require("@atlaskit/editor-common/link");
|
|
16
16
|
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
17
17
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
18
|
+
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
18
19
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
19
20
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
20
21
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
@@ -32,7 +33,6 @@ var _linkExternalShortcut = _interopRequireDefault(require("@atlaskit/icon/core/
|
|
|
32
33
|
var _settingsEditorSettings = _interopRequireDefault(require("@atlaskit/icon/core/migration/settings--editor-settings"));
|
|
33
34
|
var _settings = _interopRequireDefault(require("@atlaskit/icon/core/settings"));
|
|
34
35
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
35
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
36
36
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
37
37
|
var _doc = require("../pm-plugins/doc");
|
|
38
38
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
@@ -169,7 +169,7 @@ var unlinkCard = function unlinkCard(node, state, editorAnalyticsApi) {
|
|
|
169
169
|
};
|
|
170
170
|
};
|
|
171
171
|
var buildAlignmentOptions = function buildAlignmentOptions(state, intl, widthPluginDependencyApi, analyticsApi, cardOptions) {
|
|
172
|
-
if ((0,
|
|
172
|
+
if ((0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) {
|
|
173
173
|
return (0, _card.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);
|
|
174
174
|
}
|
|
175
175
|
return (0, _card.buildLayoutButtons)(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);
|
|
@@ -214,6 +214,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
214
214
|
title: title
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
|
+
var isNewEditorToolbarDisabled = !(0, _toolbarFlagCheck.areToolbarFlagsEnabled)();
|
|
217
218
|
var currentAppearance = (0, _utils3.appearanceForNodeType)(node.type);
|
|
218
219
|
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 : {},
|
|
219
220
|
hoverDecoration = _ref2.hoverDecoration;
|
|
@@ -322,7 +323,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
322
323
|
testId: 'link-toolbar-edit-link-button',
|
|
323
324
|
onClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true)
|
|
324
325
|
}];
|
|
325
|
-
var toolbarItems =
|
|
326
|
+
var toolbarItems = isNewEditorToolbarDisabled ? [].concat(editItems, commentItems, [{
|
|
326
327
|
id: 'editor.link.openLink',
|
|
327
328
|
type: 'button',
|
|
328
329
|
icon: _linkExternal.default,
|
|
@@ -380,7 +381,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
380
381
|
if (currentAppearance === 'embed') {
|
|
381
382
|
var _pluginInjectionApi$a4;
|
|
382
383
|
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);
|
|
383
|
-
if (alignmentOptions.length &&
|
|
384
|
+
if (alignmentOptions.length && isNewEditorToolbarDisabled) {
|
|
384
385
|
alignmentOptions.push({
|
|
385
386
|
type: 'separator'
|
|
386
387
|
});
|
|
@@ -395,7 +396,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
395
396
|
// For url appearance, please see HyperlinkToolbarAppearanceProps
|
|
396
397
|
if (currentAppearance) {
|
|
397
398
|
var showDatasourceAppearance = allowDatasource && url;
|
|
398
|
-
toolbarItems.unshift.apply(toolbarItems, (0, _toConsumableArray2.default)(getToolbarViewedItem(url, currentAppearance)).concat([
|
|
399
|
+
toolbarItems.unshift.apply(toolbarItems, (0, _toConsumableArray2.default)(getToolbarViewedItem(url, currentAppearance)).concat([isNewEditorToolbarDisabled ? {
|
|
399
400
|
type: 'custom',
|
|
400
401
|
fallback: [],
|
|
401
402
|
render: function render(editorView) {
|
|
@@ -424,7 +425,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
424
425
|
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
425
426
|
settingsConfig: getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink),
|
|
426
427
|
isDatasourceView: isDatasource
|
|
427
|
-
})], (0, _toConsumableArray2.default)(showDatasourceAppearance &&
|
|
428
|
+
})], (0, _toConsumableArray2.default)(showDatasourceAppearance && isNewEditorToolbarDisabled ? [{
|
|
428
429
|
type: 'custom',
|
|
429
430
|
fallback: [],
|
|
430
431
|
render: function render(editorView) {
|
|
@@ -437,11 +438,11 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
437
438
|
inputMethod: _analytics.INPUT_METHOD.FLOATING_TB
|
|
438
439
|
});
|
|
439
440
|
}
|
|
440
|
-
}] : []), (0, _toConsumableArray2.default)(
|
|
441
|
+
}] : []), (0, _toConsumableArray2.default)(!isNewEditorToolbarDisabled ? [] : [{
|
|
441
442
|
type: 'separator'
|
|
442
443
|
}])));
|
|
443
444
|
}
|
|
444
|
-
if (
|
|
445
|
+
if (!isNewEditorToolbarDisabled) {
|
|
445
446
|
var hoverDecorationProps = function hoverDecorationProps(nodeType, className) {
|
|
446
447
|
return {
|
|
447
448
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
@@ -493,7 +494,7 @@ var getUnlinkButtonGroup = function getUnlinkButtonGroup(state, intl, node, inli
|
|
|
493
494
|
icon: _linkBroken.default,
|
|
494
495
|
iconFallback: _linkBrokenEditorUnlink.default,
|
|
495
496
|
onClick: withToolbarMetadata(unlinkCard(node, state, editorAnalyticsApi))
|
|
496
|
-
}].concat((0, _toConsumableArray2.default)((0,
|
|
497
|
+
}].concat((0, _toConsumableArray2.default)((0, _toolbarFlagCheck.areToolbarFlagsEnabled)() ? [] : [{
|
|
497
498
|
type: 'separator'
|
|
498
499
|
}])) : [];
|
|
499
500
|
};
|
|
@@ -512,6 +513,7 @@ var getSettingsButton = exports.getSettingsButton = function getSettingsButton(i
|
|
|
512
513
|
var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance, pluginInjectionApi) {
|
|
513
514
|
var _node$attrs2;
|
|
514
515
|
var toolbarItems = [];
|
|
516
|
+
var isNewEditorToolbarDisabled = !(0, _toolbarFlagCheck.areToolbarFlagsEnabled)();
|
|
515
517
|
var canShowAppearanceSwitch = function canShowAppearanceSwitch() {
|
|
516
518
|
// we do not show smart-link or the datasource icons when the node does not have a url to resolve
|
|
517
519
|
if (!metadata.url) {
|
|
@@ -524,7 +526,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
524
526
|
allowEmbeds = cardOptions.allowEmbeds,
|
|
525
527
|
showUpgradeDiscoverability = cardOptions.showUpgradeDiscoverability;
|
|
526
528
|
var url = metadata.url;
|
|
527
|
-
if (
|
|
529
|
+
if (isNewEditorToolbarDisabled) {
|
|
528
530
|
toolbarItems.push({
|
|
529
531
|
type: 'custom',
|
|
530
532
|
fallback: [],
|
|
@@ -609,13 +611,13 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
609
611
|
href: node.attrs.url,
|
|
610
612
|
target: '_blank'
|
|
611
613
|
});
|
|
612
|
-
if (
|
|
614
|
+
if (isNewEditorToolbarDisabled) {
|
|
613
615
|
toolbarItems.push({
|
|
614
616
|
type: 'separator'
|
|
615
617
|
});
|
|
616
618
|
}
|
|
617
619
|
}
|
|
618
|
-
if (
|
|
620
|
+
if (isNewEditorToolbarDisabled) {
|
|
619
621
|
toolbarItems.push({
|
|
620
622
|
type: 'copy-button',
|
|
621
623
|
supportsViewMode: true,
|
|
@@ -733,7 +735,7 @@ var getStartingToolbarItems = exports.getStartingToolbarItems = function getStar
|
|
|
733
735
|
}, {
|
|
734
736
|
type: 'separator'
|
|
735
737
|
}];
|
|
736
|
-
if ((0,
|
|
738
|
+
if ((0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) {
|
|
737
739
|
var _api$analytics2, _api$analytics3;
|
|
738
740
|
var hyperlinkAppearance = [(0, _HyperlinkToolbarAppearanceDropdown.getCustomHyperlinkAppearanceDropdown)({
|
|
739
741
|
url: link,
|
|
@@ -797,7 +799,7 @@ var getEndingToolbarItems = exports.getEndingToolbarItems = function getEndingTo
|
|
|
797
799
|
* Require either provider to be supplied (controls link preferences)
|
|
798
800
|
* Or explicit user preferences config in order to enable button
|
|
799
801
|
*/
|
|
800
|
-
if ((options.provider || options.userPreferencesLink) && (0,
|
|
802
|
+
if ((options.provider || options.userPreferencesLink) && !(0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) {
|
|
801
803
|
var _api$analytics5;
|
|
802
804
|
return [{
|
|
803
805
|
type: 'separator'
|
|
@@ -8,13 +8,13 @@ import { useCallback, useRef, useState } from 'react';
|
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
10
10
|
import { linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
11
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
11
12
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
|
|
12
13
|
import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
|
|
13
14
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
14
15
|
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down';
|
|
15
16
|
import { ButtonItem } from '@atlaskit/menu';
|
|
16
17
|
import { Flex } from '@atlaskit/primitives/compiled';
|
|
17
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
18
18
|
import { focusEditorView } from '../../pm-plugins/utils';
|
|
19
19
|
import { editDatasource } from '../editDatasourceAction';
|
|
20
20
|
const dropdownExpandContainer = css({
|
|
@@ -46,11 +46,11 @@ const EditToolbarButtonPresentation = ({
|
|
|
46
46
|
focusEditorView(editorView);
|
|
47
47
|
}
|
|
48
48
|
}, [currentAppearance, datasourceId, editorAnalyticsApi, editorView, extensionKey]);
|
|
49
|
-
const
|
|
50
|
-
const icon =
|
|
49
|
+
const isNewEditorToolbarEnabled = areToolbarFlagsEnabled();
|
|
50
|
+
const icon = isNewEditorToolbarEnabled ? jsx(EditIcon, {
|
|
51
51
|
label: ""
|
|
52
52
|
}) : undefined;
|
|
53
|
-
const tooltipContent =
|
|
53
|
+
const tooltipContent = isNewEditorToolbarEnabled ? intl.formatMessage(linkToolbarMessages.editLink) : undefined;
|
|
54
54
|
switch (editVariant) {
|
|
55
55
|
case 'edit-link':
|
|
56
56
|
{
|
|
@@ -61,10 +61,10 @@ const EditToolbarButtonPresentation = ({
|
|
|
61
61
|
onClick: onEditLink,
|
|
62
62
|
icon: icon,
|
|
63
63
|
tooltipContent: tooltipContent
|
|
64
|
-
}, !
|
|
64
|
+
}, !isNewEditorToolbarEnabled && jsx(FormattedMessage
|
|
65
65
|
// Ignored via go/ees005
|
|
66
66
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
67
|
-
, linkToolbarMessages.editLink)), !
|
|
67
|
+
, linkToolbarMessages.editLink)), !isNewEditorToolbarEnabled && jsx(Separator, null));
|
|
68
68
|
}
|
|
69
69
|
case 'edit-datasource':
|
|
70
70
|
{
|
|
@@ -77,7 +77,7 @@ const EditToolbarButtonPresentation = ({
|
|
|
77
77
|
}, jsx(FormattedMessage
|
|
78
78
|
// Ignored via go/ees005
|
|
79
79
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
80
|
-
, linkToolbarMessages.editDatasourceStandalone)), !
|
|
80
|
+
, linkToolbarMessages.editDatasourceStandalone)), !isNewEditorToolbarEnabled && jsx(Separator, null));
|
|
81
81
|
}
|
|
82
82
|
case 'edit-dropdown':
|
|
83
83
|
{
|
|
@@ -98,7 +98,7 @@ const EditToolbarButtonPresentation = ({
|
|
|
98
98
|
}, jsx(FormattedMessage
|
|
99
99
|
// Ignored via go/ees005
|
|
100
100
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
101
|
-
, messages.editDropdownTriggerTitle)), !
|
|
101
|
+
, messages.editDropdownTriggerTitle)), !isNewEditorToolbarEnabled && jsx(Separator, null));
|
|
102
102
|
return jsx(Flex, {
|
|
103
103
|
ref: containerRef
|
|
104
104
|
}, jsx(UiDropdown, {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { appearancePropsMap } from '@atlaskit/editor-common/card';
|
|
3
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
3
4
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
|
|
4
5
|
import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
|
|
5
6
|
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down';
|
|
6
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { Flex } from '@atlaskit/primitives/compiled';
|
|
8
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
9
9
|
import { LinkAppearanceMenu } from './LinkToolbarAppearanceDropdown';
|
|
10
10
|
const CustomHyperlinkDropdown = props => {
|
|
11
11
|
var _props$cardOptions3;
|
|
@@ -123,7 +123,7 @@ const CustomHyperlinkDropdown = props => {
|
|
|
123
123
|
allowDatasource: allowDatasource,
|
|
124
124
|
dispatchCommand: dispatchCommand,
|
|
125
125
|
settingsConfig: settingsConfig
|
|
126
|
-
})), !(
|
|
126
|
+
})), !(areToolbarFlagsEnabled() && fg('platform_editor_controls_patch_15')) && /*#__PURE__*/React.createElement(Separator, null));
|
|
127
127
|
};
|
|
128
128
|
export const getCustomHyperlinkAppearanceDropdown = ({
|
|
129
129
|
url,
|
|
@@ -11,6 +11,7 @@ import { useIntl } from 'react-intl-next';
|
|
|
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 PanelRightIcon from '@atlaskit/icon/core/panel-right';
|
|
14
|
+
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
14
15
|
import { Box, Pressable, Text, xcss } from '@atlaskit/primitives';
|
|
15
16
|
const containerStyles = css({
|
|
16
17
|
position: 'relative'
|
|
@@ -5,6 +5,7 @@ import { buildLayoutButtons, buildLayoutDropdown, commandWithMetadata } from '@a
|
|
|
5
5
|
import { getLinkPreferencesURLFromENV } from '@atlaskit/editor-common/link';
|
|
6
6
|
import commonMessages, { annotationMessages, linkMessages, linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME, richMediaClassName } from '@atlaskit/editor-common/styles';
|
|
8
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
8
9
|
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
9
10
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
11
|
import { findDomRefAtPos, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -22,7 +23,6 @@ import OpenIcon from '@atlaskit/icon/core/migration/link-external--shortcut';
|
|
|
22
23
|
import CogIcon from '@atlaskit/icon/core/migration/settings--editor-settings';
|
|
23
24
|
import SettingsIcon from '@atlaskit/icon/core/settings';
|
|
24
25
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
26
26
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
27
27
|
import { changeSelectedCardToText } from '../pm-plugins/doc';
|
|
28
28
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
@@ -162,7 +162,7 @@ const unlinkCard = (node, state, editorAnalyticsApi) => {
|
|
|
162
162
|
return () => false;
|
|
163
163
|
};
|
|
164
164
|
const buildAlignmentOptions = (state, intl, widthPluginDependencyApi, analyticsApi, cardOptions) => {
|
|
165
|
-
if (
|
|
165
|
+
if (areToolbarFlagsEnabled()) {
|
|
166
166
|
return 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);
|
|
167
167
|
}
|
|
168
168
|
return buildLayoutButtons(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);
|
|
@@ -205,6 +205,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
205
205
|
title: title
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
+
const isNewEditorToolbarDisabled = !areToolbarFlagsEnabled();
|
|
208
209
|
const currentAppearance = appearanceForNodeType(node.type);
|
|
209
210
|
const {
|
|
210
211
|
hoverDecoration
|
|
@@ -312,7 +313,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
312
313
|
testId: 'link-toolbar-edit-link-button',
|
|
313
314
|
onClick: getEditLinkCallback(editorAnalyticsApi, true)
|
|
314
315
|
}];
|
|
315
|
-
const toolbarItems =
|
|
316
|
+
const toolbarItems = isNewEditorToolbarDisabled ? [...editItems, ...commentItems, {
|
|
316
317
|
id: 'editor.link.openLink',
|
|
317
318
|
type: 'button',
|
|
318
319
|
icon: LinkExternalIcon,
|
|
@@ -370,7 +371,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
370
371
|
if (currentAppearance === 'embed') {
|
|
371
372
|
var _pluginInjectionApi$a5;
|
|
372
373
|
const alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions, cardOptions);
|
|
373
|
-
if (alignmentOptions.length &&
|
|
374
|
+
if (alignmentOptions.length && isNewEditorToolbarDisabled) {
|
|
374
375
|
alignmentOptions.push({
|
|
375
376
|
type: 'separator'
|
|
376
377
|
});
|
|
@@ -387,7 +388,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
387
388
|
// For url appearance, please see HyperlinkToolbarAppearanceProps
|
|
388
389
|
if (currentAppearance) {
|
|
389
390
|
const showDatasourceAppearance = allowDatasource && url;
|
|
390
|
-
toolbarItems.unshift(...getToolbarViewedItem(url, currentAppearance),
|
|
391
|
+
toolbarItems.unshift(...getToolbarViewedItem(url, currentAppearance), isNewEditorToolbarDisabled ? {
|
|
391
392
|
type: 'custom',
|
|
392
393
|
fallback: [],
|
|
393
394
|
render: editorView => /*#__PURE__*/React.createElement(LinkToolbarAppearance, {
|
|
@@ -414,7 +415,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
414
415
|
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
415
416
|
settingsConfig: getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink),
|
|
416
417
|
isDatasourceView: isDatasource
|
|
417
|
-
}), ...(showDatasourceAppearance &&
|
|
418
|
+
}), ...(showDatasourceAppearance && isNewEditorToolbarDisabled ? [{
|
|
418
419
|
type: 'custom',
|
|
419
420
|
fallback: [],
|
|
420
421
|
render: editorView => /*#__PURE__*/React.createElement(DatasourceAppearanceButton, {
|
|
@@ -425,11 +426,11 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
425
426
|
editorState: state,
|
|
426
427
|
inputMethod: INPUT_METHOD.FLOATING_TB
|
|
427
428
|
})
|
|
428
|
-
}] : []), ...(
|
|
429
|
+
}] : []), ...(!isNewEditorToolbarDisabled ? [] : [{
|
|
429
430
|
type: 'separator'
|
|
430
431
|
}]));
|
|
431
432
|
}
|
|
432
|
-
if (
|
|
433
|
+
if (!isNewEditorToolbarDisabled) {
|
|
433
434
|
const hoverDecorationProps = (nodeType, className) => ({
|
|
434
435
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
435
436
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className),
|
|
@@ -480,7 +481,7 @@ const getUnlinkButtonGroup = (state, intl, node, inlineCard, editorAnalyticsApi)
|
|
|
480
481
|
icon: LinkBrokenIcon,
|
|
481
482
|
iconFallback: UnlinkIcon,
|
|
482
483
|
onClick: withToolbarMetadata(unlinkCard(node, state, editorAnalyticsApi))
|
|
483
|
-
}, ...(
|
|
484
|
+
}, ...(areToolbarFlagsEnabled() ? [] : [{
|
|
484
485
|
type: 'separator'
|
|
485
486
|
}])] : [];
|
|
486
487
|
};
|
|
@@ -499,6 +500,7 @@ export const getSettingsButton = (intl, editorAnalyticsApi, userPreferencesLink)
|
|
|
499
500
|
const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance, pluginInjectionApi) => {
|
|
500
501
|
var _node$attrs2;
|
|
501
502
|
const toolbarItems = [];
|
|
503
|
+
const isNewEditorToolbarDisabled = !areToolbarFlagsEnabled();
|
|
502
504
|
const canShowAppearanceSwitch = () => {
|
|
503
505
|
// we do not show smart-link or the datasource icons when the node does not have a url to resolve
|
|
504
506
|
if (!metadata.url) {
|
|
@@ -515,7 +517,7 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
515
517
|
const {
|
|
516
518
|
url
|
|
517
519
|
} = metadata;
|
|
518
|
-
if (
|
|
520
|
+
if (isNewEditorToolbarDisabled) {
|
|
519
521
|
toolbarItems.push({
|
|
520
522
|
type: 'custom',
|
|
521
523
|
fallback: [],
|
|
@@ -596,13 +598,13 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
596
598
|
href: node.attrs.url,
|
|
597
599
|
target: '_blank'
|
|
598
600
|
});
|
|
599
|
-
if (
|
|
601
|
+
if (isNewEditorToolbarDisabled) {
|
|
600
602
|
toolbarItems.push({
|
|
601
603
|
type: 'separator'
|
|
602
604
|
});
|
|
603
605
|
}
|
|
604
606
|
}
|
|
605
|
-
if (
|
|
607
|
+
if (isNewEditorToolbarDisabled) {
|
|
606
608
|
toolbarItems.push({
|
|
607
609
|
type: 'copy-button',
|
|
608
610
|
supportsViewMode: true,
|
|
@@ -720,7 +722,7 @@ export const getStartingToolbarItems = (options, api) => {
|
|
|
720
722
|
}, {
|
|
721
723
|
type: 'separator'
|
|
722
724
|
}];
|
|
723
|
-
if (
|
|
725
|
+
if (areToolbarFlagsEnabled()) {
|
|
724
726
|
var _api$analytics2, _api$analytics3;
|
|
725
727
|
const hyperlinkAppearance = [getCustomHyperlinkAppearanceDropdown({
|
|
726
728
|
url: link,
|
|
@@ -779,7 +781,7 @@ export const getEndingToolbarItems = (options, api) => (intl, link) => {
|
|
|
779
781
|
* Require either provider to be supplied (controls link preferences)
|
|
780
782
|
* Or explicit user preferences config in order to enable button
|
|
781
783
|
*/
|
|
782
|
-
if ((options.provider || options.userPreferencesLink) &&
|
|
784
|
+
if ((options.provider || options.userPreferencesLink) && !areToolbarFlagsEnabled()) {
|
|
783
785
|
var _api$analytics5;
|
|
784
786
|
return [{
|
|
785
787
|
type: 'separator'
|
|
@@ -9,13 +9,13 @@ import { useCallback, useRef, useState } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { FormattedMessage } from 'react-intl-next';
|
|
11
11
|
import { linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
12
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
12
13
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
|
|
13
14
|
import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
|
|
14
15
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
15
16
|
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down';
|
|
16
17
|
import { ButtonItem } from '@atlaskit/menu';
|
|
17
18
|
import { Flex } from '@atlaskit/primitives/compiled';
|
|
18
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
19
19
|
import { focusEditorView } from '../../pm-plugins/utils';
|
|
20
20
|
import { editDatasource } from '../editDatasourceAction';
|
|
21
21
|
var dropdownExpandContainer = css({
|
|
@@ -55,11 +55,11 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
55
55
|
focusEditorView(editorView);
|
|
56
56
|
}
|
|
57
57
|
}, [currentAppearance, datasourceId, editorAnalyticsApi, editorView, extensionKey]);
|
|
58
|
-
var
|
|
59
|
-
var icon =
|
|
58
|
+
var isNewEditorToolbarEnabled = areToolbarFlagsEnabled();
|
|
59
|
+
var icon = isNewEditorToolbarEnabled ? jsx(EditIcon, {
|
|
60
60
|
label: ""
|
|
61
61
|
}) : undefined;
|
|
62
|
-
var tooltipContent =
|
|
62
|
+
var tooltipContent = isNewEditorToolbarEnabled ? intl.formatMessage(linkToolbarMessages.editLink) : undefined;
|
|
63
63
|
switch (editVariant) {
|
|
64
64
|
case 'edit-link':
|
|
65
65
|
{
|
|
@@ -70,10 +70,10 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
70
70
|
onClick: onEditLink,
|
|
71
71
|
icon: icon,
|
|
72
72
|
tooltipContent: tooltipContent
|
|
73
|
-
}, !
|
|
73
|
+
}, !isNewEditorToolbarEnabled && jsx(FormattedMessage
|
|
74
74
|
// Ignored via go/ees005
|
|
75
75
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
76
|
-
, linkToolbarMessages.editLink)), !
|
|
76
|
+
, linkToolbarMessages.editLink)), !isNewEditorToolbarEnabled && jsx(Separator, null));
|
|
77
77
|
}
|
|
78
78
|
case 'edit-datasource':
|
|
79
79
|
{
|
|
@@ -86,7 +86,7 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
86
86
|
}, jsx(FormattedMessage
|
|
87
87
|
// Ignored via go/ees005
|
|
88
88
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
89
|
-
, linkToolbarMessages.editDatasourceStandalone)), !
|
|
89
|
+
, linkToolbarMessages.editDatasourceStandalone)), !isNewEditorToolbarEnabled && jsx(Separator, null));
|
|
90
90
|
}
|
|
91
91
|
case 'edit-dropdown':
|
|
92
92
|
{
|
|
@@ -107,7 +107,7 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
107
107
|
}, jsx(FormattedMessage
|
|
108
108
|
// Ignored via go/ees005
|
|
109
109
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
110
|
-
, messages.editDropdownTriggerTitle)), !
|
|
110
|
+
, messages.editDropdownTriggerTitle)), !isNewEditorToolbarEnabled && jsx(Separator, null));
|
|
111
111
|
return jsx(Flex, {
|
|
112
112
|
ref: containerRef
|
|
113
113
|
}, jsx(UiDropdown, {
|
|
@@ -3,12 +3,12 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { appearancePropsMap } from '@atlaskit/editor-common/card';
|
|
6
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
6
7
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
|
|
7
8
|
import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
|
|
8
9
|
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down';
|
|
9
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { Flex } from '@atlaskit/primitives/compiled';
|
|
11
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
12
12
|
import { LinkAppearanceMenu } from './LinkToolbarAppearanceDropdown';
|
|
13
13
|
var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
14
14
|
var _props$cardOptions3;
|
|
@@ -199,7 +199,7 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
199
199
|
allowDatasource: allowDatasource,
|
|
200
200
|
dispatchCommand: dispatchCommand,
|
|
201
201
|
settingsConfig: settingsConfig
|
|
202
|
-
})), !(
|
|
202
|
+
})), !(areToolbarFlagsEnabled() && fg('platform_editor_controls_patch_15')) && /*#__PURE__*/React.createElement(Separator, null));
|
|
203
203
|
};
|
|
204
204
|
export var getCustomHyperlinkAppearanceDropdown = function getCustomHyperlinkAppearanceDropdown(_ref3) {
|
|
205
205
|
var url = _ref3.url,
|
|
@@ -12,6 +12,7 @@ import { useIntl } from 'react-intl-next';
|
|
|
12
12
|
import { cardMessages } from '@atlaskit/editor-common/messages';
|
|
13
13
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
14
14
|
import PanelRightIcon from '@atlaskit/icon/core/panel-right';
|
|
15
|
+
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
15
16
|
import { Box, Pressable, Text, xcss } from '@atlaskit/primitives';
|
|
16
17
|
var containerStyles = css({
|
|
17
18
|
position: 'relative'
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -9,6 +9,7 @@ import { buildLayoutButtons, buildLayoutDropdown, commandWithMetadata } from '@a
|
|
|
9
9
|
import { getLinkPreferencesURLFromENV } from '@atlaskit/editor-common/link';
|
|
10
10
|
import commonMessages, { annotationMessages, linkMessages, linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
11
11
|
import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME, richMediaClassName } from '@atlaskit/editor-common/styles';
|
|
12
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
12
13
|
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
13
14
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
14
15
|
import { findDomRefAtPos, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -26,7 +27,6 @@ import OpenIcon from '@atlaskit/icon/core/migration/link-external--shortcut';
|
|
|
26
27
|
import CogIcon from '@atlaskit/icon/core/migration/settings--editor-settings';
|
|
27
28
|
import SettingsIcon from '@atlaskit/icon/core/settings';
|
|
28
29
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
29
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
30
30
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
31
31
|
import { changeSelectedCardToText } from '../pm-plugins/doc';
|
|
32
32
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
@@ -160,7 +160,7 @@ var unlinkCard = function unlinkCard(node, state, editorAnalyticsApi) {
|
|
|
160
160
|
};
|
|
161
161
|
};
|
|
162
162
|
var buildAlignmentOptions = function buildAlignmentOptions(state, intl, widthPluginDependencyApi, analyticsApi, cardOptions) {
|
|
163
|
-
if (
|
|
163
|
+
if (areToolbarFlagsEnabled()) {
|
|
164
164
|
return 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);
|
|
165
165
|
}
|
|
166
166
|
return buildLayoutButtons(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);
|
|
@@ -205,6 +205,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
205
205
|
title: title
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
+
var isNewEditorToolbarDisabled = !areToolbarFlagsEnabled();
|
|
208
209
|
var currentAppearance = appearanceForNodeType(node.type);
|
|
209
210
|
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 : {},
|
|
210
211
|
hoverDecoration = _ref2.hoverDecoration;
|
|
@@ -313,7 +314,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
313
314
|
testId: 'link-toolbar-edit-link-button',
|
|
314
315
|
onClick: getEditLinkCallback(editorAnalyticsApi, true)
|
|
315
316
|
}];
|
|
316
|
-
var toolbarItems =
|
|
317
|
+
var toolbarItems = isNewEditorToolbarDisabled ? [].concat(editItems, commentItems, [{
|
|
317
318
|
id: 'editor.link.openLink',
|
|
318
319
|
type: 'button',
|
|
319
320
|
icon: LinkExternalIcon,
|
|
@@ -371,7 +372,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
371
372
|
if (currentAppearance === 'embed') {
|
|
372
373
|
var _pluginInjectionApi$a4;
|
|
373
374
|
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);
|
|
374
|
-
if (alignmentOptions.length &&
|
|
375
|
+
if (alignmentOptions.length && isNewEditorToolbarDisabled) {
|
|
375
376
|
alignmentOptions.push({
|
|
376
377
|
type: 'separator'
|
|
377
378
|
});
|
|
@@ -386,7 +387,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
386
387
|
// For url appearance, please see HyperlinkToolbarAppearanceProps
|
|
387
388
|
if (currentAppearance) {
|
|
388
389
|
var showDatasourceAppearance = allowDatasource && url;
|
|
389
|
-
toolbarItems.unshift.apply(toolbarItems, _toConsumableArray(getToolbarViewedItem(url, currentAppearance)).concat([
|
|
390
|
+
toolbarItems.unshift.apply(toolbarItems, _toConsumableArray(getToolbarViewedItem(url, currentAppearance)).concat([isNewEditorToolbarDisabled ? {
|
|
390
391
|
type: 'custom',
|
|
391
392
|
fallback: [],
|
|
392
393
|
render: function render(editorView) {
|
|
@@ -415,7 +416,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
415
416
|
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
416
417
|
settingsConfig: getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink),
|
|
417
418
|
isDatasourceView: isDatasource
|
|
418
|
-
})], _toConsumableArray(showDatasourceAppearance &&
|
|
419
|
+
})], _toConsumableArray(showDatasourceAppearance && isNewEditorToolbarDisabled ? [{
|
|
419
420
|
type: 'custom',
|
|
420
421
|
fallback: [],
|
|
421
422
|
render: function render(editorView) {
|
|
@@ -428,11 +429,11 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
428
429
|
inputMethod: INPUT_METHOD.FLOATING_TB
|
|
429
430
|
});
|
|
430
431
|
}
|
|
431
|
-
}] : []), _toConsumableArray(
|
|
432
|
+
}] : []), _toConsumableArray(!isNewEditorToolbarDisabled ? [] : [{
|
|
432
433
|
type: 'separator'
|
|
433
434
|
}])));
|
|
434
435
|
}
|
|
435
|
-
if (
|
|
436
|
+
if (!isNewEditorToolbarDisabled) {
|
|
436
437
|
var hoverDecorationProps = function hoverDecorationProps(nodeType, className) {
|
|
437
438
|
return {
|
|
438
439
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
@@ -484,7 +485,7 @@ var getUnlinkButtonGroup = function getUnlinkButtonGroup(state, intl, node, inli
|
|
|
484
485
|
icon: LinkBrokenIcon,
|
|
485
486
|
iconFallback: UnlinkIcon,
|
|
486
487
|
onClick: withToolbarMetadata(unlinkCard(node, state, editorAnalyticsApi))
|
|
487
|
-
}].concat(_toConsumableArray(
|
|
488
|
+
}].concat(_toConsumableArray(areToolbarFlagsEnabled() ? [] : [{
|
|
488
489
|
type: 'separator'
|
|
489
490
|
}])) : [];
|
|
490
491
|
};
|
|
@@ -503,6 +504,7 @@ export var getSettingsButton = function getSettingsButton(intl, editorAnalyticsA
|
|
|
503
504
|
var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance, pluginInjectionApi) {
|
|
504
505
|
var _node$attrs2;
|
|
505
506
|
var toolbarItems = [];
|
|
507
|
+
var isNewEditorToolbarDisabled = !areToolbarFlagsEnabled();
|
|
506
508
|
var canShowAppearanceSwitch = function canShowAppearanceSwitch() {
|
|
507
509
|
// we do not show smart-link or the datasource icons when the node does not have a url to resolve
|
|
508
510
|
if (!metadata.url) {
|
|
@@ -515,7 +517,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
515
517
|
allowEmbeds = cardOptions.allowEmbeds,
|
|
516
518
|
showUpgradeDiscoverability = cardOptions.showUpgradeDiscoverability;
|
|
517
519
|
var url = metadata.url;
|
|
518
|
-
if (
|
|
520
|
+
if (isNewEditorToolbarDisabled) {
|
|
519
521
|
toolbarItems.push({
|
|
520
522
|
type: 'custom',
|
|
521
523
|
fallback: [],
|
|
@@ -600,13 +602,13 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
600
602
|
href: node.attrs.url,
|
|
601
603
|
target: '_blank'
|
|
602
604
|
});
|
|
603
|
-
if (
|
|
605
|
+
if (isNewEditorToolbarDisabled) {
|
|
604
606
|
toolbarItems.push({
|
|
605
607
|
type: 'separator'
|
|
606
608
|
});
|
|
607
609
|
}
|
|
608
610
|
}
|
|
609
|
-
if (
|
|
611
|
+
if (isNewEditorToolbarDisabled) {
|
|
610
612
|
toolbarItems.push({
|
|
611
613
|
type: 'copy-button',
|
|
612
614
|
supportsViewMode: true,
|
|
@@ -724,7 +726,7 @@ export var getStartingToolbarItems = function getStartingToolbarItems(options, a
|
|
|
724
726
|
}, {
|
|
725
727
|
type: 'separator'
|
|
726
728
|
}];
|
|
727
|
-
if (
|
|
729
|
+
if (areToolbarFlagsEnabled()) {
|
|
728
730
|
var _api$analytics2, _api$analytics3;
|
|
729
731
|
var hyperlinkAppearance = [getCustomHyperlinkAppearanceDropdown({
|
|
730
732
|
url: link,
|
|
@@ -788,7 +790,7 @@ export var getEndingToolbarItems = function getEndingToolbarItems(options, api)
|
|
|
788
790
|
* Require either provider to be supplied (controls link preferences)
|
|
789
791
|
* Or explicit user preferences config in order to enable button
|
|
790
792
|
*/
|
|
791
|
-
if ((options.provider || options.userPreferencesLink) &&
|
|
793
|
+
if ((options.provider || options.userPreferencesLink) && !areToolbarFlagsEnabled()) {
|
|
792
794
|
var _api$analytics5;
|
|
793
795
|
return [{
|
|
794
796
|
type: 'separator'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.10",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,20 +49,20 @@
|
|
|
49
49
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
50
50
|
"@atlaskit/editor-shared-styles": "^3.5.0",
|
|
51
51
|
"@atlaskit/frontend-utilities": "^3.1.0",
|
|
52
|
-
"@atlaskit/icon": "^27.
|
|
52
|
+
"@atlaskit/icon": "^27.5.0",
|
|
53
53
|
"@atlaskit/link": "^3.2.0",
|
|
54
54
|
"@atlaskit/link-analytics": "^10.0.0",
|
|
55
55
|
"@atlaskit/link-client-extension": "^5.0.0",
|
|
56
|
-
"@atlaskit/link-datasource": "^4.
|
|
57
|
-
"@atlaskit/linking-common": "^9.
|
|
56
|
+
"@atlaskit/link-datasource": "^4.14.0",
|
|
57
|
+
"@atlaskit/linking-common": "^9.2.0",
|
|
58
58
|
"@atlaskit/linking-types": "^14.0.0",
|
|
59
59
|
"@atlaskit/menu": "^8.0.0",
|
|
60
60
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
61
61
|
"@atlaskit/primitives": "^14.10.0",
|
|
62
|
-
"@atlaskit/smart-card": "^40.
|
|
62
|
+
"@atlaskit/smart-card": "^40.4.0",
|
|
63
63
|
"@atlaskit/theme": "^19.0.0",
|
|
64
|
-
"@atlaskit/tmp-editor-statsig": "^9.
|
|
65
|
-
"@atlaskit/tokens": "^5.
|
|
64
|
+
"@atlaskit/tmp-editor-statsig": "^9.9.0",
|
|
65
|
+
"@atlaskit/tokens": "^5.6.0",
|
|
66
66
|
"@babel/runtime": "^7.0.0",
|
|
67
67
|
"@emotion/react": "^11.7.1",
|
|
68
68
|
"lodash": "^4.17.21",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"uuid": "^3.1.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@atlaskit/editor-common": "^107.
|
|
74
|
+
"@atlaskit/editor-common": "^107.9.0",
|
|
75
75
|
"@atlaskit/link-provider": "^3.4.0",
|
|
76
76
|
"react": "^18.2.0",
|
|
77
77
|
"react-intl-next": "npm:react-intl@^5.18.1"
|