@atlaskit/editor-plugin-media 1.1.0 → 1.2.1
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 +37 -0
- package/dist/cjs/plugin.js +1 -3
- package/dist/cjs/pm-plugins/keymap.js +2 -10
- package/dist/cjs/pm-plugins/main.js +1 -2
- package/dist/cjs/utils/media-single.js +2 -4
- package/dist/es2019/plugin.js +1 -3
- package/dist/es2019/pm-plugins/keymap.js +3 -11
- package/dist/es2019/pm-plugins/main.js +1 -2
- package/dist/es2019/utils/media-single.js +2 -4
- package/dist/esm/plugin.js +1 -3
- package/dist/esm/pm-plugins/keymap.js +2 -10
- package/dist/esm/pm-plugins/main.js +1 -2
- package/dist/esm/utils/media-single.js +2 -4
- package/dist/types/next-plugin-type.d.ts +0 -2
- package/dist/types/pm-plugins/main.d.ts +0 -1
- package/dist/types/utils/media-single.d.ts +1 -1
- package/dist/types-ts4.5/next-plugin-type.d.ts +0 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -1
- package/dist/types-ts4.5/utils/media-single.d.ts +1 -1
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#73653](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/73653) [`0cffdd968f1f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0cffdd968f1f) - Refactor media keymap announcer for translations
|
|
8
|
+
|
|
9
|
+
## 1.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#72122](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72122) [`c3186450404a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c3186450404a) - Breaking change:
|
|
14
|
+
|
|
15
|
+
## WHAT?:
|
|
16
|
+
|
|
17
|
+
Removing feature flags:
|
|
18
|
+
|
|
19
|
+
- singleLayout
|
|
20
|
+
- newInsertionBehaviour
|
|
21
|
+
- interactiveExpand
|
|
22
|
+
- findReplace
|
|
23
|
+
- findReplaceMatchCase
|
|
24
|
+
- extendFloatingToolbar
|
|
25
|
+
|
|
26
|
+
## WHY?:
|
|
27
|
+
|
|
28
|
+
Because the flags and props are unused/by default active. Removing them will reduce our maintenance burden
|
|
29
|
+
|
|
30
|
+
## HOW to update your code:
|
|
31
|
+
|
|
32
|
+
- If you were using the feature flag - the behaviour is now default and you can remove the flags
|
|
33
|
+
- If you were not using the feature flag - the behaviour is now default.
|
|
34
|
+
- If you have opted out of using the feature flag - we have been careful to ensure no-one has opted out of the behaviours. If you do have an issue please reach out to #help-editor.
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies
|
|
39
|
+
|
|
3
40
|
## 1.1.0
|
|
4
41
|
|
|
5
42
|
### Minor Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -53,11 +53,9 @@ var MediaPickerFunctionalComponent = function MediaPickerFunctionalComponent(_re
|
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
55
|
var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref2) {
|
|
56
|
-
var _api$featureFlags;
|
|
57
56
|
var _ref2$config = _ref2.config,
|
|
58
57
|
options = _ref2$config === void 0 ? {} : _ref2$config,
|
|
59
58
|
api = _ref2.api;
|
|
60
|
-
var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
61
59
|
return {
|
|
62
60
|
name: 'media',
|
|
63
61
|
getSharedState: function getSharedState(editorState) {
|
|
@@ -141,7 +139,7 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref2) {
|
|
|
141
139
|
customDropzoneContainer: options && options.customDropzoneContainer,
|
|
142
140
|
customMediaPicker: options && options.customMediaPicker,
|
|
143
141
|
allowResizing: !!(options && options.allowResizing)
|
|
144
|
-
}, reactContext, getIntl, api, dispatch, options
|
|
142
|
+
}, reactContext, getIntl, api, dispatch, options);
|
|
145
143
|
}
|
|
146
144
|
}, {
|
|
147
145
|
name: 'mediaKeymap',
|
|
@@ -85,8 +85,7 @@ var createAnnouncer = function createAnnouncer(action, mediaWidth, changeAmount,
|
|
|
85
85
|
} else if (validation === 'less-than-min') {
|
|
86
86
|
announcerContainer.textContent = intl.formatMessage(_media.mediaResizeAnnouncerMessMessages.MediaWidthIsMin);
|
|
87
87
|
} else {
|
|
88
|
-
announcerContainer.textContent = intl.formatMessage(_media.mediaResizeAnnouncerMessMessages.
|
|
89
|
-
action: action,
|
|
88
|
+
announcerContainer.textContent = intl.formatMessage(action === 'increased' ? _media.mediaResizeAnnouncerMessMessages.DefaultMediaWidthIncreased : _media.mediaResizeAnnouncerMessMessages.DefaultMediaWidthDecreased, {
|
|
90
89
|
newMediaWidth: newMediaWidth
|
|
91
90
|
});
|
|
92
91
|
}
|
|
@@ -112,7 +111,6 @@ var handleMediaSizeChange = function handleMediaSizeChange(editorAnalyticsAPI, w
|
|
|
112
111
|
}
|
|
113
112
|
var validation = 'valid';
|
|
114
113
|
var newWidth = mediaWidth + changeAmount;
|
|
115
|
-
var intl = getIntl();
|
|
116
114
|
if (options !== null && options !== void 0 && options.fullWidthEnabled) {
|
|
117
115
|
var _widthPlugin$sharedSt4;
|
|
118
116
|
maxWidth = widthPlugin === null || widthPlugin === void 0 || (_widthPlugin$sharedSt4 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt4 === void 0 ? void 0 : _widthPlugin$sharedSt4.lineLength;
|
|
@@ -122,15 +120,9 @@ var handleMediaSizeChange = function handleMediaSizeChange(editorAnalyticsAPI, w
|
|
|
122
120
|
var _validationMaxMin = validationMaxMin(newWidth, maxWidth, minWidth, validation),
|
|
123
121
|
newWidthValidated = _validationMaxMin.newWidthValidated,
|
|
124
122
|
validationResult = _validationMaxMin.validation;
|
|
125
|
-
var formattedAction = action;
|
|
126
|
-
if (action === 'increased') {
|
|
127
|
-
formattedAction = intl.formatMessage(_media.mediaResizeAnnouncerMessMessages.IncreasedAction);
|
|
128
|
-
} else if (action === 'decreased') {
|
|
129
|
-
formattedAction = intl.formatMessage(_media.mediaResizeAnnouncerMessMessages.DecreasedAction);
|
|
130
|
-
}
|
|
131
123
|
var newLayout = (0, _utils.calcNewLayout)(newWidthValidated, (_getSelectedMediaSing2 = (0, _utils.getSelectedMediaSingle)(state)) === null || _getSelectedMediaSing2 === void 0 || (_getSelectedMediaSing2 = _getSelectedMediaSing2.node) === null || _getSelectedMediaSing2 === void 0 || (_getSelectedMediaSing2 = _getSelectedMediaSing2.attrs) === null || _getSelectedMediaSing2 === void 0 ? void 0 : _getSelectedMediaSing2.layout, contentWidth, options === null || options === void 0 ? void 0 : options.fullWidthEnabled);
|
|
132
124
|
(0, _commands.updateMediaSingleWidth)(editorAnalyticsAPI)(newWidthValidated, validationResult, 'keyboard', newLayout)(state, dispatch);
|
|
133
|
-
createAnnouncer(
|
|
125
|
+
createAnnouncer(action, mediaWidth, changeAmount, validationResult, getIntl);
|
|
134
126
|
return true;
|
|
135
127
|
};
|
|
136
128
|
};
|
|
@@ -228,7 +228,7 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
228
228
|
case 'block':
|
|
229
229
|
// read width state right before inserting to get up-to-date and define values
|
|
230
230
|
var widthPluginState = (_this$pluginInjection2 = _this.pluginInjectionApi) === null || _this$pluginInjection2 === void 0 || (_this$pluginInjection2 = _this$pluginInjection2.width) === null || _this$pluginInjection2 === void 0 ? void 0 : _this$pluginInjection2.sharedState.currentState();
|
|
231
|
-
(0, _mediaSingle2.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert,
|
|
231
|
+
(0, _mediaSingle2.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI);
|
|
232
232
|
break;
|
|
233
233
|
case 'group':
|
|
234
234
|
(0, _mediaFiles.insertMediaGroupNode)(editorAnalyticsAPI)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType));
|
|
@@ -467,7 +467,6 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
467
467
|
});
|
|
468
468
|
this.options = options;
|
|
469
469
|
this.mediaOptions = mediaOptions;
|
|
470
|
-
this.newInsertionBehaviour = newInsertionBehaviour;
|
|
471
470
|
this.dispatch = _dispatch;
|
|
472
471
|
this.pluginInjectionApi = pluginInjectionApi;
|
|
473
472
|
this.waitForMediaUpload = options.waitForMediaUpload === undefined ? true : options.waitForMediaUpload;
|
|
@@ -113,7 +113,7 @@ var getFileExtension = function getFileExtension(fileName) {
|
|
|
113
113
|
}
|
|
114
114
|
return undefined;
|
|
115
115
|
};
|
|
116
|
-
var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert,
|
|
116
|
+
var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI) {
|
|
117
117
|
var _state$selection$$fro;
|
|
118
118
|
if (collection === undefined) {
|
|
119
119
|
return false;
|
|
@@ -145,9 +145,7 @@ var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMedia
|
|
|
145
145
|
}, editorAnalyticsAPI)(state, dispatch);
|
|
146
146
|
} else {
|
|
147
147
|
var tr = null;
|
|
148
|
-
|
|
149
|
-
tr = (0, _insert.safeInsert)(node, state.selection.from)(state.tr);
|
|
150
|
-
}
|
|
148
|
+
tr = (0, _insert.safeInsert)(node, state.selection.from)(state.tr);
|
|
151
149
|
if (!tr) {
|
|
152
150
|
var content = shouldAddParagraph(view.state) ? _model.Fragment.fromArray([node, state.schema.nodes.paragraph.create()]) : node;
|
|
153
151
|
tr = (0, _utils2.safeInsert)(content, undefined, true)(state.tr);
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -47,8 +47,6 @@ export const mediaPlugin = ({
|
|
|
47
47
|
config: options = {},
|
|
48
48
|
api
|
|
49
49
|
}) => {
|
|
50
|
-
var _api$featureFlags;
|
|
51
|
-
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
52
50
|
return {
|
|
53
51
|
name: 'media',
|
|
54
52
|
getSharedState(editorState) {
|
|
@@ -132,7 +130,7 @@ export const mediaPlugin = ({
|
|
|
132
130
|
customDropzoneContainer: options && options.customDropzoneContainer,
|
|
133
131
|
customMediaPicker: options && options.customMediaPicker,
|
|
134
132
|
allowResizing: !!(options && options.allowResizing)
|
|
135
|
-
}, reactContext, getIntl, api, dispatch, options
|
|
133
|
+
}, reactContext, getIntl, api, dispatch, options);
|
|
136
134
|
}
|
|
137
135
|
}, {
|
|
138
136
|
name: 'mediaKeymap',
|
|
@@ -78,9 +78,8 @@ const createAnnouncer = (action, mediaWidth, changeAmount, validation, getIntl)
|
|
|
78
78
|
} else if (validation === 'less-than-min') {
|
|
79
79
|
announcerContainer.textContent = intl.formatMessage(mediaResizeAnnouncerMess.MediaWidthIsMin);
|
|
80
80
|
} else {
|
|
81
|
-
announcerContainer.textContent = intl.formatMessage(mediaResizeAnnouncerMess.
|
|
82
|
-
|
|
83
|
-
newMediaWidth: newMediaWidth
|
|
81
|
+
announcerContainer.textContent = intl.formatMessage(action === 'increased' ? mediaResizeAnnouncerMess.DefaultMediaWidthIncreased : mediaResizeAnnouncerMess.DefaultMediaWidthDecreased, {
|
|
82
|
+
newMediaWidth
|
|
84
83
|
});
|
|
85
84
|
}
|
|
86
85
|
}
|
|
@@ -106,7 +105,6 @@ const handleMediaSizeChange = (editorAnalyticsAPI, widthPlugin, options, changeA
|
|
|
106
105
|
}
|
|
107
106
|
let validation = 'valid';
|
|
108
107
|
let newWidth = mediaWidth + changeAmount;
|
|
109
|
-
const intl = getIntl();
|
|
110
108
|
if (options !== null && options !== void 0 && options.fullWidthEnabled) {
|
|
111
109
|
var _widthPlugin$sharedSt4;
|
|
112
110
|
maxWidth = widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt4 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt4 === void 0 ? void 0 : _widthPlugin$sharedSt4.lineLength;
|
|
@@ -117,15 +115,9 @@ const handleMediaSizeChange = (editorAnalyticsAPI, widthPlugin, options, changeA
|
|
|
117
115
|
newWidthValidated,
|
|
118
116
|
validation: validationResult
|
|
119
117
|
} = validationMaxMin(newWidth, maxWidth, minWidth, validation);
|
|
120
|
-
let formattedAction = action;
|
|
121
|
-
if (action === 'increased') {
|
|
122
|
-
formattedAction = intl.formatMessage(mediaResizeAnnouncerMess.IncreasedAction);
|
|
123
|
-
} else if (action === 'decreased') {
|
|
124
|
-
formattedAction = intl.formatMessage(mediaResizeAnnouncerMess.DecreasedAction);
|
|
125
|
-
}
|
|
126
118
|
const newLayout = calcNewLayout(newWidthValidated, (_getSelectedMediaSing4 = getSelectedMediaSingle(state)) === null || _getSelectedMediaSing4 === void 0 ? void 0 : (_getSelectedMediaSing5 = _getSelectedMediaSing4.node) === null || _getSelectedMediaSing5 === void 0 ? void 0 : (_getSelectedMediaSing6 = _getSelectedMediaSing5.attrs) === null || _getSelectedMediaSing6 === void 0 ? void 0 : _getSelectedMediaSing6.layout, contentWidth, options === null || options === void 0 ? void 0 : options.fullWidthEnabled);
|
|
127
119
|
updateMediaSingleWidth(editorAnalyticsAPI)(newWidthValidated, validationResult, 'keyboard', newLayout)(state, dispatch);
|
|
128
|
-
createAnnouncer(
|
|
120
|
+
createAnnouncer(action, mediaWidth, changeAmount, validationResult, getIntl);
|
|
129
121
|
return true;
|
|
130
122
|
};
|
|
131
123
|
const handleMediaIncrease = (editorAnalyticsAPI, widthPlugin, options, getIntl) => handleMediaSizeChange(editorAnalyticsAPI, widthPlugin, options, 1, 'increased', getIntl);
|
|
@@ -176,7 +176,7 @@ export class MediaPluginStateImplementation {
|
|
|
176
176
|
case 'block':
|
|
177
177
|
// read width state right before inserting to get up-to-date and define values
|
|
178
178
|
const widthPluginState = (_this$pluginInjection3 = this.pluginInjectionApi) === null || _this$pluginInjection3 === void 0 ? void 0 : (_this$pluginInjection4 = _this$pluginInjection3.width) === null || _this$pluginInjection4 === void 0 ? void 0 : _this$pluginInjection4.sharedState.currentState();
|
|
179
|
-
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert,
|
|
179
|
+
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI);
|
|
180
180
|
break;
|
|
181
181
|
case 'group':
|
|
182
182
|
insertMediaGroupNode(editorAnalyticsAPI)(this.view, [mediaStateWithContext], collection, this.getInputMethod(pickerType));
|
|
@@ -414,7 +414,6 @@ export class MediaPluginStateImplementation {
|
|
|
414
414
|
});
|
|
415
415
|
this.options = options;
|
|
416
416
|
this.mediaOptions = mediaOptions;
|
|
417
|
-
this.newInsertionBehaviour = newInsertionBehaviour;
|
|
418
417
|
this.dispatch = _dispatch;
|
|
419
418
|
this.pluginInjectionApi = pluginInjectionApi;
|
|
420
419
|
this.waitForMediaUpload = options.waitForMediaUpload === undefined ? true : options.waitForMediaUpload;
|
|
@@ -102,7 +102,7 @@ const getFileExtension = fileName => {
|
|
|
102
102
|
}
|
|
103
103
|
return undefined;
|
|
104
104
|
};
|
|
105
|
-
export const insertMediaSingleNode = (view, mediaState, inputMethod, collection, alignLeftOnInsert,
|
|
105
|
+
export const insertMediaSingleNode = (view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI) => {
|
|
106
106
|
var _state$selection$$fro;
|
|
107
107
|
if (collection === undefined) {
|
|
108
108
|
return false;
|
|
@@ -136,9 +136,7 @@ export const insertMediaSingleNode = (view, mediaState, inputMethod, collection,
|
|
|
136
136
|
}, editorAnalyticsAPI)(state, dispatch);
|
|
137
137
|
} else {
|
|
138
138
|
let tr = null;
|
|
139
|
-
|
|
140
|
-
tr = safeInsert(node, state.selection.from)(state.tr);
|
|
141
|
-
}
|
|
139
|
+
tr = safeInsert(node, state.selection.from)(state.tr);
|
|
142
140
|
if (!tr) {
|
|
143
141
|
const content = shouldAddParagraph(view.state) ? Fragment.fromArray([node, state.schema.nodes.paragraph.create()]) : node;
|
|
144
142
|
tr = pmSafeInsert(content, undefined, true)(state.tr);
|
package/dist/esm/plugin.js
CHANGED
|
@@ -42,11 +42,9 @@ var MediaPickerFunctionalComponent = function MediaPickerFunctionalComponent(_re
|
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
export var mediaPlugin = function mediaPlugin(_ref2) {
|
|
45
|
-
var _api$featureFlags;
|
|
46
45
|
var _ref2$config = _ref2.config,
|
|
47
46
|
options = _ref2$config === void 0 ? {} : _ref2$config,
|
|
48
47
|
api = _ref2.api;
|
|
49
|
-
var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
50
48
|
return {
|
|
51
49
|
name: 'media',
|
|
52
50
|
getSharedState: function getSharedState(editorState) {
|
|
@@ -130,7 +128,7 @@ export var mediaPlugin = function mediaPlugin(_ref2) {
|
|
|
130
128
|
customDropzoneContainer: options && options.customDropzoneContainer,
|
|
131
129
|
customMediaPicker: options && options.customMediaPicker,
|
|
132
130
|
allowResizing: !!(options && options.allowResizing)
|
|
133
|
-
}, reactContext, getIntl, api, dispatch, options
|
|
131
|
+
}, reactContext, getIntl, api, dispatch, options);
|
|
134
132
|
}
|
|
135
133
|
}, {
|
|
136
134
|
name: 'mediaKeymap',
|
|
@@ -78,8 +78,7 @@ var createAnnouncer = function createAnnouncer(action, mediaWidth, changeAmount,
|
|
|
78
78
|
} else if (validation === 'less-than-min') {
|
|
79
79
|
announcerContainer.textContent = intl.formatMessage(mediaResizeAnnouncerMess.MediaWidthIsMin);
|
|
80
80
|
} else {
|
|
81
|
-
announcerContainer.textContent = intl.formatMessage(mediaResizeAnnouncerMess.
|
|
82
|
-
action: action,
|
|
81
|
+
announcerContainer.textContent = intl.formatMessage(action === 'increased' ? mediaResizeAnnouncerMess.DefaultMediaWidthIncreased : mediaResizeAnnouncerMess.DefaultMediaWidthDecreased, {
|
|
83
82
|
newMediaWidth: newMediaWidth
|
|
84
83
|
});
|
|
85
84
|
}
|
|
@@ -105,7 +104,6 @@ var handleMediaSizeChange = function handleMediaSizeChange(editorAnalyticsAPI, w
|
|
|
105
104
|
}
|
|
106
105
|
var validation = 'valid';
|
|
107
106
|
var newWidth = mediaWidth + changeAmount;
|
|
108
|
-
var intl = getIntl();
|
|
109
107
|
if (options !== null && options !== void 0 && options.fullWidthEnabled) {
|
|
110
108
|
var _widthPlugin$sharedSt4;
|
|
111
109
|
maxWidth = widthPlugin === null || widthPlugin === void 0 || (_widthPlugin$sharedSt4 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt4 === void 0 ? void 0 : _widthPlugin$sharedSt4.lineLength;
|
|
@@ -115,15 +113,9 @@ var handleMediaSizeChange = function handleMediaSizeChange(editorAnalyticsAPI, w
|
|
|
115
113
|
var _validationMaxMin = validationMaxMin(newWidth, maxWidth, minWidth, validation),
|
|
116
114
|
newWidthValidated = _validationMaxMin.newWidthValidated,
|
|
117
115
|
validationResult = _validationMaxMin.validation;
|
|
118
|
-
var formattedAction = action;
|
|
119
|
-
if (action === 'increased') {
|
|
120
|
-
formattedAction = intl.formatMessage(mediaResizeAnnouncerMess.IncreasedAction);
|
|
121
|
-
} else if (action === 'decreased') {
|
|
122
|
-
formattedAction = intl.formatMessage(mediaResizeAnnouncerMess.DecreasedAction);
|
|
123
|
-
}
|
|
124
116
|
var newLayout = calcNewLayout(newWidthValidated, (_getSelectedMediaSing2 = getSelectedMediaSingle(state)) === null || _getSelectedMediaSing2 === void 0 || (_getSelectedMediaSing2 = _getSelectedMediaSing2.node) === null || _getSelectedMediaSing2 === void 0 || (_getSelectedMediaSing2 = _getSelectedMediaSing2.attrs) === null || _getSelectedMediaSing2 === void 0 ? void 0 : _getSelectedMediaSing2.layout, contentWidth, options === null || options === void 0 ? void 0 : options.fullWidthEnabled);
|
|
125
117
|
updateMediaSingleWidth(editorAnalyticsAPI)(newWidthValidated, validationResult, 'keyboard', newLayout)(state, dispatch);
|
|
126
|
-
createAnnouncer(
|
|
118
|
+
createAnnouncer(action, mediaWidth, changeAmount, validationResult, getIntl);
|
|
127
119
|
return true;
|
|
128
120
|
};
|
|
129
121
|
};
|
|
@@ -213,7 +213,7 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
213
213
|
case 'block':
|
|
214
214
|
// read width state right before inserting to get up-to-date and define values
|
|
215
215
|
var widthPluginState = (_this$pluginInjection2 = _this.pluginInjectionApi) === null || _this$pluginInjection2 === void 0 || (_this$pluginInjection2 = _this$pluginInjection2.width) === null || _this$pluginInjection2 === void 0 ? void 0 : _this$pluginInjection2.sharedState.currentState();
|
|
216
|
-
insertMediaSingleNode(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert,
|
|
216
|
+
insertMediaSingleNode(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI);
|
|
217
217
|
break;
|
|
218
218
|
case 'group':
|
|
219
219
|
insertMediaGroupNode(editorAnalyticsAPI)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType));
|
|
@@ -452,7 +452,6 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
452
452
|
});
|
|
453
453
|
this.options = options;
|
|
454
454
|
this.mediaOptions = mediaOptions;
|
|
455
|
-
this.newInsertionBehaviour = newInsertionBehaviour;
|
|
456
455
|
this.dispatch = _dispatch;
|
|
457
456
|
this.pluginInjectionApi = pluginInjectionApi;
|
|
458
457
|
this.waitForMediaUpload = options.waitForMediaUpload === undefined ? true : options.waitForMediaUpload;
|
|
@@ -104,7 +104,7 @@ var getFileExtension = function getFileExtension(fileName) {
|
|
|
104
104
|
}
|
|
105
105
|
return undefined;
|
|
106
106
|
};
|
|
107
|
-
export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert,
|
|
107
|
+
export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI) {
|
|
108
108
|
var _state$selection$$fro;
|
|
109
109
|
if (collection === undefined) {
|
|
110
110
|
return false;
|
|
@@ -136,9 +136,7 @@ export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaSta
|
|
|
136
136
|
}, editorAnalyticsAPI)(state, dispatch);
|
|
137
137
|
} else {
|
|
138
138
|
var tr = null;
|
|
139
|
-
|
|
140
|
-
tr = safeInsert(node, state.selection.from)(state.tr);
|
|
141
|
-
}
|
|
139
|
+
tr = safeInsert(node, state.selection.from)(state.tr);
|
|
142
140
|
if (!tr) {
|
|
143
141
|
var content = shouldAddParagraph(view.state) ? Fragment.fromArray([node, state.schema.nodes.paragraph.create()]) : node;
|
|
144
142
|
tr = pmSafeInsert(content, undefined, true)(state.tr);
|
|
@@ -3,7 +3,6 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
3
3
|
import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
|
|
4
4
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
5
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
6
|
-
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
7
6
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
8
7
|
import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
9
8
|
import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
@@ -16,7 +15,6 @@ import type { InsertMediaAsMediaSingle } from './utils/media-single';
|
|
|
16
15
|
export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
17
16
|
pluginConfiguration: MediaOptions | undefined;
|
|
18
17
|
dependencies: [
|
|
19
|
-
OptionalPlugin<FeatureFlagsPlugin>,
|
|
20
18
|
OptionalPlugin<AnalyticsPlugin>,
|
|
21
19
|
OptionalPlugin<ContextIdentifierPlugin>,
|
|
22
20
|
GuidelinePlugin,
|
|
@@ -33,7 +33,6 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
|
|
|
33
33
|
mediaNodes: MediaNodeWithPosHandler[];
|
|
34
34
|
options: MediaPluginOptions;
|
|
35
35
|
mediaProvider?: MediaProvider;
|
|
36
|
-
newInsertionBehaviour?: boolean;
|
|
37
36
|
isResizing: boolean;
|
|
38
37
|
resizingWidth: number;
|
|
39
38
|
currentMaxWidth?: number;
|
|
@@ -14,7 +14,7 @@ export interface MediaSingleState extends MediaState {
|
|
|
14
14
|
export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
|
|
15
15
|
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia) => boolean;
|
|
16
16
|
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => boolean;
|
|
17
|
-
export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean,
|
|
17
|
+
export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => boolean;
|
|
18
18
|
export declare const changeFromMediaInlineToMediaSingleNode: (view: EditorView, fromNode: PMNode, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => boolean;
|
|
19
19
|
export declare const createMediaSingleNode: (schema: Schema, collection: string, maxWidth?: number, minWidth?: number, alignLeftOnInsert?: boolean) => (mediaState: MediaSingleState) => PMNode;
|
|
20
20
|
export declare function isCaptionNode(editorView: EditorView): boolean;
|
|
@@ -3,7 +3,6 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
3
3
|
import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
|
|
4
4
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
5
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
6
|
-
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
7
6
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
8
7
|
import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
9
8
|
import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
@@ -16,7 +15,6 @@ import type { InsertMediaAsMediaSingle } from './utils/media-single';
|
|
|
16
15
|
export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
17
16
|
pluginConfiguration: MediaOptions | undefined;
|
|
18
17
|
dependencies: [
|
|
19
|
-
OptionalPlugin<FeatureFlagsPlugin>,
|
|
20
18
|
OptionalPlugin<AnalyticsPlugin>,
|
|
21
19
|
OptionalPlugin<ContextIdentifierPlugin>,
|
|
22
20
|
GuidelinePlugin,
|
|
@@ -33,7 +33,6 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
|
|
|
33
33
|
mediaNodes: MediaNodeWithPosHandler[];
|
|
34
34
|
options: MediaPluginOptions;
|
|
35
35
|
mediaProvider?: MediaProvider;
|
|
36
|
-
newInsertionBehaviour?: boolean;
|
|
37
36
|
isResizing: boolean;
|
|
38
37
|
resizingWidth: number;
|
|
39
38
|
currentMaxWidth?: number;
|
|
@@ -14,7 +14,7 @@ export interface MediaSingleState extends MediaState {
|
|
|
14
14
|
export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
|
|
15
15
|
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia) => boolean;
|
|
16
16
|
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => boolean;
|
|
17
|
-
export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean,
|
|
17
|
+
export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => boolean;
|
|
18
18
|
export declare const changeFromMediaInlineToMediaSingleNode: (view: EditorView, fromNode: PMNode, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => boolean;
|
|
19
19
|
export declare const createMediaSingleNode: (schema: Schema, collection: string, maxWidth?: number, minWidth?: number, alignLeftOnInsert?: boolean) => (mediaState: MediaSingleState) => PMNode;
|
|
20
20
|
export declare function isCaptionNode(editorView: EditorView): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,14 +36,13 @@
|
|
|
36
36
|
"@atlaskit/adf-schema": "^35.5.1",
|
|
37
37
|
"@atlaskit/analytics-namespaced-context": "^6.9.0",
|
|
38
38
|
"@atlaskit/analytics-next": "^9.2.0",
|
|
39
|
-
"@atlaskit/button": "^17.
|
|
40
|
-
"@atlaskit/editor-common": "^
|
|
39
|
+
"@atlaskit/button": "^17.4.0",
|
|
40
|
+
"@atlaskit/editor-common": "^78.0.0",
|
|
41
41
|
"@atlaskit/editor-palette": "1.5.2",
|
|
42
42
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-decorations": "^1.0.0",
|
|
44
44
|
"@atlaskit/editor-plugin-editor-disabled": "^1.0.0",
|
|
45
|
-
"@atlaskit/editor-plugin-
|
|
46
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^1.0.0",
|
|
45
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^1.1.0",
|
|
47
46
|
"@atlaskit/editor-plugin-focus": "^1.0.0",
|
|
48
47
|
"@atlaskit/editor-plugin-grid": "^1.0.0",
|
|
49
48
|
"@atlaskit/editor-plugin-guideline": "^1.0.0",
|