@atlaskit/editor-plugin-media 1.43.12 → 1.43.14
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 +14 -0
- package/dist/cjs/nodeviews/mediaNodeUpdater.js +186 -147
- package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +4 -0
- package/dist/cjs/pm-plugins/utils/media-single.js +43 -25
- package/dist/cjs/ui/MediaLinkingToolbar.js +1 -0
- package/dist/cjs/ui/toolbar/mediaInline.js +3 -3
- package/dist/es2019/nodeviews/mediaNodeUpdater.js +60 -27
- package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +4 -0
- package/dist/es2019/pm-plugins/utils/media-single.js +40 -18
- package/dist/es2019/ui/MediaLinkingToolbar.js +1 -0
- package/dist/es2019/ui/toolbar/mediaInline.js +3 -3
- package/dist/esm/nodeviews/mediaNodeUpdater.js +186 -147
- package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +4 -0
- package/dist/esm/pm-plugins/utils/media-single.js +43 -25
- package/dist/esm/ui/MediaLinkingToolbar.js +1 -0
- package/dist/esm/ui/toolbar/mediaInline.js +3 -3
- package/dist/types/nodeviews/mediaNodeUpdater.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/mediaNodeUpdater.d.ts +1 -0
- package/package.json +14 -8
|
@@ -32,14 +32,13 @@ var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, file
|
|
|
32
32
|
function shouldAddParagraph(state) {
|
|
33
33
|
return atTheBeginningOfBlock(state) && !checkNodeDown(state.selection, state.doc, isEmptyParagraph);
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var insertMediaVia = arguments.length > 4 ? arguments[4] : undefined;
|
|
35
|
+
function insertNodesWithOptionalParagraph(_ref) {
|
|
36
|
+
var nodes = _ref.nodes,
|
|
37
|
+
_ref$analyticsAttribu = _ref.analyticsAttributes,
|
|
38
|
+
analyticsAttributes = _ref$analyticsAttribu === void 0 ? {} : _ref$analyticsAttribu,
|
|
39
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
40
|
+
isNestingInQuoteSupported = _ref.isNestingInQuoteSupported,
|
|
41
|
+
insertMediaVia = _ref.insertMediaVia;
|
|
43
42
|
return function (state, dispatch) {
|
|
44
43
|
var tr = state.tr,
|
|
45
44
|
schema = state.schema;
|
|
@@ -49,7 +48,7 @@ function insertNodesWithOptionalParagraph(nodes) {
|
|
|
49
48
|
newType = analyticsAttributes.newType,
|
|
50
49
|
previousType = analyticsAttributes.previousType;
|
|
51
50
|
var openEnd = 0;
|
|
52
|
-
if (shouldAddParagraph(state)) {
|
|
51
|
+
if (shouldAddParagraph(state) && !fg('platform_editor_axe_leading_paragraph_from_media')) {
|
|
53
52
|
nodes.push(paragraph.create());
|
|
54
53
|
openEnd = 1;
|
|
55
54
|
}
|
|
@@ -61,12 +60,14 @@ function insertNodesWithOptionalParagraph(nodes) {
|
|
|
61
60
|
var grandparentEndPos = state.selection.$from.start(-1) + grandParentNode.nodeSize - 1;
|
|
62
61
|
pmSafeInsert(nodes[0], grandparentEndPos)(tr).scrollIntoView();
|
|
63
62
|
} else if (state.selection.empty) {
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
var insertFrom = atTheBeginningOfBlock(state) && fg('platform_editor_axe_leading_paragraph_from_media') ? state.selection.$from.before() : state.selection.from;
|
|
64
|
+
tr.insert(insertFrom, nodes);
|
|
66
65
|
var endPos = state.selection.from + nodes.reduce(function (totalSize, currNode) {
|
|
67
66
|
return totalSize + currNode.nodeSize;
|
|
68
67
|
}, 0);
|
|
69
|
-
|
|
68
|
+
if (!fg('platform_editor_axe_leading_paragraph_from_media')) {
|
|
69
|
+
tr.setSelection(new TextSelection(tr.doc.resolve(endPos), tr.doc.resolve(endPos)));
|
|
70
|
+
}
|
|
70
71
|
} else {
|
|
71
72
|
tr.replaceSelection(new Slice(Fragment.from(nodes), 0, openEnd));
|
|
72
73
|
}
|
|
@@ -116,7 +117,13 @@ export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, no
|
|
|
116
117
|
inputMethod: inputMethod,
|
|
117
118
|
fileExtension: node.attrs.__fileMimeType
|
|
118
119
|
};
|
|
119
|
-
return insertNodesWithOptionalParagraph(
|
|
120
|
+
return insertNodesWithOptionalParagraph({
|
|
121
|
+
nodes: nodes,
|
|
122
|
+
analyticsAttributes: analyticsAttributes,
|
|
123
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
124
|
+
isNestingInQuoteSupported: isNestingInQuoteSupported,
|
|
125
|
+
insertMediaVia: insertMediaVia
|
|
126
|
+
})(state, dispatch);
|
|
120
127
|
};
|
|
121
128
|
var getFileExtension = function getFileExtension(fileName) {
|
|
122
129
|
if (fileName) {
|
|
@@ -154,10 +161,16 @@ export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaSta
|
|
|
154
161
|
grandParentNodeType: grandParentNodeType,
|
|
155
162
|
content: node
|
|
156
163
|
})) {
|
|
157
|
-
insertNodesWithOptionalParagraph(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
insertNodesWithOptionalParagraph({
|
|
165
|
+
nodes: [node],
|
|
166
|
+
analyticsAttributes: {
|
|
167
|
+
fileExtension: fileExtension,
|
|
168
|
+
inputMethod: inputMethod
|
|
169
|
+
},
|
|
170
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
171
|
+
isNestingInQuoteSupported: isNestingInQuoteSupported,
|
|
172
|
+
insertMediaVia: insertMediaVia
|
|
173
|
+
})(state, dispatch);
|
|
161
174
|
} else {
|
|
162
175
|
var tr = null;
|
|
163
176
|
tr = safeInsert(node, state.selection.from)(state.tr);
|
|
@@ -201,11 +214,16 @@ export var changeFromMediaInlineToMediaSingleNode = function changeFromMediaInli
|
|
|
201
214
|
grandParentNodeType: grandParentNodeType,
|
|
202
215
|
content: node
|
|
203
216
|
})) {
|
|
204
|
-
return insertNodesWithOptionalParagraph(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
217
|
+
return insertNodesWithOptionalParagraph({
|
|
218
|
+
nodes: [node],
|
|
219
|
+
analyticsAttributes: {
|
|
220
|
+
fileExtension: fileExtension,
|
|
221
|
+
newType: ACTION_SUBJECT_ID.MEDIA_SINGLE,
|
|
222
|
+
previousType: ACTION_SUBJECT_ID.MEDIA_INLINE
|
|
223
|
+
},
|
|
224
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
225
|
+
isNestingInQuoteSupported: isNestingInQuoteSupported
|
|
226
|
+
})(state, dispatch);
|
|
209
227
|
} else {
|
|
210
228
|
var nodePos = state.tr.doc.resolve(state.selection.from).end();
|
|
211
229
|
var tr = null;
|
|
@@ -231,12 +249,12 @@ var createMediaSingleNode = function createMediaSingleNode(schema, collection, m
|
|
|
231
249
|
_mediaState$scaleFact = mediaState.scaleFactor,
|
|
232
250
|
scaleFactor = _mediaState$scaleFact === void 0 ? 1 : _mediaState$scaleFact,
|
|
233
251
|
fileName = mediaState.fileName;
|
|
234
|
-
var
|
|
252
|
+
var _ref2 = dimensions || {
|
|
235
253
|
height: undefined,
|
|
236
254
|
width: undefined
|
|
237
255
|
},
|
|
238
|
-
width =
|
|
239
|
-
height =
|
|
256
|
+
width = _ref2.width,
|
|
257
|
+
height = _ref2.height;
|
|
240
258
|
var _schema$nodes = schema.nodes,
|
|
241
259
|
media = _schema$nodes.media,
|
|
242
260
|
mediaSingle = _schema$nodes.mediaSingle;
|
|
@@ -26,6 +26,7 @@ import ChevronLeftLargeIcon from '@atlaskit/icon/glyph/chevron-left-large';
|
|
|
26
26
|
import EditorUnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
27
27
|
import { R400 } from '@atlaskit/theme/colors';
|
|
28
28
|
var validationWrapper = css({
|
|
29
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
29
30
|
lineHeight: 0,
|
|
30
31
|
padding: "var(--ds-space-150, 12px)".concat(" ", "var(--ds-space-300, 24px)", " ", "var(--ds-space-150, 12px)", " 0"),
|
|
31
32
|
margin: "0 ".concat("var(--ds-space-050, 4px)", " 0 ", "var(--ds-space-400, 32px)"),
|
|
@@ -4,9 +4,9 @@ import { IconCard, IconEmbed, IconInline } from '@atlaskit/editor-common/card';
|
|
|
4
4
|
import commonMessages, { cardMessages, mediaAndEmbedToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
7
|
-
import ExpandIcon from '@atlaskit/icon/core/grow-diagonal';
|
|
8
7
|
import ImageFullscreenIcon from '@atlaskit/icon/core/image-fullscreen';
|
|
9
8
|
import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
|
|
9
|
+
import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
10
10
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
11
11
|
import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
12
12
|
import FilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
|
|
@@ -67,7 +67,7 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
|
|
|
67
67
|
id: 'editor.media.viewer',
|
|
68
68
|
testId: 'file-preview-toolbar-button',
|
|
69
69
|
type: 'button',
|
|
70
|
-
icon:
|
|
70
|
+
icon: MaximizeIcon,
|
|
71
71
|
iconFallback: FilePreviewIcon,
|
|
72
72
|
title: intl.formatMessage(messages.preview),
|
|
73
73
|
onClick: function onClick() {
|
|
@@ -239,7 +239,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
239
239
|
id: 'editor.media.viewer',
|
|
240
240
|
testId: 'file-preview-toolbar-button',
|
|
241
241
|
type: 'button',
|
|
242
|
-
icon:
|
|
242
|
+
icon: MaximizeIcon,
|
|
243
243
|
iconFallback: FilePreviewIcon,
|
|
244
244
|
title: intl.formatMessage(messages.preview),
|
|
245
245
|
onClick: function onClick() {
|
|
@@ -38,6 +38,7 @@ export declare class MediaNodeUpdater {
|
|
|
38
38
|
hasDifferentContextId: () => Promise<boolean>;
|
|
39
39
|
isNodeFromDifferentCollection: () => Promise<boolean>;
|
|
40
40
|
handleExternalMedia(getPos: ProsemirrorGetPosHandler): Promise<void>;
|
|
41
|
+
private handleCopyFileSwitcher;
|
|
41
42
|
copyNodeFromBlobUrl: (getPos: ProsemirrorGetPosHandler) => Promise<void>;
|
|
42
43
|
copyNodeFromPos: (getPos: ProsemirrorGetPosHandler, traceContext?: MediaTraceContext) => Promise<void>;
|
|
43
44
|
copyNode: (traceContext?: MediaTraceContext) => Promise<void>;
|
|
@@ -38,6 +38,7 @@ export declare class MediaNodeUpdater {
|
|
|
38
38
|
hasDifferentContextId: () => Promise<boolean>;
|
|
39
39
|
isNodeFromDifferentCollection: () => Promise<boolean>;
|
|
40
40
|
handleExternalMedia(getPos: ProsemirrorGetPosHandler): Promise<void>;
|
|
41
|
+
private handleCopyFileSwitcher;
|
|
41
42
|
copyNodeFromBlobUrl: (getPos: ProsemirrorGetPosHandler) => Promise<void>;
|
|
42
43
|
copyNodeFromPos: (getPos: ProsemirrorGetPosHandler, traceContext?: MediaTraceContext) => Promise<void>;
|
|
43
44
|
copyNode: (traceContext?: MediaTraceContext) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "1.43.
|
|
3
|
+
"version": "1.43.14",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"@atlaskit/analytics-namespaced-context": "^6.12.0",
|
|
37
37
|
"@atlaskit/analytics-next": "^10.2.0",
|
|
38
38
|
"@atlaskit/button": "^20.3.0",
|
|
39
|
-
"@atlaskit/editor-common": "^98.
|
|
39
|
+
"@atlaskit/editor-common": "^98.2.0",
|
|
40
40
|
"@atlaskit/editor-palette": "1.6.3",
|
|
41
41
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
42
|
-
"@atlaskit/editor-plugin-annotation": "1.26.
|
|
42
|
+
"@atlaskit/editor-plugin-annotation": "1.26.10",
|
|
43
43
|
"@atlaskit/editor-plugin-connectivity": "^1.1.0",
|
|
44
44
|
"@atlaskit/editor-plugin-decorations": "^1.3.0",
|
|
45
45
|
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|
|
@@ -54,20 +54,20 @@
|
|
|
54
54
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
55
55
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
56
56
|
"@atlaskit/form": "^11.0.0",
|
|
57
|
-
"@atlaskit/icon": "^23.
|
|
58
|
-
"@atlaskit/media-card": "^78.
|
|
57
|
+
"@atlaskit/icon": "^23.2.0",
|
|
58
|
+
"@atlaskit/media-card": "^78.18.0",
|
|
59
59
|
"@atlaskit/media-client": "^29.0.0",
|
|
60
60
|
"@atlaskit/media-client-react": "^2.5.0",
|
|
61
61
|
"@atlaskit/media-common": "^11.7.0",
|
|
62
62
|
"@atlaskit/media-filmstrip": "^48.1.0",
|
|
63
63
|
"@atlaskit/media-picker": "^67.0.0",
|
|
64
|
-
"@atlaskit/media-ui": "^27.
|
|
65
|
-
"@atlaskit/media-viewer": "^49.
|
|
64
|
+
"@atlaskit/media-ui": "^27.3.0",
|
|
65
|
+
"@atlaskit/media-viewer": "^49.6.0",
|
|
66
66
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
67
67
|
"@atlaskit/primitives": "^13.3.0",
|
|
68
68
|
"@atlaskit/textfield": "^6.7.0",
|
|
69
69
|
"@atlaskit/theme": "^14.0.0",
|
|
70
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
70
|
+
"@atlaskit/tmp-editor-statsig": "^2.33.0",
|
|
71
71
|
"@atlaskit/tokens": "^2.5.0",
|
|
72
72
|
"@atlaskit/tooltip": "^19.0.0",
|
|
73
73
|
"@babel/runtime": "^7.0.0",
|
|
@@ -127,6 +127,9 @@
|
|
|
127
127
|
"platform_editor_react18_phase2__media_single": {
|
|
128
128
|
"type": "boolean"
|
|
129
129
|
},
|
|
130
|
+
"platform_media_copy_and_paste_v2": {
|
|
131
|
+
"type": "boolean"
|
|
132
|
+
},
|
|
130
133
|
"platform_editor_media_extended_resize_experience": {
|
|
131
134
|
"type": "boolean"
|
|
132
135
|
},
|
|
@@ -162,6 +165,9 @@
|
|
|
162
165
|
},
|
|
163
166
|
"platform_editor_fix_edit_caption_on_edge": {
|
|
164
167
|
"type": "boolean"
|
|
168
|
+
},
|
|
169
|
+
"platform_editor_axe_leading_paragraph_from_media": {
|
|
170
|
+
"type": "boolean"
|
|
165
171
|
}
|
|
166
172
|
},
|
|
167
173
|
"stricter": {
|