@atlaskit/editor-plugin-media 0.3.1 → 0.3.3
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/mediaNodeView/index.js +4 -2
- package/dist/cjs/toolbar/index.js +6 -1
- package/dist/cjs/toolbar/utils.js +5 -2
- package/dist/es2019/nodeviews/mediaNodeView/index.js +4 -2
- package/dist/es2019/toolbar/index.js +5 -2
- package/dist/es2019/toolbar/utils.js +5 -3
- package/dist/esm/nodeviews/mediaNodeView/index.js +4 -2
- package/dist/esm/toolbar/index.js +7 -2
- package/dist/esm/toolbar/utils.js +5 -2
- package/dist/types/toolbar/utils.d.ts +1 -1
- package/dist/types-ts4.5/commands/captions.d.ts +5 -0
- package/dist/types-ts4.5/commands/helpers.d.ts +15 -0
- package/dist/types-ts4.5/commands/index.d.ts +1 -0
- package/dist/types-ts4.5/commands/linking.d.ts +9 -0
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/media-plugin-options.d.ts +17 -0
- package/dist/types-ts4.5/next-plugin-type.d.ts +33 -0
- package/dist/types-ts4.5/nodeviews/__mocks__/mediaNodeUpdater.d.ts +24 -0
- package/dist/types-ts4.5/nodeviews/mediaGroup.d.ts +33 -0
- package/dist/types-ts4.5/nodeviews/mediaInline.d.ts +50 -0
- package/dist/types-ts4.5/nodeviews/mediaNodeUpdater.d.ts +45 -0
- package/dist/types-ts4.5/nodeviews/mediaNodeView/index.d.ts +28 -0
- package/dist/types-ts4.5/nodeviews/mediaNodeView/media.d.ts +44 -0
- package/dist/types-ts4.5/nodeviews/mediaSingle.d.ts +62 -0
- package/dist/types-ts4.5/nodeviews/messages.d.ts +7 -0
- package/dist/types-ts4.5/nodeviews/styles.d.ts +16 -0
- package/dist/types-ts4.5/nodeviews/types.d.ts +42 -0
- package/dist/types-ts4.5/picker-facade.d.ts +44 -0
- package/dist/types-ts4.5/plugin.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/actions.d.ts +10 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/commands.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/index.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/keymap.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/messages.d.ts +37 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/reducer.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/types.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/ui/AltTextEdit.d.ts +41 -0
- package/dist/types-ts4.5/pm-plugins/keymap-media-single.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +6 -0
- package/dist/types-ts4.5/pm-plugins/linking/actions.d.ts +20 -0
- package/dist/types-ts4.5/pm-plugins/linking/index.d.ts +10 -0
- package/dist/types-ts4.5/pm-plugins/linking/keymap.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/linking/reducer.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/linking/types.d.ts +12 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +120 -0
- package/dist/types-ts4.5/pm-plugins/media-editor-plugin-factory.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/mediaTaskManager.d.ts +9 -0
- package/dist/types-ts4.5/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/types.d.ts +65 -0
- package/dist/types-ts4.5/toolbar/alt-text.d.ts +13 -0
- package/dist/types-ts4.5/toolbar/commands.d.ts +12 -0
- package/dist/types-ts4.5/toolbar/filePreviewItem.d.ts +9 -0
- package/dist/types-ts4.5/toolbar/imageBorder.d.ts +2 -0
- package/dist/types-ts4.5/toolbar/index.d.ts +6 -0
- package/dist/types-ts4.5/toolbar/linking-toolbar-appearance.d.ts +14 -0
- package/dist/types-ts4.5/toolbar/linking.d.ts +10 -0
- package/dist/types-ts4.5/toolbar/utils.d.ts +11 -0
- package/dist/types-ts4.5/types.d.ts +119 -0
- package/dist/types-ts4.5/ui/CaptionPlaceholder/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/CaptionPlaceholder/messages.d.ts +7 -0
- package/dist/types-ts4.5/ui/ImageBorder/index.d.ts +11 -0
- package/dist/types-ts4.5/ui/ImageBorder/messages.d.ts +42 -0
- package/dist/types-ts4.5/ui/ImageBorder/styles.d.ts +15 -0
- package/dist/types-ts4.5/ui/Media/DropPlaceholder.d.ts +8 -0
- package/dist/types-ts4.5/ui/Media/drop-placeholder-messages.d.ts +7 -0
- package/dist/types-ts4.5/ui/MediaLinkingToolbar.d.ts +35 -0
- package/dist/types-ts4.5/ui/MediaPicker/BrowserWrapper.d.ts +11 -0
- package/dist/types-ts4.5/ui/MediaPicker/ClipboardWrapper.d.ts +10 -0
- package/dist/types-ts4.5/ui/MediaPicker/DropzoneWrapper.d.ts +13 -0
- package/dist/types-ts4.5/ui/MediaPicker/PickerFacadeProvider.d.ts +28 -0
- package/dist/types-ts4.5/ui/MediaPicker/index.d.ts +23 -0
- package/dist/types-ts4.5/ui/PixelEntry/constants.d.ts +1 -0
- package/dist/types-ts4.5/ui/PixelEntry/index.d.ts +8 -0
- package/dist/types-ts4.5/ui/PixelEntry/messages.d.ts +47 -0
- package/dist/types-ts4.5/ui/PixelEntry/styles.d.ts +8 -0
- package/dist/types-ts4.5/ui/PixelEntry/types.d.ts +58 -0
- package/dist/types-ts4.5/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.d.ts +3 -0
- package/dist/types-ts4.5/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +59 -0
- package/dist/types-ts4.5/ui/ResizableMediaSingle/index.d.ts +45 -0
- package/dist/types-ts4.5/ui/ResizableMediaSingle/styled.d.ts +2 -0
- package/dist/types-ts4.5/ui/ResizableMediaSingle/styles.d.ts +1 -0
- package/dist/types-ts4.5/ui/ResizableMediaSingle/types.d.ts +27 -0
- package/dist/types-ts4.5/ui/ToolbarMedia/index.d.ts +13 -0
- package/dist/types-ts4.5/ui/ToolbarMedia/toolbar-media-messages.d.ts +7 -0
- package/dist/types-ts4.5/ui/media-linking-toolbar-messages.d.ts +7 -0
- package/dist/types-ts4.5/utils/analytics.d.ts +3 -0
- package/dist/types-ts4.5/utils/check-media-type.d.ts +4 -0
- package/dist/types-ts4.5/utils/current-media-node.d.ts +9 -0
- package/dist/types-ts4.5/utils/is-image.d.ts +1 -0
- package/dist/types-ts4.5/utils/media-common.d.ts +20 -0
- package/dist/types-ts4.5/utils/media-files.d.ts +30 -0
- package/dist/types-ts4.5/utils/media-single.d.ts +20 -0
- package/package.json +3 -3
- package/report.api.md +2 -0
- package/tmp/api-report-tmp.d.ts +392 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 0.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#41425](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41425) [`130e8656e37`](https://bitbucket.org/atlassian/atlassian-frontend/commits/130e8656e37) - Fixed bug where media single node was shrinking unexpectedly inside table cell.
|
|
8
|
+
|
|
9
|
+
## 0.3.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#41248](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41248) [`21fa5648746`](https://bitbucket.org/atlassian/atlassian-frontend/commits/21fa5648746) - Fix incorrect layout calculation for nested Media Single nodes resized via toolbar
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 0.3.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -66,9 +66,11 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
66
66
|
}
|
|
67
67
|
width = width || _mediaSingle.DEFAULT_IMAGE_WIDTH;
|
|
68
68
|
height = height || _mediaSingle.DEFAULT_IMAGE_HEIGHT;
|
|
69
|
+
|
|
70
|
+
// mediaSingle defines the max dimensions, so we don't need to constrain twice.
|
|
69
71
|
var maxDimensions = {
|
|
70
|
-
width: ""
|
|
71
|
-
height: ""
|
|
72
|
+
width: "100%",
|
|
73
|
+
height: "100%"
|
|
72
74
|
};
|
|
73
75
|
var originalDimensions = {
|
|
74
76
|
width: width,
|
|
@@ -297,6 +297,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
297
297
|
// get pos of media node
|
|
298
298
|
mediaWidth || _mediaSingle.DEFAULT_IMAGE_WIDTH);
|
|
299
299
|
var pixelWidth = isLegacy ? pixelWidthFromElement : mediaSingleWidth;
|
|
300
|
+
|
|
301
|
+
//hasParentNode will return falsey value if selection depth === 0
|
|
302
|
+
var isNested = (0, _utils.hasParentNode)(function (n) {
|
|
303
|
+
return n.type !== state.schema.nodes.doc;
|
|
304
|
+
})(state.selection);
|
|
300
305
|
return /*#__PURE__*/_react.default.createElement(_PixelEntry.PixelEntry, {
|
|
301
306
|
intl: intl,
|
|
302
307
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
@@ -316,7 +321,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
316
321
|
var _pluginInjectionApi$a4;
|
|
317
322
|
var width = _ref2.width,
|
|
318
323
|
validation = _ref2.validation;
|
|
319
|
-
var newLayout = (0, _utils2.calcNewLayout)(width, layout, contentWidth, options.fullWidthEnabled);
|
|
324
|
+
var newLayout = (0, _utils2.calcNewLayout)(width, layout, contentWidth, options.fullWidthEnabled, isNested);
|
|
320
325
|
(0, _commands.updateMediaSingleWidth)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions)(width, validation, newLayout)(state, dispatch);
|
|
321
326
|
},
|
|
322
327
|
onMigrate: function onMigrate() {
|
|
@@ -81,7 +81,10 @@ var getPixelWidthOfElement = exports.getPixelWidthOfElement = function getPixelW
|
|
|
81
81
|
};
|
|
82
82
|
var calcNewLayout = exports.calcNewLayout = function calcNewLayout(width, layout, contentWidth) {
|
|
83
83
|
var fullWidthMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
84
|
+
var isNested = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
84
85
|
var isWrappedLayout = _mediaSingle.wrappedLayouts.indexOf(layout) > -1;
|
|
86
|
+
|
|
87
|
+
//See flowchart for layout logic: https://hello.atlassian.net/wiki/spaces/TWPCP/whiteboard/2969594044
|
|
85
88
|
if (width >= _editorSharedStyles.akEditorFullWidthLayoutWidth) {
|
|
86
89
|
// If width is greater than or equal to full editor width
|
|
87
90
|
return 'full-width';
|
|
@@ -90,11 +93,11 @@ var calcNewLayout = exports.calcNewLayout = function calcNewLayout(width, layout
|
|
|
90
93
|
// If under editor full width mode
|
|
91
94
|
return isWrappedLayout ? layout : 'center';
|
|
92
95
|
}
|
|
93
|
-
if (width > contentWidth) {
|
|
96
|
+
if (width > contentWidth && !isNested) {
|
|
94
97
|
// If width is greater than content length and not nested
|
|
95
98
|
return 'wide';
|
|
96
99
|
}
|
|
97
|
-
return isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
100
|
+
return isNested || isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
98
101
|
};
|
|
99
102
|
var maxToolbarFitWidth = 0;
|
|
100
103
|
var getMaxToolbarWidth = exports.getMaxToolbarWidth = function getMaxToolbarWidth() {
|
|
@@ -52,9 +52,11 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
52
52
|
}
|
|
53
53
|
width = width || DEFAULT_IMAGE_WIDTH;
|
|
54
54
|
height = height || DEFAULT_IMAGE_HEIGHT;
|
|
55
|
+
|
|
56
|
+
// mediaSingle defines the max dimensions, so we don't need to constrain twice.
|
|
55
57
|
const maxDimensions = {
|
|
56
|
-
width:
|
|
57
|
-
height:
|
|
58
|
+
width: `100%`,
|
|
59
|
+
height: `100%`
|
|
58
60
|
};
|
|
59
61
|
const originalDimensions = {
|
|
60
62
|
width,
|
|
@@ -4,7 +4,7 @@ import { buildLayoutButtons } from '@atlaskit/editor-common/card';
|
|
|
4
4
|
import { calcMinWidth, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
5
5
|
import commonMessages, { cardMessages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import { findParentNodeOfType, hasParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
+
import { findParentNodeOfType, hasParentNode, hasParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
8
8
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
9
9
|
import DownloadIcon from '@atlaskit/icon/glyph/download';
|
|
10
10
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
@@ -300,6 +300,9 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
300
300
|
// get pos of media node
|
|
301
301
|
mediaWidth || DEFAULT_IMAGE_WIDTH);
|
|
302
302
|
const pixelWidth = isLegacy ? pixelWidthFromElement : mediaSingleWidth;
|
|
303
|
+
|
|
304
|
+
//hasParentNode will return falsey value if selection depth === 0
|
|
305
|
+
const isNested = hasParentNode(n => n.type !== state.schema.nodes.doc)(state.selection);
|
|
303
306
|
return /*#__PURE__*/React.createElement(PixelEntry, {
|
|
304
307
|
intl: intl,
|
|
305
308
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
@@ -320,7 +323,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
320
323
|
validation
|
|
321
324
|
}) => {
|
|
322
325
|
var _pluginInjectionApi$a4;
|
|
323
|
-
const newLayout = calcNewLayout(width, layout, contentWidth, options.fullWidthEnabled);
|
|
326
|
+
const newLayout = calcNewLayout(width, layout, contentWidth, options.fullWidthEnabled, isNested);
|
|
324
327
|
updateMediaSingleWidth(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions)(width, validation, newLayout)(state, dispatch);
|
|
325
328
|
},
|
|
326
329
|
onMigrate: () => {
|
|
@@ -56,8 +56,10 @@ export const getPixelWidthOfElement = (editorView, pos, mediaWidth) => {
|
|
|
56
56
|
}
|
|
57
57
|
return mediaWidth;
|
|
58
58
|
};
|
|
59
|
-
export const calcNewLayout = (width, layout, contentWidth, fullWidthMode = false) => {
|
|
59
|
+
export const calcNewLayout = (width, layout, contentWidth, fullWidthMode = false, isNested = false) => {
|
|
60
60
|
const isWrappedLayout = wrappedLayouts.indexOf(layout) > -1;
|
|
61
|
+
|
|
62
|
+
//See flowchart for layout logic: https://hello.atlassian.net/wiki/spaces/TWPCP/whiteboard/2969594044
|
|
61
63
|
if (width >= akEditorFullWidthLayoutWidth) {
|
|
62
64
|
// If width is greater than or equal to full editor width
|
|
63
65
|
return 'full-width';
|
|
@@ -66,11 +68,11 @@ export const calcNewLayout = (width, layout, contentWidth, fullWidthMode = false
|
|
|
66
68
|
// If under editor full width mode
|
|
67
69
|
return isWrappedLayout ? layout : 'center';
|
|
68
70
|
}
|
|
69
|
-
if (width > contentWidth) {
|
|
71
|
+
if (width > contentWidth && !isNested) {
|
|
70
72
|
// If width is greater than content length and not nested
|
|
71
73
|
return 'wide';
|
|
72
74
|
}
|
|
73
|
-
return isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
75
|
+
return isNested || isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
74
76
|
};
|
|
75
77
|
let maxToolbarFitWidth = 0;
|
|
76
78
|
export const getMaxToolbarWidth = () => {
|
|
@@ -59,9 +59,11 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
59
59
|
}
|
|
60
60
|
width = width || DEFAULT_IMAGE_WIDTH;
|
|
61
61
|
height = height || DEFAULT_IMAGE_HEIGHT;
|
|
62
|
+
|
|
63
|
+
// mediaSingle defines the max dimensions, so we don't need to constrain twice.
|
|
62
64
|
var maxDimensions = {
|
|
63
|
-
width: ""
|
|
64
|
-
height: ""
|
|
65
|
+
width: "100%",
|
|
66
|
+
height: "100%"
|
|
65
67
|
};
|
|
66
68
|
var originalDimensions = {
|
|
67
69
|
width: width,
|
|
@@ -8,7 +8,7 @@ import { buildLayoutButtons } from '@atlaskit/editor-common/card';
|
|
|
8
8
|
import { calcMinWidth, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
9
9
|
import commonMessages, { cardMessages } from '@atlaskit/editor-common/messages';
|
|
10
10
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
11
|
-
import { findParentNodeOfType, hasParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
11
|
+
import { findParentNodeOfType, hasParentNode, hasParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
12
12
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
13
13
|
import DownloadIcon from '@atlaskit/icon/glyph/download';
|
|
14
14
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
@@ -287,6 +287,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
287
287
|
// get pos of media node
|
|
288
288
|
mediaWidth || DEFAULT_IMAGE_WIDTH);
|
|
289
289
|
var pixelWidth = isLegacy ? pixelWidthFromElement : mediaSingleWidth;
|
|
290
|
+
|
|
291
|
+
//hasParentNode will return falsey value if selection depth === 0
|
|
292
|
+
var isNested = hasParentNode(function (n) {
|
|
293
|
+
return n.type !== state.schema.nodes.doc;
|
|
294
|
+
})(state.selection);
|
|
290
295
|
return /*#__PURE__*/React.createElement(PixelEntry, {
|
|
291
296
|
intl: intl,
|
|
292
297
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
@@ -306,7 +311,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
306
311
|
var _pluginInjectionApi$a4;
|
|
307
312
|
var width = _ref2.width,
|
|
308
313
|
validation = _ref2.validation;
|
|
309
|
-
var newLayout = calcNewLayout(width, layout, contentWidth, options.fullWidthEnabled);
|
|
314
|
+
var newLayout = calcNewLayout(width, layout, contentWidth, options.fullWidthEnabled, isNested);
|
|
310
315
|
updateMediaSingleWidth(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions)(width, validation, newLayout)(state, dispatch);
|
|
311
316
|
},
|
|
312
317
|
onMigrate: function onMigrate() {
|
|
@@ -74,7 +74,10 @@ export var getPixelWidthOfElement = function getPixelWidthOfElement(editorView,
|
|
|
74
74
|
};
|
|
75
75
|
export var calcNewLayout = function calcNewLayout(width, layout, contentWidth) {
|
|
76
76
|
var fullWidthMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
77
|
+
var isNested = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
77
78
|
var isWrappedLayout = wrappedLayouts.indexOf(layout) > -1;
|
|
79
|
+
|
|
80
|
+
//See flowchart for layout logic: https://hello.atlassian.net/wiki/spaces/TWPCP/whiteboard/2969594044
|
|
78
81
|
if (width >= akEditorFullWidthLayoutWidth) {
|
|
79
82
|
// If width is greater than or equal to full editor width
|
|
80
83
|
return 'full-width';
|
|
@@ -83,11 +86,11 @@ export var calcNewLayout = function calcNewLayout(width, layout, contentWidth) {
|
|
|
83
86
|
// If under editor full width mode
|
|
84
87
|
return isWrappedLayout ? layout : 'center';
|
|
85
88
|
}
|
|
86
|
-
if (width > contentWidth) {
|
|
89
|
+
if (width > contentWidth && !isNested) {
|
|
87
90
|
// If width is greater than content length and not nested
|
|
88
91
|
return 'wide';
|
|
89
92
|
}
|
|
90
|
-
return isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
93
|
+
return isNested || isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
91
94
|
};
|
|
92
95
|
var maxToolbarFitWidth = 0;
|
|
93
96
|
export var getMaxToolbarWidth = function getMaxToolbarWidth() {
|
|
@@ -7,5 +7,5 @@ export declare const downloadMedia: (mediaPluginState: MediaPluginState) => Prom
|
|
|
7
7
|
export declare const removeMediaGroupNode: (state: EditorState) => import("prosemirror-state").Transaction;
|
|
8
8
|
export declare const getSelectedMediaSingle: (state: EditorState) => import("prosemirror-utils/dist/types").FindResult;
|
|
9
9
|
export declare const getPixelWidthOfElement: (editorView: EditorView, pos: number, mediaWidth: number) => number;
|
|
10
|
-
export declare const calcNewLayout: (width: number, layout: RichMediaLayout, contentWidth: number, fullWidthMode?: boolean) => RichMediaLayout;
|
|
10
|
+
export declare const calcNewLayout: (width: number, layout: RichMediaLayout, contentWidth: number, fullWidthMode?: boolean, isNested?: boolean) => RichMediaLayout;
|
|
11
11
|
export declare const getMaxToolbarWidth: () => number;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
export declare const selectCaptionFromMediaSinglePos: (mediaSingleNodePos: number, mediaSingleNode: PMNode) => Command;
|
|
5
|
+
export declare const insertAndSelectCaptionFromMediaSinglePos: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (mediaSingleNodePos: number | undefined, mediaSingleNode: PMNode) => Command;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { MediaNodeWithPosHandler, MediaPluginState } from '../pm-plugins/types';
|
|
4
|
+
/**
|
|
5
|
+
* Note that Media Inline is inserted like a media single node into the media plugin state.
|
|
6
|
+
* Though it is not of type mediaSingle, it shares the same `findMediaSingleNode` method
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export declare const findMediaSingleNode: (mediaPluginState: MediaPluginState, id: string) => MediaNodeWithPosHandler | null;
|
|
10
|
+
export declare const findAllMediaSingleNodes: (mediaPluginState: MediaPluginState, id: string) => MediaNodeWithPosHandler[];
|
|
11
|
+
export declare const isMediaNode: (pos: number, state: EditorState) => boolean | null;
|
|
12
|
+
export declare const updateAllMediaSingleNodesAttrs: (id: string, attrs: object) => Command;
|
|
13
|
+
export declare const updateCurrentMediaNodeAttrs: (attrs: object, mediaNode: MediaNodeWithPosHandler) => Command;
|
|
14
|
+
export declare const updateMediaSingleNodeAttrs: (id: string, attrs: object) => Command;
|
|
15
|
+
export declare const replaceExternalMedia: (pos: number, attrs: object) => Command;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { updateMediaSingleNodeAttrs, updateAllMediaSingleNodesAttrs, replaceExternalMedia, } from './helpers';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { Command, CommandDispatch } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
export declare const showLinkingToolbar: Command;
|
|
6
|
+
export declare const showLinkingToolbarWithMediaTypeCheck: Command;
|
|
7
|
+
export declare const hideLinkingToolbar: (state: EditorState, dispatch?: CommandDispatch, view?: EditorView, focusFloatingToolbar?: boolean) => void;
|
|
8
|
+
export declare const unlink: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
9
|
+
export declare const setUrlToMedia: (url: string, inputMethod: INPUT_METHOD.TYPEAHEAD | INPUT_METHOD.MANUAL, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import type { ErrorReporter } from '@atlaskit/editor-common/utils';
|
|
3
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import type { CustomMediaPicker, getPosHandler, MediaState } from './types';
|
|
6
|
+
export type MediaPluginOptions = {
|
|
7
|
+
providerFactory: ProviderFactory;
|
|
8
|
+
nodeViews: {
|
|
9
|
+
[name: string]: (node: PMNode, view: EditorView, getPos: getPosHandler) => NodeView;
|
|
10
|
+
};
|
|
11
|
+
errorReporter?: ErrorReporter;
|
|
12
|
+
uploadErrorHandler?: (state: MediaState) => void;
|
|
13
|
+
waitForMediaUpload?: boolean;
|
|
14
|
+
customDropzoneContainer?: HTMLElement;
|
|
15
|
+
customMediaPicker?: CustomMediaPicker;
|
|
16
|
+
allowResizing: boolean;
|
|
17
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
4
|
+
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
5
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
6
|
+
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
7
|
+
import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
8
|
+
import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
9
|
+
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
10
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
11
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
12
|
+
import type { MediaPluginState } from './pm-plugins/types';
|
|
13
|
+
import type { MediaOptions } from './types';
|
|
14
|
+
import type { InsertMediaAsMediaSingle } from './utils/media-single';
|
|
15
|
+
export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
16
|
+
pluginConfiguration: MediaOptions | undefined;
|
|
17
|
+
dependencies: [
|
|
18
|
+
FeatureFlagsPlugin,
|
|
19
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
20
|
+
GuidelinePlugin,
|
|
21
|
+
GridPlugin,
|
|
22
|
+
WidthPlugin,
|
|
23
|
+
DecorationsPlugin,
|
|
24
|
+
FloatingToolbarPlugin,
|
|
25
|
+
EditorDisabledPlugin,
|
|
26
|
+
FocusPlugin,
|
|
27
|
+
SelectionPlugin
|
|
28
|
+
];
|
|
29
|
+
sharedState: MediaPluginState | null;
|
|
30
|
+
actions: {
|
|
31
|
+
insertMediaAsMediaSingle: InsertMediaAsMediaSingle;
|
|
32
|
+
};
|
|
33
|
+
}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare class MediaNodeUpdater {
|
|
2
|
+
static instances: MediaNodeUpdater[];
|
|
3
|
+
static mockOverrides: {};
|
|
4
|
+
static mockReset(): void;
|
|
5
|
+
constructor();
|
|
6
|
+
static setMock(thisKey: string, value: any): void;
|
|
7
|
+
updateContextId(): Promise<void>;
|
|
8
|
+
updateNodeContextId(): Promise<void>;
|
|
9
|
+
getAttrs(): void;
|
|
10
|
+
getObjectId(): Promise<void>;
|
|
11
|
+
getNodeContextId(): void;
|
|
12
|
+
updateDimensions(): void;
|
|
13
|
+
getRemoteDimensions(): Promise<void>;
|
|
14
|
+
isNodeFromDifferentCollection(): Promise<void>;
|
|
15
|
+
hasDifferentContextId(): Promise<void>;
|
|
16
|
+
copyNode(): Promise<void>;
|
|
17
|
+
copyNodeFromPos(): Promise<void>;
|
|
18
|
+
updateMediaSingleFileAttrs(): Promise<void>;
|
|
19
|
+
uploadExternalMedia(): Promise<void>;
|
|
20
|
+
isMediaBlobUrl(): void;
|
|
21
|
+
copyNodeFromBlobUrl(): void;
|
|
22
|
+
updateNodeAttrs(): void;
|
|
23
|
+
handleExternalMedia(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
|
+
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
5
|
+
import type { ContextIdentifierProvider, MediaProvider, ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
7
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
+
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
10
|
+
import type { MediaNextEditorPluginType } from '../next-plugin-type';
|
|
11
|
+
import type { getPosHandler, MediaOptions } from '../types';
|
|
12
|
+
export type MediaGroupProps = {
|
|
13
|
+
forwardRef?: (ref: HTMLElement) => void;
|
|
14
|
+
node: PMNode;
|
|
15
|
+
view: EditorView;
|
|
16
|
+
getPos: () => number | undefined;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
allowLazyLoading?: boolean;
|
|
19
|
+
mediaProvider: Promise<MediaProvider>;
|
|
20
|
+
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
21
|
+
isCopyPasteEnabled?: boolean;
|
|
22
|
+
anchorPos: number;
|
|
23
|
+
headPos: number;
|
|
24
|
+
mediaOptions: MediaOptions;
|
|
25
|
+
} & WrappedComponentProps;
|
|
26
|
+
export interface MediaGroupState {
|
|
27
|
+
viewMediaClientConfig?: MediaClientConfig;
|
|
28
|
+
}
|
|
29
|
+
declare const IntlMediaGroup: React.FC<import("react-intl-next").WithIntlProps<MediaGroupProps>> & {
|
|
30
|
+
WrappedComponent: React.ComponentType<MediaGroupProps>;
|
|
31
|
+
};
|
|
32
|
+
export default IntlMediaGroup;
|
|
33
|
+
export declare const ReactMediaGroupNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, mediaOptions: MediaOptions | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => (node: PMNode, view: EditorView, getPos: getPosHandler) => NodeView;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
|
+
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
5
|
+
import type { ContextIdentifierProvider, MediaProvider, ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
7
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
9
|
+
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
10
|
+
import type { FileIdentifier } from '@atlaskit/media-client';
|
|
11
|
+
import type { MediaNextEditorPluginType } from '../next-plugin-type';
|
|
12
|
+
import type { MediaPluginState } from '../pm-plugins/types';
|
|
13
|
+
import type { getPosHandler, getPosHandler as ProsemirrorGetPosHandler } from '../types';
|
|
14
|
+
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
15
|
+
export interface MediaInlineProps {
|
|
16
|
+
mediaProvider: Promise<MediaProvider>;
|
|
17
|
+
identifier: FileIdentifier;
|
|
18
|
+
node: PMNode;
|
|
19
|
+
isSelected: boolean;
|
|
20
|
+
view: EditorView;
|
|
21
|
+
getPos: ProsemirrorGetPosHandler;
|
|
22
|
+
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
23
|
+
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
24
|
+
mediaPluginState: MediaPluginState;
|
|
25
|
+
}
|
|
26
|
+
export declare const createMediaNodeUpdater: (props: MediaInlineProps) => MediaNodeUpdater;
|
|
27
|
+
/**
|
|
28
|
+
* Handles updating the media inline node attributes
|
|
29
|
+
* but also handling copy-paste for cross-editor of the same instance
|
|
30
|
+
* using the contextid
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
export declare const updateMediaNodeAttributes: (props: MediaInlineProps, mediaNodeUpdater: MediaNodeUpdater) => Promise<void>;
|
|
34
|
+
export declare const handleNewNode: (props: MediaInlineProps) => void;
|
|
35
|
+
export declare const MediaInline: React.FC<MediaInlineProps>;
|
|
36
|
+
export interface MediaInlineNodeViewProps {
|
|
37
|
+
providerFactory: ProviderFactory;
|
|
38
|
+
api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
39
|
+
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
40
|
+
}
|
|
41
|
+
export declare class MediaInlineNodeView extends SelectionBasedNodeView<MediaInlineNodeViewProps> {
|
|
42
|
+
createDomRef(): HTMLSpanElement;
|
|
43
|
+
getContentDOM(): {
|
|
44
|
+
dom: HTMLSpanElement;
|
|
45
|
+
};
|
|
46
|
+
ignoreMutation(): boolean;
|
|
47
|
+
viewShouldUpdate(nextNode: PMNode): boolean;
|
|
48
|
+
render(props: MediaInlineNodeViewProps): JSX.Element;
|
|
49
|
+
}
|
|
50
|
+
export declare const ReactMediaInlineNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, dispatchAnalyticsEvent?: DispatchAnalyticsEvent) => (node: PMNode, view: EditorView, getPos: getPosHandler) => NodeView;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { MediaADFAttrs } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { MediaTraceContext } from '@atlaskit/media-common';
|
|
7
|
+
import type { MediaOptions, getPosHandler as ProsemirrorGetPosHandler } from '../types';
|
|
8
|
+
export type RemoteDimensions = {
|
|
9
|
+
id: string;
|
|
10
|
+
height: number;
|
|
11
|
+
width: number;
|
|
12
|
+
};
|
|
13
|
+
export interface MediaNodeUpdaterProps {
|
|
14
|
+
view: EditorView;
|
|
15
|
+
node: PMNode;
|
|
16
|
+
mediaProvider?: Promise<MediaProvider>;
|
|
17
|
+
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
18
|
+
isMediaSingle: boolean;
|
|
19
|
+
mediaOptions?: MediaOptions;
|
|
20
|
+
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
21
|
+
}
|
|
22
|
+
export declare class MediaNodeUpdater {
|
|
23
|
+
props: MediaNodeUpdaterProps;
|
|
24
|
+
constructor(props: MediaNodeUpdaterProps);
|
|
25
|
+
isMediaBlobUrl(): boolean;
|
|
26
|
+
updateContextId: () => Promise<void>;
|
|
27
|
+
updateNodeContextId: (getPos: ProsemirrorGetPosHandler) => Promise<void>;
|
|
28
|
+
private hasFileAttributesDefined;
|
|
29
|
+
private getNewFileAttrsForNode;
|
|
30
|
+
updateMediaSingleFileAttrs: () => Promise<void>;
|
|
31
|
+
updateNodeAttrs: (getPos: ProsemirrorGetPosHandler) => Promise<void>;
|
|
32
|
+
getAttrs: () => MediaADFAttrs | undefined;
|
|
33
|
+
getObjectId: () => Promise<string | null>;
|
|
34
|
+
uploadExternalMedia: (getPos: ProsemirrorGetPosHandler) => Promise<void>;
|
|
35
|
+
getNodeContextId: () => string | null;
|
|
36
|
+
updateDimensions: (dimensions: RemoteDimensions) => void;
|
|
37
|
+
getRemoteDimensions(): Promise<false | RemoteDimensions>;
|
|
38
|
+
hasDifferentContextId: () => Promise<boolean>;
|
|
39
|
+
isNodeFromDifferentCollection: () => Promise<boolean>;
|
|
40
|
+
handleExternalMedia(getPos: ProsemirrorGetPosHandler): Promise<void>;
|
|
41
|
+
copyNodeFromBlobUrl: (getPos: ProsemirrorGetPosHandler) => Promise<void>;
|
|
42
|
+
copyNodeFromPos: (getPos: ProsemirrorGetPosHandler, traceContext?: MediaTraceContext) => Promise<void>;
|
|
43
|
+
copyNode: (traceContext?: MediaTraceContext) => Promise<void>;
|
|
44
|
+
private copyFile;
|
|
45
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { MediaADFAttrs } from '@atlaskit/adf-schema';
|
|
3
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
|
+
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
5
|
+
import type { ContextIdentifierProvider, MediaProvider, ProviderFactory, Providers } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
7
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
|
+
import type { WidthPluginState } from '@atlaskit/editor-plugin-width';
|
|
9
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
10
|
+
import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
11
|
+
import type { MediaNextEditorPluginType } from '../../next-plugin-type';
|
|
12
|
+
import type { getPosHandler, MediaOptions } from '../../types';
|
|
13
|
+
import type { MediaNodeViewProps } from '../types';
|
|
14
|
+
declare class MediaNodeView extends SelectionBasedNodeView<MediaNodeViewProps> {
|
|
15
|
+
private isSelected;
|
|
16
|
+
createDomRef(): HTMLElement;
|
|
17
|
+
viewShouldUpdate(nextNode: PMNode, decorations: Decoration[]): boolean;
|
|
18
|
+
stopEvent(event: Event): boolean;
|
|
19
|
+
getAttrs(): MediaADFAttrs;
|
|
20
|
+
isMediaBlobUrl(): boolean;
|
|
21
|
+
renderMediaNodeWithState: (mediaProvider?: Promise<MediaProvider>, contextIdentifierProvider?: Promise<ContextIdentifierProvider>) => ({ width: editorWidth }: {
|
|
22
|
+
width?: import("@atlaskit/editor-common/types").EditorContainerWidth | undefined;
|
|
23
|
+
}) => JSX.Element;
|
|
24
|
+
renderMediaNodeWithProviders: ({ mediaProvider, contextIdentifierProvider, }: Providers) => JSX.Element;
|
|
25
|
+
render(): JSX.Element;
|
|
26
|
+
}
|
|
27
|
+
export declare const ReactMediaNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, mediaOptions: MediaOptions | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => (node: PMNode, view: EditorView, getPos: getPosHandler) => MediaNodeView;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import type { ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { ImageLoaderProps } from '@atlaskit/editor-common/utils';
|
|
4
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { CardDimensions, CardOnClickCallback, NumericalCardDimensions } from '@atlaskit/media-card';
|
|
7
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
8
|
+
import type { MediaOptions, getPosHandler as ProsemirrorGetPosHandler, ReactNodeProps } from '../../types';
|
|
9
|
+
export declare const MEDIA_HEIGHT = 125;
|
|
10
|
+
export declare const FILE_WIDTH = 156;
|
|
11
|
+
export interface MediaNodeProps extends ReactNodeProps, ImageLoaderProps {
|
|
12
|
+
view: EditorView;
|
|
13
|
+
node: PMNode;
|
|
14
|
+
getPos: ProsemirrorGetPosHandler;
|
|
15
|
+
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
16
|
+
originalDimensions: NumericalCardDimensions;
|
|
17
|
+
maxDimensions: CardDimensions;
|
|
18
|
+
isMediaSingle?: boolean;
|
|
19
|
+
onClick?: CardOnClickCallback;
|
|
20
|
+
mediaProvider?: Promise<MediaProvider>;
|
|
21
|
+
isLoading?: boolean;
|
|
22
|
+
mediaOptions?: MediaOptions;
|
|
23
|
+
}
|
|
24
|
+
interface MediaNodeState {
|
|
25
|
+
viewMediaClientConfig?: MediaClientConfig;
|
|
26
|
+
contextIdentifierProvider?: ContextIdentifierProvider;
|
|
27
|
+
}
|
|
28
|
+
export declare class MediaNode extends Component<MediaNodeProps, MediaNodeState> {
|
|
29
|
+
private mediaPluginState;
|
|
30
|
+
state: MediaNodeState;
|
|
31
|
+
constructor(props: MediaNodeProps);
|
|
32
|
+
shouldComponentUpdate(nextProps: MediaNodeProps, nextState: MediaNodeState): boolean;
|
|
33
|
+
componentDidMount(): Promise<void>;
|
|
34
|
+
componentWillUnmount(): void;
|
|
35
|
+
componentDidUpdate(prevProps: Readonly<MediaNodeProps>): void;
|
|
36
|
+
private setViewMediaClientConfig;
|
|
37
|
+
private selectMediaSingleFromCard;
|
|
38
|
+
private selectMediaSingle;
|
|
39
|
+
render(): JSX.Element;
|
|
40
|
+
private onFullscreenChange;
|
|
41
|
+
private handleNewNode;
|
|
42
|
+
}
|
|
43
|
+
declare const _default: React.ComponentClass<MediaNodeProps & ImageLoaderProps, any>;
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import type { MouseEvent } from 'react';
|
|
3
|
+
import React, { Component } from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
6
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
7
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
8
|
+
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
9
|
+
import type { ContextIdentifierProvider, ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
10
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
11
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
12
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
13
|
+
import type { Decoration, DecorationSource, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
14
|
+
import type { CardEvent } from '@atlaskit/media-card';
|
|
15
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
16
|
+
import type { MediaNextEditorPluginType } from '../next-plugin-type';
|
|
17
|
+
import type { ForwardRef, getPosHandler } from '../types';
|
|
18
|
+
import type { MediaOptions } from '../types';
|
|
19
|
+
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
20
|
+
import type { MediaSingleNodeProps, MediaSingleNodeViewProps } from './types';
|
|
21
|
+
export interface MediaSingleNodeState {
|
|
22
|
+
width?: number;
|
|
23
|
+
height?: number;
|
|
24
|
+
viewMediaClientConfig?: MediaClientConfig;
|
|
25
|
+
contextIdentifierProvider?: ContextIdentifierProvider;
|
|
26
|
+
isCopying: boolean;
|
|
27
|
+
}
|
|
28
|
+
export default class MediaSingleNode extends Component<MediaSingleNodeProps, MediaSingleNodeState> {
|
|
29
|
+
static defaultProps: Partial<MediaSingleNodeProps>;
|
|
30
|
+
static displayName: string;
|
|
31
|
+
state: MediaSingleNodeState;
|
|
32
|
+
mediaSingleWrapperRef: React.RefObject<HTMLDivElement>;
|
|
33
|
+
captionPlaceHolderRef: React.RefObject<HTMLSpanElement>;
|
|
34
|
+
createMediaNodeUpdater: (props: MediaSingleNodeProps) => MediaNodeUpdater;
|
|
35
|
+
UNSAFE_componentWillReceiveProps(nextProps: MediaSingleNodeProps): void;
|
|
36
|
+
setViewMediaClientConfig: (props: MediaSingleNodeProps) => Promise<void>;
|
|
37
|
+
updateMediaNodeAttributes: (props: MediaSingleNodeProps) => Promise<void>;
|
|
38
|
+
componentDidMount(): Promise<void>;
|
|
39
|
+
selectMediaSingle: ({ event }: CardEvent) => void;
|
|
40
|
+
updateSize: (width: number | null, layout: MediaSingleLayout) => void;
|
|
41
|
+
onMediaSingleClicked: (event: MouseEvent) => void;
|
|
42
|
+
render(): jsx.JSX.Element;
|
|
43
|
+
private clickPlaceholder;
|
|
44
|
+
}
|
|
45
|
+
declare class MediaSingleNodeView extends ReactNodeView<MediaSingleNodeViewProps> {
|
|
46
|
+
lastOffsetLeft: number;
|
|
47
|
+
forceViewUpdate: boolean;
|
|
48
|
+
selectionType: number | null;
|
|
49
|
+
createDomRef(): HTMLElement;
|
|
50
|
+
getContentDOM(): {
|
|
51
|
+
dom: HTMLDivElement;
|
|
52
|
+
};
|
|
53
|
+
viewShouldUpdate(nextNode: PMNode): boolean;
|
|
54
|
+
checkAndUpdateSelectionType: () => import("@atlaskit/editor-common/utils").SelectedState | null;
|
|
55
|
+
isNodeSelected: () => boolean;
|
|
56
|
+
getNodeMediaId(node: PMNode): string | undefined;
|
|
57
|
+
update(node: PMNode, decorations: readonly Decoration[], _innerDecorations?: DecorationSource, isValidUpdate?: (currentNode: PMNode, newNode: PMNode) => boolean): boolean;
|
|
58
|
+
render(props: MediaSingleNodeViewProps, forwardRef?: ForwardRef): jsx.JSX.Element;
|
|
59
|
+
ignoreMutation(): boolean;
|
|
60
|
+
}
|
|
61
|
+
export declare const ReactMediaSingleNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, dispatchAnalyticsEvent?: DispatchAnalyticsEvent, mediaOptions?: MediaOptions) => (node: PMNode, view: EditorView, getPos: getPosHandler) => MediaSingleNodeView;
|
|
62
|
+
export {};
|