@atlaskit/editor-plugin-media 1.4.1 → 1.6.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 +26 -0
- package/dist/cjs/nodeviews/mediaSingle.js +4 -2
- package/dist/cjs/plugin.js +1 -0
- package/dist/cjs/toolbar/filePreviewItem.js +2 -2
- package/dist/cjs/toolbar/index.js +22 -7
- package/dist/cjs/toolbar/mediaInline.js +8 -0
- package/dist/cjs/toolbar/utils.js +16 -1
- package/dist/es2019/nodeviews/mediaSingle.js +4 -2
- package/dist/es2019/plugin.js +1 -0
- package/dist/es2019/toolbar/filePreviewItem.js +3 -3
- package/dist/es2019/toolbar/index.js +23 -8
- package/dist/es2019/toolbar/mediaInline.js +8 -0
- package/dist/es2019/toolbar/utils.js +15 -0
- package/dist/esm/nodeviews/mediaSingle.js +4 -2
- package/dist/esm/plugin.js +1 -0
- package/dist/esm/toolbar/filePreviewItem.js +3 -3
- package/dist/esm/toolbar/index.js +21 -6
- package/dist/esm/toolbar/mediaInline.js +8 -0
- package/dist/esm/toolbar/utils.js +15 -0
- package/dist/types/next-plugin-type.d.ts +3 -1
- package/dist/types/nodeviews/types.d.ts +2 -0
- package/dist/types/toolbar/index.d.ts +3 -1
- package/dist/types/toolbar/utils.d.ts +1 -0
- package/dist/types/types.d.ts +2 -0
- package/dist/types-ts4.5/next-plugin-type.d.ts +3 -1
- package/dist/types-ts4.5/nodeviews/types.d.ts +2 -0
- package/dist/types-ts4.5/toolbar/index.d.ts +3 -1
- package/dist/types-ts4.5/toolbar/utils.d.ts +1 -0
- package/dist/types-ts4.5/types.d.ts +2 -0
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 1.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#78166](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78166) [`8055c8ca1c32`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8055c8ca1c32) - [ux] Add support for preview button in floating toolbar to mediaInline nodes
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#78326](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78326) [`4adb95539d29`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4adb95539d29) - Added logic to allow media single to access annotation state
|
|
12
|
+
|
|
13
|
+
## 1.5.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
19
|
+
## 1.5.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [#76504](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/76504) [`35deb7a5d492`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/35deb7a5d492) - [ux] Add Media preview feature for full page Editor under FF
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 1.4.1
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -462,9 +462,10 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref5) {
|
|
|
462
462
|
eventDispatcher = _ref5.eventDispatcher,
|
|
463
463
|
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent,
|
|
464
464
|
forwardRef = _ref5.forwardRef;
|
|
465
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['width', 'media']),
|
|
465
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['width', 'media', 'annotation']),
|
|
466
466
|
widthState = _useSharedPluginState.widthState,
|
|
467
|
-
mediaState = _useSharedPluginState.mediaState
|
|
467
|
+
mediaState = _useSharedPluginState.mediaState,
|
|
468
|
+
annotationState = _useSharedPluginState.annotationState;
|
|
468
469
|
return (0, _react2.jsx)(MediaSingleNode, {
|
|
469
470
|
width: widthState.width,
|
|
470
471
|
lineLength: widthState.lineLength,
|
|
@@ -478,6 +479,7 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref5) {
|
|
|
478
479
|
selected: selected,
|
|
479
480
|
eventDispatcher: eventDispatcher,
|
|
480
481
|
mediaPluginState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined,
|
|
482
|
+
annotationPluginState: annotationState !== null && annotationState !== void 0 ? annotationState : undefined,
|
|
481
483
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
482
484
|
forwardRef: forwardRef,
|
|
483
485
|
pluginInjectionApi: pluginInjectionApi
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -277,6 +277,7 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref2) {
|
|
|
277
277
|
allowLinking: options && options.allowLinking,
|
|
278
278
|
allowAdvancedToolBarOptions: options && options.allowAdvancedToolBarOptions,
|
|
279
279
|
allowAltTextOnImages: options && options.allowAltTextOnImages,
|
|
280
|
+
allowImagePreview: options && options.allowImagePreview,
|
|
280
281
|
altTextValidator: options && options.altTextValidator,
|
|
281
282
|
fullWidthEnabled: options && options.fullWidthEnabled,
|
|
282
283
|
allowMediaInlineImages: options && options.allowMediaInlineImages,
|
|
@@ -31,7 +31,7 @@ var FilePreviewItem = exports.FilePreviewItem = function FilePreviewItem(_ref) {
|
|
|
31
31
|
};
|
|
32
32
|
var renderMediaViewer = function renderMediaViewer() {
|
|
33
33
|
if (isMediaViewerVisible) {
|
|
34
|
-
var selectedNodeAttrs = (0, _utils.
|
|
34
|
+
var selectedNodeAttrs = (0, _utils.getSelectedNearestMediaContainerNodeAttrs)(mediaPluginState);
|
|
35
35
|
if (selectedNodeAttrs && mediaPluginState.mediaClientConfig) {
|
|
36
36
|
var id = selectedNodeAttrs.id,
|
|
37
37
|
_selectedNodeAttrs$co = selectedNodeAttrs.collection,
|
|
@@ -54,7 +54,7 @@ var FilePreviewItem = exports.FilePreviewItem = function FilePreviewItem(_ref) {
|
|
|
54
54
|
};
|
|
55
55
|
var mediaViewer = renderMediaViewer();
|
|
56
56
|
var tooltipContent = intl.formatMessage(_mediaUi.messages.preview);
|
|
57
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
57
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarButton, {
|
|
58
58
|
testId: "file-preview-toolbar-button",
|
|
59
59
|
key: "editor.media.card.preview",
|
|
60
60
|
onClick: openMediaViewer,
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.floatingToolbar = void 0;
|
|
8
|
+
exports.generateFilePreviewItem = exports.floatingToolbar = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
@@ -67,11 +67,8 @@ var handleRemoveMediaGroup = function handleRemoveMediaGroup(state, dispatch) {
|
|
|
67
67
|
}
|
|
68
68
|
return true;
|
|
69
69
|
};
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
var items = [{
|
|
73
|
-
type: 'separator'
|
|
74
|
-
}, {
|
|
70
|
+
var generateFilePreviewItem = exports.generateFilePreviewItem = function generateFilePreviewItem(mediaPluginState, intl) {
|
|
71
|
+
return {
|
|
75
72
|
type: 'custom',
|
|
76
73
|
fallback: [],
|
|
77
74
|
render: function render() {
|
|
@@ -81,7 +78,13 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
81
78
|
intl: intl
|
|
82
79
|
});
|
|
83
80
|
}
|
|
84
|
-
}
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, forceFocusSelector) {
|
|
84
|
+
var mediaGroup = state.schema.nodes.mediaGroup;
|
|
85
|
+
var items = [{
|
|
86
|
+
type: 'separator'
|
|
87
|
+
}, generateFilePreviewItem(mediaPluginState, intl), {
|
|
85
88
|
type: 'separator'
|
|
86
89
|
}, {
|
|
87
90
|
id: 'editor.media.card.download',
|
|
@@ -177,6 +180,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
177
180
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
178
181
|
allowMediaInline = options.allowMediaInline,
|
|
179
182
|
allowMediaInlineImages = options.allowMediaInlineImages,
|
|
183
|
+
allowImagePreview = options.allowImagePreview,
|
|
180
184
|
getEditorFeatureFlags = options.getEditorFeatureFlags;
|
|
181
185
|
var editorFeatureFlags = getEditorFeatureFlags ? getEditorFeatureFlags() : undefined;
|
|
182
186
|
var toolbarButtons = [];
|
|
@@ -449,6 +453,17 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
449
453
|
}
|
|
450
454
|
});
|
|
451
455
|
}
|
|
456
|
+
// Preview Support
|
|
457
|
+
if (allowImagePreview) {
|
|
458
|
+
var _mediaNode$attrs;
|
|
459
|
+
var _selectedMediaSingleNode = (0, _utils2.getSelectedMediaSingle)(state);
|
|
460
|
+
var mediaNode = _selectedMediaSingleNode === null || _selectedMediaSingleNode === void 0 ? void 0 : _selectedMediaSingleNode.node.content.firstChild;
|
|
461
|
+
if (!(0, _mediaSingle2.isVideo)(mediaNode === null || mediaNode === void 0 || (_mediaNode$attrs = mediaNode.attrs) === null || _mediaNode$attrs === void 0 ? void 0 : _mediaNode$attrs.__fileMimeType)) {
|
|
462
|
+
toolbarButtons.push(generateFilePreviewItem(pluginState, intl), {
|
|
463
|
+
type: 'separator'
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
}
|
|
452
467
|
}
|
|
453
468
|
if (allowAltTextOnImages) {
|
|
454
469
|
var _pluginInjectionApi$a8;
|
|
@@ -26,6 +26,7 @@ var _filePreviewItem = require("./filePreviewItem");
|
|
|
26
26
|
var _imageBorder = require("./imageBorder");
|
|
27
27
|
var _linkingToolbarAppearance = require("./linking-toolbar-appearance");
|
|
28
28
|
var _utils = require("./utils");
|
|
29
|
+
var _index = require("./index");
|
|
29
30
|
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); }
|
|
30
31
|
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; }
|
|
31
32
|
var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi) {
|
|
@@ -246,6 +247,13 @@ var getMediaInlineImageToolbar = exports.getMediaInlineImageToolbar = function g
|
|
|
246
247
|
return null;
|
|
247
248
|
}
|
|
248
249
|
});
|
|
250
|
+
|
|
251
|
+
//Image Preview
|
|
252
|
+
if (options.allowImagePreview) {
|
|
253
|
+
inlineImageItems.push((0, _index.generateFilePreviewItem)(mediaPluginState, intl), {
|
|
254
|
+
type: 'separator'
|
|
255
|
+
});
|
|
256
|
+
}
|
|
249
257
|
if (options.allowAltTextOnImages) {
|
|
250
258
|
var _pluginInjectionApi$a5;
|
|
251
259
|
inlineImageItems.push((0, _altText.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions), {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.removeMediaGroupNode = exports.getSelectedMediaSingle = exports.getSelectedMediaContainerNodeAttrs = exports.getSelectedLayoutIcon = exports.getPixelWidthOfElement = exports.getMaxToolbarWidth = exports.downloadMedia = exports.canShowSwitchButtons = exports.calcNewLayout = void 0;
|
|
7
|
+
exports.removeMediaGroupNode = exports.getSelectedNearestMediaContainerNodeAttrs = exports.getSelectedMediaSingle = exports.getSelectedMediaContainerNodeAttrs = exports.getSelectedLayoutIcon = exports.getPixelWidthOfElement = exports.getMaxToolbarWidth = exports.downloadMedia = exports.canShowSwitchButtons = exports.calcNewLayout = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
@@ -21,6 +21,21 @@ var getSelectedMediaContainerNodeAttrs = exports.getSelectedMediaContainerNodeAt
|
|
|
21
21
|
}
|
|
22
22
|
return null;
|
|
23
23
|
};
|
|
24
|
+
var getSelectedNearestMediaContainerNodeAttrs = exports.getSelectedNearestMediaContainerNodeAttrs = function getSelectedNearestMediaContainerNodeAttrs(mediaPluginState) {
|
|
25
|
+
var selectedNode = mediaPluginState.selectedMediaContainerNode();
|
|
26
|
+
if (selectedNode) {
|
|
27
|
+
switch (selectedNode.type.name) {
|
|
28
|
+
case 'mediaSingle':
|
|
29
|
+
{
|
|
30
|
+
var childNode = selectedNode.firstChild;
|
|
31
|
+
return childNode === null || childNode === void 0 ? void 0 : childNode.attrs;
|
|
32
|
+
}
|
|
33
|
+
default:
|
|
34
|
+
return selectedNode.attrs;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
24
39
|
var downloadMedia = exports.downloadMedia = /*#__PURE__*/function () {
|
|
25
40
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(mediaPluginState) {
|
|
26
41
|
var selectedNodeAttrs, id, _selectedNodeAttrs$co, collection, mediaClient, fileState, fileName;
|
|
@@ -376,8 +376,9 @@ const MediaSingleNodeWrapper = ({
|
|
|
376
376
|
}) => {
|
|
377
377
|
const {
|
|
378
378
|
widthState,
|
|
379
|
-
mediaState
|
|
380
|
-
|
|
379
|
+
mediaState,
|
|
380
|
+
annotationState
|
|
381
|
+
} = useSharedPluginState(pluginInjectionApi, ['width', 'media', 'annotation']);
|
|
381
382
|
return jsx(MediaSingleNode, {
|
|
382
383
|
width: widthState.width,
|
|
383
384
|
lineLength: widthState.lineLength,
|
|
@@ -391,6 +392,7 @@ const MediaSingleNodeWrapper = ({
|
|
|
391
392
|
selected: selected,
|
|
392
393
|
eventDispatcher: eventDispatcher,
|
|
393
394
|
mediaPluginState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined,
|
|
395
|
+
annotationPluginState: annotationState !== null && annotationState !== void 0 ? annotationState : undefined,
|
|
394
396
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
395
397
|
forwardRef: forwardRef,
|
|
396
398
|
pluginInjectionApi: pluginInjectionApi
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -270,6 +270,7 @@ export const mediaPlugin = ({
|
|
|
270
270
|
allowLinking: options && options.allowLinking,
|
|
271
271
|
allowAdvancedToolBarOptions: options && options.allowAdvancedToolBarOptions,
|
|
272
272
|
allowAltTextOnImages: options && options.allowAltTextOnImages,
|
|
273
|
+
allowImagePreview: options && options.allowImagePreview,
|
|
273
274
|
altTextValidator: options && options.altTextValidator,
|
|
274
275
|
fullWidthEnabled: options && options.fullWidthEnabled,
|
|
275
276
|
allowMediaInlineImages: options && options.allowMediaInlineImages,
|
|
@@ -4,7 +4,7 @@ import { FloatingToolbarButton as ToolbarButton } from '@atlaskit/editor-common/
|
|
|
4
4
|
import FilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
|
|
5
5
|
import { messages } from '@atlaskit/media-ui';
|
|
6
6
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
7
|
-
import {
|
|
7
|
+
import { getSelectedNearestMediaContainerNodeAttrs } from './utils';
|
|
8
8
|
export const FilePreviewItem = ({
|
|
9
9
|
mediaPluginState,
|
|
10
10
|
intl
|
|
@@ -18,7 +18,7 @@ export const FilePreviewItem = ({
|
|
|
18
18
|
};
|
|
19
19
|
const renderMediaViewer = () => {
|
|
20
20
|
if (isMediaViewerVisible) {
|
|
21
|
-
const selectedNodeAttrs =
|
|
21
|
+
const selectedNodeAttrs = getSelectedNearestMediaContainerNodeAttrs(mediaPluginState);
|
|
22
22
|
if (selectedNodeAttrs && mediaPluginState.mediaClientConfig) {
|
|
23
23
|
const {
|
|
24
24
|
id,
|
|
@@ -42,7 +42,7 @@ export const FilePreviewItem = ({
|
|
|
42
42
|
};
|
|
43
43
|
const mediaViewer = renderMediaViewer();
|
|
44
44
|
const tooltipContent = intl.formatMessage(messages.preview);
|
|
45
|
-
return /*#__PURE__*/React.createElement(
|
|
45
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
46
46
|
testId: "file-preview-toolbar-button",
|
|
47
47
|
key: "editor.media.card.preview",
|
|
48
48
|
onClick: openMediaViewer,
|
|
@@ -53,13 +53,8 @@ const handleRemoveMediaGroup = (state, dispatch) => {
|
|
|
53
53
|
}
|
|
54
54
|
return true;
|
|
55
55
|
};
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
mediaGroup
|
|
59
|
-
} = state.schema.nodes;
|
|
60
|
-
const items = [{
|
|
61
|
-
type: 'separator'
|
|
62
|
-
}, {
|
|
56
|
+
export const generateFilePreviewItem = (mediaPluginState, intl) => {
|
|
57
|
+
return {
|
|
63
58
|
type: 'custom',
|
|
64
59
|
fallback: [],
|
|
65
60
|
render: () => {
|
|
@@ -69,7 +64,15 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDe
|
|
|
69
64
|
intl: intl
|
|
70
65
|
});
|
|
71
66
|
}
|
|
72
|
-
}
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, forceFocusSelector) => {
|
|
70
|
+
const {
|
|
71
|
+
mediaGroup
|
|
72
|
+
} = state.schema.nodes;
|
|
73
|
+
const items = [{
|
|
74
|
+
type: 'separator'
|
|
75
|
+
}, generateFilePreviewItem(mediaPluginState, intl), {
|
|
73
76
|
type: 'separator'
|
|
74
77
|
}, {
|
|
75
78
|
id: 'editor.media.card.download',
|
|
@@ -166,6 +169,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
166
169
|
allowAltTextOnImages,
|
|
167
170
|
allowMediaInline,
|
|
168
171
|
allowMediaInlineImages,
|
|
172
|
+
allowImagePreview,
|
|
169
173
|
getEditorFeatureFlags
|
|
170
174
|
} = options;
|
|
171
175
|
const editorFeatureFlags = getEditorFeatureFlags ? getEditorFeatureFlags() : undefined;
|
|
@@ -452,6 +456,17 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
452
456
|
}
|
|
453
457
|
});
|
|
454
458
|
}
|
|
459
|
+
// Preview Support
|
|
460
|
+
if (allowImagePreview) {
|
|
461
|
+
var _mediaNode$attrs;
|
|
462
|
+
const selectedMediaSingleNode = getSelectedMediaSingle(state);
|
|
463
|
+
const mediaNode = selectedMediaSingleNode === null || selectedMediaSingleNode === void 0 ? void 0 : selectedMediaSingleNode.node.content.firstChild;
|
|
464
|
+
if (!isVideo(mediaNode === null || mediaNode === void 0 ? void 0 : (_mediaNode$attrs = mediaNode.attrs) === null || _mediaNode$attrs === void 0 ? void 0 : _mediaNode$attrs.__fileMimeType)) {
|
|
465
|
+
toolbarButtons.push(generateFilePreviewItem(pluginState, intl), {
|
|
466
|
+
type: 'separator'
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
}
|
|
455
470
|
}
|
|
456
471
|
if (allowAltTextOnImages) {
|
|
457
472
|
var _pluginInjectionApi$a8;
|
|
@@ -18,6 +18,7 @@ import { FilePreviewItem } from './filePreviewItem';
|
|
|
18
18
|
import { shouldShowImageBorder } from './imageBorder';
|
|
19
19
|
import { LinkToolbarAppearance } from './linking-toolbar-appearance';
|
|
20
20
|
import { downloadMedia } from './utils';
|
|
21
|
+
import { generateFilePreviewItem } from './index';
|
|
21
22
|
export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, options = {}) => {
|
|
22
23
|
var _pluginInjectionApi$a, _pluginInjectionApi$f, _pluginInjectionApi$f2;
|
|
23
24
|
const editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
@@ -240,6 +241,13 @@ export const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverD
|
|
|
240
241
|
return null;
|
|
241
242
|
}
|
|
242
243
|
});
|
|
244
|
+
|
|
245
|
+
//Image Preview
|
|
246
|
+
if (options.allowImagePreview) {
|
|
247
|
+
inlineImageItems.push(generateFilePreviewItem(mediaPluginState, intl), {
|
|
248
|
+
type: 'separator'
|
|
249
|
+
});
|
|
250
|
+
}
|
|
243
251
|
if (options.allowAltTextOnImages) {
|
|
244
252
|
var _pluginInjectionApi$a5;
|
|
245
253
|
inlineImageItems.push(altTextButton(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions), {
|
|
@@ -12,6 +12,21 @@ export const getSelectedMediaContainerNodeAttrs = mediaPluginState => {
|
|
|
12
12
|
}
|
|
13
13
|
return null;
|
|
14
14
|
};
|
|
15
|
+
export const getSelectedNearestMediaContainerNodeAttrs = mediaPluginState => {
|
|
16
|
+
const selectedNode = mediaPluginState.selectedMediaContainerNode();
|
|
17
|
+
if (selectedNode) {
|
|
18
|
+
switch (selectedNode.type.name) {
|
|
19
|
+
case 'mediaSingle':
|
|
20
|
+
{
|
|
21
|
+
const childNode = selectedNode.firstChild;
|
|
22
|
+
return childNode === null || childNode === void 0 ? void 0 : childNode.attrs;
|
|
23
|
+
}
|
|
24
|
+
default:
|
|
25
|
+
return selectedNode.attrs;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
};
|
|
15
30
|
export const downloadMedia = async mediaPluginState => {
|
|
16
31
|
try {
|
|
17
32
|
const selectedNodeAttrs = getSelectedMediaContainerNodeAttrs(mediaPluginState);
|
|
@@ -455,9 +455,10 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref5) {
|
|
|
455
455
|
eventDispatcher = _ref5.eventDispatcher,
|
|
456
456
|
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent,
|
|
457
457
|
forwardRef = _ref5.forwardRef;
|
|
458
|
-
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width', 'media']),
|
|
458
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width', 'media', 'annotation']),
|
|
459
459
|
widthState = _useSharedPluginState.widthState,
|
|
460
|
-
mediaState = _useSharedPluginState.mediaState
|
|
460
|
+
mediaState = _useSharedPluginState.mediaState,
|
|
461
|
+
annotationState = _useSharedPluginState.annotationState;
|
|
461
462
|
return jsx(MediaSingleNode, {
|
|
462
463
|
width: widthState.width,
|
|
463
464
|
lineLength: widthState.lineLength,
|
|
@@ -471,6 +472,7 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref5) {
|
|
|
471
472
|
selected: selected,
|
|
472
473
|
eventDispatcher: eventDispatcher,
|
|
473
474
|
mediaPluginState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined,
|
|
475
|
+
annotationPluginState: annotationState !== null && annotationState !== void 0 ? annotationState : undefined,
|
|
474
476
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
475
477
|
forwardRef: forwardRef,
|
|
476
478
|
pluginInjectionApi: pluginInjectionApi
|
package/dist/esm/plugin.js
CHANGED
|
@@ -266,6 +266,7 @@ export var mediaPlugin = function mediaPlugin(_ref2) {
|
|
|
266
266
|
allowLinking: options && options.allowLinking,
|
|
267
267
|
allowAdvancedToolBarOptions: options && options.allowAdvancedToolBarOptions,
|
|
268
268
|
allowAltTextOnImages: options && options.allowAltTextOnImages,
|
|
269
|
+
allowImagePreview: options && options.allowImagePreview,
|
|
269
270
|
altTextValidator: options && options.altTextValidator,
|
|
270
271
|
fullWidthEnabled: options && options.fullWidthEnabled,
|
|
271
272
|
allowMediaInlineImages: options && options.allowMediaInlineImages,
|
|
@@ -5,7 +5,7 @@ import { FloatingToolbarButton as ToolbarButton } from '@atlaskit/editor-common/
|
|
|
5
5
|
import FilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
|
|
6
6
|
import { messages } from '@atlaskit/media-ui';
|
|
7
7
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
8
|
-
import {
|
|
8
|
+
import { getSelectedNearestMediaContainerNodeAttrs } from './utils';
|
|
9
9
|
export var FilePreviewItem = function FilePreviewItem(_ref) {
|
|
10
10
|
var mediaPluginState = _ref.mediaPluginState,
|
|
11
11
|
intl = _ref.intl;
|
|
@@ -21,7 +21,7 @@ export var FilePreviewItem = function FilePreviewItem(_ref) {
|
|
|
21
21
|
};
|
|
22
22
|
var renderMediaViewer = function renderMediaViewer() {
|
|
23
23
|
if (isMediaViewerVisible) {
|
|
24
|
-
var selectedNodeAttrs =
|
|
24
|
+
var selectedNodeAttrs = getSelectedNearestMediaContainerNodeAttrs(mediaPluginState);
|
|
25
25
|
if (selectedNodeAttrs && mediaPluginState.mediaClientConfig) {
|
|
26
26
|
var id = selectedNodeAttrs.id,
|
|
27
27
|
_selectedNodeAttrs$co = selectedNodeAttrs.collection,
|
|
@@ -44,7 +44,7 @@ export var FilePreviewItem = function FilePreviewItem(_ref) {
|
|
|
44
44
|
};
|
|
45
45
|
var mediaViewer = renderMediaViewer();
|
|
46
46
|
var tooltipContent = intl.formatMessage(messages.preview);
|
|
47
|
-
return /*#__PURE__*/React.createElement(
|
|
47
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
48
48
|
testId: "file-preview-toolbar-button",
|
|
49
49
|
key: "editor.media.card.preview",
|
|
50
50
|
onClick: openMediaViewer,
|
|
@@ -57,11 +57,8 @@ var handleRemoveMediaGroup = function handleRemoveMediaGroup(state, dispatch) {
|
|
|
57
57
|
}
|
|
58
58
|
return true;
|
|
59
59
|
};
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
var items = [{
|
|
63
|
-
type: 'separator'
|
|
64
|
-
}, {
|
|
60
|
+
export var generateFilePreviewItem = function generateFilePreviewItem(mediaPluginState, intl) {
|
|
61
|
+
return {
|
|
65
62
|
type: 'custom',
|
|
66
63
|
fallback: [],
|
|
67
64
|
render: function render() {
|
|
@@ -71,7 +68,13 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
71
68
|
intl: intl
|
|
72
69
|
});
|
|
73
70
|
}
|
|
74
|
-
}
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, forceFocusSelector) {
|
|
74
|
+
var mediaGroup = state.schema.nodes.mediaGroup;
|
|
75
|
+
var items = [{
|
|
76
|
+
type: 'separator'
|
|
77
|
+
}, generateFilePreviewItem(mediaPluginState, intl), {
|
|
75
78
|
type: 'separator'
|
|
76
79
|
}, {
|
|
77
80
|
id: 'editor.media.card.download',
|
|
@@ -167,6 +170,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
167
170
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
168
171
|
allowMediaInline = options.allowMediaInline,
|
|
169
172
|
allowMediaInlineImages = options.allowMediaInlineImages,
|
|
173
|
+
allowImagePreview = options.allowImagePreview,
|
|
170
174
|
getEditorFeatureFlags = options.getEditorFeatureFlags;
|
|
171
175
|
var editorFeatureFlags = getEditorFeatureFlags ? getEditorFeatureFlags() : undefined;
|
|
172
176
|
var toolbarButtons = [];
|
|
@@ -439,6 +443,17 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
439
443
|
}
|
|
440
444
|
});
|
|
441
445
|
}
|
|
446
|
+
// Preview Support
|
|
447
|
+
if (allowImagePreview) {
|
|
448
|
+
var _mediaNode$attrs;
|
|
449
|
+
var _selectedMediaSingleNode = getSelectedMediaSingle(state);
|
|
450
|
+
var mediaNode = _selectedMediaSingleNode === null || _selectedMediaSingleNode === void 0 ? void 0 : _selectedMediaSingleNode.node.content.firstChild;
|
|
451
|
+
if (!isVideo(mediaNode === null || mediaNode === void 0 || (_mediaNode$attrs = mediaNode.attrs) === null || _mediaNode$attrs === void 0 ? void 0 : _mediaNode$attrs.__fileMimeType)) {
|
|
452
|
+
toolbarButtons.push(generateFilePreviewItem(pluginState, intl), {
|
|
453
|
+
type: 'separator'
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
}
|
|
442
457
|
}
|
|
443
458
|
if (allowAltTextOnImages) {
|
|
444
459
|
var _pluginInjectionApi$a8;
|
|
@@ -18,6 +18,7 @@ import { FilePreviewItem } from './filePreviewItem';
|
|
|
18
18
|
import { shouldShowImageBorder } from './imageBorder';
|
|
19
19
|
import { LinkToolbarAppearance } from './linking-toolbar-appearance';
|
|
20
20
|
import { downloadMedia } from './utils';
|
|
21
|
+
import { generateFilePreviewItem } from './index';
|
|
21
22
|
export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi) {
|
|
22
23
|
var _pluginInjectionApi$a, _pluginInjectionApi$f;
|
|
23
24
|
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
@@ -236,6 +237,13 @@ export var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(stat
|
|
|
236
237
|
return null;
|
|
237
238
|
}
|
|
238
239
|
});
|
|
240
|
+
|
|
241
|
+
//Image Preview
|
|
242
|
+
if (options.allowImagePreview) {
|
|
243
|
+
inlineImageItems.push(generateFilePreviewItem(mediaPluginState, intl), {
|
|
244
|
+
type: 'separator'
|
|
245
|
+
});
|
|
246
|
+
}
|
|
239
247
|
if (options.allowAltTextOnImages) {
|
|
240
248
|
var _pluginInjectionApi$a5;
|
|
241
249
|
inlineImageItems.push(altTextButton(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions), {
|
|
@@ -14,6 +14,21 @@ export var getSelectedMediaContainerNodeAttrs = function getSelectedMediaContain
|
|
|
14
14
|
}
|
|
15
15
|
return null;
|
|
16
16
|
};
|
|
17
|
+
export var getSelectedNearestMediaContainerNodeAttrs = function getSelectedNearestMediaContainerNodeAttrs(mediaPluginState) {
|
|
18
|
+
var selectedNode = mediaPluginState.selectedMediaContainerNode();
|
|
19
|
+
if (selectedNode) {
|
|
20
|
+
switch (selectedNode.type.name) {
|
|
21
|
+
case 'mediaSingle':
|
|
22
|
+
{
|
|
23
|
+
var childNode = selectedNode.firstChild;
|
|
24
|
+
return childNode === null || childNode === void 0 ? void 0 : childNode.attrs;
|
|
25
|
+
}
|
|
26
|
+
default:
|
|
27
|
+
return selectedNode.attrs;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
};
|
|
17
32
|
export var downloadMedia = /*#__PURE__*/function () {
|
|
18
33
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mediaPluginState) {
|
|
19
34
|
var selectedNodeAttrs, id, _selectedNodeAttrs$co, collection, mediaClient, fileState, fileName;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { AnnotationPlugin } from '@atlaskit/editor-plugin-annotation';
|
|
3
4
|
import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
|
|
4
5
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
6
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
@@ -24,7 +25,8 @@ export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
|
24
25
|
FloatingToolbarPlugin,
|
|
25
26
|
EditorDisabledPlugin,
|
|
26
27
|
FocusPlugin,
|
|
27
|
-
SelectionPlugin
|
|
28
|
+
SelectionPlugin,
|
|
29
|
+
AnnotationPlugin
|
|
28
30
|
];
|
|
29
31
|
sharedState: MediaPluginState | null;
|
|
30
32
|
actions: {
|
|
@@ -2,6 +2,7 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { ContextIdentifierProvider, MediaProvider, ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
4
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { InlineCommentPluginState } from '@atlaskit/editor-plugin-annotation';
|
|
5
6
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
8
|
import type { MediaNextEditorPluginType } from '../next-plugin-type';
|
|
@@ -20,6 +21,7 @@ export interface MediaSingleNodeProps {
|
|
|
20
21
|
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
21
22
|
fullWidthMode?: boolean;
|
|
22
23
|
mediaPluginState: MediaPluginState;
|
|
24
|
+
annotationPluginState: InlineCommentPluginState;
|
|
23
25
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
24
26
|
isCopyPasteEnabled?: boolean;
|
|
25
27
|
forwardRef: ForwardRef;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
|
-
import type { ExtractInjectionAPI, FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Command, ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarItem } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { MediaNextEditorPluginType } from '../next-plugin-type';
|
|
5
|
+
import type { MediaPluginState } from '../pm-plugins/types';
|
|
5
6
|
import type { MediaFloatingToolbarOptions } from '../types';
|
|
7
|
+
export declare const generateFilePreviewItem: (mediaPluginState: MediaPluginState, intl: IntlShape) => FloatingToolbarItem<Command>;
|
|
6
8
|
export declare const floatingToolbar: (state: EditorState, intl: IntlShape, options: MediaFloatingToolbarOptions | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => FloatingToolbarConfig | undefined;
|
|
@@ -5,6 +5,7 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { MediaPluginState } from '../pm-plugins/types';
|
|
7
7
|
export declare const getSelectedMediaContainerNodeAttrs: (mediaPluginState: MediaPluginState) => MediaBaseAttributes | null;
|
|
8
|
+
export declare const getSelectedNearestMediaContainerNodeAttrs: (mediaPluginState: MediaPluginState) => MediaBaseAttributes | null;
|
|
8
9
|
export declare const downloadMedia: (mediaPluginState: MediaPluginState) => Promise<boolean>;
|
|
9
10
|
export declare const removeMediaGroupNode: (state: EditorState) => import("prosemirror-state").Transaction;
|
|
10
11
|
export declare const getSelectedMediaSingle: (state: EditorState) => import("prosemirror-utils/dist/types").FindResult;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export interface MediaOptions {
|
|
|
35
35
|
allowRemoteDimensionsFetch?: boolean;
|
|
36
36
|
allowDropzoneDropLine?: boolean;
|
|
37
37
|
allowMarkingUploadsAsIncomplete?: boolean;
|
|
38
|
+
allowImagePreview?: boolean;
|
|
38
39
|
fullWidthEnabled?: boolean;
|
|
39
40
|
uploadErrorHandler?: (state: MediaState) => void;
|
|
40
41
|
waitForMediaUpload?: boolean;
|
|
@@ -108,6 +109,7 @@ export type MediaFloatingToolbarOptions = {
|
|
|
108
109
|
allowAdvancedToolBarOptions?: boolean;
|
|
109
110
|
allowResizingInTables?: boolean;
|
|
110
111
|
allowAltTextOnImages?: boolean;
|
|
112
|
+
allowImagePreview?: boolean;
|
|
111
113
|
altTextValidator?: (value: string) => string[];
|
|
112
114
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
113
115
|
fullWidthEnabled?: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { AnnotationPlugin } from '@atlaskit/editor-plugin-annotation';
|
|
3
4
|
import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
|
|
4
5
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
6
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
@@ -24,7 +25,8 @@ export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
|
24
25
|
FloatingToolbarPlugin,
|
|
25
26
|
EditorDisabledPlugin,
|
|
26
27
|
FocusPlugin,
|
|
27
|
-
SelectionPlugin
|
|
28
|
+
SelectionPlugin,
|
|
29
|
+
AnnotationPlugin
|
|
28
30
|
];
|
|
29
31
|
sharedState: MediaPluginState | null;
|
|
30
32
|
actions: {
|
|
@@ -2,6 +2,7 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { ContextIdentifierProvider, MediaProvider, ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
4
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { InlineCommentPluginState } from '@atlaskit/editor-plugin-annotation';
|
|
5
6
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
8
|
import type { MediaNextEditorPluginType } from '../next-plugin-type';
|
|
@@ -20,6 +21,7 @@ export interface MediaSingleNodeProps {
|
|
|
20
21
|
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
21
22
|
fullWidthMode?: boolean;
|
|
22
23
|
mediaPluginState: MediaPluginState;
|
|
24
|
+
annotationPluginState: InlineCommentPluginState;
|
|
23
25
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
24
26
|
isCopyPasteEnabled?: boolean;
|
|
25
27
|
forwardRef: ForwardRef;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
|
-
import type { ExtractInjectionAPI, FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Command, ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarItem } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { MediaNextEditorPluginType } from '../next-plugin-type';
|
|
5
|
+
import type { MediaPluginState } from '../pm-plugins/types';
|
|
5
6
|
import type { MediaFloatingToolbarOptions } from '../types';
|
|
7
|
+
export declare const generateFilePreviewItem: (mediaPluginState: MediaPluginState, intl: IntlShape) => FloatingToolbarItem<Command>;
|
|
6
8
|
export declare const floatingToolbar: (state: EditorState, intl: IntlShape, options: MediaFloatingToolbarOptions | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => FloatingToolbarConfig | undefined;
|
|
@@ -5,6 +5,7 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { MediaPluginState } from '../pm-plugins/types';
|
|
7
7
|
export declare const getSelectedMediaContainerNodeAttrs: (mediaPluginState: MediaPluginState) => MediaBaseAttributes | null;
|
|
8
|
+
export declare const getSelectedNearestMediaContainerNodeAttrs: (mediaPluginState: MediaPluginState) => MediaBaseAttributes | null;
|
|
8
9
|
export declare const downloadMedia: (mediaPluginState: MediaPluginState) => Promise<boolean>;
|
|
9
10
|
export declare const removeMediaGroupNode: (state: EditorState) => import("prosemirror-state").Transaction;
|
|
10
11
|
export declare const getSelectedMediaSingle: (state: EditorState) => import("prosemirror-utils/dist/types").FindResult;
|
|
@@ -35,6 +35,7 @@ export interface MediaOptions {
|
|
|
35
35
|
allowRemoteDimensionsFetch?: boolean;
|
|
36
36
|
allowDropzoneDropLine?: boolean;
|
|
37
37
|
allowMarkingUploadsAsIncomplete?: boolean;
|
|
38
|
+
allowImagePreview?: boolean;
|
|
38
39
|
fullWidthEnabled?: boolean;
|
|
39
40
|
uploadErrorHandler?: (state: MediaState) => void;
|
|
40
41
|
waitForMediaUpload?: boolean;
|
|
@@ -108,6 +109,7 @@ export type MediaFloatingToolbarOptions = {
|
|
|
108
109
|
allowAdvancedToolBarOptions?: boolean;
|
|
109
110
|
allowResizingInTables?: boolean;
|
|
110
111
|
allowAltTextOnImages?: boolean;
|
|
112
|
+
allowImagePreview?: boolean;
|
|
111
113
|
altTextValidator?: (value: string) => string[];
|
|
112
114
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
113
115
|
fullWidthEnabled?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@atlaskit/editor-common": "^78.9.0",
|
|
41
41
|
"@atlaskit/editor-palette": "1.5.2",
|
|
42
42
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
43
|
+
"@atlaskit/editor-plugin-annotation": "1.0.1",
|
|
43
44
|
"@atlaskit/editor-plugin-decorations": "^1.0.0",
|
|
44
45
|
"@atlaskit/editor-plugin-editor-disabled": "^1.0.0",
|
|
45
46
|
"@atlaskit/editor-plugin-floating-toolbar": "^1.2.0",
|
|
@@ -59,13 +60,13 @@
|
|
|
59
60
|
"@atlaskit/media-common": "^11.0.0",
|
|
60
61
|
"@atlaskit/media-filmstrip": "^47.0.0",
|
|
61
62
|
"@atlaskit/media-picker": "^66.3.0",
|
|
62
|
-
"@atlaskit/media-ui": "^25.
|
|
63
|
-
"@atlaskit/media-viewer": "^48.
|
|
63
|
+
"@atlaskit/media-ui": "^25.3.0",
|
|
64
|
+
"@atlaskit/media-viewer": "^48.3.0",
|
|
64
65
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
65
|
-
"@atlaskit/primitives": "^
|
|
66
|
+
"@atlaskit/primitives": "^4.0.0",
|
|
66
67
|
"@atlaskit/textfield": "^6.0.0",
|
|
67
68
|
"@atlaskit/theme": "^12.6.0",
|
|
68
|
-
"@atlaskit/tokens": "^1.
|
|
69
|
+
"@atlaskit/tokens": "^1.39.0",
|
|
69
70
|
"@atlaskit/tooltip": "^18.1.0",
|
|
70
71
|
"@babel/runtime": "^7.0.0",
|
|
71
72
|
"@emotion/react": "^11.7.1",
|