@atlaskit/editor-plugin-media 13.1.1 → 13.2.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 +7 -0
- package/dist/cjs/pm-plugins/commands.js +2 -2
- package/dist/cjs/pm-plugins/utils/media-single.js +13 -4
- package/dist/es2019/pm-plugins/commands.js +1 -1
- package/dist/es2019/pm-plugins/utils/media-single.js +16 -5
- package/dist/esm/pm-plugins/commands.js +2 -2
- package/dist/esm/pm-plugins/utils/media-single.js +14 -5
- package/dist/types/mediaPluginType.d.ts +2 -1
- package/dist/types/pm-plugins/commands.d.ts +1 -1
- package/dist/types/pm-plugins/utils/media-single.d.ts +1 -1
- package/dist/types-ts4.5/mediaPluginType.d.ts +5 -1
- package/dist/types-ts4.5/pm-plugins/commands.d.ts +4 -1
- package/dist/types-ts4.5/pm-plugins/utils/media-single.d.ts +4 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 13.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`220363acedb01`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/220363acedb01) -
|
|
8
|
+
MAUI-590 in-editor remix image update - use saved positions to insert the image
|
|
9
|
+
|
|
3
10
|
## 13.1.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -66,7 +66,7 @@ var clearAIGenerating = exports.clearAIGenerating = function clearAIGenerating(m
|
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
var insertMediaAsMediaSingleCommand = exports.insertMediaAsMediaSingleCommand = function insertMediaAsMediaSingleCommand(editorAnalyticsAPI, allowPixelResizing) {
|
|
69
|
-
return function (mediaAttrs, inputMethod, insertMediaVia) {
|
|
70
|
-
return (0, _mediaSingle.createInsertMediaAsMediaSingleCommand)(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing);
|
|
69
|
+
return function (mediaAttrs, inputMethod, insertMediaVia, positions) {
|
|
70
|
+
return (0, _mediaSingle.createInsertMediaAsMediaSingleCommand)(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, positions);
|
|
71
71
|
};
|
|
72
72
|
};
|
|
@@ -94,6 +94,7 @@ function insertNodesWithOptionalParagraph(_ref) {
|
|
|
94
94
|
}
|
|
95
95
|
function insertNodesWithOptionalParagraphCommand(_ref2) {
|
|
96
96
|
var nodes = _ref2.nodes,
|
|
97
|
+
positions = _ref2.positions,
|
|
97
98
|
_ref2$analyticsAttrib = _ref2.analyticsAttributes,
|
|
98
99
|
analyticsAttributes = _ref2$analyticsAttrib === void 0 ? {} : _ref2$analyticsAttrib,
|
|
99
100
|
editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
|
|
@@ -106,8 +107,14 @@ function insertNodesWithOptionalParagraphCommand(_ref2) {
|
|
|
106
107
|
previousType = analyticsAttributes.previousType;
|
|
107
108
|
var updatedTr = tr;
|
|
108
109
|
var openEnd = 0;
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
var selection = tr.selection;
|
|
111
|
+
var from = positions ? positions[0] : selection.from;
|
|
112
|
+
var to = positions ? positions[1] : selection.to;
|
|
113
|
+
var $from = positions ? tr.doc.resolve(from) : selection.$from;
|
|
114
|
+
var isEmpty = positions ? from === to : selection.empty;
|
|
115
|
+
if (isEmpty) {
|
|
116
|
+
var isAtTheBeginningOfBlock = positions ? (0, _selection.startPositionOfParent)($from) === $from.pos : (0, _selection.selectionIsAtTheBeginningOfBlock)(selection);
|
|
117
|
+
var insertFrom = isAtTheBeginningOfBlock ? $from.before() : from;
|
|
111
118
|
|
|
112
119
|
// the use of pmSafeInsert causes the node selection to media single node.
|
|
113
120
|
// It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
|
|
@@ -118,7 +125,8 @@ function insertNodesWithOptionalParagraphCommand(_ref2) {
|
|
|
118
125
|
// so we revert to use tr.insert instead. No extra paragraph is added.
|
|
119
126
|
updatedTr = updatedTr.insert(insertFrom, nodes);
|
|
120
127
|
} else {
|
|
121
|
-
|
|
128
|
+
var slice = new _model.Slice(_model.Fragment.from(nodes), 0, openEnd);
|
|
129
|
+
updatedTr = positions ? updatedTr.replaceRange(from, to, slice) : updatedTr.replaceSelection(slice);
|
|
122
130
|
}
|
|
123
131
|
if (inputMethod) {
|
|
124
132
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia))(updatedTr);
|
|
@@ -175,7 +183,7 @@ var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function inser
|
|
|
175
183
|
insertMediaVia: insertMediaVia
|
|
176
184
|
})(state, dispatch);
|
|
177
185
|
};
|
|
178
|
-
var createInsertMediaAsMediaSingleCommand = exports.createInsertMediaAsMediaSingleCommand = function createInsertMediaAsMediaSingleCommand(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing) {
|
|
186
|
+
var createInsertMediaAsMediaSingleCommand = exports.createInsertMediaAsMediaSingleCommand = function createInsertMediaAsMediaSingleCommand(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, positions) {
|
|
179
187
|
return function (_ref4) {
|
|
180
188
|
var _mediaAttrs$__fileMim, _mediaAttrs$width, _mediaAttrs$__fileMim2;
|
|
181
189
|
var tr = _ref4.tr;
|
|
@@ -203,6 +211,7 @@ var createInsertMediaAsMediaSingleCommand = exports.createInsertMediaAsMediaSing
|
|
|
203
211
|
};
|
|
204
212
|
return insertNodesWithOptionalParagraphCommand({
|
|
205
213
|
nodes: nodes,
|
|
214
|
+
positions: positions,
|
|
206
215
|
analyticsAttributes: analyticsAttributes,
|
|
207
216
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
208
217
|
insertMediaVia: insertMediaVia
|
|
@@ -52,4 +52,4 @@ export const setAIGenerating = (mediaId, source) => ({
|
|
|
52
52
|
export const clearAIGenerating = mediaId => ({
|
|
53
53
|
tr
|
|
54
54
|
}) => clearAIGeneratingMeta(tr, mediaId);
|
|
55
|
-
export const insertMediaAsMediaSingleCommand = (editorAnalyticsAPI, allowPixelResizing) => (mediaAttrs, inputMethod, insertMediaVia) => createInsertMediaAsMediaSingleCommand(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing);
|
|
55
|
+
export const insertMediaAsMediaSingleCommand = (editorAnalyticsAPI, allowPixelResizing) => (mediaAttrs, inputMethod, insertMediaVia, positions) => createInsertMediaAsMediaSingleCommand(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, positions);
|
|
@@ -2,7 +2,7 @@ import memoizeOne from 'memoize-one';
|
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { safeInsert, shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
|
|
4
4
|
import { DEFAULT_IMAGE_WIDTH, getMaxWidthForNestedNodeNext, getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
5
|
-
import { atTheBeginningOfBlock, selectionIsAtTheBeginningOfBlock } from '@atlaskit/editor-common/selection';
|
|
5
|
+
import { atTheBeginningOfBlock, selectionIsAtTheBeginningOfBlock, startPositionOfParent } from '@atlaskit/editor-common/selection';
|
|
6
6
|
import { checkNodeDown, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
8
8
|
import { safeInsert as pmSafeInsert, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -86,6 +86,7 @@ function insertNodesWithOptionalParagraph({
|
|
|
86
86
|
}
|
|
87
87
|
function insertNodesWithOptionalParagraphCommand({
|
|
88
88
|
nodes,
|
|
89
|
+
positions,
|
|
89
90
|
analyticsAttributes = {},
|
|
90
91
|
editorAnalyticsAPI,
|
|
91
92
|
insertMediaVia
|
|
@@ -101,8 +102,16 @@ function insertNodesWithOptionalParagraphCommand({
|
|
|
101
102
|
} = analyticsAttributes;
|
|
102
103
|
let updatedTr = tr;
|
|
103
104
|
const openEnd = 0;
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
const {
|
|
106
|
+
selection
|
|
107
|
+
} = tr;
|
|
108
|
+
const from = positions ? positions[0] : selection.from;
|
|
109
|
+
const to = positions ? positions[1] : selection.to;
|
|
110
|
+
const $from = positions ? tr.doc.resolve(from) : selection.$from;
|
|
111
|
+
const isEmpty = positions ? from === to : selection.empty;
|
|
112
|
+
if (isEmpty) {
|
|
113
|
+
const isAtTheBeginningOfBlock = positions ? startPositionOfParent($from) === $from.pos : selectionIsAtTheBeginningOfBlock(selection);
|
|
114
|
+
const insertFrom = isAtTheBeginningOfBlock ? $from.before() : from;
|
|
106
115
|
|
|
107
116
|
// the use of pmSafeInsert causes the node selection to media single node.
|
|
108
117
|
// It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
|
|
@@ -113,7 +122,8 @@ function insertNodesWithOptionalParagraphCommand({
|
|
|
113
122
|
// so we revert to use tr.insert instead. No extra paragraph is added.
|
|
114
123
|
updatedTr = updatedTr.insert(insertFrom, nodes);
|
|
115
124
|
} else {
|
|
116
|
-
|
|
125
|
+
const slice = new Slice(Fragment.from(nodes), 0, openEnd);
|
|
126
|
+
updatedTr = positions ? updatedTr.replaceRange(from, to, slice) : updatedTr.replaceSelection(slice);
|
|
117
127
|
}
|
|
118
128
|
if (inputMethod) {
|
|
119
129
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia))(updatedTr);
|
|
@@ -171,7 +181,7 @@ export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalytic
|
|
|
171
181
|
insertMediaVia
|
|
172
182
|
})(state, dispatch);
|
|
173
183
|
};
|
|
174
|
-
export const createInsertMediaAsMediaSingleCommand = (mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing) => {
|
|
184
|
+
export const createInsertMediaAsMediaSingleCommand = (mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, positions) => {
|
|
175
185
|
return ({
|
|
176
186
|
tr
|
|
177
187
|
}) => {
|
|
@@ -201,6 +211,7 @@ export const createInsertMediaAsMediaSingleCommand = (mediaAttrs, inputMethod, e
|
|
|
201
211
|
};
|
|
202
212
|
return insertNodesWithOptionalParagraphCommand({
|
|
203
213
|
nodes,
|
|
214
|
+
positions,
|
|
204
215
|
analyticsAttributes,
|
|
205
216
|
editorAnalyticsAPI,
|
|
206
217
|
insertMediaVia
|
|
@@ -60,7 +60,7 @@ export var clearAIGenerating = function clearAIGenerating(mediaId) {
|
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
62
|
export var insertMediaAsMediaSingleCommand = function insertMediaAsMediaSingleCommand(editorAnalyticsAPI, allowPixelResizing) {
|
|
63
|
-
return function (mediaAttrs, inputMethod, insertMediaVia) {
|
|
64
|
-
return createInsertMediaAsMediaSingleCommand(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing);
|
|
63
|
+
return function (mediaAttrs, inputMethod, insertMediaVia, positions) {
|
|
64
|
+
return createInsertMediaAsMediaSingleCommand(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, positions);
|
|
65
65
|
};
|
|
66
66
|
};
|
|
@@ -5,7 +5,7 @@ import memoizeOne from 'memoize-one';
|
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { safeInsert, shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
|
|
7
7
|
import { DEFAULT_IMAGE_WIDTH, getMaxWidthForNestedNodeNext, getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
8
|
-
import { atTheBeginningOfBlock, selectionIsAtTheBeginningOfBlock } from '@atlaskit/editor-common/selection';
|
|
8
|
+
import { atTheBeginningOfBlock, selectionIsAtTheBeginningOfBlock, startPositionOfParent } from '@atlaskit/editor-common/selection';
|
|
9
9
|
import { checkNodeDown, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
11
11
|
import { safeInsert as pmSafeInsert, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -87,6 +87,7 @@ function insertNodesWithOptionalParagraph(_ref) {
|
|
|
87
87
|
}
|
|
88
88
|
function insertNodesWithOptionalParagraphCommand(_ref2) {
|
|
89
89
|
var nodes = _ref2.nodes,
|
|
90
|
+
positions = _ref2.positions,
|
|
90
91
|
_ref2$analyticsAttrib = _ref2.analyticsAttributes,
|
|
91
92
|
analyticsAttributes = _ref2$analyticsAttrib === void 0 ? {} : _ref2$analyticsAttrib,
|
|
92
93
|
editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
|
|
@@ -99,8 +100,14 @@ function insertNodesWithOptionalParagraphCommand(_ref2) {
|
|
|
99
100
|
previousType = analyticsAttributes.previousType;
|
|
100
101
|
var updatedTr = tr;
|
|
101
102
|
var openEnd = 0;
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
var selection = tr.selection;
|
|
104
|
+
var from = positions ? positions[0] : selection.from;
|
|
105
|
+
var to = positions ? positions[1] : selection.to;
|
|
106
|
+
var $from = positions ? tr.doc.resolve(from) : selection.$from;
|
|
107
|
+
var isEmpty = positions ? from === to : selection.empty;
|
|
108
|
+
if (isEmpty) {
|
|
109
|
+
var isAtTheBeginningOfBlock = positions ? startPositionOfParent($from) === $from.pos : selectionIsAtTheBeginningOfBlock(selection);
|
|
110
|
+
var insertFrom = isAtTheBeginningOfBlock ? $from.before() : from;
|
|
104
111
|
|
|
105
112
|
// the use of pmSafeInsert causes the node selection to media single node.
|
|
106
113
|
// It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
|
|
@@ -111,7 +118,8 @@ function insertNodesWithOptionalParagraphCommand(_ref2) {
|
|
|
111
118
|
// so we revert to use tr.insert instead. No extra paragraph is added.
|
|
112
119
|
updatedTr = updatedTr.insert(insertFrom, nodes);
|
|
113
120
|
} else {
|
|
114
|
-
|
|
121
|
+
var slice = new Slice(Fragment.from(nodes), 0, openEnd);
|
|
122
|
+
updatedTr = positions ? updatedTr.replaceRange(from, to, slice) : updatedTr.replaceSelection(slice);
|
|
115
123
|
}
|
|
116
124
|
if (inputMethod) {
|
|
117
125
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia))(updatedTr);
|
|
@@ -168,7 +176,7 @@ export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, no
|
|
|
168
176
|
insertMediaVia: insertMediaVia
|
|
169
177
|
})(state, dispatch);
|
|
170
178
|
};
|
|
171
|
-
export var createInsertMediaAsMediaSingleCommand = function createInsertMediaAsMediaSingleCommand(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing) {
|
|
179
|
+
export var createInsertMediaAsMediaSingleCommand = function createInsertMediaAsMediaSingleCommand(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, positions) {
|
|
172
180
|
return function (_ref4) {
|
|
173
181
|
var _mediaAttrs$__fileMim, _mediaAttrs$width, _mediaAttrs$__fileMim2;
|
|
174
182
|
var tr = _ref4.tr;
|
|
@@ -196,6 +204,7 @@ export var createInsertMediaAsMediaSingleCommand = function createInsertMediaAsM
|
|
|
196
204
|
};
|
|
197
205
|
return insertNodesWithOptionalParagraphCommand({
|
|
198
206
|
nodes: nodes,
|
|
207
|
+
positions: positions,
|
|
199
208
|
analyticsAttributes: analyticsAttributes,
|
|
200
209
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
201
210
|
insertMediaVia: insertMediaVia
|
|
@@ -83,8 +83,9 @@ export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
|
83
83
|
* @param attrs - The media node attributes of the node to insert
|
|
84
84
|
* @param inputMethod - The method used to input the media
|
|
85
85
|
* @param insertMediaVia - Optional parameter indicating how the media was inserted
|
|
86
|
+
* @param positions - Optional parameter indicating the positions for the insertion
|
|
86
87
|
*/
|
|
87
|
-
insertMediaSingle: (attrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia) => EditorCommand;
|
|
88
|
+
insertMediaSingle: (attrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia, positions?: [number, number]) => EditorCommand;
|
|
88
89
|
/**
|
|
89
90
|
* Sets the AI-generating decoration on a media node identified by `mediaId`.
|
|
90
91
|
* Renders an AI border around the media node while AI is generating/replacing it.
|
|
@@ -18,4 +18,4 @@ export declare const setAIGenerating: (mediaId: string, source?: AIGeneratingSou
|
|
|
18
18
|
* `mediaId`. Removes the AI border visual from that media's NodeView.
|
|
19
19
|
*/
|
|
20
20
|
export declare const clearAIGenerating: (mediaId: string) => EditorCommand;
|
|
21
|
-
export declare const insertMediaAsMediaSingleCommand: (editorAnalyticsAPI?: EditorAnalyticsAPI, allowPixelResizing?: boolean) => (mediaAttrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia) => EditorCommand;
|
|
21
|
+
export declare const insertMediaAsMediaSingleCommand: (editorAnalyticsAPI?: EditorAnalyticsAPI, allowPixelResizing?: boolean) => (mediaAttrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia, positions?: [number, number]) => EditorCommand;
|
|
@@ -9,7 +9,7 @@ import type { MediaState } from '../../types';
|
|
|
9
9
|
export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
|
|
10
10
|
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => boolean;
|
|
11
11
|
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => boolean;
|
|
12
|
-
export declare const createInsertMediaAsMediaSingleCommand: (mediaAttrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => EditorCommand;
|
|
12
|
+
export declare const createInsertMediaAsMediaSingleCommand: (mediaAttrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean, positions?: [number, number]) => EditorCommand;
|
|
13
13
|
export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, onNodeInserted?: (id: string, selectionPosition: number) => void, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => boolean;
|
|
14
14
|
export declare const changeFromMediaInlineToMediaSingleNode: (view: EditorView, fromNode: PMNode, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, allowPixelResizing?: boolean) => boolean;
|
|
15
15
|
export declare const isVideo: MemoizedFn<(fileType?: string) => boolean>;
|
|
@@ -83,8 +83,12 @@ export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
|
83
83
|
* @param attrs - The media node attributes of the node to insert
|
|
84
84
|
* @param inputMethod - The method used to input the media
|
|
85
85
|
* @param insertMediaVia - Optional parameter indicating how the media was inserted
|
|
86
|
+
* @param positions - Optional parameter indicating the positions for the insertion
|
|
86
87
|
*/
|
|
87
|
-
insertMediaSingle: (attrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia
|
|
88
|
+
insertMediaSingle: (attrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia, positions?: [
|
|
89
|
+
number,
|
|
90
|
+
number
|
|
91
|
+
]) => EditorCommand;
|
|
88
92
|
/**
|
|
89
93
|
* Sets the AI-generating decoration on a media node identified by `mediaId`.
|
|
90
94
|
* Renders an AI border around the media node while AI is generating/replacing it.
|
|
@@ -18,4 +18,7 @@ export declare const setAIGenerating: (mediaId: string, source?: AIGeneratingSou
|
|
|
18
18
|
* `mediaId`. Removes the AI border visual from that media's NodeView.
|
|
19
19
|
*/
|
|
20
20
|
export declare const clearAIGenerating: (mediaId: string) => EditorCommand;
|
|
21
|
-
export declare const insertMediaAsMediaSingleCommand: (editorAnalyticsAPI?: EditorAnalyticsAPI, allowPixelResizing?: boolean) => (mediaAttrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia
|
|
21
|
+
export declare const insertMediaAsMediaSingleCommand: (editorAnalyticsAPI?: EditorAnalyticsAPI, allowPixelResizing?: boolean) => (mediaAttrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia, positions?: [
|
|
22
|
+
number,
|
|
23
|
+
number
|
|
24
|
+
]) => EditorCommand;
|
|
@@ -9,7 +9,10 @@ import type { MediaState } from '../../types';
|
|
|
9
9
|
export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
|
|
10
10
|
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => boolean;
|
|
11
11
|
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => boolean;
|
|
12
|
-
export declare const createInsertMediaAsMediaSingleCommand: (mediaAttrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean
|
|
12
|
+
export declare const createInsertMediaAsMediaSingleCommand: (mediaAttrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean, positions?: [
|
|
13
|
+
number,
|
|
14
|
+
number
|
|
15
|
+
]) => EditorCommand;
|
|
13
16
|
export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, onNodeInserted?: (id: string, selectionPosition: number) => void, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => boolean;
|
|
14
17
|
export declare const changeFromMediaInlineToMediaSingleNode: (view: EditorView, fromNode: PMNode, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, allowPixelResizing?: boolean) => boolean;
|
|
15
18
|
export declare const isVideo: MemoizedFn<(fileType?: string) => boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.2.0",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"uuid": "^3.1.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
|
-
"@atlaskit/editor-common": "^115.
|
|
80
|
+
"@atlaskit/editor-common": "^115.5.0",
|
|
81
81
|
"@atlaskit/media-core": "^37.1.0",
|
|
82
82
|
"react": "^18.2.0",
|
|
83
83
|
"react-dom": "^18.2.0",
|