@atlaskit/editor-plugin-media 3.0.9 → 3.0.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 +10 -0
- package/dist/cjs/ui/toolbar/comments.js +0 -2
- package/dist/cjs/ui/toolbar/index.js +27 -40
- package/dist/cjs/ui/toolbar/linking-toolbar-appearance.js +1 -3
- package/dist/cjs/ui/toolbar/mediaInline.js +23 -37
- package/dist/cjs/ui/toolbar/utils.js +68 -1
- package/dist/es2019/ui/toolbar/comments.js +0 -2
- package/dist/es2019/ui/toolbar/index.js +27 -40
- package/dist/es2019/ui/toolbar/linking-toolbar-appearance.js +1 -3
- package/dist/es2019/ui/toolbar/mediaInline.js +22 -36
- package/dist/es2019/ui/toolbar/utils.js +62 -0
- package/dist/esm/ui/toolbar/comments.js +0 -2
- package/dist/esm/ui/toolbar/index.js +29 -42
- package/dist/esm/ui/toolbar/linking-toolbar-appearance.js +1 -3
- package/dist/esm/ui/toolbar/mediaInline.js +24 -38
- package/dist/esm/ui/toolbar/utils.js +67 -0
- package/dist/types/ui/toolbar/commands.d.ts +1 -1
- package/dist/types/ui/toolbar/utils.d.ts +4 -1
- package/dist/types-ts4.5/ui/toolbar/commands.d.ts +1 -1
- package/dist/types-ts4.5/ui/toolbar/utils.d.ts +4 -1
- package/package.json +5 -2
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import memoizeOne from 'memoize-one';
|
|
4
5
|
import { wrappedLayouts } from '@atlaskit/editor-common/media-single';
|
|
6
|
+
import { mediaAndEmbedToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
5
7
|
import { nonWrappedLayouts } from '@atlaskit/editor-common/utils';
|
|
6
8
|
import { findParentNodeOfType, findSelectedNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
7
9
|
import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
10
|
+
import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
|
|
11
|
+
import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
8
12
|
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
13
|
+
import { messages } from '@atlaskit/media-ui';
|
|
9
14
|
import { isVideo } from '../../pm-plugins/utils/media-single';
|
|
15
|
+
import { changeMediaInlineToMediaSingle, changeMediaSingleToMediaInline } from './commands';
|
|
10
16
|
export var isExternalMedia = function isExternalMedia(attrs) {
|
|
11
17
|
return attrs.type === 'external';
|
|
12
18
|
};
|
|
@@ -159,4 +165,65 @@ export var updateToFullHeightSeparator = function updateToFullHeightSeparator(it
|
|
|
159
165
|
fullHeight: true
|
|
160
166
|
});
|
|
161
167
|
}
|
|
168
|
+
};
|
|
169
|
+
export var getMediaSingleAndMediaInlineSwitcherDropdown = function getMediaSingleAndMediaInlineSwitcherDropdown(nodeType, intl, pluginInjectionApi) {
|
|
170
|
+
var _pluginInjectionApi$a, _pluginInjectionApi$a2;
|
|
171
|
+
var hasCaption = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
172
|
+
var mediaInlineImageTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
|
|
173
|
+
var mediaSingleTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaSingle);
|
|
174
|
+
var inlineSwitcherTitle = intl.formatMessage(hasCaption ? mediaAndEmbedToolbarMessages.changeToMediaInlineImageCaptionWarning : mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
|
|
175
|
+
var InlineIcon = function InlineIcon() {
|
|
176
|
+
return /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
177
|
+
color: "currentColor",
|
|
178
|
+
spacing: "spacious",
|
|
179
|
+
label: ""
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
var BlockIcon = function BlockIcon() {
|
|
183
|
+
return /*#__PURE__*/React.createElement(MaximizeIcon, {
|
|
184
|
+
color: "currentColor",
|
|
185
|
+
spacing: "spacious",
|
|
186
|
+
label: ""
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
var dropdownConfig = {
|
|
190
|
+
inline: {
|
|
191
|
+
handleInlineButtonClick: function handleInlineButtonClick() {
|
|
192
|
+
return true;
|
|
193
|
+
},
|
|
194
|
+
handleBlockButtonClick: changeMediaInlineToMediaSingle(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width.sharedState.currentState()),
|
|
195
|
+
id: 'media-inline-to-block-toolbar-item',
|
|
196
|
+
icon: InlineIcon
|
|
197
|
+
},
|
|
198
|
+
block: {
|
|
199
|
+
handleInlineButtonClick: changeMediaSingleToMediaInline(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions),
|
|
200
|
+
handleBlockButtonClick: function handleBlockButtonClick() {
|
|
201
|
+
return true;
|
|
202
|
+
},
|
|
203
|
+
id: 'media-block-to-inline-toolbar-item',
|
|
204
|
+
icon: BlockIcon
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
var options = [{
|
|
208
|
+
id: 'editor.media.convert.mediainline',
|
|
209
|
+
title: mediaInlineImageTitle,
|
|
210
|
+
onClick: dropdownConfig[nodeType].handleInlineButtonClick,
|
|
211
|
+
selected: nodeType === 'inline',
|
|
212
|
+
icon: /*#__PURE__*/React.createElement(InlineIcon, null),
|
|
213
|
+
tooltip: hasCaption ? inlineSwitcherTitle : undefined
|
|
214
|
+
}, {
|
|
215
|
+
id: 'editor.media.convert.mediasingle',
|
|
216
|
+
title: mediaSingleTitle,
|
|
217
|
+
onClick: dropdownConfig[nodeType].handleBlockButtonClick,
|
|
218
|
+
selected: nodeType === 'block',
|
|
219
|
+
icon: /*#__PURE__*/React.createElement(BlockIcon, null)
|
|
220
|
+
}];
|
|
221
|
+
return {
|
|
222
|
+
id: dropdownConfig[nodeType].id,
|
|
223
|
+
testId: 'media-inline-to-block-dropdown',
|
|
224
|
+
title: intl.formatMessage(messages.sizeOptions),
|
|
225
|
+
type: 'dropdown',
|
|
226
|
+
options: options,
|
|
227
|
+
icon: dropdownConfig[nodeType].icon
|
|
228
|
+
};
|
|
162
229
|
};
|
|
@@ -7,7 +7,7 @@ import type { PixelEntryValidation } from '../../pm-plugins/pixel-resizing/ui/ty
|
|
|
7
7
|
import type { EventInput } from '../../pm-plugins/types';
|
|
8
8
|
export declare const DEFAULT_BORDER_COLOR = "#091e4224";
|
|
9
9
|
export declare const DEFAULT_BORDER_SIZE = 2;
|
|
10
|
-
export declare const getNodeType: (state: EditorState) => "
|
|
10
|
+
export declare const getNodeType: (state: EditorState) => "mediaInline" | "mediaSingle";
|
|
11
11
|
export declare const changeInlineToMediaCard: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, forceFocusSelector: ForceFocusSelector | undefined) => Command;
|
|
12
12
|
export declare const changeMediaCardToInline: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, forceFocusSelector: ForceFocusSelector | undefined) => Command;
|
|
13
13
|
export declare const changeMediaInlineToMediaSingle: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, widthPluginState: WidthPluginState | undefined, allowPixelResizing?: boolean) => Command;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { IntlShape } from 'react-intl-next';
|
|
1
2
|
import type { ExternalMediaAttributes, MediaADFAttrs, RichMediaLayout } from '@atlaskit/adf-schema';
|
|
2
3
|
import type { LayoutIcon } from '@atlaskit/editor-common/card';
|
|
3
|
-
import type { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { Command, FloatingToolbarItem, FloatingToolbarDropdown, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
5
|
import type { Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
8
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
+
import type { MediaNextEditorPluginType } from '../../mediaPluginType';
|
|
8
10
|
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
9
11
|
export declare const isExternalMedia: (attrs: MediaADFAttrs) => attrs is ExternalMediaAttributes;
|
|
10
12
|
export declare const getSelectedNearestMediaContainerNodeAttrsFunction: (selectedMediaContainerNode: () => ProseMirrorNode | undefined) => MediaADFAttrs | null;
|
|
@@ -22,3 +24,4 @@ export declare const getSelectedLayoutIcon: (layoutIcons: LayoutIcon[], selected
|
|
|
22
24
|
*/
|
|
23
25
|
export declare const canShowSwitchButtons: (mediaSingleNode?: ProseMirrorNode) => boolean | null;
|
|
24
26
|
export declare const updateToFullHeightSeparator: (items: FloatingToolbarItem<Command>[]) => void;
|
|
27
|
+
export declare const getMediaSingleAndMediaInlineSwitcherDropdown: (nodeType: 'inline' | 'block', intl: IntlShape, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, hasCaption?: boolean) => FloatingToolbarDropdown<Command>;
|
|
@@ -7,7 +7,7 @@ import type { PixelEntryValidation } from '../../pm-plugins/pixel-resizing/ui/ty
|
|
|
7
7
|
import type { EventInput } from '../../pm-plugins/types';
|
|
8
8
|
export declare const DEFAULT_BORDER_COLOR = "#091e4224";
|
|
9
9
|
export declare const DEFAULT_BORDER_SIZE = 2;
|
|
10
|
-
export declare const getNodeType: (state: EditorState) => "
|
|
10
|
+
export declare const getNodeType: (state: EditorState) => "mediaInline" | "mediaSingle";
|
|
11
11
|
export declare const changeInlineToMediaCard: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, forceFocusSelector: ForceFocusSelector | undefined) => Command;
|
|
12
12
|
export declare const changeMediaCardToInline: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, forceFocusSelector: ForceFocusSelector | undefined) => Command;
|
|
13
13
|
export declare const changeMediaInlineToMediaSingle: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, widthPluginState: WidthPluginState | undefined, allowPixelResizing?: boolean) => Command;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { IntlShape } from 'react-intl-next';
|
|
1
2
|
import type { ExternalMediaAttributes, MediaADFAttrs, RichMediaLayout } from '@atlaskit/adf-schema';
|
|
2
3
|
import type { LayoutIcon } from '@atlaskit/editor-common/card';
|
|
3
|
-
import type { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { Command, FloatingToolbarItem, FloatingToolbarDropdown, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
5
|
import type { Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
8
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
+
import type { MediaNextEditorPluginType } from '../../mediaPluginType';
|
|
8
10
|
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
9
11
|
export declare const isExternalMedia: (attrs: MediaADFAttrs) => attrs is ExternalMediaAttributes;
|
|
10
12
|
export declare const getSelectedNearestMediaContainerNodeAttrsFunction: (selectedMediaContainerNode: () => ProseMirrorNode | undefined) => MediaADFAttrs | null;
|
|
@@ -22,3 +24,4 @@ export declare const getSelectedLayoutIcon: (layoutIcons: LayoutIcon[], selected
|
|
|
22
24
|
*/
|
|
23
25
|
export declare const canShowSwitchButtons: (mediaSingleNode?: ProseMirrorNode) => boolean | null;
|
|
24
26
|
export declare const updateToFullHeightSeparator: (items: FloatingToolbarItem<Command>[]) => void;
|
|
27
|
+
export declare const getMediaSingleAndMediaInlineSwitcherDropdown: (nodeType: 'inline' | 'block', intl: IntlShape, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, hasCaption?: boolean) => FloatingToolbarDropdown<Command>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@atlaskit/primitives": "^14.8.0",
|
|
71
71
|
"@atlaskit/textfield": "^8.0.0",
|
|
72
72
|
"@atlaskit/theme": "^18.0.0",
|
|
73
|
-
"@atlaskit/tmp-editor-statsig": "^5.
|
|
73
|
+
"@atlaskit/tmp-editor-statsig": "^5.5.0",
|
|
74
74
|
"@atlaskit/tokens": "^4.9.0",
|
|
75
75
|
"@atlaskit/tooltip": "^20.2.0",
|
|
76
76
|
"@babel/runtime": "^7.0.0",
|
|
@@ -207,6 +207,9 @@
|
|
|
207
207
|
},
|
|
208
208
|
"platform_editor_interaction_api_refactor": {
|
|
209
209
|
"type": "boolean"
|
|
210
|
+
},
|
|
211
|
+
"platform_editor_controls_patch_11": {
|
|
212
|
+
"type": "boolean"
|
|
210
213
|
}
|
|
211
214
|
},
|
|
212
215
|
"stricter": {
|