@atlaskit/editor-plugin-media 2.2.3 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/ui/toolbar/index.js +135 -47
- package/dist/cjs/ui/toolbar/mediaInline.js +94 -57
- package/dist/es2019/ui/toolbar/index.js +139 -53
- package/dist/es2019/ui/toolbar/mediaInline.js +98 -63
- package/dist/esm/ui/toolbar/index.js +135 -47
- package/dist/esm/ui/toolbar/mediaInline.js +94 -57
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 2.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#121092](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/121092)
|
|
8
|
+
[`8cd08b738070d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8cd08b738070d) -
|
|
9
|
+
[ux] Implemented full height separator as per design for media and card
|
|
10
|
+
|
|
11
|
+
## 2.2.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#120999](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120999)
|
|
16
|
+
[`3d280e8a1e183`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3d280e8a1e183) -
|
|
17
|
+
[ux] Moves media floating toolbar options to convert image from block to inline and back to a
|
|
18
|
+
dropdown.
|
|
19
|
+
- [#120575](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120575)
|
|
20
|
+
[`0da64a47689b5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0da64a47689b5) -
|
|
21
|
+
[ux] Add overflow menu on editor floating toolbar for media and card plugin
|
|
22
|
+
|
|
3
23
|
## 2.2.3
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -18,7 +18,9 @@ var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/message
|
|
|
18
18
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
19
19
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
20
20
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
21
|
+
var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
|
|
21
22
|
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
23
|
+
var _growHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/grow-horizontal"));
|
|
22
24
|
var _imageFullscreen = _interopRequireDefault(require("@atlaskit/icon/core/image-fullscreen"));
|
|
23
25
|
var _imageInline = _interopRequireDefault(require("@atlaskit/icon/core/image-inline"));
|
|
24
26
|
var _maximize = _interopRequireDefault(require("@atlaskit/icon/core/maximize"));
|
|
@@ -273,46 +275,96 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
273
275
|
var _selectedNode$node$fi;
|
|
274
276
|
// mediaInlne doesn't suppprt external images, so hiding buttons to prevent conversion from mediaSingle to mediaInline
|
|
275
277
|
if (((_selectedNode$node$fi = selectedNode.node.firstChild) === null || _selectedNode$node$fi === void 0 ? void 0 : _selectedNode$node$fi.attrs.type) !== 'external') {
|
|
276
|
-
var _pluginInjectionApi$a4;
|
|
277
278
|
var hasCaption = (0, _utils.contains)(selectedNode.node, state.schema.nodes.caption);
|
|
278
279
|
var inlineSwitcherTitle = intl.formatMessage(hasCaption ? _messages.mediaAndEmbedToolbarMessages.changeToMediaInlineImageCaptionWarning : _messages.mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
|
|
279
280
|
var floatingSwitcherTitle = intl.formatMessage(_messages.mediaAndEmbedToolbarMessages.changeToMediaSingle);
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
281
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
|
|
282
|
+
var _pluginInjectionApi$a4;
|
|
283
|
+
toolbarButtons.push({
|
|
284
|
+
type: 'button',
|
|
285
|
+
id: 'editor.media.image.view.switcher.inline',
|
|
286
|
+
title: inlineSwitcherTitle,
|
|
287
|
+
icon: function icon() {
|
|
288
|
+
return /*#__PURE__*/_react.default.createElement(_imageInline.default, {
|
|
289
|
+
color: "currentColor",
|
|
290
|
+
spacing: "spacious",
|
|
291
|
+
label: inlineSwitcherTitle,
|
|
292
|
+
LEGACY_size: "medium",
|
|
293
|
+
LEGACY_fallbackIcon: _card.IconInline
|
|
294
|
+
});
|
|
295
|
+
},
|
|
296
|
+
onClick: (0, _commands.changeMediaSingleToMediaInline)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions),
|
|
297
|
+
testId: 'image-inline-appearance'
|
|
298
|
+
}, {
|
|
299
|
+
type: 'button',
|
|
300
|
+
id: 'editor.media.image.view.switcher.floating',
|
|
301
|
+
title: floatingSwitcherTitle,
|
|
302
|
+
icon: function icon() {
|
|
303
|
+
return /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
|
|
304
|
+
color: "currentColor",
|
|
305
|
+
spacing: "spacious",
|
|
306
|
+
label: floatingSwitcherTitle,
|
|
307
|
+
LEGACY_size: "medium",
|
|
308
|
+
LEGACY_fallbackIcon: _card.IconEmbed
|
|
309
|
+
});
|
|
310
|
+
},
|
|
311
|
+
onClick: function onClick() {
|
|
312
|
+
return true;
|
|
313
|
+
},
|
|
314
|
+
testId: 'image-floating-appearance',
|
|
315
|
+
selected: true
|
|
316
|
+
}, {
|
|
317
|
+
type: 'separator'
|
|
318
|
+
});
|
|
319
|
+
} else {
|
|
320
|
+
var _pluginInjectionApi$a5;
|
|
321
|
+
var _options2 = [{
|
|
322
|
+
id: 'editor.media.convert.mediainline',
|
|
323
|
+
title: inlineSwitcherTitle,
|
|
324
|
+
onClick: (0, _commands.changeMediaSingleToMediaInline)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions),
|
|
325
|
+
icon: /*#__PURE__*/_react.default.createElement(_imageInline.default, {
|
|
286
326
|
color: "currentColor",
|
|
287
327
|
spacing: "spacious",
|
|
288
328
|
label: inlineSwitcherTitle,
|
|
289
329
|
LEGACY_size: "medium",
|
|
290
330
|
LEGACY_fallbackIcon: _card.IconInline
|
|
291
|
-
})
|
|
292
|
-
},
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
|
|
331
|
+
})
|
|
332
|
+
}, {
|
|
333
|
+
id: 'editor.media.convert.mediasingle',
|
|
334
|
+
title: floatingSwitcherTitle,
|
|
335
|
+
selected: true,
|
|
336
|
+
onClick: function onClick() {
|
|
337
|
+
return true;
|
|
338
|
+
},
|
|
339
|
+
icon: /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
|
|
301
340
|
color: "currentColor",
|
|
302
341
|
spacing: "spacious",
|
|
303
342
|
label: floatingSwitcherTitle,
|
|
304
343
|
LEGACY_size: "medium",
|
|
305
344
|
LEGACY_fallbackIcon: _card.IconEmbed
|
|
306
|
-
})
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
345
|
+
})
|
|
346
|
+
}];
|
|
347
|
+
var switchFromBlockToInline = {
|
|
348
|
+
id: 'media-block-to-inline-toolbar-item',
|
|
349
|
+
testId: 'media-inline-to-block-dropdown',
|
|
350
|
+
type: 'dropdown',
|
|
351
|
+
options: _options2,
|
|
352
|
+
title: intl.formatMessage(_mediaUi.messages.sizeOptions),
|
|
353
|
+
icon: function icon() {
|
|
354
|
+
return /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
|
|
355
|
+
color: "currentColor",
|
|
356
|
+
spacing: "spacious",
|
|
357
|
+
label: intl.formatMessage(_mediaUi.messages.sizeOptions),
|
|
358
|
+
LEGACY_size: "medium",
|
|
359
|
+
LEGACY_fallbackIcon: _card.IconEmbed
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
toolbarButtons.push(switchFromBlockToInline, {
|
|
364
|
+
type: 'separator',
|
|
365
|
+
fullHeight: true
|
|
366
|
+
});
|
|
367
|
+
}
|
|
316
368
|
}
|
|
317
369
|
}
|
|
318
370
|
|
|
@@ -373,11 +425,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
373
425
|
}
|
|
374
426
|
},
|
|
375
427
|
onSubmit: function onSubmit(_ref3) {
|
|
376
|
-
var _pluginInjectionApi$
|
|
428
|
+
var _pluginInjectionApi$a6;
|
|
377
429
|
var width = _ref3.width,
|
|
378
430
|
validation = _ref3.validation;
|
|
379
431
|
var newLayout = (0, _utils2.calcNewLayout)(width, layout, contentWidth, options.fullWidthEnabled, isNested);
|
|
380
|
-
(0, _commands.updateMediaSingleWidth)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
432
|
+
(0, _commands.updateMediaSingleWidth)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a6 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a6 === void 0 ? void 0 : _pluginInjectionApi$a6.actions)(width, validation, 'floatingToolBar', newLayout)(state, dispatch);
|
|
381
433
|
},
|
|
382
434
|
onMigrate: function onMigrate() {
|
|
383
435
|
var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
|
|
@@ -439,10 +491,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
439
491
|
};
|
|
440
492
|
var openLink = function openLink() {
|
|
441
493
|
if (editorView) {
|
|
442
|
-
var _pluginInjectionApi$
|
|
494
|
+
var _pluginInjectionApi$a7;
|
|
443
495
|
var tr = editorView.state.tr,
|
|
444
496
|
dispatch = editorView.dispatch;
|
|
445
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
497
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a7 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a7 === void 0 || _pluginInjectionApi$a7.actions.attachAnalyticsEvent({
|
|
446
498
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
447
499
|
action: _analytics.ACTION.VISITED,
|
|
448
500
|
actionSubject: _analytics.ACTION_SUBJECT.MEDIA,
|
|
@@ -514,9 +566,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
514
566
|
});
|
|
515
567
|
}
|
|
516
568
|
if (allowAltTextOnImages) {
|
|
517
|
-
var _pluginInjectionApi$
|
|
518
|
-
toolbarButtons.push((0, _altText2.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
519
|
-
type: 'separator'
|
|
569
|
+
var _pluginInjectionApi$a8;
|
|
570
|
+
toolbarButtons.push((0, _altText2.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a8 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a8 === void 0 ? void 0 : _pluginInjectionApi$a8.actions), {
|
|
571
|
+
type: 'separator',
|
|
572
|
+
fullHeight: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
520
573
|
});
|
|
521
574
|
}
|
|
522
575
|
var removeButton = {
|
|
@@ -535,13 +588,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
535
588
|
testId: 'media-toolbar-remove-button',
|
|
536
589
|
supportsViewMode: false
|
|
537
590
|
};
|
|
538
|
-
if (
|
|
539
|
-
toolbarButtons.push(removeButton);
|
|
540
|
-
toolbarButtons.push({
|
|
541
|
-
type: 'separator',
|
|
542
|
-
supportsViewMode: false
|
|
543
|
-
});
|
|
544
|
-
|
|
591
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
545
592
|
// Preview Support
|
|
546
593
|
if (allowAdvancedToolBarOptions && allowImagePreview) {
|
|
547
594
|
var _mediaNode$attrs2;
|
|
@@ -565,11 +612,12 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
565
612
|
supportsViewMode: true
|
|
566
613
|
}, {
|
|
567
614
|
type: 'separator',
|
|
568
|
-
supportsViewMode: true
|
|
615
|
+
supportsViewMode: true,
|
|
616
|
+
fullHeight: true
|
|
569
617
|
});
|
|
570
618
|
}
|
|
571
619
|
}
|
|
572
|
-
toolbarButtons.push({
|
|
620
|
+
isViewOnly && toolbarButtons.push({
|
|
573
621
|
type: 'copy-button',
|
|
574
622
|
items: [{
|
|
575
623
|
state: state,
|
|
@@ -577,8 +625,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
577
625
|
nodeType: mediaSingle
|
|
578
626
|
}],
|
|
579
627
|
supportsViewMode: true
|
|
580
|
-
}
|
|
581
|
-
toolbarButtons.push({
|
|
628
|
+
}, {
|
|
582
629
|
type: 'separator',
|
|
583
630
|
supportsViewMode: true
|
|
584
631
|
});
|
|
@@ -664,7 +711,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
664
711
|
selectedNodeType = state.selection.node.type;
|
|
665
712
|
}
|
|
666
713
|
if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
|
|
667
|
-
var _pluginInjectionApi$
|
|
714
|
+
var _pluginInjectionApi$a9, _pluginInjectionApi$f2;
|
|
668
715
|
var mediaOffset = state.selection.$from.parentOffset + 1;
|
|
669
716
|
baseToolbar.getDomRef = function () {
|
|
670
717
|
var _mediaPluginState$ele;
|
|
@@ -673,7 +720,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
673
720
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
674
721
|
return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
|
|
675
722
|
};
|
|
676
|
-
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
723
|
+
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a9 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a9 === void 0 ? void 0 : _pluginInjectionApi$a9.actions, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 || (_pluginInjectionApi$f2 = _pluginInjectionApi$f2.actions) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.forceFocusSelector, isViewOnly);
|
|
677
724
|
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
678
725
|
items = (0, _mediaInline2.generateMediaInlineFloatingToolbar)(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, options);
|
|
679
726
|
} else {
|
|
@@ -686,6 +733,47 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
686
733
|
};
|
|
687
734
|
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi);
|
|
688
735
|
}
|
|
736
|
+
if (items.length > 0 && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
737
|
+
if (items[items.length - 1].type === 'separator') {
|
|
738
|
+
var separatorItem = items[items.length - 1];
|
|
739
|
+
separatorItem.fullHeight = true;
|
|
740
|
+
} else {
|
|
741
|
+
items.push({
|
|
742
|
+
type: 'separator',
|
|
743
|
+
fullHeight: true
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
items.push({
|
|
747
|
+
type: 'overflow-dropdown',
|
|
748
|
+
options: [{
|
|
749
|
+
title: 'Resize',
|
|
750
|
+
onClick: function onClick() {
|
|
751
|
+
// TODO open resize dialog?
|
|
752
|
+
return true;
|
|
753
|
+
},
|
|
754
|
+
icon: /*#__PURE__*/_react.default.createElement(_growHorizontal.default, {
|
|
755
|
+
label: "Resize"
|
|
756
|
+
})
|
|
757
|
+
}, {
|
|
758
|
+
type: 'separator'
|
|
759
|
+
}, {
|
|
760
|
+
title: 'Copy',
|
|
761
|
+
onClick: function onClick() {
|
|
762
|
+
// TODO replace with copy-button plugin
|
|
763
|
+
return true;
|
|
764
|
+
},
|
|
765
|
+
icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
|
|
766
|
+
label: "Copy"
|
|
767
|
+
})
|
|
768
|
+
}, {
|
|
769
|
+
title: 'Delete',
|
|
770
|
+
onClick: remove,
|
|
771
|
+
icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
|
|
772
|
+
label: "Delete"
|
|
773
|
+
})
|
|
774
|
+
}]
|
|
775
|
+
});
|
|
776
|
+
}
|
|
689
777
|
|
|
690
778
|
// Ignored via go/ees005
|
|
691
779
|
// eslint-disable-next-line no-var
|
|
@@ -88,7 +88,8 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
|
|
|
88
88
|
})) !== null && _handleShowMediaViewe !== void 0 ? _handleShowMediaViewe : false;
|
|
89
89
|
}
|
|
90
90
|
}, {
|
|
91
|
-
type: 'separator'
|
|
91
|
+
type: 'separator',
|
|
92
|
+
fullHeight: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
92
93
|
}, {
|
|
93
94
|
id: 'editor.media.card.download',
|
|
94
95
|
type: 'button',
|
|
@@ -164,40 +165,92 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
164
165
|
type: 'separator'
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
|
|
169
|
+
// For Editor Controls: show options to convert from 'Inline' to 'Original size' via dropdown
|
|
170
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
|
|
171
|
+
inlineImageItems.push({
|
|
172
|
+
id: 'editor.media.convert.mediainline',
|
|
173
|
+
type: 'button',
|
|
174
|
+
title: mediaInlineImageTitle,
|
|
175
|
+
icon: function icon() {
|
|
176
|
+
return /*#__PURE__*/_react.default.createElement(_imageInline.default, {
|
|
177
|
+
color: "currentColor",
|
|
178
|
+
spacing: "spacious",
|
|
179
|
+
label: mediaInlineImageTitle,
|
|
180
|
+
LEGACY_size: "medium",
|
|
181
|
+
LEGACY_fallbackIcon: _card.IconInline
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
onClick: function onClick() {
|
|
185
|
+
return true;
|
|
186
|
+
},
|
|
187
|
+
selected: true
|
|
188
|
+
}, {
|
|
189
|
+
id: 'editor.media.convert.mediasingle',
|
|
190
|
+
type: 'button',
|
|
191
|
+
title: mediaSingleTitle,
|
|
192
|
+
icon: function icon() {
|
|
193
|
+
return /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
|
|
194
|
+
color: "currentColor",
|
|
195
|
+
spacing: "spacious",
|
|
196
|
+
label: mediaSingleTitle,
|
|
197
|
+
LEGACY_size: "medium",
|
|
198
|
+
LEGACY_fallbackIcon: _card.IconEmbed
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
onClick: (0, _commands.changeMediaInlineToMediaSingle)(editorAnalyticsAPI, widthPluginState)
|
|
202
|
+
}, {
|
|
203
|
+
type: 'separator'
|
|
204
|
+
});
|
|
205
|
+
} else {
|
|
206
|
+
var _options = [{
|
|
207
|
+
id: 'editor.media.convert.mediainline',
|
|
208
|
+
title: mediaInlineImageTitle,
|
|
209
|
+
onClick: function onClick() {
|
|
210
|
+
return true;
|
|
211
|
+
},
|
|
212
|
+
selected: true,
|
|
213
|
+
disabled: false,
|
|
214
|
+
icon: /*#__PURE__*/_react.default.createElement(_imageInline.default, {
|
|
173
215
|
color: "currentColor",
|
|
174
216
|
spacing: "spacious",
|
|
175
217
|
label: mediaInlineImageTitle,
|
|
176
218
|
LEGACY_size: "medium",
|
|
177
219
|
LEGACY_fallbackIcon: _card.IconInline
|
|
178
|
-
})
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}, {
|
|
185
|
-
id: 'editor.media.convert.mediasingle',
|
|
186
|
-
type: 'button',
|
|
187
|
-
title: mediaSingleTitle,
|
|
188
|
-
icon: function icon() {
|
|
189
|
-
return /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
|
|
220
|
+
})
|
|
221
|
+
}, {
|
|
222
|
+
id: 'editor.media.convert.mediasingle',
|
|
223
|
+
title: mediaSingleTitle,
|
|
224
|
+
onClick: (0, _commands.changeMediaInlineToMediaSingle)(editorAnalyticsAPI, widthPluginState),
|
|
225
|
+
icon: /*#__PURE__*/_react.default.createElement(_imageFullscreen.default, {
|
|
190
226
|
color: "currentColor",
|
|
191
227
|
spacing: "spacious",
|
|
192
228
|
label: mediaSingleTitle,
|
|
193
229
|
LEGACY_size: "medium",
|
|
194
230
|
LEGACY_fallbackIcon: _card.IconEmbed
|
|
195
|
-
})
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
231
|
+
})
|
|
232
|
+
}];
|
|
233
|
+
var switchFromInlineToBlock = {
|
|
234
|
+
id: 'media-inline-to-block-toolbar-item',
|
|
235
|
+
testId: 'media-inline-to-block-dropdown',
|
|
236
|
+
type: 'dropdown',
|
|
237
|
+
options: _options,
|
|
238
|
+
title: intl.formatMessage(_mediaUi.messages.sizeOptions),
|
|
239
|
+
icon: function icon() {
|
|
240
|
+
return /*#__PURE__*/_react.default.createElement(_imageInline.default, {
|
|
241
|
+
color: "currentColor",
|
|
242
|
+
spacing: "spacious",
|
|
243
|
+
label: mediaInlineImageTitle,
|
|
244
|
+
LEGACY_size: "medium",
|
|
245
|
+
LEGACY_fallbackIcon: _card.IconInline
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
inlineImageItems.push(switchFromInlineToBlock, {
|
|
250
|
+
type: 'separator',
|
|
251
|
+
fullHeight: true
|
|
252
|
+
});
|
|
253
|
+
}
|
|
201
254
|
|
|
202
255
|
// TODO: editor controls move to overflow menu
|
|
203
256
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
|
|
@@ -245,30 +298,11 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
245
298
|
supportsViewMode: true
|
|
246
299
|
});
|
|
247
300
|
}
|
|
248
|
-
if (options.allowAltTextOnImages &&
|
|
301
|
+
if (options.allowAltTextOnImages && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
249
302
|
var _pluginInjectionApi$a5;
|
|
250
303
|
inlineImageItems.push((0, _altText.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions), {
|
|
251
|
-
type: 'separator'
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
if (!(0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
|
|
255
|
-
inlineImageItems.push({
|
|
256
|
-
id: 'editor.media.delete',
|
|
257
|
-
type: 'button',
|
|
258
|
-
appearance: 'danger',
|
|
259
|
-
focusEditoronEnter: true,
|
|
260
|
-
icon: _delete.default,
|
|
261
|
-
iconFallback: _remove.default,
|
|
262
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
263
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
264
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
265
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
266
|
-
title: intl.formatMessage(_messages.default.remove),
|
|
267
|
-
onClick: _commands.removeInlineCard,
|
|
268
|
-
testId: 'media-toolbar-remove-button'
|
|
269
|
-
});
|
|
270
|
-
inlineImageItems.push({
|
|
271
|
-
type: 'separator'
|
|
304
|
+
type: 'separator',
|
|
305
|
+
fullHeight: true
|
|
272
306
|
});
|
|
273
307
|
}
|
|
274
308
|
|
|
@@ -291,7 +325,8 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
291
325
|
supportsViewMode: true
|
|
292
326
|
}, {
|
|
293
327
|
type: 'separator',
|
|
294
|
-
supportsViewMode: true
|
|
328
|
+
supportsViewMode: true,
|
|
329
|
+
fullHeight: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
295
330
|
});
|
|
296
331
|
}
|
|
297
332
|
if (options.isViewOnly) {
|
|
@@ -316,15 +351,17 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
316
351
|
type: 'separator'
|
|
317
352
|
});
|
|
318
353
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
354
|
+
if (options.isViewOnly || (0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
|
|
355
|
+
inlineImageItems.push({
|
|
356
|
+
type: 'copy-button',
|
|
357
|
+
supportsViewMode: true,
|
|
358
|
+
items: [{
|
|
359
|
+
state: state,
|
|
360
|
+
formatMessage: intl.formatMessage,
|
|
361
|
+
nodeType: mediaInline
|
|
362
|
+
}]
|
|
363
|
+
});
|
|
364
|
+
}
|
|
328
365
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
|
|
329
366
|
inlineImageItems.push({
|
|
330
367
|
type: 'separator'
|