@atlaskit/editor-plugin-media 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +6 -2
- package/dist/cjs/ui/MediaLinkingToolbar.js +7 -3
- package/dist/cjs/ui/toolbar/alt-text.js +2 -1
- package/dist/cjs/ui/toolbar/index.js +23 -19
- package/dist/cjs/ui/toolbar/layout-group.js +8 -4
- package/dist/cjs/ui/toolbar/linking-toolbar-appearance.js +14 -6
- package/dist/cjs/ui/toolbar/linking.js +3 -1
- package/dist/cjs/ui/toolbar/mediaInline.js +7 -6
- package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +6 -2
- package/dist/es2019/ui/MediaLinkingToolbar.js +7 -3
- package/dist/es2019/ui/toolbar/alt-text.js +2 -1
- package/dist/es2019/ui/toolbar/index.js +23 -19
- package/dist/es2019/ui/toolbar/layout-group.js +8 -4
- package/dist/es2019/ui/toolbar/linking-toolbar-appearance.js +14 -6
- package/dist/es2019/ui/toolbar/linking.js +3 -1
- package/dist/es2019/ui/toolbar/mediaInline.js +7 -6
- package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +6 -2
- package/dist/esm/ui/MediaLinkingToolbar.js +7 -3
- package/dist/esm/ui/toolbar/alt-text.js +2 -1
- package/dist/esm/ui/toolbar/index.js +23 -19
- package/dist/esm/ui/toolbar/layout-group.js +8 -4
- package/dist/esm/ui/toolbar/linking-toolbar-appearance.js +14 -6
- package/dist/esm/ui/toolbar/linking.js +3 -1
- package/dist/esm/ui/toolbar/mediaInline.js +7 -6
- package/dist/types/mediaPluginType.d.ts +3 -1
- package/dist/types/pm-plugins/alt-text/ui/AltTextEdit.d.ts +1 -0
- package/dist/types/ui/MediaLinkingToolbar.d.ts +1 -0
- package/dist/types/ui/toolbar/alt-text.d.ts +1 -0
- package/dist/types/ui/toolbar/layout-group.d.ts +2 -1
- package/dist/types/ui/toolbar/linking-toolbar-appearance.d.ts +2 -1
- package/dist/types-ts4.5/mediaPluginType.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/alt-text/ui/AltTextEdit.d.ts +1 -0
- package/dist/types-ts4.5/ui/MediaLinkingToolbar.d.ts +1 -0
- package/dist/types-ts4.5/ui/toolbar/alt-text.d.ts +1 -0
- package/dist/types-ts4.5/ui/toolbar/layout-group.d.ts +2 -1
- package/dist/types-ts4.5/ui/toolbar/linking-toolbar-appearance.d.ts +2 -1
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 6.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c0113eeccb2df`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c0113eeccb2df) -
|
|
8
|
+
[ux] ED-29120 add a new config option for default editor preset
|
|
9
|
+
(`toolbar.enableNewToolbarExperience`) which allows the new toolbar to be disabled. This is needed
|
|
10
|
+
for editors that can't be excluded at the experiment level.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 6.1.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -18,6 +18,7 @@ var _analyticsNext = require("@atlaskit/analytics-next");
|
|
|
18
18
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
19
19
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
20
20
|
var _media = require("@atlaskit/editor-common/media");
|
|
21
|
+
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
21
22
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
22
23
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
23
24
|
var _chevronLeftChevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-left--chevron-left-large"));
|
|
@@ -181,6 +182,7 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
|
|
|
181
182
|
}, {
|
|
182
183
|
key: "render",
|
|
183
184
|
value: function render() {
|
|
185
|
+
var _this$props$areAnyNew, _this$props$areAnyNew2;
|
|
184
186
|
var formatMessage = this.props.intl.formatMessage;
|
|
185
187
|
var showClearTextButton = this.state.showClearTextButton;
|
|
186
188
|
var backButtonMessage = formatMessage(_media.altTextMessages.back);
|
|
@@ -211,7 +213,8 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
|
|
|
211
213
|
size: "small"
|
|
212
214
|
}),
|
|
213
215
|
tooltipContent: backButtonMessageComponent,
|
|
214
|
-
onClick: this.closeMediaAltTextMenu
|
|
216
|
+
onClick: this.closeMediaAltTextMenu,
|
|
217
|
+
areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew !== void 0 ? _this$props$areAnyNew : (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()
|
|
215
218
|
})), (0, _react2.jsx)(_ui.PanelTextInput, {
|
|
216
219
|
testId: "alt-text-input",
|
|
217
220
|
ariaLabel: formatMessage(_media.altTextMessages.placeholder),
|
|
@@ -237,7 +240,8 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
|
|
|
237
240
|
label: formatMessage(_media.altTextMessages.clear)
|
|
238
241
|
})),
|
|
239
242
|
tooltipContent: formatMessage(_media.altTextMessages.clear),
|
|
240
|
-
onClick: this.handleClearText
|
|
243
|
+
onClick: this.handleClearText,
|
|
244
|
+
areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew2 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew2 !== void 0 ? _this$props$areAnyNew2 : (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()
|
|
241
245
|
}))), hasErrors && (0, _react2.jsx)("section", {
|
|
242
246
|
id: "errors-list",
|
|
243
247
|
ref: this.errorsListRef,
|
|
@@ -141,7 +141,8 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
141
141
|
inputMethod: currentInputMethod
|
|
142
142
|
}, true);
|
|
143
143
|
}
|
|
144
|
-
}
|
|
144
|
+
},
|
|
145
|
+
areAnyNewToolbarFlagsEnabled: _this.props.areAnyNewToolbarFlagsEnabled
|
|
145
146
|
})), (0, _react2.jsx)(_ui.PanelTextInput, {
|
|
146
147
|
inputId: "media-link-search-input",
|
|
147
148
|
testId: "media-link-input",
|
|
@@ -168,7 +169,9 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
168
169
|
}), (0, _react2.jsx)("label", {
|
|
169
170
|
className: "assistive",
|
|
170
171
|
htmlFor: "media-link-search-input"
|
|
171
|
-
}, formatMessage(_messages.linkToolbarMessages.searchInput)), (0, _utils.normalizeUrl)(displayUrl) && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_ui.FloatingToolbarSeparator,
|
|
172
|
+
}, formatMessage(_messages.linkToolbarMessages.searchInput)), (0, _utils.normalizeUrl)(displayUrl) && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_ui.FloatingToolbarSeparator, {
|
|
173
|
+
areAnyNewToolbarFlagsEnabled: _this.props.areAnyNewToolbarFlagsEnabled
|
|
174
|
+
}), (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
172
175
|
title: formatUnlinkText,
|
|
173
176
|
icon: (0, _react2.jsx)(_linkBrokenEditorUnlink.default, {
|
|
174
177
|
label: formatUnlinkText
|
|
@@ -181,7 +184,8 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
181
184
|
event.preventDefault();
|
|
182
185
|
_this.handleUnlink(true);
|
|
183
186
|
}
|
|
184
|
-
}
|
|
187
|
+
},
|
|
188
|
+
areAnyNewToolbarFlagsEnabled: _this.props.areAnyNewToolbarFlagsEnabled
|
|
185
189
|
}))), !!errorsList.length && (0, _react2.jsx)("section", {
|
|
186
190
|
css: validationWrapper
|
|
187
191
|
}, errorsList), renderRecentList()))
|
|
@@ -77,7 +77,8 @@ var altTextEditComponent = function altTextEditComponent(options) {
|
|
|
77
77
|
value: mediaNode.attrs.alt,
|
|
78
78
|
altTextValidator: options && options.altTextValidator,
|
|
79
79
|
onEscape: setFocus,
|
|
80
|
-
onEnter: setFocus
|
|
80
|
+
onEnter: setFocus,
|
|
81
|
+
areAnyNewToolbarFlagsEnabled: options === null || options === void 0 ? void 0 : options.areAnyNewToolbarFlagsEnabled
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
};
|
|
@@ -123,12 +123,12 @@ var handleShowMediaViewer = exports.handleShowMediaViewer = function handleShowM
|
|
|
123
123
|
var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, editorAnalyticsAPI, forceFocusSelector, isViewOnly) {
|
|
124
124
|
var _pluginInjectionApi$c;
|
|
125
125
|
var disableDownloadButton = (0, _utils2.getIsDownloadDisabledByDataSecurityPolicy)(mediaPluginState);
|
|
126
|
-
var
|
|
126
|
+
var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
127
127
|
var preview = {
|
|
128
128
|
id: 'editor.media.viewer',
|
|
129
129
|
testId: 'file-preview-toolbar-button',
|
|
130
130
|
type: 'button',
|
|
131
|
-
icon:
|
|
131
|
+
icon: areAnyNewToolbarFlagsEnabled ? _growDiagonal.default : _maximize.default,
|
|
132
132
|
title: intl.formatMessage(_mediaUi.messages.preview),
|
|
133
133
|
onClick: function onClick() {
|
|
134
134
|
var _handleShowMediaViewe;
|
|
@@ -150,15 +150,15 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
150
150
|
},
|
|
151
151
|
title: intl.formatMessage(_mediaUi.messages.download),
|
|
152
152
|
disabled: disableDownloadButton
|
|
153
|
-
},
|
|
153
|
+
}, areAnyNewToolbarFlagsEnabled && {
|
|
154
154
|
supportsViewMode: true
|
|
155
155
|
});
|
|
156
|
-
if (isViewOnly && !
|
|
156
|
+
if (isViewOnly && !areAnyNewToolbarFlagsEnabled) {
|
|
157
157
|
return [];
|
|
158
158
|
}
|
|
159
159
|
var mediaGroup = state.schema.nodes.mediaGroup;
|
|
160
160
|
var items = [];
|
|
161
|
-
if (!
|
|
161
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
162
162
|
items.push({
|
|
163
163
|
id: 'editor.media.view.switcher.inline',
|
|
164
164
|
type: 'button',
|
|
@@ -278,7 +278,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
278
278
|
var toolbarButtons = [];
|
|
279
279
|
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 : {},
|
|
280
280
|
hoverDecoration = _ref2.hoverDecoration;
|
|
281
|
-
var
|
|
281
|
+
var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
282
282
|
var disableDownloadButton = (0, _utils2.getIsDownloadDisabledByDataSecurityPolicy)(pluginState);
|
|
283
283
|
if ((0, _imageBorder.shouldShowImageBorder)(state)) {
|
|
284
284
|
toolbarButtons.push({
|
|
@@ -305,7 +305,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
307
|
});
|
|
308
|
-
if (!
|
|
308
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
309
309
|
toolbarButtons.push({
|
|
310
310
|
type: 'separator'
|
|
311
311
|
});
|
|
@@ -326,7 +326,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
326
326
|
}
|
|
327
327
|
var layoutButtons = (0, _card.buildLayoutButtons)(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled, allowPixelResizing);
|
|
328
328
|
var addLayoutDropdownToToolbar = function addLayoutDropdownToToolbar() {
|
|
329
|
-
if (
|
|
329
|
+
if (areAnyNewToolbarFlagsEnabled) {
|
|
330
330
|
var _pluginInjectionApi$a4;
|
|
331
331
|
var layoutDropdown = (0, _card.buildLayoutDropdown)(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled, allowPixelResizing);
|
|
332
332
|
toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)(layoutDropdown));
|
|
@@ -341,7 +341,9 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
341
341
|
layoutButtons: layoutButtons
|
|
342
342
|
// Ignored via go/ees005
|
|
343
343
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
344
|
-
}, props
|
|
344
|
+
}, props, {
|
|
345
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
346
|
+
}));
|
|
345
347
|
},
|
|
346
348
|
width: 188,
|
|
347
349
|
height: 32
|
|
@@ -354,7 +356,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
354
356
|
title: intl.formatMessage(_card.layoutToMessages[selectedLayoutIcon.value]),
|
|
355
357
|
icon: selectedLayoutIcon.icon
|
|
356
358
|
};
|
|
357
|
-
toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), [trigger], (0, _toConsumableArray2.default)(
|
|
359
|
+
toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), [trigger], (0, _toConsumableArray2.default)(areAnyNewToolbarFlagsEnabled ? [] : [{
|
|
358
360
|
type: 'separator'
|
|
359
361
|
}]));
|
|
360
362
|
}
|
|
@@ -376,7 +378,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
376
378
|
addLayoutDropdownToToolbar();
|
|
377
379
|
} else {
|
|
378
380
|
toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)(layoutButtons));
|
|
379
|
-
if (layoutButtons.length && !
|
|
381
|
+
if (layoutButtons.length && !areAnyNewToolbarFlagsEnabled) {
|
|
380
382
|
toolbarButtons.push({
|
|
381
383
|
type: 'separator'
|
|
382
384
|
});
|
|
@@ -392,7 +394,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
392
394
|
var hasCaption = (0, _utils.contains)(selectedNode.node, state.schema.nodes.caption);
|
|
393
395
|
var inlineSwitcherTitle = intl.formatMessage(hasCaption ? _messages.mediaAndEmbedToolbarMessages.changeToMediaInlineImageCaptionWarning : _messages.mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
|
|
394
396
|
var floatingSwitcherTitle = intl.formatMessage(_messages.mediaAndEmbedToolbarMessages.changeToMediaSingle);
|
|
395
|
-
if (!
|
|
397
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
396
398
|
var _pluginInjectionApi$a5;
|
|
397
399
|
toolbarButtons.push({
|
|
398
400
|
type: 'button',
|
|
@@ -437,7 +439,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
437
439
|
}
|
|
438
440
|
|
|
439
441
|
// A separator is needed regardless switcher is enabled or not
|
|
440
|
-
if ((0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true)) {
|
|
442
|
+
if (Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar) && (0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true)) {
|
|
441
443
|
toolbarButtons.push({
|
|
442
444
|
type: 'separator',
|
|
443
445
|
fullHeight: true
|
|
@@ -488,14 +490,14 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
488
490
|
}
|
|
489
491
|
return [sizeInput];
|
|
490
492
|
}
|
|
491
|
-
if (!
|
|
493
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
492
494
|
toolbarButtons.push(sizeInput);
|
|
493
495
|
toolbarButtons.push({
|
|
494
496
|
type: 'separator'
|
|
495
497
|
});
|
|
496
498
|
}
|
|
497
499
|
}
|
|
498
|
-
if (!
|
|
500
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
499
501
|
if (allowCommentsOnMedia) {
|
|
500
502
|
toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi, onCommentButtonMount), {
|
|
501
503
|
type: 'separator',
|
|
@@ -538,7 +540,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
538
540
|
onAddLink: editLink,
|
|
539
541
|
onEditLink: editLink,
|
|
540
542
|
onOpenLink: openLink,
|
|
541
|
-
isViewOnly: isViewOnly
|
|
543
|
+
isViewOnly: isViewOnly,
|
|
544
|
+
areAnyNewToolbarFlagsEnabled: false
|
|
542
545
|
});
|
|
543
546
|
}
|
|
544
547
|
return null;
|
|
@@ -593,7 +596,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
593
596
|
supportsViewMode: true
|
|
594
597
|
});
|
|
595
598
|
}
|
|
596
|
-
if (!
|
|
599
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
597
600
|
var _pluginInjectionApi$a8;
|
|
598
601
|
if (allowAltTextOnImages) {
|
|
599
602
|
var _pluginInjectionApi$a7;
|
|
@@ -759,7 +762,8 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
759
762
|
return (0, _altText2.getAltTextToolbar)(baseToolbar, {
|
|
760
763
|
altTextValidator: altTextValidator,
|
|
761
764
|
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f === void 0 || (_pluginInjectionApi$f = _pluginInjectionApi$f.actions) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.forceFocusSelector,
|
|
762
|
-
triggerButtonSelector: overflowButtonSelector
|
|
765
|
+
triggerButtonSelector: overflowButtonSelector,
|
|
766
|
+
areAnyNewToolbarFlagsEnabled: (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))
|
|
763
767
|
});
|
|
764
768
|
}
|
|
765
769
|
}
|
|
@@ -807,7 +811,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
807
811
|
};
|
|
808
812
|
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi);
|
|
809
813
|
}
|
|
810
|
-
if (!mediaPluginState.isResizing && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) {
|
|
814
|
+
if (!mediaPluginState.isResizing && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
|
|
811
815
|
var _pluginInjectionApi$a0, _pluginInjectionApi$a1;
|
|
812
816
|
(0, _utils2.updateToFullHeightSeparator)(items);
|
|
813
817
|
var customOptions = [].concat((0, _toConsumableArray2.default)((0, _linking3.getLinkingDropdownOptions)(state, intl, mediaLinkingState, allowMediaInline && selectedNodeType && selectedNodeType === mediaInline, allowLinking, isViewOnly)), (0, _toConsumableArray2.default)((0, _altText2.getAltTextDropdownOption)(state, intl.formatMessage, allowAltTextOnImages, selectedNodeType, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a0 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a0 === void 0 ? void 0 : _pluginInjectionApi$a0.actions)), (0, _toConsumableArray2.default)((0, _pixelResizing2.getResizeDropdownOption)(options, state, intl.formatMessage, selectedNodeType)));
|
|
@@ -22,16 +22,19 @@ var containerStyles = (0, _primitives.xcss)({
|
|
|
22
22
|
var LayoutGroup = exports.LayoutGroup = function LayoutGroup(_ref) {
|
|
23
23
|
var layoutButtons = _ref.layoutButtons,
|
|
24
24
|
dispatchCommand = _ref.dispatchCommand,
|
|
25
|
-
hide = _ref.hide
|
|
25
|
+
hide = _ref.hide,
|
|
26
|
+
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
|
|
26
27
|
return (0, _react.jsx)(_primitives.Box, {
|
|
27
28
|
xcss: containerStyles
|
|
28
29
|
}, (0, _react.jsx)(_button.ButtonGroup, null, layoutButtons.map(function (item, idx) {
|
|
29
30
|
switch (item.type) {
|
|
30
31
|
case 'separator':
|
|
32
|
+
return (0, _react.jsx)(_ui.FloatingToolbarSeparator
|
|
31
33
|
// Ignored via go/ees005
|
|
32
34
|
// eslint-disable-next-line react/no-array-index-key
|
|
33
|
-
|
|
34
|
-
key: idx
|
|
35
|
+
, {
|
|
36
|
+
key: idx,
|
|
37
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
35
38
|
});
|
|
36
39
|
case 'button':
|
|
37
40
|
// Ignored via go/ees005
|
|
@@ -51,7 +54,8 @@ var LayoutGroup = exports.LayoutGroup = function LayoutGroup(_ref) {
|
|
|
51
54
|
onClick: function onClick() {
|
|
52
55
|
dispatchCommand(item.onClick);
|
|
53
56
|
hide();
|
|
54
|
-
}
|
|
57
|
+
},
|
|
58
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
55
59
|
});
|
|
56
60
|
}
|
|
57
61
|
})));
|
|
@@ -38,7 +38,8 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = function LinkToolbar
|
|
|
38
38
|
onEditLink = _ref.onEditLink,
|
|
39
39
|
onOpenLink = _ref.onOpenLink,
|
|
40
40
|
isInlineNode = _ref.isInlineNode,
|
|
41
|
-
isViewOnly = _ref.isViewOnly
|
|
41
|
+
isViewOnly = _ref.isViewOnly,
|
|
42
|
+
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
|
|
42
43
|
var _useState = (0, _react.useState)(true),
|
|
43
44
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
44
45
|
showLinkingControls = _useState2[0],
|
|
@@ -75,7 +76,8 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = function LinkToolbar
|
|
|
75
76
|
description: title,
|
|
76
77
|
keymap: _keymaps.addLink
|
|
77
78
|
}),
|
|
78
|
-
testId: "edit-link-button"
|
|
79
|
+
testId: "edit-link-button",
|
|
80
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
79
81
|
}, title)), (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
80
82
|
target: "_blank",
|
|
81
83
|
href: isValidUrl ? mediaLinkingState.link : undefined,
|
|
@@ -89,8 +91,11 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = function LinkToolbar
|
|
|
89
91
|
})
|
|
90
92
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
91
93
|
,
|
|
92
|
-
className: "hyperlink-open-link"
|
|
93
|
-
|
|
94
|
+
className: "hyperlink-open-link",
|
|
95
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
96
|
+
}), (0, _react2.jsx)(_ui.FloatingToolbarSeparator, {
|
|
97
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
98
|
+
}));
|
|
94
99
|
} else {
|
|
95
100
|
var _title = intl.formatMessage(_messages.linkToolbarMessages.addLink);
|
|
96
101
|
return !isViewOnly ? (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
@@ -105,7 +110,10 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = function LinkToolbar
|
|
|
105
110
|
color: "currentColor",
|
|
106
111
|
label: _title,
|
|
107
112
|
spacing: "spacious"
|
|
108
|
-
})
|
|
109
|
-
|
|
113
|
+
}),
|
|
114
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
115
|
+
}), (0, _react2.jsx)(_ui.FloatingToolbarSeparator, {
|
|
116
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
117
|
+
})) : null;
|
|
110
118
|
}
|
|
111
119
|
};
|
|
@@ -11,6 +11,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
12
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
|
+
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
14
15
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
15
16
|
var _link = _interopRequireDefault(require("@atlaskit/icon/core/link"));
|
|
16
17
|
var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
|
|
@@ -109,7 +110,8 @@ var getLinkingToolbar = exports.getLinkingToolbar = function getLinkingToolbar(t
|
|
|
109
110
|
},
|
|
110
111
|
onBlur: function onBlur() {
|
|
111
112
|
(0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view);
|
|
112
|
-
}
|
|
113
|
+
},
|
|
114
|
+
areAnyNewToolbarFlagsEnabled: (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))
|
|
113
115
|
});
|
|
114
116
|
}
|
|
115
117
|
}]
|
|
@@ -48,12 +48,12 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
|
|
|
48
48
|
return getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState, options);
|
|
49
49
|
}
|
|
50
50
|
var items = [];
|
|
51
|
-
var
|
|
51
|
+
var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
52
52
|
var preview = _objectSpread({
|
|
53
53
|
id: 'editor.media.viewer',
|
|
54
54
|
testId: 'file-preview-toolbar-button',
|
|
55
55
|
type: 'button',
|
|
56
|
-
icon:
|
|
56
|
+
icon: areAnyNewToolbarFlagsEnabled ? _growDiagonal.default : _maximize.default,
|
|
57
57
|
title: intl.formatMessage(_mediaUi.messages.preview),
|
|
58
58
|
onClick: function onClick() {
|
|
59
59
|
var _handleShowMediaViewe;
|
|
@@ -62,7 +62,7 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
|
|
|
62
62
|
api: pluginInjectionApi
|
|
63
63
|
})) !== null && _handleShowMediaViewe !== void 0 ? _handleShowMediaViewe : false;
|
|
64
64
|
}
|
|
65
|
-
},
|
|
65
|
+
}, areAnyNewToolbarFlagsEnabled && {
|
|
66
66
|
supportsViewMode: true
|
|
67
67
|
});
|
|
68
68
|
var disableDownloadButton = (0, _utils.getIsDownloadDisabledByDataSecurityPolicy)(mediaPluginState);
|
|
@@ -76,10 +76,10 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
|
|
|
76
76
|
},
|
|
77
77
|
disabled: disableDownloadButton,
|
|
78
78
|
title: intl.formatMessage(_mediaUi.messages.download)
|
|
79
|
-
},
|
|
79
|
+
}, areAnyNewToolbarFlagsEnabled && {
|
|
80
80
|
supportsViewMode: true
|
|
81
81
|
});
|
|
82
|
-
if (!
|
|
82
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
83
83
|
items.push({
|
|
84
84
|
id: 'editor.media.view.switcher.inline',
|
|
85
85
|
type: 'button',
|
|
@@ -304,7 +304,8 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
304
304
|
onEditLink: editLink,
|
|
305
305
|
onOpenLink: openLink,
|
|
306
306
|
isInlineNode: true,
|
|
307
|
-
isViewOnly: options.isViewOnly
|
|
307
|
+
isViewOnly: options.isViewOnly,
|
|
308
|
+
areAnyNewToolbarFlagsEnabled: (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))
|
|
308
309
|
});
|
|
309
310
|
}
|
|
310
311
|
return null;
|
|
@@ -13,6 +13,7 @@ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
13
13
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
14
14
|
import { escape, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
15
15
|
import { altTextMessages as messages } from '@atlaskit/editor-common/media';
|
|
16
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
16
17
|
import { RECENT_SEARCH_WIDTH_IN_PX as CONTAINER_WIDTH_IN_PX, FloatingToolbarButton as Button, ErrorMessage, PanelTextInput } from '@atlaskit/editor-common/ui';
|
|
17
18
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
18
19
|
import ChevronLeftLargeIcon from '@atlaskit/icon/core/migration/chevron-left--chevron-left-large';
|
|
@@ -164,6 +165,7 @@ export class AltTextEditComponent extends React.Component {
|
|
|
164
165
|
return [];
|
|
165
166
|
}
|
|
166
167
|
render() {
|
|
168
|
+
var _this$props$areAnyNew, _this$props$areAnyNew2;
|
|
167
169
|
const {
|
|
168
170
|
intl: {
|
|
169
171
|
formatMessage
|
|
@@ -200,7 +202,8 @@ export class AltTextEditComponent extends React.Component {
|
|
|
200
202
|
size: "small"
|
|
201
203
|
}),
|
|
202
204
|
tooltipContent: backButtonMessageComponent,
|
|
203
|
-
onClick: this.closeMediaAltTextMenu
|
|
205
|
+
onClick: this.closeMediaAltTextMenu,
|
|
206
|
+
areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew !== void 0 ? _this$props$areAnyNew : areToolbarFlagsEnabled()
|
|
204
207
|
})), jsx(PanelTextInput, {
|
|
205
208
|
testId: "alt-text-input",
|
|
206
209
|
ariaLabel: formatMessage(messages.placeholder),
|
|
@@ -226,7 +229,8 @@ export class AltTextEditComponent extends React.Component {
|
|
|
226
229
|
label: formatMessage(messages.clear)
|
|
227
230
|
})),
|
|
228
231
|
tooltipContent: formatMessage(messages.clear),
|
|
229
|
-
onClick: this.handleClearText
|
|
232
|
+
onClick: this.handleClearText,
|
|
233
|
+
areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew2 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew2 !== void 0 ? _this$props$areAnyNew2 : areToolbarFlagsEnabled()
|
|
230
234
|
}))), hasErrors && jsx("section", {
|
|
231
235
|
id: "errors-list",
|
|
232
236
|
ref: this.errorsListRef,
|
|
@@ -134,7 +134,8 @@ class LinkAddToolbar extends React.PureComponent {
|
|
|
134
134
|
inputMethod: currentInputMethod
|
|
135
135
|
}, true);
|
|
136
136
|
}
|
|
137
|
-
}
|
|
137
|
+
},
|
|
138
|
+
areAnyNewToolbarFlagsEnabled: this.props.areAnyNewToolbarFlagsEnabled
|
|
138
139
|
})), jsx(PanelTextInput, {
|
|
139
140
|
inputId: "media-link-search-input",
|
|
140
141
|
testId: "media-link-input",
|
|
@@ -161,7 +162,9 @@ class LinkAddToolbar extends React.PureComponent {
|
|
|
161
162
|
}), jsx("label", {
|
|
162
163
|
className: "assistive",
|
|
163
164
|
htmlFor: "media-link-search-input"
|
|
164
|
-
}, formatMessage(linkToolbarMessages.searchInput)), normalizeUrl(displayUrl) && jsx(Fragment, null, jsx(Separator,
|
|
165
|
+
}, formatMessage(linkToolbarMessages.searchInput)), normalizeUrl(displayUrl) && jsx(Fragment, null, jsx(Separator, {
|
|
166
|
+
areAnyNewToolbarFlagsEnabled: this.props.areAnyNewToolbarFlagsEnabled
|
|
167
|
+
}), jsx(Button, {
|
|
165
168
|
title: formatUnlinkText,
|
|
166
169
|
icon: jsx(EditorUnlinkIcon, {
|
|
167
170
|
label: formatUnlinkText
|
|
@@ -172,7 +175,8 @@ class LinkAddToolbar extends React.PureComponent {
|
|
|
172
175
|
event.preventDefault();
|
|
173
176
|
this.handleUnlink(true);
|
|
174
177
|
}
|
|
175
|
-
}
|
|
178
|
+
},
|
|
179
|
+
areAnyNewToolbarFlagsEnabled: this.props.areAnyNewToolbarFlagsEnabled
|
|
176
180
|
}))), !!errorsList.length && jsx("section", {
|
|
177
181
|
css: validationWrapper
|
|
178
182
|
}, errorsList), renderRecentList()))
|
|
@@ -71,7 +71,8 @@ const altTextEditComponent = options => {
|
|
|
71
71
|
value: mediaNode.attrs.alt,
|
|
72
72
|
altTextValidator: options && options.altTextValidator,
|
|
73
73
|
onEscape: setFocus,
|
|
74
|
-
onEnter: setFocus
|
|
74
|
+
onEnter: setFocus,
|
|
75
|
+
areAnyNewToolbarFlagsEnabled: options === null || options === void 0 ? void 0 : options.areAnyNewToolbarFlagsEnabled
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
};
|
|
@@ -111,12 +111,12 @@ export const handleShowMediaViewer = ({
|
|
|
111
111
|
const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, editorAnalyticsAPI, forceFocusSelector, isViewOnly) => {
|
|
112
112
|
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$c3;
|
|
113
113
|
const disableDownloadButton = getIsDownloadDisabledByDataSecurityPolicy(mediaPluginState);
|
|
114
|
-
const
|
|
114
|
+
const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
115
115
|
const preview = {
|
|
116
116
|
id: 'editor.media.viewer',
|
|
117
117
|
testId: 'file-preview-toolbar-button',
|
|
118
118
|
type: 'button',
|
|
119
|
-
icon:
|
|
119
|
+
icon: areAnyNewToolbarFlagsEnabled ? GrowDiagonalIcon : MaximizeIcon,
|
|
120
120
|
title: intl.formatMessage(messages.preview),
|
|
121
121
|
onClick: () => {
|
|
122
122
|
var _handleShowMediaViewe;
|
|
@@ -138,18 +138,18 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDe
|
|
|
138
138
|
},
|
|
139
139
|
title: intl.formatMessage(messages.download),
|
|
140
140
|
disabled: disableDownloadButton,
|
|
141
|
-
...(
|
|
141
|
+
...(areAnyNewToolbarFlagsEnabled && {
|
|
142
142
|
supportsViewMode: true
|
|
143
143
|
})
|
|
144
144
|
};
|
|
145
|
-
if (isViewOnly && !
|
|
145
|
+
if (isViewOnly && !areAnyNewToolbarFlagsEnabled) {
|
|
146
146
|
return [];
|
|
147
147
|
}
|
|
148
148
|
const {
|
|
149
149
|
mediaGroup
|
|
150
150
|
} = state.schema.nodes;
|
|
151
151
|
const items = [];
|
|
152
|
-
if (!
|
|
152
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
153
153
|
items.push({
|
|
154
154
|
id: 'editor.media.view.switcher.inline',
|
|
155
155
|
type: 'button',
|
|
@@ -268,7 +268,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
268
268
|
const {
|
|
269
269
|
hoverDecoration
|
|
270
270
|
} = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {};
|
|
271
|
-
const
|
|
271
|
+
const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
272
272
|
const disableDownloadButton = getIsDownloadDisabledByDataSecurityPolicy(pluginState);
|
|
273
273
|
if (shouldShowImageBorder(state)) {
|
|
274
274
|
toolbarButtons.push({
|
|
@@ -297,7 +297,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
299
|
});
|
|
300
|
-
if (!
|
|
300
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
301
301
|
toolbarButtons.push({
|
|
302
302
|
type: 'separator'
|
|
303
303
|
});
|
|
@@ -318,7 +318,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
318
318
|
}
|
|
319
319
|
const layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled, allowPixelResizing);
|
|
320
320
|
const addLayoutDropdownToToolbar = () => {
|
|
321
|
-
if (
|
|
321
|
+
if (areAnyNewToolbarFlagsEnabled) {
|
|
322
322
|
var _pluginInjectionApi$a4;
|
|
323
323
|
const layoutDropdown = buildLayoutDropdown(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled, allowPixelResizing);
|
|
324
324
|
toolbarButtons = [...toolbarButtons, ...layoutDropdown];
|
|
@@ -333,7 +333,9 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
333
333
|
layoutButtons: layoutButtons
|
|
334
334
|
// Ignored via go/ees005
|
|
335
335
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
336
|
-
}, props
|
|
336
|
+
}, props, {
|
|
337
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
338
|
+
}));
|
|
337
339
|
},
|
|
338
340
|
width: 188,
|
|
339
341
|
height: 32
|
|
@@ -346,7 +348,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
346
348
|
title: intl.formatMessage(layoutToMessages[selectedLayoutIcon.value]),
|
|
347
349
|
icon: selectedLayoutIcon.icon
|
|
348
350
|
};
|
|
349
|
-
toolbarButtons = [...toolbarButtons, trigger, ...(
|
|
351
|
+
toolbarButtons = [...toolbarButtons, trigger, ...(areAnyNewToolbarFlagsEnabled ? [] : [{
|
|
350
352
|
type: 'separator'
|
|
351
353
|
}])];
|
|
352
354
|
}
|
|
@@ -368,7 +370,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
368
370
|
addLayoutDropdownToToolbar();
|
|
369
371
|
} else {
|
|
370
372
|
toolbarButtons = [...toolbarButtons, ...layoutButtons];
|
|
371
|
-
if (layoutButtons.length && !
|
|
373
|
+
if (layoutButtons.length && !areAnyNewToolbarFlagsEnabled) {
|
|
372
374
|
toolbarButtons.push({
|
|
373
375
|
type: 'separator'
|
|
374
376
|
});
|
|
@@ -384,7 +386,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
384
386
|
const hasCaption = contains(selectedNode.node, state.schema.nodes.caption);
|
|
385
387
|
const inlineSwitcherTitle = intl.formatMessage(hasCaption ? mediaAndEmbedToolbarMessages.changeToMediaInlineImageCaptionWarning : mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
|
|
386
388
|
const floatingSwitcherTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaSingle);
|
|
387
|
-
if (!
|
|
389
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
388
390
|
var _pluginInjectionApi$a5;
|
|
389
391
|
toolbarButtons.push({
|
|
390
392
|
type: 'button',
|
|
@@ -425,7 +427,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
425
427
|
}
|
|
426
428
|
|
|
427
429
|
// A separator is needed regardless switcher is enabled or not
|
|
428
|
-
if (editorExperiment('platform_editor_toolbar_aifc', true)) {
|
|
430
|
+
if (Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar) && editorExperiment('platform_editor_toolbar_aifc', true)) {
|
|
429
431
|
toolbarButtons.push({
|
|
430
432
|
type: 'separator',
|
|
431
433
|
fullHeight: true
|
|
@@ -480,14 +482,14 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
480
482
|
}
|
|
481
483
|
return [sizeInput];
|
|
482
484
|
}
|
|
483
|
-
if (!
|
|
485
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
484
486
|
toolbarButtons.push(sizeInput);
|
|
485
487
|
toolbarButtons.push({
|
|
486
488
|
type: 'separator'
|
|
487
489
|
});
|
|
488
490
|
}
|
|
489
491
|
}
|
|
490
|
-
if (!
|
|
492
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
491
493
|
if (allowCommentsOnMedia) {
|
|
492
494
|
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount), {
|
|
493
495
|
type: 'separator',
|
|
@@ -536,7 +538,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
536
538
|
onAddLink: editLink,
|
|
537
539
|
onEditLink: editLink,
|
|
538
540
|
onOpenLink: openLink,
|
|
539
|
-
isViewOnly: isViewOnly
|
|
541
|
+
isViewOnly: isViewOnly,
|
|
542
|
+
areAnyNewToolbarFlagsEnabled: false
|
|
540
543
|
});
|
|
541
544
|
}
|
|
542
545
|
return null;
|
|
@@ -591,7 +594,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
591
594
|
supportsViewMode: true
|
|
592
595
|
});
|
|
593
596
|
}
|
|
594
|
-
if (!
|
|
597
|
+
if (!areAnyNewToolbarFlagsEnabled) {
|
|
595
598
|
var _pluginInjectionApi$a8;
|
|
596
599
|
if (allowAltTextOnImages) {
|
|
597
600
|
var _pluginInjectionApi$a7;
|
|
@@ -759,7 +762,8 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
759
762
|
return getAltTextToolbar(baseToolbar, {
|
|
760
763
|
altTextValidator,
|
|
761
764
|
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f === void 0 ? void 0 : (_pluginInjectionApi$f2 = _pluginInjectionApi$f.actions) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.forceFocusSelector,
|
|
762
|
-
triggerButtonSelector: overflowButtonSelector
|
|
765
|
+
triggerButtonSelector: overflowButtonSelector,
|
|
766
|
+
areAnyNewToolbarFlagsEnabled: areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))
|
|
763
767
|
});
|
|
764
768
|
}
|
|
765
769
|
}
|
|
@@ -809,7 +813,7 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
809
813
|
};
|
|
810
814
|
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi);
|
|
811
815
|
}
|
|
812
|
-
if (!mediaPluginState.isResizing && areToolbarFlagsEnabled()) {
|
|
816
|
+
if (!mediaPluginState.isResizing && areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
|
|
813
817
|
var _pluginInjectionApi$a0, _pluginInjectionApi$a1;
|
|
814
818
|
updateToFullHeightSeparator(items);
|
|
815
819
|
const customOptions = [...getLinkingDropdownOptions(state, intl, mediaLinkingState, allowMediaInline && selectedNodeType && selectedNodeType === mediaInline, allowLinking, isViewOnly), ...getAltTextDropdownOption(state, intl.formatMessage, allowAltTextOnImages, selectedNodeType, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a0 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a0 === void 0 ? void 0 : _pluginInjectionApi$a0.actions), ...getResizeDropdownOption(options, state, intl.formatMessage, selectedNodeType)];
|