@atlaskit/editor-plugin-media 2.3.13 → 2.3.15
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 +19 -0
- package/dist/cjs/nodeviews/mediaInline.js +2 -1
- package/dist/cjs/nodeviews/mediaNodeView/index.js +3 -1
- package/dist/cjs/nodeviews/mediaNodeView/media.js +13 -1
- package/dist/cjs/pm-plugins/utils/media-single.js +13 -2
- package/dist/cjs/ui/toolbar/alt-text.js +20 -1
- package/dist/cjs/ui/toolbar/index.js +59 -82
- package/dist/cjs/ui/toolbar/mediaInline.js +75 -71
- package/dist/cjs/ui/toolbar/pixel-resizing.js +28 -3
- package/dist/cjs/ui/toolbar/utils.js +12 -1
- package/dist/es2019/nodeviews/mediaInline.js +2 -1
- package/dist/es2019/nodeviews/mediaNodeView/index.js +3 -1
- package/dist/es2019/nodeviews/mediaNodeView/media.js +13 -1
- package/dist/es2019/pm-plugins/utils/media-single.js +13 -2
- package/dist/es2019/ui/toolbar/alt-text.js +20 -0
- package/dist/es2019/ui/toolbar/index.js +55 -78
- package/dist/es2019/ui/toolbar/mediaInline.js +81 -75
- package/dist/es2019/ui/toolbar/pixel-resizing.js +28 -1
- package/dist/es2019/ui/toolbar/utils.js +11 -0
- package/dist/esm/nodeviews/mediaInline.js +2 -1
- package/dist/esm/nodeviews/mediaNodeView/index.js +3 -1
- package/dist/esm/nodeviews/mediaNodeView/media.js +13 -1
- package/dist/esm/pm-plugins/utils/media-single.js +13 -2
- package/dist/esm/ui/toolbar/alt-text.js +19 -0
- package/dist/esm/ui/toolbar/index.js +55 -78
- package/dist/esm/ui/toolbar/mediaInline.js +75 -71
- package/dist/esm/ui/toolbar/pixel-resizing.js +25 -0
- package/dist/esm/ui/toolbar/utils.js +11 -0
- package/dist/types/nodeviews/mediaNodeView/media.d.ts +1 -0
- package/dist/types/ui/toolbar/alt-text.d.ts +4 -2
- package/dist/types/ui/toolbar/pixel-resizing.d.ts +6 -2
- package/dist/types/ui/toolbar/utils.d.ts +2 -0
- package/dist/types-ts4.5/nodeviews/mediaNodeView/media.d.ts +1 -0
- package/dist/types-ts4.5/ui/toolbar/alt-text.d.ts +4 -2
- package/dist/types-ts4.5/ui/toolbar/pixel-resizing.d.ts +6 -2
- package/dist/types-ts4.5/ui/toolbar/utils.d.ts +2 -0
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 2.3.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#131280](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131280)
|
|
8
|
+
[`9ff92ea2432f2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9ff92ea2432f2) -
|
|
9
|
+
[ED-27082] Fix media overflow toolbar to show correct options + update separators between button
|
|
10
|
+
groups
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 2.3.14
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#130717](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/130717)
|
|
18
|
+
[`ee87c286f2f80`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ee87c286f2f80) -
|
|
19
|
+
ED-27126 Multiple images upload overridden fix
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 2.3.13
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -205,7 +205,8 @@ var MediaInline = exports.MediaInline = function MediaInline(props) {
|
|
|
205
205
|
border: {
|
|
206
206
|
borderSize: borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.size,
|
|
207
207
|
borderColor: borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.color
|
|
208
|
-
}
|
|
208
|
+
},
|
|
209
|
+
isViewOnly: props.editorViewMode
|
|
209
210
|
});
|
|
210
211
|
}
|
|
211
212
|
return (0, _react2.jsx)(_MediaViewerContainer.MediaViewerContainer, {
|
|
@@ -70,6 +70,7 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
70
70
|
});
|
|
71
71
|
(0, _defineProperty2.default)(_this, "renderMediaNodeWithState", function (contextIdentifierProvider) {
|
|
72
72
|
return function (_ref2) {
|
|
73
|
+
var _this$reactComponentP;
|
|
73
74
|
var editorWidth = _ref2.width,
|
|
74
75
|
mediaProvider = _ref2.mediaProvider;
|
|
75
76
|
var getPos = _this.getPos;
|
|
@@ -110,7 +111,8 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
110
111
|
mediaProvider: mediaProvider,
|
|
111
112
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
112
113
|
mediaOptions: mediaOptions,
|
|
113
|
-
onExternalImageLoaded: _this.onExternalImageLoaded
|
|
114
|
+
onExternalImageLoaded: _this.onExternalImageLoaded,
|
|
115
|
+
isViewOnly: ((_this$reactComponentP = _this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.sharedState.currentState()) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.mode) === 'view'
|
|
114
116
|
});
|
|
115
117
|
};
|
|
116
118
|
});
|
|
@@ -21,6 +21,7 @@ var _analyticsNext = require("@atlaskit/analytics-next");
|
|
|
21
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
22
22
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
23
23
|
var _mediaCard = require("@atlaskit/media-card");
|
|
24
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
24
25
|
var _pluginKey = require("../../pm-plugins/plugin-key");
|
|
25
26
|
var _styles = require("../styles");
|
|
26
27
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -63,6 +64,13 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
|
|
|
63
64
|
(0, _defineProperty2.default)(_this, "selectMediaSingleFromCard", function (_ref2) {
|
|
64
65
|
var event = _ref2.event;
|
|
65
66
|
_this.selectMediaSingle(event);
|
|
67
|
+
|
|
68
|
+
// In edit mode (node content wrapper has contenteditable set to true), link redirection is disabled by default
|
|
69
|
+
// We need to call "stopPropagation" here in order to prevent in editor view mode, the browser from navigating to
|
|
70
|
+
// another URL if the media node is wrapped in a link mark.
|
|
71
|
+
if (_this.props.isViewOnly && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
}
|
|
66
74
|
});
|
|
67
75
|
(0, _defineProperty2.default)(_this, "selectMediaSingle", function (event) {
|
|
68
76
|
var propPos = _this.props.getPos();
|
|
@@ -70,9 +78,13 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
|
|
|
70
78
|
return;
|
|
71
79
|
}
|
|
72
80
|
|
|
81
|
+
// NOTE: This does not prevent the link navigation in the editor view mode, .preventDefault is needed (see selectMediaSingleFromCard)
|
|
82
|
+
// Hence it should be removed
|
|
73
83
|
// We need to call "stopPropagation" here in order to prevent the browser from navigating to
|
|
74
84
|
// another URL if the media node is wrapped in a link mark.
|
|
75
|
-
|
|
85
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
|
|
86
|
+
event.stopPropagation();
|
|
87
|
+
}
|
|
76
88
|
var state = _this.props.view.state;
|
|
77
89
|
if (event.shiftKey) {
|
|
78
90
|
// don't select text if there is current selection in a table (as this would override selected cells)
|
|
@@ -61,8 +61,19 @@ function insertNodesWithOptionalParagraph(_ref) {
|
|
|
61
61
|
if (state.selection.empty) {
|
|
62
62
|
var insertFrom = (0, _selection.atTheBeginningOfBlock)(state) && (0, _platformFeatureFlags.fg)('platform_editor_axe_leading_paragraph_from_media') ? state.selection.$from.before() : state.selection.from;
|
|
63
63
|
if ((0, _platformFeatureFlags.fg)('platform_editor_axe_leading_paragraph_from_media')) {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_multi_images_overridden_upload_fix')) {
|
|
65
|
+
// the use of pmSafeInsert causes the node selection to media single node.
|
|
66
|
+
// It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
|
|
67
|
+
// When multiple images are uploaded, the node selection is set to the previous node
|
|
68
|
+
// and got overridden by the next node inserted.
|
|
69
|
+
// It also causes the images position shifted when the images are uploaded.
|
|
70
|
+
// E.g the images are uploaded after a table, the images will be inserted inside the table.
|
|
71
|
+
// so we revert to use tr.insert instead. No extra paragraph is added.
|
|
72
|
+
updatedTr = updatedTr.insert(insertFrom, nodes);
|
|
73
|
+
} else {
|
|
74
|
+
var shouldInsertFrom = !(0, _mediaCommon.isInsidePotentialEmptyParagraph)(state);
|
|
75
|
+
updatedTr = (0, _selection.atTheBeginningOfBlock)(state) ? (0, _utils2.safeInsert)(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
|
|
76
|
+
}
|
|
66
77
|
} else {
|
|
67
78
|
updatedTr.insert(insertFrom, nodes);
|
|
68
79
|
}
|
|
@@ -4,15 +4,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.getAltTextToolbar = exports.altTextButton = void 0;
|
|
7
|
+
exports.getAltTextToolbar = exports.getAltTextDropdownOption = exports.altTextButton = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
11
11
|
var _media = require("@atlaskit/editor-common/media");
|
|
12
12
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
13
13
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
14
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
|
+
var _text = _interopRequireDefault(require("@atlaskit/icon/core/text"));
|
|
14
16
|
var _commands = require("../../pm-plugins/alt-text/commands");
|
|
15
17
|
var _AltTextEdit = _interopRequireDefault(require("../../pm-plugins/alt-text/ui/AltTextEdit"));
|
|
18
|
+
var _isType = require("../../pm-plugins/utils/is-type");
|
|
16
19
|
var _mediaCommon = require("../../pm-plugins/utils/media-common");
|
|
17
20
|
var _commands2 = require("./commands");
|
|
18
21
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -80,4 +83,20 @@ var getAltTextToolbar = exports.getAltTextToolbar = function getAltTextToolbar(t
|
|
|
80
83
|
className: _styles.MediaSharedClassNames.FLOATING_TOOLBAR_COMPONENT,
|
|
81
84
|
items: [altTextEditComponent(options)]
|
|
82
85
|
});
|
|
86
|
+
};
|
|
87
|
+
var getAltTextDropdownOption = exports.getAltTextDropdownOption = function getAltTextDropdownOption(state, formatMessage, allowAltTextOnImages, selectedNodeType, editorAnalyticsAPI) {
|
|
88
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
89
|
+
mediaSingle = _state$schema$nodes.mediaSingle,
|
|
90
|
+
mediaInline = _state$schema$nodes.mediaInline;
|
|
91
|
+
var mediaType = state.selection instanceof _state.NodeSelection && state.selection.node.attrs.type;
|
|
92
|
+
if (allowAltTextOnImages && (selectedNodeType === mediaSingle || selectedNodeType === mediaInline && (0, _isType.isImage)(mediaType))) {
|
|
93
|
+
return [{
|
|
94
|
+
title: formatMessage(_media.altTextMessages.addAltText),
|
|
95
|
+
onClick: (0, _commands.openMediaAltTextMenu)(editorAnalyticsAPI),
|
|
96
|
+
icon: /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
97
|
+
label: ""
|
|
98
|
+
})
|
|
99
|
+
}];
|
|
100
|
+
}
|
|
101
|
+
return [];
|
|
83
102
|
};
|
|
@@ -12,7 +12,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
14
14
|
var _card = require("@atlaskit/editor-common/card");
|
|
15
|
-
var _media = require("@atlaskit/editor-common/media");
|
|
16
15
|
var _mediaInline = require("@atlaskit/editor-common/media-inline");
|
|
17
16
|
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
18
17
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
@@ -20,13 +19,11 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
|
20
19
|
var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
|
|
21
20
|
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
22
21
|
var _growDiagonal = _interopRequireDefault(require("@atlaskit/icon/core/grow-diagonal"));
|
|
23
|
-
var _growHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/grow-horizontal"));
|
|
24
22
|
var _imageFullscreen = _interopRequireDefault(require("@atlaskit/icon/core/image-fullscreen"));
|
|
25
23
|
var _imageInline = _interopRequireDefault(require("@atlaskit/icon/core/image-inline"));
|
|
26
24
|
var _maximize = _interopRequireDefault(require("@atlaskit/icon/core/maximize"));
|
|
27
25
|
var _download = _interopRequireDefault(require("@atlaskit/icon/core/migration/download"));
|
|
28
26
|
var _smartLinkCard = _interopRequireDefault(require("@atlaskit/icon/core/smart-link-card"));
|
|
29
|
-
var _text = _interopRequireDefault(require("@atlaskit/icon/core/text"));
|
|
30
27
|
var _filePreview = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/file-preview"));
|
|
31
28
|
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
32
29
|
var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
|
|
@@ -35,18 +32,16 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
35
32
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
36
33
|
var _styles = require("../../nodeviews/styles");
|
|
37
34
|
var _altText = require("../../pm-plugins/alt-text");
|
|
38
|
-
var _commands = require("../../pm-plugins/alt-text/commands");
|
|
39
35
|
var _linking = require("../../pm-plugins/commands/linking");
|
|
40
36
|
var _linking2 = require("../../pm-plugins/linking");
|
|
41
37
|
var _pixelResizing = require("../../pm-plugins/pixel-resizing");
|
|
42
|
-
var _commands2 = require("../../pm-plugins/pixel-resizing/commands");
|
|
43
38
|
var _ui = require("../../pm-plugins/pixel-resizing/ui");
|
|
44
39
|
var _pluginKey = require("../../pm-plugins/plugin-key");
|
|
45
40
|
var _currentMediaNode = require("../../pm-plugins/utils/current-media-node");
|
|
46
41
|
var _mediaSingle = require("../../pm-plugins/utils/media-single");
|
|
47
42
|
var _ImageBorder = _interopRequireDefault(require("../../ui/ImageBorder"));
|
|
48
43
|
var _altText2 = require("./alt-text");
|
|
49
|
-
var
|
|
44
|
+
var _commands = require("./commands");
|
|
50
45
|
var _comments = require("./comments");
|
|
51
46
|
var _imageBorder = require("./imageBorder");
|
|
52
47
|
var _layoutGroup = require("./layout-group");
|
|
@@ -138,7 +133,7 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
138
133
|
selected: false,
|
|
139
134
|
focusEditoronEnter: true,
|
|
140
135
|
disabled: false,
|
|
141
|
-
onClick: (0,
|
|
136
|
+
onClick: (0, _commands.changeMediaCardToInline)(editorAnalyticsAPI, forceFocusSelector),
|
|
142
137
|
title: intl.formatMessage(_messages.cardMessages.inlineTitle),
|
|
143
138
|
testId: 'inline-appearance',
|
|
144
139
|
className: 'inline-appearance' // a11y. uses to force focus on item
|
|
@@ -191,7 +186,7 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
191
186
|
var options = [{
|
|
192
187
|
id: 'editor.media.view.switcher.inline',
|
|
193
188
|
title: intl.formatMessage(_messages.cardMessages.inlineTitle),
|
|
194
|
-
onClick: (0,
|
|
189
|
+
onClick: (0, _commands.changeMediaCardToInline)(editorAnalyticsAPI, forceFocusSelector),
|
|
195
190
|
icon: /*#__PURE__*/_react.default.createElement(_imageInline.default, {
|
|
196
191
|
label: "",
|
|
197
192
|
spacing: "spacious"
|
|
@@ -226,7 +221,6 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
226
221
|
fullHeight: true
|
|
227
222
|
}, download, {
|
|
228
223
|
type: 'separator',
|
|
229
|
-
fullHeight: true,
|
|
230
224
|
supportsViewMode: true
|
|
231
225
|
}, preview, {
|
|
232
226
|
type: 'separator',
|
|
@@ -251,6 +245,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
251
245
|
var toolbarButtons = [];
|
|
252
246
|
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 : {},
|
|
253
247
|
hoverDecoration = _ref2.hoverDecoration;
|
|
248
|
+
var isEditorControlsEnabled = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
|
|
254
249
|
if ((0, _imageBorder.shouldShowImageBorder)(state)) {
|
|
255
250
|
toolbarButtons.push({
|
|
256
251
|
type: 'custom',
|
|
@@ -265,11 +260,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
265
260
|
return /*#__PURE__*/_react.default.createElement(_ImageBorder.default, {
|
|
266
261
|
toggleBorder: function toggleBorder() {
|
|
267
262
|
var _pluginInjectionApi$a;
|
|
268
|
-
(0,
|
|
263
|
+
(0, _commands.toggleBorderMark)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(state, dispatch);
|
|
269
264
|
},
|
|
270
265
|
setBorder: function setBorder(attrs) {
|
|
271
266
|
var _pluginInjectionApi$a2;
|
|
272
|
-
(0,
|
|
267
|
+
(0, _commands.setBorderMark)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(attrs)(state, dispatch);
|
|
273
268
|
},
|
|
274
269
|
borderMark: borderMark,
|
|
275
270
|
intl: intl
|
|
@@ -337,7 +332,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
337
332
|
var hasCaption = (0, _utils.contains)(selectedNode.node, state.schema.nodes.caption);
|
|
338
333
|
var inlineSwitcherTitle = intl.formatMessage(hasCaption ? _messages.mediaAndEmbedToolbarMessages.changeToMediaInlineImageCaptionWarning : _messages.mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
|
|
339
334
|
var floatingSwitcherTitle = intl.formatMessage(_messages.mediaAndEmbedToolbarMessages.changeToMediaSingle);
|
|
340
|
-
if (
|
|
335
|
+
if (!isEditorControlsEnabled) {
|
|
341
336
|
var _pluginInjectionApi$a4;
|
|
342
337
|
toolbarButtons.push({
|
|
343
338
|
type: 'button',
|
|
@@ -352,7 +347,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
352
347
|
LEGACY_fallbackIcon: _card.IconInline
|
|
353
348
|
});
|
|
354
349
|
},
|
|
355
|
-
onClick: (0,
|
|
350
|
+
onClick: (0, _commands.changeMediaSingleToMediaInline)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions),
|
|
356
351
|
testId: 'image-inline-appearance'
|
|
357
352
|
}, {
|
|
358
353
|
type: 'button',
|
|
@@ -381,7 +376,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
381
376
|
var _options2 = [{
|
|
382
377
|
id: 'editor.media.convert.mediainline',
|
|
383
378
|
title: inlineTitle,
|
|
384
|
-
onClick: (0,
|
|
379
|
+
onClick: (0, _commands.changeMediaSingleToMediaInline)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions),
|
|
385
380
|
icon: /*#__PURE__*/_react.default.createElement(_imageInline.default, {
|
|
386
381
|
color: "currentColor",
|
|
387
382
|
spacing: "spacious",
|
|
@@ -473,14 +468,14 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
473
468
|
}
|
|
474
469
|
return [sizeInput];
|
|
475
470
|
}
|
|
476
|
-
if (
|
|
471
|
+
if (!isEditorControlsEnabled) {
|
|
477
472
|
toolbarButtons.push(sizeInput);
|
|
478
473
|
toolbarButtons.push({
|
|
479
474
|
type: 'separator'
|
|
480
475
|
});
|
|
481
476
|
}
|
|
482
477
|
}
|
|
483
|
-
if (
|
|
478
|
+
if (!isEditorControlsEnabled) {
|
|
484
479
|
if (allowCommentsOnMedia) {
|
|
485
480
|
toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi), {
|
|
486
481
|
type: 'separator',
|
|
@@ -578,29 +573,45 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
578
573
|
supportsViewMode: true
|
|
579
574
|
});
|
|
580
575
|
}
|
|
581
|
-
if (
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
576
|
+
if (!isEditorControlsEnabled) {
|
|
577
|
+
if (allowAltTextOnImages) {
|
|
578
|
+
var _pluginInjectionApi$a7;
|
|
579
|
+
toolbarButtons.push((0, _altText2.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a7 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a7 === void 0 ? void 0 : _pluginInjectionApi$a7.actions), {
|
|
580
|
+
type: 'separator'
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
var removeButton = {
|
|
584
|
+
id: 'editor.media.delete',
|
|
585
|
+
type: 'button',
|
|
586
|
+
appearance: 'danger',
|
|
587
|
+
focusEditoronEnter: true,
|
|
588
|
+
icon: _delete.default,
|
|
589
|
+
iconFallback: _remove.default,
|
|
590
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
|
|
591
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
|
|
592
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
|
|
593
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
|
|
594
|
+
title: intl.formatMessage(_messages.default.remove),
|
|
595
|
+
onClick: remove,
|
|
596
|
+
testId: 'media-toolbar-remove-button',
|
|
597
|
+
supportsViewMode: false
|
|
598
|
+
};
|
|
599
|
+
var items = [].concat((0, _toConsumableArray2.default)(toolbarButtons), [{
|
|
600
|
+
type: 'copy-button',
|
|
601
|
+
items: [{
|
|
602
|
+
state: state,
|
|
603
|
+
formatMessage: intl.formatMessage,
|
|
604
|
+
nodeType: mediaSingle
|
|
605
|
+
}],
|
|
606
|
+
supportsViewMode: true
|
|
607
|
+
}]);
|
|
608
|
+
items.push({
|
|
609
|
+
type: 'separator',
|
|
610
|
+
supportsViewMode: false
|
|
585
611
|
});
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
type: 'button',
|
|
590
|
-
appearance: 'danger',
|
|
591
|
-
focusEditoronEnter: true,
|
|
592
|
-
icon: _delete.default,
|
|
593
|
-
iconFallback: _remove.default,
|
|
594
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
|
|
595
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
|
|
596
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
|
|
597
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
|
|
598
|
-
title: intl.formatMessage(_messages.default.remove),
|
|
599
|
-
onClick: remove,
|
|
600
|
-
testId: 'media-toolbar-remove-button',
|
|
601
|
-
supportsViewMode: false
|
|
602
|
-
};
|
|
603
|
-
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
612
|
+
items.push(removeButton);
|
|
613
|
+
return items;
|
|
614
|
+
} else {
|
|
604
615
|
// Preview Support
|
|
605
616
|
if (allowAdvancedToolBarOptions && allowImagePreview) {
|
|
606
617
|
var _mediaNode$attrs2;
|
|
@@ -626,8 +637,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
626
637
|
supportsViewMode: true
|
|
627
638
|
}, {
|
|
628
639
|
type: 'separator',
|
|
629
|
-
supportsViewMode: true
|
|
630
|
-
fullHeight: true
|
|
640
|
+
supportsViewMode: true
|
|
631
641
|
});
|
|
632
642
|
}
|
|
633
643
|
}
|
|
@@ -636,8 +646,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
636
646
|
if (allowLinking && (0, _linking3.shouldShowMediaLinkToolbar)(state) && mediaLinkingState && mediaLinkingState.editable) {
|
|
637
647
|
toolbarButtons.push((0, _linking3.getOpenLinkToolbarButtonOption)(intl, mediaLinkingState, pluginInjectionApi), {
|
|
638
648
|
type: 'separator',
|
|
639
|
-
supportsViewMode: true
|
|
640
|
-
fullHeight: true
|
|
649
|
+
supportsViewMode: true
|
|
641
650
|
});
|
|
642
651
|
}
|
|
643
652
|
isViewOnly && toolbarButtons.push({
|
|
@@ -653,26 +662,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
653
662
|
supportsViewMode: true
|
|
654
663
|
});
|
|
655
664
|
if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
|
|
656
|
-
|
|
665
|
+
(0, _utils2.updateToFullHeightSeparator)(toolbarButtons);
|
|
657
666
|
toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi));
|
|
658
667
|
}
|
|
659
668
|
return toolbarButtons;
|
|
660
669
|
}
|
|
661
|
-
var items = [].concat((0, _toConsumableArray2.default)(toolbarButtons), [{
|
|
662
|
-
type: 'copy-button',
|
|
663
|
-
items: [{
|
|
664
|
-
state: state,
|
|
665
|
-
formatMessage: intl.formatMessage,
|
|
666
|
-
nodeType: mediaSingle
|
|
667
|
-
}],
|
|
668
|
-
supportsViewMode: true
|
|
669
|
-
}]);
|
|
670
|
-
items.push({
|
|
671
|
-
type: 'separator',
|
|
672
|
-
supportsViewMode: false
|
|
673
|
-
});
|
|
674
|
-
items.push(removeButton);
|
|
675
|
-
return items;
|
|
676
670
|
};
|
|
677
671
|
var getMediaTypeMessage = function getMediaTypeMessage(selectedNodeTypeSingle) {
|
|
678
672
|
var mediaType = Object.keys(mediaTypeMessages).find(function (key) {
|
|
@@ -774,34 +768,17 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
774
768
|
}
|
|
775
769
|
if (!mediaPluginState.isResizing && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
776
770
|
var _pluginInjectionApi$a9;
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
type: 'separator',
|
|
783
|
-
fullHeight: true
|
|
771
|
+
(0, _utils2.updateToFullHeightSeparator)(items);
|
|
772
|
+
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$a9 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a9 === void 0 ? void 0 : _pluginInjectionApi$a9.actions)), (0, _toConsumableArray2.default)((0, _pixelResizing2.getResizeDropdownOption)(options, state, intl.formatMessage, selectedNodeType)));
|
|
773
|
+
if (customOptions.length) {
|
|
774
|
+
customOptions.push({
|
|
775
|
+
type: 'separator'
|
|
784
776
|
});
|
|
785
777
|
}
|
|
786
|
-
var altTextTitle = intl.formatMessage(_media.altTextMessages.addAltText);
|
|
787
778
|
items.push({
|
|
788
779
|
type: 'overflow-dropdown',
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
onClick: (0, _commands.openMediaAltTextMenu)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a9 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a9 === void 0 ? void 0 : _pluginInjectionApi$a9.actions),
|
|
792
|
-
icon: /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
793
|
-
label: ""
|
|
794
|
-
})
|
|
795
|
-
}, {
|
|
796
|
-
title: 'Resize',
|
|
797
|
-
onClick: (0, _commands2.openPixelEditor)(),
|
|
798
|
-
icon: /*#__PURE__*/_react.default.createElement(_growHorizontal.default, {
|
|
799
|
-
label: ""
|
|
800
|
-
}),
|
|
801
|
-
testId: 'media-pixel-resizing-dropdown-option'
|
|
802
|
-
}, {
|
|
803
|
-
type: 'separator'
|
|
804
|
-
}, {
|
|
780
|
+
id: 'media',
|
|
781
|
+
options: [].concat((0, _toConsumableArray2.default)(customOptions), [{
|
|
805
782
|
title: 'Copy',
|
|
806
783
|
onClick: function onClick() {
|
|
807
784
|
var _pluginInjectionApi$c4, _pluginInjectionApi$f3;
|