@atlaskit/editor-plugin-media 0.4.9 → 0.5.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 +18 -0
- package/dist/cjs/nodeviews/mediaInline.js +17 -1
- package/dist/cjs/nodeviews/mediaSingle.js +11 -10
- package/dist/cjs/nodeviews/styles.js +5 -4
- package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +15 -14
- package/dist/cjs/toolbar/index.js +30 -75
- package/dist/cjs/toolbar/layout-group.js +7 -5
- package/dist/cjs/toolbar/linking-toolbar-appearance.js +12 -11
- package/dist/cjs/toolbar/mediaInline.js +127 -0
- package/dist/cjs/ui/CaptionPlaceholder/index.js +3 -2
- package/dist/cjs/ui/ImageBorder/index.js +23 -20
- package/dist/cjs/ui/Media/DropPlaceholder.js +5 -4
- package/dist/cjs/ui/MediaLinkingToolbar.js +15 -13
- package/dist/cjs/ui/PixelEntry/index.js +18 -15
- package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +4 -1
- package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +5 -4
- package/dist/cjs/ui/ResizableMediaSingle/index.js +5 -4
- package/dist/cjs/utils/media-single.js +6 -3
- package/dist/es2019/nodeviews/mediaInline.js +17 -1
- package/dist/es2019/nodeviews/mediaSingle.js +12 -9
- package/dist/es2019/nodeviews/styles.js +6 -5
- package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +17 -15
- package/dist/es2019/toolbar/index.js +28 -77
- package/dist/es2019/toolbar/layout-group.js +7 -6
- package/dist/es2019/toolbar/linking-toolbar-appearance.js +13 -12
- package/dist/es2019/toolbar/mediaInline.js +121 -0
- package/dist/es2019/ui/CaptionPlaceholder/index.js +4 -3
- package/dist/es2019/ui/ImageBorder/index.js +22 -20
- package/dist/es2019/ui/Media/DropPlaceholder.js +6 -5
- package/dist/es2019/ui/MediaLinkingToolbar.js +14 -13
- package/dist/es2019/ui/PixelEntry/index.js +17 -15
- package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +3 -1
- package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +5 -3
- package/dist/es2019/ui/ResizableMediaSingle/index.js +5 -3
- package/dist/es2019/utils/media-single.js +6 -2
- package/dist/esm/nodeviews/mediaInline.js +17 -1
- package/dist/esm/nodeviews/mediaSingle.js +12 -9
- package/dist/esm/nodeviews/styles.js +6 -5
- package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +17 -15
- package/dist/esm/toolbar/index.js +30 -75
- package/dist/esm/toolbar/layout-group.js +7 -6
- package/dist/esm/toolbar/linking-toolbar-appearance.js +13 -12
- package/dist/esm/toolbar/mediaInline.js +117 -0
- package/dist/esm/ui/CaptionPlaceholder/index.js +4 -3
- package/dist/esm/ui/ImageBorder/index.js +22 -20
- package/dist/esm/ui/Media/DropPlaceholder.js +6 -5
- package/dist/esm/ui/MediaLinkingToolbar.js +14 -13
- package/dist/esm/ui/PixelEntry/index.js +17 -15
- package/dist/esm/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +3 -1
- package/dist/esm/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +5 -3
- package/dist/esm/ui/ResizableMediaSingle/index.js +5 -3
- package/dist/esm/utils/media-single.js +6 -3
- package/dist/types/toolbar/mediaInline.d.ts +8 -0
- package/dist/types-ts4.5/toolbar/mediaInline.d.ts +8 -0
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#58884](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58884) [`a149612dc46d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a149612dc46d) - [ux] Added support for Media Inline Image Card in Editor and Renderer
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#59147](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/59147) [`f12e489f23b0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f12e489f23b0) - Re-build and deploy packages to NPM to resolve React/Compiled not found error (HOT-106483).
|
|
12
|
+
- [#56822](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/56822) [`77f4fbf44e93`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/77f4fbf44e93) - ECA11Y-78: Added announce for the selected file
|
|
13
|
+
|
|
14
|
+
## 0.4.10
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#58567](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58567) [`5c0892098c84`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5c0892098c84) - add media inline image floating toolbar under FF
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 0.4.9
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -18,9 +18,11 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
18
18
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
19
|
var _react = _interopRequireWildcard(require("react"));
|
|
20
20
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
21
|
+
var _mediaInline = require("@atlaskit/editor-common/media-inline");
|
|
21
22
|
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
22
23
|
var _selectionBasedNodeView = require("@atlaskit/editor-common/selection-based-node-view");
|
|
23
24
|
var _mediaCard = require("@atlaskit/media-card");
|
|
25
|
+
var _mediaClientReact = require("@atlaskit/media-client-react");
|
|
24
26
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
25
27
|
var _mediaNodeUpdater = require("./mediaNodeUpdater");
|
|
26
28
|
var _styles = require("./styles");
|
|
@@ -157,7 +159,11 @@ var MediaInline = exports.MediaInline = function MediaInline(props) {
|
|
|
157
159
|
}();
|
|
158
160
|
var _props$node$attrs = props.node.attrs,
|
|
159
161
|
id = _props$node$attrs.id,
|
|
160
|
-
collection = _props$node$attrs.collection
|
|
162
|
+
collection = _props$node$attrs.collection,
|
|
163
|
+
type = _props$node$attrs.type,
|
|
164
|
+
alt = _props$node$attrs.alt,
|
|
165
|
+
width = _props$node$attrs.width,
|
|
166
|
+
height = _props$node$attrs.height;
|
|
161
167
|
var identifier = {
|
|
162
168
|
id: id,
|
|
163
169
|
mediaItemType: 'file',
|
|
@@ -177,6 +183,16 @@ var MediaInline = exports.MediaInline = function MediaInline(props) {
|
|
|
177
183
|
isSelected: false
|
|
178
184
|
});
|
|
179
185
|
}
|
|
186
|
+
if ((0, _mediaInline.shouldShowInlineImage)(type)) {
|
|
187
|
+
return /*#__PURE__*/_react.default.createElement(_mediaInline.MediaInlineImageCard, {
|
|
188
|
+
mediaClient: (0, _mediaClientReact.getMediaClient)(viewMediaClientConfig),
|
|
189
|
+
identifier: identifier,
|
|
190
|
+
isSelected: props.isSelected,
|
|
191
|
+
alt: alt,
|
|
192
|
+
width: width,
|
|
193
|
+
height: height
|
|
194
|
+
});
|
|
195
|
+
}
|
|
180
196
|
return /*#__PURE__*/_react.default.createElement(_mediaCard.MediaInlineCard, {
|
|
181
197
|
isSelected: props.isSelected,
|
|
182
198
|
identifier: identifier,
|
|
@@ -18,6 +18,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
18
18
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
19
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
+
var _react2 = require("@emotion/react");
|
|
21
22
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
22
23
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
23
24
|
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
@@ -43,7 +44,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
43
44
|
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; }
|
|
44
45
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
45
46
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
46
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
47
48
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
48
49
|
var MediaSingleNode = exports.default = /*#__PURE__*/function (_Component) {
|
|
49
50
|
(0, _inherits2.default)(MediaSingleNode, _Component);
|
|
@@ -418,23 +419,23 @@ var MediaSingleNode = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
418
419
|
}
|
|
419
420
|
}
|
|
420
421
|
var shouldShowPlaceholder = mediaOptions.allowCaptions && node.childCount !== 2 && isSelected && state.selection instanceof _state.NodeSelection;
|
|
421
|
-
var MediaChildren =
|
|
422
|
+
var MediaChildren = (0, _react2.jsx)("figure", {
|
|
422
423
|
ref: this.mediaSingleWrapperRef,
|
|
423
424
|
css: [_styles.figureWrapper],
|
|
424
425
|
className: _styles.MediaSingleNodeSelector,
|
|
425
426
|
onClick: this.onMediaSingleClicked
|
|
426
|
-
},
|
|
427
|
+
}, (0, _react2.jsx)("div", {
|
|
427
428
|
ref: this.props.forwardRef
|
|
428
|
-
}), shouldShowPlaceholder &&
|
|
429
|
+
}), shouldShowPlaceholder && (0, _react2.jsx)(_CaptionPlaceholder.default, {
|
|
429
430
|
ref: this.captionPlaceHolderRef,
|
|
430
431
|
onClick: this.clickPlaceholder
|
|
431
432
|
}));
|
|
432
|
-
return canResize ? (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ?
|
|
433
|
+
return canResize ? (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ? (0, _react2.jsx)(_ResizableMediaSingleNext.default, (0, _extends2.default)({}, resizableMediaSingleProps, {
|
|
433
434
|
showLegacyNotification: widthType !== 'pixel'
|
|
434
|
-
}), MediaChildren) :
|
|
435
|
+
}), MediaChildren) : (0, _react2.jsx)(_ResizableMediaSingle.default, (0, _extends2.default)({}, resizableMediaSingleProps, {
|
|
435
436
|
lineLength: contentWidthForLegacyExperience,
|
|
436
437
|
pctWidth: mediaSingleWidthAttribute
|
|
437
|
-
}), MediaChildren) :
|
|
438
|
+
}), MediaChildren) : (0, _react2.jsx)(_ui.MediaSingle, (0, _extends2.default)({}, mediaSingleProps, {
|
|
438
439
|
pctWidth: mediaSingleWidthAttribute
|
|
439
440
|
}), MediaChildren);
|
|
440
441
|
}
|
|
@@ -461,7 +462,7 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref5) {
|
|
|
461
462
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['width', 'media']),
|
|
462
463
|
widthState = _useSharedPluginState.widthState,
|
|
463
464
|
mediaState = _useSharedPluginState.mediaState;
|
|
464
|
-
return
|
|
465
|
+
return (0, _react2.jsx)(MediaSingleNode, {
|
|
465
466
|
width: widthState.width,
|
|
466
467
|
lineLength: widthState.lineLength,
|
|
467
468
|
node: node,
|
|
@@ -591,13 +592,13 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
591
592
|
|
|
592
593
|
// getPos is a boolean for marks, since this is a node we know it must be a function
|
|
593
594
|
var getPos = this.getPos;
|
|
594
|
-
return
|
|
595
|
+
return (0, _react2.jsx)(_providerFactory.WithProviders, {
|
|
595
596
|
providers: ['mediaProvider', 'contextIdentifierProvider'],
|
|
596
597
|
providerFactory: providerFactory,
|
|
597
598
|
renderNode: function renderNode(_ref6) {
|
|
598
599
|
var mediaProvider = _ref6.mediaProvider,
|
|
599
600
|
contextIdentifierProvider = _ref6.contextIdentifierProvider;
|
|
600
|
-
return
|
|
601
|
+
return (0, _react2.jsx)(MediaSingleNodeWrapper, {
|
|
601
602
|
pluginInjectionApi: pluginInjectionApi,
|
|
602
603
|
mediaProvider: mediaProvider,
|
|
603
604
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
@@ -10,6 +10,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
12
12
|
var _templateObject, _templateObject2, _templateObject3;
|
|
13
|
+
/** @jsx jsx */
|
|
13
14
|
var MediaInlineNodeSelector = exports.MediaInlineNodeSelector = 'media-inline-node';
|
|
14
15
|
var MediaSingleNodeSelector = exports.MediaSingleNodeSelector = 'media-single-node';
|
|
15
16
|
var figureWrapper = exports.figureWrapper = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin: 0;\n"])));
|
|
@@ -23,7 +24,7 @@ var MediaCardWrapper = exports.MediaCardWrapper = function MediaCardWrapper(_ref
|
|
|
23
24
|
borderWidth = _ref$borderWidth === void 0 ? 0 : _ref$borderWidth,
|
|
24
25
|
onContextMenu = _ref.onContextMenu;
|
|
25
26
|
var calculatedBorderWidth = selected && borderWidth > 0 ? borderWidth + 1 : borderWidth;
|
|
26
|
-
return
|
|
27
|
+
return (0, _react2.jsx)("div", {
|
|
27
28
|
"data-testid": "media-card-wrapper",
|
|
28
29
|
style: {
|
|
29
30
|
borderColor: "var(--custom-palette-color)",
|
|
@@ -31,15 +32,15 @@ var MediaCardWrapper = exports.MediaCardWrapper = function MediaCardWrapper(_ref
|
|
|
31
32
|
borderStyle: 'solid',
|
|
32
33
|
borderRadius: "".concat(calculatedBorderWidth * 2, "px")
|
|
33
34
|
}
|
|
34
|
-
},
|
|
35
|
+
}, (0, _react2.jsx)("div", {
|
|
35
36
|
css: forcedDimensions,
|
|
36
37
|
style: {
|
|
37
38
|
paddingBottom: "".concat(dimensions.height / dimensions.width * 100, "%")
|
|
38
39
|
},
|
|
39
40
|
onContextMenuCapture: onContextMenu
|
|
40
|
-
}, borderWidth > 0 &&
|
|
41
|
+
}, borderWidth > 0 && (0, _react2.jsx)(_ui.MediaBorderGapFiller, {
|
|
41
42
|
borderColor: "var(--custom-palette-color)"
|
|
42
|
-
}),
|
|
43
|
+
}), (0, _react2.jsx)("div", {
|
|
43
44
|
css: absoluteDiv
|
|
44
45
|
}, children)));
|
|
45
46
|
};
|
|
@@ -27,6 +27,7 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
27
27
|
var _commands = require("../commands");
|
|
28
28
|
var _messages = require("../messages");
|
|
29
29
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
30
|
+
/** @jsx jsx */
|
|
30
31
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
31
32
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
32
33
|
var CONTAINER_WIDTH_IN_PX = exports.CONTAINER_WIDTH_IN_PX = _ui.RECENT_SEARCH_WIDTH_IN_PX;
|
|
@@ -145,31 +146,31 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
|
|
|
145
146
|
var formatMessage = this.props.intl.formatMessage;
|
|
146
147
|
var showClearTextButton = this.state.showClearTextButton;
|
|
147
148
|
var backButtonMessage = formatMessage(_messages.messages.back);
|
|
148
|
-
var backButtonMessageComponent =
|
|
149
|
+
var backButtonMessageComponent = (0, _react2.jsx)(_keymaps.ToolTipContent, {
|
|
149
150
|
description: backButtonMessage,
|
|
150
151
|
keymap: _keymaps.escape,
|
|
151
152
|
shortcutOverride: "Esc"
|
|
152
153
|
});
|
|
153
154
|
var errorsList = (this.state.validationErrors || []).map(function (error, index) {
|
|
154
|
-
return
|
|
155
|
+
return (0, _react2.jsx)(_ui.ErrorMessage, {
|
|
155
156
|
key: index
|
|
156
157
|
}, error);
|
|
157
158
|
});
|
|
158
159
|
var hasErrors = !!errorsList.length;
|
|
159
|
-
return
|
|
160
|
+
return (0, _react2.jsx)("div", {
|
|
160
161
|
css: container
|
|
161
|
-
},
|
|
162
|
+
}, (0, _react2.jsx)("section", {
|
|
162
163
|
css: inputWrapper
|
|
163
|
-
},
|
|
164
|
+
}, (0, _react2.jsx)("div", {
|
|
164
165
|
css: buttonWrapper
|
|
165
|
-
},
|
|
166
|
+
}, (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
166
167
|
title: formatMessage(_messages.messages.back),
|
|
167
|
-
icon:
|
|
168
|
+
icon: (0, _react2.jsx)(_chevronLeftLarge.default, {
|
|
168
169
|
label: formatMessage(_messages.messages.back)
|
|
169
170
|
}),
|
|
170
171
|
tooltipContent: backButtonMessageComponent,
|
|
171
172
|
onClick: this.closeMediaAltTextMenu
|
|
172
|
-
})),
|
|
173
|
+
})), (0, _react2.jsx)(_ui.PanelTextInput, {
|
|
173
174
|
testId: "alt-text-input",
|
|
174
175
|
ariaLabel: formatMessage(_messages.messages.placeholder),
|
|
175
176
|
describedById: "".concat(hasErrors ? 'errors-list' : '', " support-text"),
|
|
@@ -183,24 +184,24 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
|
|
|
183
184
|
ariaRequired: true,
|
|
184
185
|
ariaInvalid: hasErrors,
|
|
185
186
|
autoFocus: true
|
|
186
|
-
}), showClearTextButton &&
|
|
187
|
+
}), showClearTextButton && (0, _react2.jsx)("div", {
|
|
187
188
|
css: buttonWrapper
|
|
188
|
-
},
|
|
189
|
+
}, (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
189
190
|
testId: "alt-text-clear-button",
|
|
190
191
|
title: formatMessage(_messages.messages.clear),
|
|
191
|
-
icon:
|
|
192
|
+
icon: (0, _react2.jsx)("span", {
|
|
192
193
|
css: clearText
|
|
193
|
-
},
|
|
194
|
+
}, (0, _react2.jsx)(_crossCircle.default, {
|
|
194
195
|
label: formatMessage(_messages.messages.clear)
|
|
195
196
|
})),
|
|
196
197
|
tooltipContent: formatMessage(_messages.messages.clear),
|
|
197
198
|
onClick: this.handleClearText
|
|
198
|
-
}))), hasErrors &&
|
|
199
|
+
}))), hasErrors && (0, _react2.jsx)("section", {
|
|
199
200
|
id: "errors-list",
|
|
200
201
|
ref: this.errorsListRef,
|
|
201
202
|
"aria-live": "assertive",
|
|
202
203
|
css: validationWrapper
|
|
203
|
-
}, errorsList),
|
|
204
|
+
}, errorsList), (0, _react2.jsx)("p", {
|
|
204
205
|
css: supportText,
|
|
205
206
|
id: "support-text"
|
|
206
207
|
}, formatMessage(_messages.messages.supportText)));
|
|
@@ -38,11 +38,20 @@ var _imageBorder = require("./imageBorder");
|
|
|
38
38
|
var _layoutGroup = require("./layout-group");
|
|
39
39
|
var _linking3 = require("./linking");
|
|
40
40
|
var _linkingToolbarAppearance = require("./linking-toolbar-appearance");
|
|
41
|
+
var _mediaInline = require("./mediaInline");
|
|
41
42
|
var _utils2 = require("./utils");
|
|
42
43
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
43
44
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
44
45
|
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; }
|
|
45
46
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
47
|
+
var mediaTypeMessages = {
|
|
48
|
+
image: _mediaUi.messages.file_image_is_selected,
|
|
49
|
+
video: _mediaUi.messages.file_video_is_selected,
|
|
50
|
+
audio: _mediaUi.messages.file_audio_is_selected,
|
|
51
|
+
doc: _mediaUi.messages.file_doc_is_selected,
|
|
52
|
+
archive: _mediaUi.messages.file_archive_is_selected,
|
|
53
|
+
unknown: _mediaUi.messages.file_unknown_is_selected
|
|
54
|
+
};
|
|
46
55
|
var remove = function remove(state, dispatch) {
|
|
47
56
|
if (dispatch) {
|
|
48
57
|
dispatch((0, _utils.removeSelectedNode)(state.tr));
|
|
@@ -129,79 +138,6 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
129
138
|
}];
|
|
130
139
|
return items;
|
|
131
140
|
};
|
|
132
|
-
var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI) {
|
|
133
|
-
var mediaInline = state.schema.nodes.mediaInline;
|
|
134
|
-
var items = [{
|
|
135
|
-
id: 'editor.media.view.switcher',
|
|
136
|
-
type: 'dropdown',
|
|
137
|
-
title: intl.formatMessage(_mediaUi.messages.changeView),
|
|
138
|
-
options: [{
|
|
139
|
-
id: 'editor.media.view.switcher.inline',
|
|
140
|
-
title: intl.formatMessage(_messages.cardMessages.inline),
|
|
141
|
-
selected: true,
|
|
142
|
-
disabled: false,
|
|
143
|
-
onClick: function onClick() {
|
|
144
|
-
return true;
|
|
145
|
-
},
|
|
146
|
-
testId: 'inline-appearance'
|
|
147
|
-
}, {
|
|
148
|
-
id: 'editor.media.view.switcher.thumbnail',
|
|
149
|
-
title: intl.formatMessage(_mediaUi.messages.displayThumbnail),
|
|
150
|
-
selected: false,
|
|
151
|
-
disabled: false,
|
|
152
|
-
onClick: (0, _commands.changeInlineToMediaCard)(editorAnalyticsAPI),
|
|
153
|
-
testId: 'thumbnail-appearance'
|
|
154
|
-
}]
|
|
155
|
-
}, {
|
|
156
|
-
type: 'separator'
|
|
157
|
-
}, {
|
|
158
|
-
type: 'custom',
|
|
159
|
-
fallback: [],
|
|
160
|
-
render: function render() {
|
|
161
|
-
return /*#__PURE__*/_react.default.createElement(_filePreviewItem.FilePreviewItem, {
|
|
162
|
-
key: "editor.media.card.preview",
|
|
163
|
-
mediaPluginState: mediaPluginState,
|
|
164
|
-
intl: intl
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}, {
|
|
168
|
-
type: 'separator'
|
|
169
|
-
}, {
|
|
170
|
-
id: 'editor.media.card.download',
|
|
171
|
-
type: 'button',
|
|
172
|
-
icon: _download.default,
|
|
173
|
-
onClick: function onClick() {
|
|
174
|
-
(0, _utils2.downloadMedia)(mediaPluginState);
|
|
175
|
-
return true;
|
|
176
|
-
},
|
|
177
|
-
title: intl.formatMessage(_mediaUi.messages.download)
|
|
178
|
-
}, {
|
|
179
|
-
type: 'separator'
|
|
180
|
-
}, {
|
|
181
|
-
type: 'copy-button',
|
|
182
|
-
items: [{
|
|
183
|
-
state: state,
|
|
184
|
-
formatMessage: intl.formatMessage,
|
|
185
|
-
nodeType: mediaInline
|
|
186
|
-
}, {
|
|
187
|
-
type: 'separator'
|
|
188
|
-
}]
|
|
189
|
-
}, {
|
|
190
|
-
id: 'editor.media.delete',
|
|
191
|
-
type: 'button',
|
|
192
|
-
appearance: 'danger',
|
|
193
|
-
focusEditoronEnter: true,
|
|
194
|
-
icon: _remove.default,
|
|
195
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
196
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
197
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
198
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
199
|
-
title: intl.formatMessage(_messages.default.remove),
|
|
200
|
-
onClick: _commands.removeInlineCard,
|
|
201
|
-
testId: 'media-toolbar-remove-button'
|
|
202
|
-
}];
|
|
203
|
-
return items;
|
|
204
|
-
};
|
|
205
141
|
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags) {
|
|
206
142
|
var _pluginInjectionApi$d;
|
|
207
143
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
@@ -465,6 +401,12 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
465
401
|
}, removeButton]);
|
|
466
402
|
return items;
|
|
467
403
|
};
|
|
404
|
+
var getMediaTypeMessage = function getMediaTypeMessage(selectedNodeTypeSingle) {
|
|
405
|
+
var mediaType = Object.keys(mediaTypeMessages).find(function (key) {
|
|
406
|
+
return selectedNodeTypeSingle === null || selectedNodeTypeSingle === void 0 ? void 0 : selectedNodeTypeSingle.includes(key);
|
|
407
|
+
});
|
|
408
|
+
return mediaType ? mediaTypeMessages[mediaType] : _mediaUi.messages.file_unknown_is_selected;
|
|
409
|
+
};
|
|
468
410
|
var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state, intl) {
|
|
469
411
|
var _pluginInjectionApi$d2;
|
|
470
412
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -534,7 +476,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
534
476
|
var element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(".".concat(_styles.MediaInlineNodeSelector));
|
|
535
477
|
return element || mediaPluginState.element;
|
|
536
478
|
};
|
|
537
|
-
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a8 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a8 === void 0 ? void 0 : _pluginInjectionApi$a8.actions);
|
|
479
|
+
items = (0, _mediaInline.generateMediaInlineFloatingToolbar)(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a8 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a8 === void 0 ? void 0 : _pluginInjectionApi$a8.actions);
|
|
538
480
|
} else {
|
|
539
481
|
baseToolbar.getDomRef = function () {
|
|
540
482
|
var _mediaPluginState$ele3;
|
|
@@ -543,9 +485,22 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
543
485
|
};
|
|
544
486
|
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags);
|
|
545
487
|
}
|
|
488
|
+
var assistiveMessage = '';
|
|
489
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-media_er96o')) {
|
|
490
|
+
var selectedMediaSingleNode = (0, _utils2.getSelectedMediaSingle)(state);
|
|
491
|
+
if (selectedMediaSingleNode) {
|
|
492
|
+
var selectedMediaNode = selectedMediaSingleNode === null || selectedMediaSingleNode === void 0 ? void 0 : selectedMediaSingleNode.node.content.firstChild;
|
|
493
|
+
var selectedNodeTypeSingle = selectedMediaNode === null || selectedMediaNode === void 0 ? void 0 : selectedMediaNode.attrs.__fileMimeType;
|
|
494
|
+
var selectedMediaAlt = selectedMediaNode === null || selectedMediaNode === void 0 ? void 0 : selectedMediaNode.attrs.alt;
|
|
495
|
+
assistiveMessage = intl === null || intl === void 0 ? void 0 : intl.formatMessage(getMediaTypeMessage(selectedNodeTypeSingle), {
|
|
496
|
+
name: selectedMediaAlt
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
}
|
|
546
500
|
var toolbarConfig = _objectSpread(_objectSpread({}, baseToolbar), {}, {
|
|
547
501
|
items: items,
|
|
548
|
-
scrollable: true
|
|
502
|
+
scrollable: true,
|
|
503
|
+
mediaAssistiveMessage: assistiveMessage
|
|
549
504
|
});
|
|
550
505
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') && allowResizing) {
|
|
551
506
|
return _objectSpread(_objectSpread({}, toolbarConfig), {}, {
|
|
@@ -7,6 +7,8 @@ exports.LayoutGroup = void 0;
|
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _button = require("@atlaskit/button");
|
|
9
9
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
10
|
+
/** @jsx jsx */
|
|
11
|
+
|
|
10
12
|
var containerStyles = (0, _react.css)({
|
|
11
13
|
marginLeft: "var(--ds-space-100, 8px)"
|
|
12
14
|
});
|
|
@@ -14,19 +16,19 @@ var LayoutGroup = exports.LayoutGroup = function LayoutGroup(_ref) {
|
|
|
14
16
|
var layoutButtons = _ref.layoutButtons,
|
|
15
17
|
dispatchCommand = _ref.dispatchCommand,
|
|
16
18
|
hide = _ref.hide;
|
|
17
|
-
return
|
|
19
|
+
return (0, _react.jsx)("div", {
|
|
18
20
|
css: containerStyles
|
|
19
|
-
},
|
|
21
|
+
}, (0, _react.jsx)(_button.ButtonGroup, null, layoutButtons.map(function (item, idx) {
|
|
20
22
|
switch (item.type) {
|
|
21
23
|
case 'separator':
|
|
22
|
-
return
|
|
24
|
+
return (0, _react.jsx)(_ui.FloatingToolbarSeparator, {
|
|
23
25
|
key: idx
|
|
24
26
|
});
|
|
25
27
|
case 'button':
|
|
26
28
|
var ButtonIcon = item.icon;
|
|
27
|
-
return
|
|
29
|
+
return (0, _react.jsx)(_ui.FloatingToolbarButton, {
|
|
28
30
|
key: idx,
|
|
29
|
-
icon: item.icon ?
|
|
31
|
+
icon: item.icon ? (0, _react.jsx)(ButtonIcon, {
|
|
30
32
|
label: item.title
|
|
31
33
|
}) : undefined,
|
|
32
34
|
title: item.title,
|
|
@@ -20,6 +20,7 @@ var _pluginKey = require("../pm-plugins/plugin-key");
|
|
|
20
20
|
var _checkMediaType = require("../utils/check-media-type");
|
|
21
21
|
var _currentMediaNode = require("../utils/current-media-node");
|
|
22
22
|
var _templateObject;
|
|
23
|
+
/** @jsx jsx */
|
|
23
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
26
|
// need this wrapper, need to have 4px between items.
|
|
@@ -58,42 +59,42 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = function LinkToolbar
|
|
|
58
59
|
var isValidUrl = (0, _adfSchema.isSafeUrl)(mediaLinkingState.link);
|
|
59
60
|
var title = intl.formatMessage(_messages.linkToolbarMessages.editLink);
|
|
60
61
|
var linkTitle = intl.formatMessage(isValidUrl ? _messages.linkMessages.openLink : _messages.linkToolbarMessages.unableToOpenLink);
|
|
61
|
-
return
|
|
62
|
+
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("div", {
|
|
62
63
|
css: wrapper
|
|
63
|
-
},
|
|
64
|
+
}, (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
64
65
|
onClick: onEditLink,
|
|
65
66
|
title: title,
|
|
66
|
-
tooltipContent:
|
|
67
|
+
tooltipContent: (0, _react2.jsx)(_keymaps.ToolTipContent, {
|
|
67
68
|
description: title,
|
|
68
69
|
keymap: _keymaps.addLink
|
|
69
70
|
}),
|
|
70
71
|
testId: "edit-link-button"
|
|
71
|
-
}, title)),
|
|
72
|
+
}, title)), (0, _react2.jsx)("div", {
|
|
72
73
|
css: wrapper
|
|
73
|
-
},
|
|
74
|
+
}, (0, _react2.jsx)(_ui.FloatingToolbarSeparator, null)), (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
74
75
|
target: "_blank",
|
|
75
76
|
href: isValidUrl ? mediaLinkingState.link : undefined,
|
|
76
77
|
disabled: !isValidUrl,
|
|
77
78
|
onClick: onOpenLink,
|
|
78
79
|
title: linkTitle,
|
|
79
|
-
icon:
|
|
80
|
+
icon: (0, _react2.jsx)(_shortcut.default, {
|
|
80
81
|
label: linkTitle
|
|
81
82
|
}),
|
|
82
83
|
className: "hyperlink-open-link"
|
|
83
|
-
}),
|
|
84
|
+
}), (0, _react2.jsx)(_ui.FloatingToolbarSeparator, null));
|
|
84
85
|
} else {
|
|
85
86
|
var _title = intl.formatMessage(_messages.linkToolbarMessages.addLink);
|
|
86
|
-
return
|
|
87
|
+
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_ui.FloatingToolbarButton, {
|
|
87
88
|
testId: "add-link-button",
|
|
88
89
|
onClick: onAddLink,
|
|
89
90
|
title: _title,
|
|
90
|
-
tooltipContent:
|
|
91
|
+
tooltipContent: (0, _react2.jsx)(_keymaps.ToolTipContent, {
|
|
91
92
|
description: _title,
|
|
92
93
|
keymap: _keymaps.addLink
|
|
93
94
|
}),
|
|
94
|
-
icon:
|
|
95
|
+
icon: (0, _react2.jsx)(_link.default, {
|
|
95
96
|
label: _title
|
|
96
97
|
})
|
|
97
|
-
}),
|
|
98
|
+
}), (0, _react2.jsx)(_ui.FloatingToolbarSeparator, null));
|
|
98
99
|
}
|
|
99
100
|
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.getMediaInlineImageToolbar = exports.generateMediaInlineFloatingToolbar = void 0;
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _mediaInline = require("@atlaskit/editor-common/media-inline");
|
|
11
|
+
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
12
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
|
+
var _download = _interopRequireDefault(require("@atlaskit/icon/glyph/download"));
|
|
14
|
+
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
15
|
+
var _mediaUi = require("@atlaskit/media-ui");
|
|
16
|
+
var _commands = require("./commands");
|
|
17
|
+
var _filePreviewItem = require("./filePreviewItem");
|
|
18
|
+
var _utils = require("./utils");
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI) {
|
|
22
|
+
var mediaInline = state.schema.nodes.mediaInline;
|
|
23
|
+
var mediaType = state.selection instanceof _state.NodeSelection && state.selection.node.attrs.type;
|
|
24
|
+
if ((0, _mediaInline.shouldShowInlineImage)(mediaType)) {
|
|
25
|
+
return getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI);
|
|
26
|
+
}
|
|
27
|
+
var items = [{
|
|
28
|
+
id: 'editor.media.view.switcher',
|
|
29
|
+
type: 'dropdown',
|
|
30
|
+
title: intl.formatMessage(_mediaUi.messages.changeView),
|
|
31
|
+
options: [{
|
|
32
|
+
id: 'editor.media.view.switcher.inline',
|
|
33
|
+
title: intl.formatMessage(_messages.cardMessages.inline),
|
|
34
|
+
selected: true,
|
|
35
|
+
disabled: false,
|
|
36
|
+
onClick: function onClick() {
|
|
37
|
+
return true;
|
|
38
|
+
},
|
|
39
|
+
testId: 'inline-appearance'
|
|
40
|
+
}, {
|
|
41
|
+
id: 'editor.media.view.switcher.thumbnail',
|
|
42
|
+
title: intl.formatMessage(_mediaUi.messages.displayThumbnail),
|
|
43
|
+
selected: false,
|
|
44
|
+
disabled: false,
|
|
45
|
+
onClick: (0, _commands.changeInlineToMediaCard)(editorAnalyticsAPI),
|
|
46
|
+
testId: 'thumbnail-appearance'
|
|
47
|
+
}]
|
|
48
|
+
}, {
|
|
49
|
+
type: 'separator'
|
|
50
|
+
}, {
|
|
51
|
+
type: 'custom',
|
|
52
|
+
fallback: [],
|
|
53
|
+
render: function render() {
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_filePreviewItem.FilePreviewItem, {
|
|
55
|
+
key: "editor.media.card.preview",
|
|
56
|
+
mediaPluginState: mediaPluginState,
|
|
57
|
+
intl: intl
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
type: 'separator'
|
|
62
|
+
}, {
|
|
63
|
+
id: 'editor.media.card.download',
|
|
64
|
+
type: 'button',
|
|
65
|
+
icon: _download.default,
|
|
66
|
+
onClick: function onClick() {
|
|
67
|
+
(0, _utils.downloadMedia)(mediaPluginState);
|
|
68
|
+
return true;
|
|
69
|
+
},
|
|
70
|
+
title: intl.formatMessage(_mediaUi.messages.download)
|
|
71
|
+
}, {
|
|
72
|
+
type: 'separator'
|
|
73
|
+
}, {
|
|
74
|
+
type: 'copy-button',
|
|
75
|
+
items: [{
|
|
76
|
+
state: state,
|
|
77
|
+
formatMessage: intl.formatMessage,
|
|
78
|
+
nodeType: mediaInline
|
|
79
|
+
}, {
|
|
80
|
+
type: 'separator'
|
|
81
|
+
}]
|
|
82
|
+
}, {
|
|
83
|
+
id: 'editor.media.delete',
|
|
84
|
+
type: 'button',
|
|
85
|
+
appearance: 'danger',
|
|
86
|
+
focusEditoronEnter: true,
|
|
87
|
+
icon: _remove.default,
|
|
88
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
89
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
90
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
91
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
92
|
+
title: intl.formatMessage(_messages.default.remove),
|
|
93
|
+
onClick: _commands.removeInlineCard,
|
|
94
|
+
testId: 'media-toolbar-remove-button'
|
|
95
|
+
}];
|
|
96
|
+
return items;
|
|
97
|
+
};
|
|
98
|
+
var getMediaInlineImageToolbar = exports.getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI) {
|
|
99
|
+
var mediaInline = state.schema.nodes.mediaInline;
|
|
100
|
+
// if type is image, return inline image floating toolbar items
|
|
101
|
+
var inlineImageItems = [
|
|
102
|
+
// TODO: border marks, media single switcher, link, alt text, etc
|
|
103
|
+
{
|
|
104
|
+
type: 'copy-button',
|
|
105
|
+
items: [{
|
|
106
|
+
state: state,
|
|
107
|
+
formatMessage: intl.formatMessage,
|
|
108
|
+
nodeType: mediaInline
|
|
109
|
+
}, {
|
|
110
|
+
type: 'separator'
|
|
111
|
+
}]
|
|
112
|
+
}, {
|
|
113
|
+
id: 'editor.media.delete',
|
|
114
|
+
type: 'button',
|
|
115
|
+
appearance: 'danger',
|
|
116
|
+
focusEditoronEnter: true,
|
|
117
|
+
icon: _remove.default,
|
|
118
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
119
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
120
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
121
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
122
|
+
title: intl.formatMessage(_messages.default.remove),
|
|
123
|
+
onClick: _commands.removeInlineCard,
|
|
124
|
+
testId: 'media-toolbar-remove-button'
|
|
125
|
+
}];
|
|
126
|
+
return inlineImageItems;
|
|
127
|
+
};
|