@atlaskit/editor-plugin-media 0.4.8 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/nodeviews/mediaSingle.js +10 -11
- package/dist/cjs/nodeviews/styles.js +4 -5
- package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +14 -15
- package/dist/cjs/toolbar/index.js +2 -74
- package/dist/cjs/toolbar/layout-group.js +5 -7
- package/dist/cjs/toolbar/linking-toolbar-appearance.js +11 -12
- package/dist/cjs/toolbar/mediaInline.js +127 -0
- package/dist/cjs/ui/CaptionPlaceholder/index.js +2 -3
- package/dist/cjs/ui/ImageBorder/index.js +20 -23
- package/dist/cjs/ui/Media/DropPlaceholder.js +4 -5
- package/dist/cjs/ui/MediaLinkingToolbar.js +13 -15
- package/dist/cjs/ui/PixelEntry/index.js +15 -18
- package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +1 -4
- package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -5
- package/dist/cjs/ui/ResizableMediaSingle/index.js +4 -5
- package/dist/es2019/nodeviews/mediaSingle.js +9 -12
- package/dist/es2019/nodeviews/styles.js +5 -6
- package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +15 -17
- package/dist/es2019/toolbar/index.js +2 -76
- package/dist/es2019/toolbar/layout-group.js +6 -7
- package/dist/es2019/toolbar/linking-toolbar-appearance.js +12 -13
- package/dist/es2019/toolbar/mediaInline.js +121 -0
- package/dist/es2019/ui/CaptionPlaceholder/index.js +3 -4
- package/dist/es2019/ui/ImageBorder/index.js +20 -22
- package/dist/es2019/ui/Media/DropPlaceholder.js +5 -6
- package/dist/es2019/ui/MediaLinkingToolbar.js +13 -14
- package/dist/es2019/ui/PixelEntry/index.js +15 -17
- package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +1 -3
- package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +3 -5
- package/dist/es2019/ui/ResizableMediaSingle/index.js +3 -5
- package/dist/esm/nodeviews/mediaSingle.js +9 -12
- package/dist/esm/nodeviews/styles.js +5 -6
- package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +15 -17
- package/dist/esm/toolbar/index.js +2 -74
- package/dist/esm/toolbar/layout-group.js +6 -7
- package/dist/esm/toolbar/linking-toolbar-appearance.js +12 -13
- package/dist/esm/toolbar/mediaInline.js +117 -0
- package/dist/esm/ui/CaptionPlaceholder/index.js +3 -4
- package/dist/esm/ui/ImageBorder/index.js +20 -22
- package/dist/esm/ui/Media/DropPlaceholder.js +5 -6
- package/dist/esm/ui/MediaLinkingToolbar.js +13 -14
- package/dist/esm/ui/PixelEntry/index.js +15 -17
- package/dist/esm/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +1 -3
- package/dist/esm/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +3 -5
- package/dist/esm/ui/ResizableMediaSingle/index.js +3 -5
- package/dist/types/toolbar/mediaInline.d.ts +8 -0
- package/dist/types-ts4.5/toolbar/mediaInline.d.ts +8 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 0.4.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 0.4.9
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#58763](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58763) [`0fdbd64522bf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0fdbd64522bf) - update ADF schema
|
|
15
|
+
|
|
3
16
|
## 0.4.8
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -18,7 +18,6 @@ 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");
|
|
22
21
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
23
22
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
24
23
|
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
@@ -44,7 +43,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
44
43
|
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
44
|
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; }
|
|
46
45
|
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); }; }
|
|
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; } }
|
|
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; } }
|
|
48
47
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
49
48
|
var MediaSingleNode = exports.default = /*#__PURE__*/function (_Component) {
|
|
50
49
|
(0, _inherits2.default)(MediaSingleNode, _Component);
|
|
@@ -419,23 +418,23 @@ var MediaSingleNode = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
419
418
|
}
|
|
420
419
|
}
|
|
421
420
|
var shouldShowPlaceholder = mediaOptions.allowCaptions && node.childCount !== 2 && isSelected && state.selection instanceof _state.NodeSelection;
|
|
422
|
-
var MediaChildren =
|
|
421
|
+
var MediaChildren = /*#__PURE__*/_react.default.createElement("figure", {
|
|
423
422
|
ref: this.mediaSingleWrapperRef,
|
|
424
423
|
css: [_styles.figureWrapper],
|
|
425
424
|
className: _styles.MediaSingleNodeSelector,
|
|
426
425
|
onClick: this.onMediaSingleClicked
|
|
427
|
-
},
|
|
426
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
428
427
|
ref: this.props.forwardRef
|
|
429
|
-
}), shouldShowPlaceholder &&
|
|
428
|
+
}), shouldShowPlaceholder && /*#__PURE__*/_react.default.createElement(_CaptionPlaceholder.default, {
|
|
430
429
|
ref: this.captionPlaceHolderRef,
|
|
431
430
|
onClick: this.clickPlaceholder
|
|
432
431
|
}));
|
|
433
|
-
return canResize ? (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ?
|
|
432
|
+
return canResize ? (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ? /*#__PURE__*/_react.default.createElement(_ResizableMediaSingleNext.default, (0, _extends2.default)({}, resizableMediaSingleProps, {
|
|
434
433
|
showLegacyNotification: widthType !== 'pixel'
|
|
435
|
-
}), MediaChildren) :
|
|
434
|
+
}), MediaChildren) : /*#__PURE__*/_react.default.createElement(_ResizableMediaSingle.default, (0, _extends2.default)({}, resizableMediaSingleProps, {
|
|
436
435
|
lineLength: contentWidthForLegacyExperience,
|
|
437
436
|
pctWidth: mediaSingleWidthAttribute
|
|
438
|
-
}), MediaChildren) :
|
|
437
|
+
}), MediaChildren) : /*#__PURE__*/_react.default.createElement(_ui.MediaSingle, (0, _extends2.default)({}, mediaSingleProps, {
|
|
439
438
|
pctWidth: mediaSingleWidthAttribute
|
|
440
439
|
}), MediaChildren);
|
|
441
440
|
}
|
|
@@ -462,7 +461,7 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref5) {
|
|
|
462
461
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['width', 'media']),
|
|
463
462
|
widthState = _useSharedPluginState.widthState,
|
|
464
463
|
mediaState = _useSharedPluginState.mediaState;
|
|
465
|
-
return
|
|
464
|
+
return /*#__PURE__*/_react.default.createElement(MediaSingleNode, {
|
|
466
465
|
width: widthState.width,
|
|
467
466
|
lineLength: widthState.lineLength,
|
|
468
467
|
node: node,
|
|
@@ -592,13 +591,13 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
592
591
|
|
|
593
592
|
// getPos is a boolean for marks, since this is a node we know it must be a function
|
|
594
593
|
var getPos = this.getPos;
|
|
595
|
-
return
|
|
594
|
+
return /*#__PURE__*/_react.default.createElement(_providerFactory.WithProviders, {
|
|
596
595
|
providers: ['mediaProvider', 'contextIdentifierProvider'],
|
|
597
596
|
providerFactory: providerFactory,
|
|
598
597
|
renderNode: function renderNode(_ref6) {
|
|
599
598
|
var mediaProvider = _ref6.mediaProvider,
|
|
600
599
|
contextIdentifierProvider = _ref6.contextIdentifierProvider;
|
|
601
|
-
return
|
|
600
|
+
return /*#__PURE__*/_react.default.createElement(MediaSingleNodeWrapper, {
|
|
602
601
|
pluginInjectionApi: pluginInjectionApi,
|
|
603
602
|
mediaProvider: mediaProvider,
|
|
604
603
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
@@ -10,7 +10,6 @@ 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 */
|
|
14
13
|
var MediaInlineNodeSelector = exports.MediaInlineNodeSelector = 'media-inline-node';
|
|
15
14
|
var MediaSingleNodeSelector = exports.MediaSingleNodeSelector = 'media-single-node';
|
|
16
15
|
var figureWrapper = exports.figureWrapper = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin: 0;\n"])));
|
|
@@ -24,7 +23,7 @@ var MediaCardWrapper = exports.MediaCardWrapper = function MediaCardWrapper(_ref
|
|
|
24
23
|
borderWidth = _ref$borderWidth === void 0 ? 0 : _ref$borderWidth,
|
|
25
24
|
onContextMenu = _ref.onContextMenu;
|
|
26
25
|
var calculatedBorderWidth = selected && borderWidth > 0 ? borderWidth + 1 : borderWidth;
|
|
27
|
-
return
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
28
27
|
"data-testid": "media-card-wrapper",
|
|
29
28
|
style: {
|
|
30
29
|
borderColor: "var(--custom-palette-color)",
|
|
@@ -32,15 +31,15 @@ var MediaCardWrapper = exports.MediaCardWrapper = function MediaCardWrapper(_ref
|
|
|
32
31
|
borderStyle: 'solid',
|
|
33
32
|
borderRadius: "".concat(calculatedBorderWidth * 2, "px")
|
|
34
33
|
}
|
|
35
|
-
},
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
36
35
|
css: forcedDimensions,
|
|
37
36
|
style: {
|
|
38
37
|
paddingBottom: "".concat(dimensions.height / dimensions.width * 100, "%")
|
|
39
38
|
},
|
|
40
39
|
onContextMenuCapture: onContextMenu
|
|
41
|
-
}, borderWidth > 0 &&
|
|
40
|
+
}, borderWidth > 0 && /*#__PURE__*/_react.default.createElement(_ui.MediaBorderGapFiller, {
|
|
42
41
|
borderColor: "var(--custom-palette-color)"
|
|
43
|
-
}),
|
|
42
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
44
43
|
css: absoluteDiv
|
|
45
44
|
}, children)));
|
|
46
45
|
};
|
|
@@ -27,7 +27,6 @@ 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 */
|
|
31
30
|
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); }; }
|
|
32
31
|
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; } }
|
|
33
32
|
var CONTAINER_WIDTH_IN_PX = exports.CONTAINER_WIDTH_IN_PX = _ui.RECENT_SEARCH_WIDTH_IN_PX;
|
|
@@ -146,31 +145,31 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
|
|
|
146
145
|
var formatMessage = this.props.intl.formatMessage;
|
|
147
146
|
var showClearTextButton = this.state.showClearTextButton;
|
|
148
147
|
var backButtonMessage = formatMessage(_messages.messages.back);
|
|
149
|
-
var backButtonMessageComponent =
|
|
148
|
+
var backButtonMessageComponent = /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
|
|
150
149
|
description: backButtonMessage,
|
|
151
150
|
keymap: _keymaps.escape,
|
|
152
151
|
shortcutOverride: "Esc"
|
|
153
152
|
});
|
|
154
153
|
var errorsList = (this.state.validationErrors || []).map(function (error, index) {
|
|
155
|
-
return
|
|
154
|
+
return /*#__PURE__*/_react.default.createElement(_ui.ErrorMessage, {
|
|
156
155
|
key: index
|
|
157
156
|
}, error);
|
|
158
157
|
});
|
|
159
158
|
var hasErrors = !!errorsList.length;
|
|
160
|
-
return
|
|
159
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
161
160
|
css: container
|
|
162
|
-
},
|
|
161
|
+
}, /*#__PURE__*/_react.default.createElement("section", {
|
|
163
162
|
css: inputWrapper
|
|
164
|
-
},
|
|
163
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
165
164
|
css: buttonWrapper
|
|
166
|
-
},
|
|
165
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarButton, {
|
|
167
166
|
title: formatMessage(_messages.messages.back),
|
|
168
|
-
icon:
|
|
167
|
+
icon: /*#__PURE__*/_react.default.createElement(_chevronLeftLarge.default, {
|
|
169
168
|
label: formatMessage(_messages.messages.back)
|
|
170
169
|
}),
|
|
171
170
|
tooltipContent: backButtonMessageComponent,
|
|
172
171
|
onClick: this.closeMediaAltTextMenu
|
|
173
|
-
})),
|
|
172
|
+
})), /*#__PURE__*/_react.default.createElement(_ui.PanelTextInput, {
|
|
174
173
|
testId: "alt-text-input",
|
|
175
174
|
ariaLabel: formatMessage(_messages.messages.placeholder),
|
|
176
175
|
describedById: "".concat(hasErrors ? 'errors-list' : '', " support-text"),
|
|
@@ -184,24 +183,24 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
|
|
|
184
183
|
ariaRequired: true,
|
|
185
184
|
ariaInvalid: hasErrors,
|
|
186
185
|
autoFocus: true
|
|
187
|
-
}), showClearTextButton &&
|
|
186
|
+
}), showClearTextButton && /*#__PURE__*/_react.default.createElement("div", {
|
|
188
187
|
css: buttonWrapper
|
|
189
|
-
},
|
|
188
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarButton, {
|
|
190
189
|
testId: "alt-text-clear-button",
|
|
191
190
|
title: formatMessage(_messages.messages.clear),
|
|
192
|
-
icon:
|
|
191
|
+
icon: /*#__PURE__*/_react.default.createElement("span", {
|
|
193
192
|
css: clearText
|
|
194
|
-
},
|
|
193
|
+
}, /*#__PURE__*/_react.default.createElement(_crossCircle.default, {
|
|
195
194
|
label: formatMessage(_messages.messages.clear)
|
|
196
195
|
})),
|
|
197
196
|
tooltipContent: formatMessage(_messages.messages.clear),
|
|
198
197
|
onClick: this.handleClearText
|
|
199
|
-
}))), hasErrors &&
|
|
198
|
+
}))), hasErrors && /*#__PURE__*/_react.default.createElement("section", {
|
|
200
199
|
id: "errors-list",
|
|
201
200
|
ref: this.errorsListRef,
|
|
202
201
|
"aria-live": "assertive",
|
|
203
202
|
css: validationWrapper
|
|
204
|
-
}, errorsList),
|
|
203
|
+
}, errorsList), /*#__PURE__*/_react.default.createElement("p", {
|
|
205
204
|
css: supportText,
|
|
206
205
|
id: "support-text"
|
|
207
206
|
}, formatMessage(_messages.messages.supportText)));
|
|
@@ -38,6 +38,7 @@ 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; }
|
|
@@ -129,79 +130,6 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
129
130
|
}];
|
|
130
131
|
return items;
|
|
131
132
|
};
|
|
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
133
|
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags) {
|
|
206
134
|
var _pluginInjectionApi$d;
|
|
207
135
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
@@ -534,7 +462,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
534
462
|
var element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(".".concat(_styles.MediaInlineNodeSelector));
|
|
535
463
|
return element || mediaPluginState.element;
|
|
536
464
|
};
|
|
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);
|
|
465
|
+
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
466
|
} else {
|
|
539
467
|
baseToolbar.getDomRef = function () {
|
|
540
468
|
var _mediaPluginState$ele3;
|
|
@@ -7,8 +7,6 @@ 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
|
-
|
|
12
10
|
var containerStyles = (0, _react.css)({
|
|
13
11
|
marginLeft: "var(--ds-space-100, 8px)"
|
|
14
12
|
});
|
|
@@ -16,19 +14,19 @@ var LayoutGroup = exports.LayoutGroup = function LayoutGroup(_ref) {
|
|
|
16
14
|
var layoutButtons = _ref.layoutButtons,
|
|
17
15
|
dispatchCommand = _ref.dispatchCommand,
|
|
18
16
|
hide = _ref.hide;
|
|
19
|
-
return
|
|
17
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
18
|
css: containerStyles
|
|
21
|
-
},
|
|
19
|
+
}, /*#__PURE__*/React.createElement(_button.ButtonGroup, null, layoutButtons.map(function (item, idx) {
|
|
22
20
|
switch (item.type) {
|
|
23
21
|
case 'separator':
|
|
24
|
-
return
|
|
22
|
+
return /*#__PURE__*/React.createElement(_ui.FloatingToolbarSeparator, {
|
|
25
23
|
key: idx
|
|
26
24
|
});
|
|
27
25
|
case 'button':
|
|
28
26
|
var ButtonIcon = item.icon;
|
|
29
|
-
return
|
|
27
|
+
return /*#__PURE__*/React.createElement(_ui.FloatingToolbarButton, {
|
|
30
28
|
key: idx,
|
|
31
|
-
icon: item.icon ?
|
|
29
|
+
icon: item.icon ? /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
32
30
|
label: item.title
|
|
33
31
|
}) : undefined,
|
|
34
32
|
title: item.title,
|
|
@@ -20,7 +20,6 @@ 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 */
|
|
24
23
|
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); }
|
|
25
24
|
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; }
|
|
26
25
|
// need this wrapper, need to have 4px between items.
|
|
@@ -59,42 +58,42 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = function LinkToolbar
|
|
|
59
58
|
var isValidUrl = (0, _adfSchema.isSafeUrl)(mediaLinkingState.link);
|
|
60
59
|
var title = intl.formatMessage(_messages.linkToolbarMessages.editLink);
|
|
61
60
|
var linkTitle = intl.formatMessage(isValidUrl ? _messages.linkMessages.openLink : _messages.linkToolbarMessages.unableToOpenLink);
|
|
62
|
-
return
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
63
62
|
css: wrapper
|
|
64
|
-
},
|
|
63
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarButton, {
|
|
65
64
|
onClick: onEditLink,
|
|
66
65
|
title: title,
|
|
67
|
-
tooltipContent:
|
|
66
|
+
tooltipContent: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
|
|
68
67
|
description: title,
|
|
69
68
|
keymap: _keymaps.addLink
|
|
70
69
|
}),
|
|
71
70
|
testId: "edit-link-button"
|
|
72
|
-
}, title)),
|
|
71
|
+
}, title)), /*#__PURE__*/_react.default.createElement("div", {
|
|
73
72
|
css: wrapper
|
|
74
|
-
},
|
|
73
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarSeparator, null)), /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarButton, {
|
|
75
74
|
target: "_blank",
|
|
76
75
|
href: isValidUrl ? mediaLinkingState.link : undefined,
|
|
77
76
|
disabled: !isValidUrl,
|
|
78
77
|
onClick: onOpenLink,
|
|
79
78
|
title: linkTitle,
|
|
80
|
-
icon:
|
|
79
|
+
icon: /*#__PURE__*/_react.default.createElement(_shortcut.default, {
|
|
81
80
|
label: linkTitle
|
|
82
81
|
}),
|
|
83
82
|
className: "hyperlink-open-link"
|
|
84
|
-
}),
|
|
83
|
+
}), /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarSeparator, null));
|
|
85
84
|
} else {
|
|
86
85
|
var _title = intl.formatMessage(_messages.linkToolbarMessages.addLink);
|
|
87
|
-
return
|
|
86
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarButton, {
|
|
88
87
|
testId: "add-link-button",
|
|
89
88
|
onClick: onAddLink,
|
|
90
89
|
title: _title,
|
|
91
|
-
tooltipContent:
|
|
90
|
+
tooltipContent: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
|
|
92
91
|
description: _title,
|
|
93
92
|
keymap: _keymaps.addLink
|
|
94
93
|
}),
|
|
95
|
-
icon:
|
|
94
|
+
icon: /*#__PURE__*/_react.default.createElement(_link.default, {
|
|
96
95
|
label: _title
|
|
97
96
|
})
|
|
98
|
-
}),
|
|
97
|
+
}), /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarSeparator, null));
|
|
99
98
|
}
|
|
100
99
|
};
|
|
@@ -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
|
+
};
|
|
@@ -13,15 +13,14 @@ var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
|
13
13
|
var _colors = require("@atlaskit/theme/colors");
|
|
14
14
|
var _messages = require("./messages");
|
|
15
15
|
var _templateObject;
|
|
16
|
-
/** @jsx jsx */
|
|
17
16
|
var placeholder = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n width: 100%;\n text-align: center;\n margin-top: ", " !important;\n display: block;\n"])), "var(--ds-text-subtlest, ".concat(_colors.N200, ")"), "var(--ds-space-100, 8px)");
|
|
18
17
|
var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
19
18
|
var onClick = _ref.onClick;
|
|
20
|
-
return
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
21
20
|
ref: ref,
|
|
22
21
|
css: placeholder,
|
|
23
22
|
onClick: onClick,
|
|
24
23
|
"data-id": _mediaSingle.CAPTION_PLACEHOLDER_ID,
|
|
25
24
|
"data-testid": "caption-placeholder"
|
|
26
|
-
},
|
|
25
|
+
}, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.placeholder));
|
|
27
26
|
});
|