@atlaskit/editor-plugin-media 1.2.0 → 1.2.2
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 +13 -0
- package/dist/cjs/pm-plugins/keymap.js +2 -10
- package/dist/cjs/ui/MediaPicker/index.js +12 -1
- package/dist/es2019/pm-plugins/keymap.js +3 -11
- package/dist/es2019/ui/MediaPicker/index.js +12 -1
- package/dist/esm/pm-plugins/keymap.js +2 -10
- package/dist/esm/ui/MediaPicker/index.js +12 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 1.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#74284](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/74284) [`c88cf104546f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c88cf104546f) - fix copy paste issue in excel and numbers that paste table results in screenshot of table pasted
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 1.2.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#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
|
|
15
|
+
|
|
3
16
|
## 1.2.0
|
|
4
17
|
|
|
5
18
|
### 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
|
};
|
|
@@ -14,12 +14,14 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
16
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
17
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
18
|
var _BrowserWrapper = require("./BrowserWrapper");
|
|
18
19
|
var _ClipboardWrapper = require("./ClipboardWrapper");
|
|
19
20
|
var _DropzoneWrapper = require("./DropzoneWrapper");
|
|
20
21
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
21
22
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
23
|
var MediaPicker = function MediaPicker(_ref) {
|
|
24
|
+
var _editorDom$parentElem;
|
|
23
25
|
var api = _ref.api,
|
|
24
26
|
isPopupOpened = _ref.isPopupOpened,
|
|
25
27
|
appearance = _ref.appearance,
|
|
@@ -29,7 +31,16 @@ var MediaPicker = function MediaPicker(_ref) {
|
|
|
29
31
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['focus']),
|
|
30
32
|
focusState = _useSharedPluginState.focusState;
|
|
31
33
|
var featureFlags = mediaState.mediaOptions && mediaState.mediaOptions.featureFlags;
|
|
32
|
-
var
|
|
34
|
+
var editorDom = editorDomElement;
|
|
35
|
+
var editorParent = (_editorDom$parentElem = editorDom.parentElement) !== null && _editorDom$parentElem !== void 0 ? _editorDom$parentElem : undefined;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* https://product-fabric.atlassian.net/browse/ED-21993
|
|
39
|
+
* Avoid attach paste event to same dom element,
|
|
40
|
+
* so editor-paste-plugin can use stopPropagation,
|
|
41
|
+
* as stopImmediatePropagation could cause race condition issues
|
|
42
|
+
*/
|
|
43
|
+
var container = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.fix-copy-paste-excel_62g4s') ? editorParent : editorDom;
|
|
33
44
|
var clipboard = focusState !== null && focusState !== void 0 && focusState.hasFocus ? /*#__PURE__*/_react.default.createElement(_ClipboardWrapper.ClipboardWrapper, {
|
|
34
45
|
mediaState: mediaState,
|
|
35
46
|
featureFlags: featureFlags,
|
|
@@ -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);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { BrowserWrapper } from './BrowserWrapper';
|
|
5
6
|
import { ClipboardWrapper } from './ClipboardWrapper';
|
|
6
7
|
import { DropzoneWrapper } from './DropzoneWrapper';
|
|
@@ -12,11 +13,21 @@ const MediaPicker = ({
|
|
|
12
13
|
onBrowseFn,
|
|
13
14
|
editorDomElement
|
|
14
15
|
}) => {
|
|
16
|
+
var _editorDom$parentElem;
|
|
15
17
|
const {
|
|
16
18
|
focusState
|
|
17
19
|
} = useSharedPluginState(api, ['focus']);
|
|
18
20
|
const featureFlags = mediaState.mediaOptions && mediaState.mediaOptions.featureFlags;
|
|
19
|
-
const
|
|
21
|
+
const editorDom = editorDomElement;
|
|
22
|
+
const editorParent = (_editorDom$parentElem = editorDom.parentElement) !== null && _editorDom$parentElem !== void 0 ? _editorDom$parentElem : undefined;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* https://product-fabric.atlassian.net/browse/ED-21993
|
|
26
|
+
* Avoid attach paste event to same dom element,
|
|
27
|
+
* so editor-paste-plugin can use stopPropagation,
|
|
28
|
+
* as stopImmediatePropagation could cause race condition issues
|
|
29
|
+
*/
|
|
30
|
+
const container = getBooleanFF('platform.editor.media.fix-copy-paste-excel_62g4s') ? editorParent : editorDom;
|
|
20
31
|
const clipboard = focusState !== null && focusState !== void 0 && focusState.hasFocus ? /*#__PURE__*/React.createElement(ClipboardWrapper, {
|
|
21
32
|
mediaState: mediaState,
|
|
22
33
|
featureFlags: featureFlags,
|
|
@@ -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
|
};
|
|
@@ -9,10 +9,12 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
9
9
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
12
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { BrowserWrapper } from './BrowserWrapper';
|
|
13
14
|
import { ClipboardWrapper } from './ClipboardWrapper';
|
|
14
15
|
import { DropzoneWrapper } from './DropzoneWrapper';
|
|
15
16
|
var MediaPicker = function MediaPicker(_ref) {
|
|
17
|
+
var _editorDom$parentElem;
|
|
16
18
|
var api = _ref.api,
|
|
17
19
|
isPopupOpened = _ref.isPopupOpened,
|
|
18
20
|
appearance = _ref.appearance,
|
|
@@ -22,7 +24,16 @@ var MediaPicker = function MediaPicker(_ref) {
|
|
|
22
24
|
var _useSharedPluginState = useSharedPluginState(api, ['focus']),
|
|
23
25
|
focusState = _useSharedPluginState.focusState;
|
|
24
26
|
var featureFlags = mediaState.mediaOptions && mediaState.mediaOptions.featureFlags;
|
|
25
|
-
var
|
|
27
|
+
var editorDom = editorDomElement;
|
|
28
|
+
var editorParent = (_editorDom$parentElem = editorDom.parentElement) !== null && _editorDom$parentElem !== void 0 ? _editorDom$parentElem : undefined;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* https://product-fabric.atlassian.net/browse/ED-21993
|
|
32
|
+
* Avoid attach paste event to same dom element,
|
|
33
|
+
* so editor-paste-plugin can use stopPropagation,
|
|
34
|
+
* as stopImmediatePropagation could cause race condition issues
|
|
35
|
+
*/
|
|
36
|
+
var container = getBooleanFF('platform.editor.media.fix-copy-paste-excel_62g4s') ? editorParent : editorDom;
|
|
26
37
|
var clipboard = focusState !== null && focusState !== void 0 && focusState.hasFocus ? /*#__PURE__*/React.createElement(ClipboardWrapper, {
|
|
27
38
|
mediaState: mediaState,
|
|
28
39
|
featureFlags: featureFlags,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/analytics-namespaced-context": "^6.9.0",
|
|
38
38
|
"@atlaskit/analytics-next": "^9.2.0",
|
|
39
39
|
"@atlaskit/button": "^17.4.0",
|
|
40
|
-
"@atlaskit/editor-common": "^78.
|
|
40
|
+
"@atlaskit/editor-common": "^78.3.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",
|
|
@@ -140,6 +140,9 @@
|
|
|
140
140
|
},
|
|
141
141
|
"platform.editor.allow-extended-panel": {
|
|
142
142
|
"type": "boolean"
|
|
143
|
+
},
|
|
144
|
+
"platform.editor.media.fix-copy-paste-excel_62g4s": {
|
|
145
|
+
"type": "boolean"
|
|
143
146
|
}
|
|
144
147
|
},
|
|
145
148
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|