@atlaskit/editor-plugin-media 1.2.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
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
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
|
+
|
|
3
9
|
## 1.2.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -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
|
};
|
|
@@ -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);
|
|
@@ -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
|
};
|