@atlaskit/editor-plugin-media 1.30.0 → 1.31.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
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 1.31.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#138140](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/138140)
|
|
8
|
+
[`d912a8053c5f9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d912a8053c5f9) -
|
|
9
|
+
[ED-24869] ensure images inserted from outside media plugin are given pixel widthType
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 1.30.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -79,6 +79,7 @@ var isMediaSingle = exports.isMediaSingle = function isMediaSingle(schema, fileM
|
|
|
79
79
|
return !!schema.nodes.mediaSingle && (0, _isType.isImage)(fileMimeType);
|
|
80
80
|
};
|
|
81
81
|
var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod, editorAnalyticsAPI) {
|
|
82
|
+
var _node$attrs$width;
|
|
82
83
|
var state = view.state,
|
|
83
84
|
dispatch = view.dispatch;
|
|
84
85
|
var _state$schema$nodes = state.schema.nodes,
|
|
@@ -92,7 +93,14 @@ var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function inser
|
|
|
92
93
|
if (node.type !== media || !(0, _isType.isImage)(node.attrs.__fileMimeType) && node.attrs.type !== 'external') {
|
|
93
94
|
return false;
|
|
94
95
|
}
|
|
95
|
-
var
|
|
96
|
+
var resizeExperience = (0, _platformFeatureFlags.fg)('platform.editor.media.extended-resize-experience');
|
|
97
|
+
var insertMediaPopup = (0, _platformFeatureFlags.fg)('platform_editor_insert_media_plugin_phase_one');
|
|
98
|
+
var mediaSingleAttrs = resizeExperience && insertMediaPopup ? {
|
|
99
|
+
widthType: 'pixel',
|
|
100
|
+
width: (0, _mediaSingle.getMediaSingleInitialWidth)((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : _mediaSingle.DEFAULT_IMAGE_WIDTH),
|
|
101
|
+
layout: 'center'
|
|
102
|
+
} : {};
|
|
103
|
+
var mediaSingleNode = mediaSingle.create(mediaSingleAttrs, node);
|
|
96
104
|
var nodes = [mediaSingleNode];
|
|
97
105
|
var analyticsAttributes = {
|
|
98
106
|
inputMethod: inputMethod,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
-
import { getMaxWidthForNestedNodeNext, getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
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
5
|
import { atTheBeginningOfBlock } 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';
|
|
@@ -67,6 +67,7 @@ function insertNodesWithOptionalParagraph(nodes, analyticsAttributes = {}, edito
|
|
|
67
67
|
}
|
|
68
68
|
export const isMediaSingle = (schema, fileMimeType) => !!schema.nodes.mediaSingle && isImage(fileMimeType);
|
|
69
69
|
export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalyticsAPI) => {
|
|
70
|
+
var _node$attrs$width;
|
|
70
71
|
const {
|
|
71
72
|
state,
|
|
72
73
|
dispatch
|
|
@@ -83,7 +84,14 @@ export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalytic
|
|
|
83
84
|
if (node.type !== media || !isImage(node.attrs.__fileMimeType) && node.attrs.type !== 'external') {
|
|
84
85
|
return false;
|
|
85
86
|
}
|
|
86
|
-
const
|
|
87
|
+
const resizeExperience = fg('platform.editor.media.extended-resize-experience');
|
|
88
|
+
const insertMediaPopup = fg('platform_editor_insert_media_plugin_phase_one');
|
|
89
|
+
const mediaSingleAttrs = resizeExperience && insertMediaPopup ? {
|
|
90
|
+
widthType: 'pixel',
|
|
91
|
+
width: getMediaSingleInitialWidth((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : DEFAULT_IMAGE_WIDTH),
|
|
92
|
+
layout: 'center'
|
|
93
|
+
} : {};
|
|
94
|
+
const mediaSingleNode = mediaSingle.create(mediaSingleAttrs, node);
|
|
87
95
|
const nodes = [mediaSingleNode];
|
|
88
96
|
const analyticsAttributes = {
|
|
89
97
|
inputMethod,
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
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
|
-
import { getMaxWidthForNestedNodeNext, getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
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
8
|
import { atTheBeginningOfBlock } 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';
|
|
@@ -72,6 +72,7 @@ export var isMediaSingle = function isMediaSingle(schema, fileMimeType) {
|
|
|
72
72
|
return !!schema.nodes.mediaSingle && isImage(fileMimeType);
|
|
73
73
|
};
|
|
74
74
|
export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod, editorAnalyticsAPI) {
|
|
75
|
+
var _node$attrs$width;
|
|
75
76
|
var state = view.state,
|
|
76
77
|
dispatch = view.dispatch;
|
|
77
78
|
var _state$schema$nodes = state.schema.nodes,
|
|
@@ -85,7 +86,14 @@ export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, no
|
|
|
85
86
|
if (node.type !== media || !isImage(node.attrs.__fileMimeType) && node.attrs.type !== 'external') {
|
|
86
87
|
return false;
|
|
87
88
|
}
|
|
88
|
-
var
|
|
89
|
+
var resizeExperience = fg('platform.editor.media.extended-resize-experience');
|
|
90
|
+
var insertMediaPopup = fg('platform_editor_insert_media_plugin_phase_one');
|
|
91
|
+
var mediaSingleAttrs = resizeExperience && insertMediaPopup ? {
|
|
92
|
+
widthType: 'pixel',
|
|
93
|
+
width: getMediaSingleInitialWidth((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : DEFAULT_IMAGE_WIDTH),
|
|
94
|
+
layout: 'center'
|
|
95
|
+
} : {};
|
|
96
|
+
var mediaSingleNode = mediaSingle.create(mediaSingleAttrs, node);
|
|
89
97
|
var nodes = [mediaSingleNode];
|
|
90
98
|
var analyticsAttributes = {
|
|
91
99
|
inputMethod: inputMethod,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/analytics-namespaced-context": "^6.12.0",
|
|
37
37
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
38
38
|
"@atlaskit/button": "^20.1.0",
|
|
39
|
-
"@atlaskit/editor-common": "^88.
|
|
39
|
+
"@atlaskit/editor-common": "^88.13.0",
|
|
40
40
|
"@atlaskit/editor-palette": "1.6.0",
|
|
41
41
|
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
42
42
|
"@atlaskit/editor-plugin-annotation": "1.19.4",
|