@atlaskit/editor-common 93.4.3 → 93.5.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 +30 -0
- package/UNSAFE_do_not_use_editor_context/package.json +15 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/EditorContext/index.js +9 -0
- package/dist/cjs/ui-menu/ColorPickerButton/index.js +14 -6
- package/dist/cjs/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +7 -2
- package/dist/cjs/with-plugin-state/index.js +273 -18
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/EditorContext/index.js +2 -0
- package/dist/es2019/ui-menu/ColorPickerButton/index.js +15 -7
- package/dist/es2019/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +9 -4
- package/dist/es2019/with-plugin-state/index.js +217 -5
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/EditorContext/index.js +2 -0
- package/dist/esm/ui-menu/ColorPickerButton/index.js +15 -7
- package/dist/esm/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +9 -4
- package/dist/esm/with-plugin-state/index.js +272 -17
- package/dist/types/analytics/types/view-events.d.ts +1 -0
- package/dist/types/ui/EditorContext/index.d.ts +2 -0
- package/dist/types/with-plugin-state/index.d.ts +35 -1
- package/dist/types-ts4.5/analytics/types/view-events.d.ts +1 -0
- package/dist/types-ts4.5/ui/EditorContext/index.d.ts +2 -0
- package/dist/types-ts4.5/with-plugin-state/index.d.ts +35 -1
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 93.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#151611](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151611)
|
|
8
|
+
[`ee71cb75c933c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ee71cb75c933c) -
|
|
9
|
+
ED-25294 add new attribute as engagement platform message trigger
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#152399](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152399)
|
|
14
|
+
[`fbd7217f0cb51`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fbd7217f0cb51) -
|
|
15
|
+
[ux] ED-25092: Added iconFallback prop to FloatingToolbarDropdown
|
|
16
|
+
- [#151611](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151611)
|
|
17
|
+
[`c866e61e26ae2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c866e61e26ae2) -
|
|
18
|
+
[ux] [ED-25306] When opening the media picker from the editor main toolbar do not use the
|
|
19
|
+
ToolbarArrowKeyNavigationProvider
|
|
20
|
+
- [#152510](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152510)
|
|
21
|
+
[`dcf9edde7ac7b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dcf9edde7ac7b) -
|
|
22
|
+
bump adf-schema to 42.0.1
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
25
|
+
## 93.4.4
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [#151676](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151676)
|
|
30
|
+
[`ed6d01983b0da`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ed6d01983b0da) -
|
|
31
|
+
ED-25183: Remediate WithEditorActions, WithPluginState & LegacyEditorContext context type
|
|
32
|
+
|
|
3
33
|
## 93.4.3
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/UNSAFE_do_not_use_editor_context",
|
|
3
|
+
"main": "../dist/cjs/ui/EditorContext/index.js",
|
|
4
|
+
"module": "../dist/esm/ui/EditorContext/index.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/ui/EditorContext/index.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/ui/EditorContext/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <5.4": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/ui/EditorContext/index.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
19
19
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
20
|
-
var packageVersion = "93.
|
|
20
|
+
var packageVersion = "93.5.0";
|
|
21
21
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
22
22
|
// Remove URL as it has UGC
|
|
23
23
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "93.
|
|
27
|
+
var packageVersion = "93.5.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.EditorContext = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var EditorContext = exports.EditorContext = /*#__PURE__*/_react.default.createContext({});
|
|
@@ -12,6 +12,8 @@ var _withAnalyticsContext = _interopRequireDefault(require("@atlaskit/analytics-
|
|
|
12
12
|
var _withAnalyticsEvents = _interopRequireDefault(require("@atlaskit/analytics-next/withAnalyticsEvents"));
|
|
13
13
|
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
14
14
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
|
|
15
|
+
var _chevronDown2 = _interopRequireDefault(require("@atlaskit/icon/utility/chevron-down"));
|
|
16
|
+
var _primitives = require("@atlaskit/primitives");
|
|
15
17
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
16
18
|
var _analytics = require("../../analytics");
|
|
17
19
|
var _uiColor = require("../../ui-color");
|
|
@@ -30,8 +32,11 @@ var _types = require("../ArrowKeyNavigationProvider/types");
|
|
|
30
32
|
var colorPickerButtonWrapper = (0, _react2.css)({
|
|
31
33
|
position: 'relative'
|
|
32
34
|
});
|
|
33
|
-
var colorPickerExpandContainer = (0,
|
|
34
|
-
|
|
35
|
+
var colorPickerExpandContainer = (0, _primitives.xcss)({
|
|
36
|
+
marginTop: 'space.0',
|
|
37
|
+
marginBottom: 'space.0',
|
|
38
|
+
marginLeft: 'space.negative.050',
|
|
39
|
+
marginRight: 'space.negative.050'
|
|
35
40
|
});
|
|
36
41
|
|
|
37
42
|
// Control the size of color picker buttons and preview
|
|
@@ -228,10 +233,13 @@ var ColorPickerButton = function ColorPickerButton(props) {
|
|
|
228
233
|
// TODO: (from codemod) Buttons with "component", "css" or "style" prop can't be automatically migrated with codemods. Please migrate it manually.
|
|
229
234
|
,
|
|
230
235
|
css: buttonStyle,
|
|
231
|
-
iconAfter: (0, _react2.jsx)(
|
|
232
|
-
|
|
233
|
-
}, (0, _react2.jsx)(
|
|
234
|
-
|
|
236
|
+
iconAfter: (0, _react2.jsx)(_primitives.Box, {
|
|
237
|
+
xcss: colorPickerExpandContainer
|
|
238
|
+
}, (0, _react2.jsx)(_chevronDown2.default, {
|
|
239
|
+
color: "currentColor",
|
|
240
|
+
spacing: "spacious",
|
|
241
|
+
LEGACY_fallbackIcon: _chevronDown.default,
|
|
242
|
+
label: "color-picker-chevron-down"
|
|
235
243
|
})),
|
|
236
244
|
"data-selected-color": props.currentColor
|
|
237
245
|
})), renderPopup());
|
|
@@ -9,6 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _react2 = require("@emotion/react");
|
|
10
10
|
var _elementBrowser = require("../../element-browser");
|
|
11
11
|
var _messages = require("../../messages");
|
|
12
|
+
var _mediaInsert = require("../../messages/media-insert");
|
|
12
13
|
var _ui = require("../../ui");
|
|
13
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -16,7 +17,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
16
17
|
* @jsxRuntime classic
|
|
17
18
|
* @jsx jsx
|
|
18
19
|
*/
|
|
19
|
-
/* eslint-disable no-console */
|
|
20
20
|
|
|
21
21
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
22
22
|
|
|
@@ -144,6 +144,11 @@ var ToolbarArrowKeyNavigationProvider = exports.ToolbarArrowKeyNavigationProvide
|
|
|
144
144
|
if (!filteredFocusableElements || (filteredFocusableElements === null || filteredFocusableElements === void 0 ? void 0 : filteredFocusableElements.length) === 0) {
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
|
+
|
|
148
|
+
// If the target element is the media picker then navigation is handled by the media picker
|
|
149
|
+
if (targetElement instanceof HTMLElement && targetElement.closest("[aria-label=\"".concat(intl.formatMessage(_mediaInsert.mediaInsertMessages.mediaPickerPopupAriaLabel), "\"]"))) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
147
152
|
if (targetElement instanceof HTMLElement && !((_wrapperRef$current2 = wrapperRef.current) !== null && _wrapperRef$current2 !== void 0 && _wrapperRef$current2.contains(targetElement))) {
|
|
148
153
|
selectedItemIndex.current = -1;
|
|
149
154
|
} else {
|
|
@@ -196,7 +201,7 @@ var ToolbarArrowKeyNavigationProvider = exports.ToolbarArrowKeyNavigationProvide
|
|
|
196
201
|
editorViewDom === null || editorViewDom === void 0 || editorViewDom.removeEventListener('keydown', globalKeyDownHandler);
|
|
197
202
|
}
|
|
198
203
|
};
|
|
199
|
-
}, [selectedItemIndex, wrapperRef, editorView, disableArrowKeyNavigation, handleEscape, childComponentSelector, incrementIndex, decrementIndex, isShortcutToFocusToolbar, editorAppearance, useStickyToolbar]);
|
|
204
|
+
}, [selectedItemIndex, wrapperRef, editorView, disableArrowKeyNavigation, handleEscape, childComponentSelector, incrementIndex, decrementIndex, isShortcutToFocusToolbar, editorAppearance, useStickyToolbar, intl]);
|
|
200
205
|
return (0, _react2.jsx)("div", {
|
|
201
206
|
css: editorAppearance === 'comment' && centeredToolbarContainer
|
|
202
207
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -4,19 +4,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.WithPluginState = void 0;
|
|
7
|
+
exports.WithPluginStateOld = exports.WithPluginStateInner = exports.WithPluginState = void 0;
|
|
8
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
16
|
var _react = _interopRequireDefault(require("react"));
|
|
16
17
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
19
|
var _analytics = require("../analytics");
|
|
18
20
|
var _eventDispatcher = require("../event-dispatcher");
|
|
19
21
|
var _performanceMeasures = require("../performance-measures");
|
|
22
|
+
var _EditorContext = require("../ui/EditorContext");
|
|
20
23
|
var _utils = require("../utils");
|
|
21
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -68,10 +71,34 @@ var DEFAULT_SLOW_THRESHOLD = 4;
|
|
|
68
71
|
var WithPluginState = exports.WithPluginState = /*#__PURE__*/function (_React$Component) {
|
|
69
72
|
(0, _inherits2.default)(WithPluginState, _React$Component);
|
|
70
73
|
var _super = _createSuper(WithPluginState);
|
|
71
|
-
function WithPluginState(props
|
|
72
|
-
var _this;
|
|
74
|
+
function WithPluginState(props) {
|
|
73
75
|
(0, _classCallCheck2.default)(this, WithPluginState);
|
|
74
|
-
|
|
76
|
+
return _super.call(this, props);
|
|
77
|
+
}
|
|
78
|
+
(0, _createClass2.default)(WithPluginState, [{
|
|
79
|
+
key: "render",
|
|
80
|
+
value: function render() {
|
|
81
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2')) {
|
|
82
|
+
return /*#__PURE__*/_react.default.createElement(WithPluginStateNew, this.props);
|
|
83
|
+
}
|
|
84
|
+
return /*#__PURE__*/_react.default.createElement(WithPluginStateOld, this.props);
|
|
85
|
+
}
|
|
86
|
+
}]);
|
|
87
|
+
return WithPluginState;
|
|
88
|
+
}(_react.default.Component);
|
|
89
|
+
function WithPluginStateNew(props) {
|
|
90
|
+
var context = _react.default.useContext(_EditorContext.EditorContext);
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement(WithPluginStateInner, (0, _extends2.default)({}, props, {
|
|
92
|
+
editorActions: context === null || context === void 0 ? void 0 : context.editorActions
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
var WithPluginStateInner = exports.WithPluginStateInner = /*#__PURE__*/function (_React$Component2) {
|
|
96
|
+
(0, _inherits2.default)(WithPluginStateInner, _React$Component2);
|
|
97
|
+
var _super2 = _createSuper(WithPluginStateInner);
|
|
98
|
+
function WithPluginStateInner(props) {
|
|
99
|
+
var _this;
|
|
100
|
+
(0, _classCallCheck2.default)(this, WithPluginStateInner);
|
|
101
|
+
_this = _super2.call(this, props);
|
|
75
102
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "listeners", {});
|
|
76
103
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "debounce", null);
|
|
77
104
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "notAppliedState", {});
|
|
@@ -137,24 +164,22 @@ var WithPluginState = exports.WithPluginState = /*#__PURE__*/function (_React$Co
|
|
|
137
164
|
});
|
|
138
165
|
}
|
|
139
166
|
});
|
|
140
|
-
|
|
141
|
-
_this.subscribe(_this.props);
|
|
142
|
-
});
|
|
143
|
-
_this.state = _this.getPluginsStates(_this.props.plugins, _this.getEditorView(props, context));
|
|
167
|
+
_this.state = _this.getPluginsStates(_this.props.plugins, _this.getEditorView(props));
|
|
144
168
|
return _this;
|
|
145
169
|
}
|
|
146
|
-
(0, _createClass2.default)(
|
|
170
|
+
(0, _createClass2.default)(WithPluginStateInner, [{
|
|
147
171
|
key: "getEditorView",
|
|
148
|
-
value: function getEditorView(maybeProps
|
|
172
|
+
value: function getEditorView(maybeProps) {
|
|
149
173
|
var props = maybeProps || this.props;
|
|
150
|
-
var
|
|
151
|
-
return props.editorView ||
|
|
174
|
+
var editorActions = props.editorActions;
|
|
175
|
+
return props.editorView || (editorActions === null || editorActions === void 0 ? void 0 : editorActions._privateGetEditorView());
|
|
152
176
|
}
|
|
153
177
|
}, {
|
|
154
178
|
key: "getEventDispatcher",
|
|
155
179
|
value: function getEventDispatcher(maybeProps) {
|
|
180
|
+
var _props$editorActions;
|
|
156
181
|
var props = maybeProps || this.props;
|
|
157
|
-
return props.eventDispatcher ||
|
|
182
|
+
return props.eventDispatcher || ((_props$editorActions = props.editorActions) === null || _props$editorActions === void 0 ? void 0 : _props$editorActions._privateGetEventDispatcher());
|
|
158
183
|
}
|
|
159
184
|
}, {
|
|
160
185
|
key: "getPluginsStates",
|
|
@@ -245,6 +270,236 @@ var WithPluginState = exports.WithPluginState = /*#__PURE__*/function (_React$Co
|
|
|
245
270
|
});
|
|
246
271
|
this.listeners = [];
|
|
247
272
|
}
|
|
273
|
+
}, {
|
|
274
|
+
key: "subscribeToContextUpdates",
|
|
275
|
+
value: function subscribeToContextUpdates() {
|
|
276
|
+
var _this$props$editorAct,
|
|
277
|
+
_this4 = this;
|
|
278
|
+
(_this$props$editorAct = this.props.editorActions) === null || _this$props$editorAct === void 0 || _this$props$editorAct._privateSubscribe(function () {
|
|
279
|
+
return _this4.subscribe(_this4.props);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}, {
|
|
283
|
+
key: "unsubscribeFromContextUpdates",
|
|
284
|
+
value: function unsubscribeFromContextUpdates() {
|
|
285
|
+
var _this$props$editorAct2,
|
|
286
|
+
_this5 = this;
|
|
287
|
+
(_this$props$editorAct2 = this.props.editorActions) === null || _this$props$editorAct2 === void 0 || _this$props$editorAct2._privateUnsubscribe(function () {
|
|
288
|
+
return _this5.subscribe(_this5.props);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}, {
|
|
292
|
+
key: "componentDidMount",
|
|
293
|
+
value: function componentDidMount() {
|
|
294
|
+
this.subscribe(this.props);
|
|
295
|
+
this.subscribeToContextUpdates();
|
|
296
|
+
}
|
|
297
|
+
}, {
|
|
298
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
299
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
300
|
+
if (!this.isSubscribed) {
|
|
301
|
+
this.subscribe(nextProps);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}, {
|
|
305
|
+
key: "componentWillUnmount",
|
|
306
|
+
value: function componentWillUnmount() {
|
|
307
|
+
if (this.debounce) {
|
|
308
|
+
window.clearTimeout(this.debounce);
|
|
309
|
+
}
|
|
310
|
+
this.unsubscribeFromContextUpdates();
|
|
311
|
+
this.unsubscribe();
|
|
312
|
+
}
|
|
313
|
+
}, {
|
|
314
|
+
key: "render",
|
|
315
|
+
value: function render() {
|
|
316
|
+
var render = this.props.render;
|
|
317
|
+
return render(this.state);
|
|
318
|
+
}
|
|
319
|
+
}]);
|
|
320
|
+
return WithPluginStateInner;
|
|
321
|
+
}(_react.default.Component);
|
|
322
|
+
(0, _defineProperty2.default)(WithPluginStateInner, "displayName", 'WithPluginState');
|
|
323
|
+
var WithPluginStateOld = exports.WithPluginStateOld = /*#__PURE__*/function (_React$Component3) {
|
|
324
|
+
(0, _inherits2.default)(WithPluginStateOld, _React$Component3);
|
|
325
|
+
var _super3 = _createSuper(WithPluginStateOld);
|
|
326
|
+
function WithPluginStateOld(props, context) {
|
|
327
|
+
var _this6;
|
|
328
|
+
(0, _classCallCheck2.default)(this, WithPluginStateOld);
|
|
329
|
+
_this6 = _super3.call(this, props, context);
|
|
330
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "listeners", {});
|
|
331
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "debounce", null);
|
|
332
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "notAppliedState", {});
|
|
333
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "isSubscribed", false);
|
|
334
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "callsCount", 0);
|
|
335
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "handlePluginStateChange", function (propName, pluginName, performanceOptions, skipEqualityCheck) {
|
|
336
|
+
return function (pluginState) {
|
|
337
|
+
// skipEqualityCheck is being used for old plugins since they are mutating plugin state instead of creating a new one
|
|
338
|
+
if (_this6.state[propName] !== pluginState || skipEqualityCheck) {
|
|
339
|
+
_this6.updateState({
|
|
340
|
+
stateSubset: (0, _defineProperty2.default)({}, propName, pluginState),
|
|
341
|
+
pluginName: pluginName,
|
|
342
|
+
performanceOptions: performanceOptions
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
});
|
|
347
|
+
/**
|
|
348
|
+
* Debounces setState calls in order to reduce number of re-renders caused by several plugin state changes.
|
|
349
|
+
*/
|
|
350
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "updateState", function (_ref2) {
|
|
351
|
+
var stateSubset = _ref2.stateSubset,
|
|
352
|
+
pluginName = _ref2.pluginName,
|
|
353
|
+
performanceOptions = _ref2.performanceOptions;
|
|
354
|
+
_this6.notAppliedState = _objectSpread(_objectSpread({}, _this6.notAppliedState), stateSubset);
|
|
355
|
+
if (_this6.debounce) {
|
|
356
|
+
window.clearTimeout(_this6.debounce);
|
|
357
|
+
}
|
|
358
|
+
var debounce = _this6.props.debounce !== false ? function (fn) {
|
|
359
|
+
return window.setTimeout(fn, 0);
|
|
360
|
+
} : function (fn) {
|
|
361
|
+
return fn();
|
|
362
|
+
};
|
|
363
|
+
_this6.debounce = debounce(function () {
|
|
364
|
+
var measure = "\uD83E\uDD89".concat(pluginName, "::WithPluginState");
|
|
365
|
+
performanceOptions.trackingEnabled && (0, _performanceMeasures.startMeasure)(measure);
|
|
366
|
+
_this6.setState(_this6.notAppliedState, function () {
|
|
367
|
+
performanceOptions.trackingEnabled && (0, _performanceMeasures.stopMeasure)(measure, function (duration) {
|
|
368
|
+
// Each WithPluginState component will fire analytics event no more than once every `samplingLimit` times
|
|
369
|
+
if (++_this6.callsCount % performanceOptions.samplingRate === 0 && duration > performanceOptions.slowThreshold) {
|
|
370
|
+
_this6.dispatchAnalyticsEvent({
|
|
371
|
+
action: _analytics.ACTION.WITH_PLUGIN_STATE_CALLED,
|
|
372
|
+
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
373
|
+
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
374
|
+
attributes: {
|
|
375
|
+
plugin: pluginName,
|
|
376
|
+
duration: duration
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
_this6.debounce = null;
|
|
383
|
+
_this6.notAppliedState = {};
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "dispatchAnalyticsEvent", function (payload) {
|
|
387
|
+
var eventDispatcher = _this6.getEventDispatcher();
|
|
388
|
+
if (eventDispatcher) {
|
|
389
|
+
var dispatch = (0, _eventDispatcher.createDispatch)(eventDispatcher);
|
|
390
|
+
dispatch(_utils.analyticsEventKey, {
|
|
391
|
+
payload: payload
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "onContextUpdate", function () {
|
|
396
|
+
_this6.subscribe(_this6.props);
|
|
397
|
+
});
|
|
398
|
+
_this6.state = _this6.getPluginsStates(_this6.props.plugins, _this6.getEditorView(props, context));
|
|
399
|
+
return _this6;
|
|
400
|
+
}
|
|
401
|
+
(0, _createClass2.default)(WithPluginStateOld, [{
|
|
402
|
+
key: "getEditorView",
|
|
403
|
+
value: function getEditorView(maybeProps, maybeContext) {
|
|
404
|
+
var props = maybeProps || this.props;
|
|
405
|
+
var context = maybeContext || this.context;
|
|
406
|
+
return props.editorView || context && context.editorActions && context.editorActions._privateGetEditorView() || context && context.editorSharedConfig && context.editorSharedConfig.editorView;
|
|
407
|
+
}
|
|
408
|
+
}, {
|
|
409
|
+
key: "getEventDispatcher",
|
|
410
|
+
value: function getEventDispatcher(maybeProps) {
|
|
411
|
+
var props = maybeProps || this.props;
|
|
412
|
+
return props.eventDispatcher || this.context && this.context.editorActions && this.context.editorActions._privateGetEventDispatcher() || this.context && this.context.editorSharedConfig && this.context.editorSharedConfig.eventDispatcher;
|
|
413
|
+
}
|
|
414
|
+
}, {
|
|
415
|
+
key: "getPluginsStates",
|
|
416
|
+
value: function getPluginsStates(plugins, editorView) {
|
|
417
|
+
if (!editorView || !plugins) {
|
|
418
|
+
return {};
|
|
419
|
+
}
|
|
420
|
+
var keys = Object.keys(plugins);
|
|
421
|
+
return keys.reduce(function (acc, propName) {
|
|
422
|
+
var pluginKey = plugins[propName];
|
|
423
|
+
if (!pluginKey) {
|
|
424
|
+
return acc;
|
|
425
|
+
}
|
|
426
|
+
acc[propName] = pluginKey.getState(editorView.state);
|
|
427
|
+
return acc;
|
|
428
|
+
}, {});
|
|
429
|
+
}
|
|
430
|
+
}, {
|
|
431
|
+
key: "subscribe",
|
|
432
|
+
value: function subscribe(props) {
|
|
433
|
+
var _uiTracking$samplingR2,
|
|
434
|
+
_uiTracking$slowThres2,
|
|
435
|
+
_this7 = this;
|
|
436
|
+
var plugins = props.plugins;
|
|
437
|
+
var eventDispatcher = this.getEventDispatcher(props);
|
|
438
|
+
var editorView = this.getEditorView(props);
|
|
439
|
+
if (!eventDispatcher || !editorView || this.isSubscribed) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// TODO: ED-15663
|
|
444
|
+
// Please, do not copy or use this kind of code below
|
|
445
|
+
// @ts-ignore
|
|
446
|
+
var fakePluginKey = {
|
|
447
|
+
key: 'analyticsPlugin$',
|
|
448
|
+
getState: function getState(state) {
|
|
449
|
+
return state['analyticsPlugin$'];
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
var analyticsPlugin = fakePluginKey.getState(editorView.state);
|
|
453
|
+
var uiTracking = analyticsPlugin && analyticsPlugin.performanceTracking ? analyticsPlugin.performanceTracking.uiTracking || {} : {};
|
|
454
|
+
var trackingEnabled = uiTracking.enabled === true;
|
|
455
|
+
var samplingRate = (_uiTracking$samplingR2 = uiTracking.samplingRate) !== null && _uiTracking$samplingR2 !== void 0 ? _uiTracking$samplingR2 : DEFAULT_SAMPLING_RATE;
|
|
456
|
+
var slowThreshold = (_uiTracking$slowThres2 = uiTracking.slowThreshold) !== null && _uiTracking$slowThres2 !== void 0 ? _uiTracking$slowThres2 : DEFAULT_SLOW_THRESHOLD;
|
|
457
|
+
this.isSubscribed = true;
|
|
458
|
+
var pluginsStates = this.getPluginsStates(plugins, editorView);
|
|
459
|
+
this.setState(pluginsStates);
|
|
460
|
+
Object.keys(plugins).forEach(function (propName) {
|
|
461
|
+
var pluginKey = plugins[propName];
|
|
462
|
+
if (!pluginKey) {
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
var pluginName = pluginKey.key;
|
|
466
|
+
var pluginState = pluginsStates[propName];
|
|
467
|
+
var isPluginWithSubscribe = pluginState && pluginState.subscribe;
|
|
468
|
+
var handler = _this7.handlePluginStateChange(propName, pluginName, {
|
|
469
|
+
samplingRate: samplingRate,
|
|
470
|
+
slowThreshold: slowThreshold,
|
|
471
|
+
trackingEnabled: trackingEnabled
|
|
472
|
+
}, isPluginWithSubscribe);
|
|
473
|
+
if (isPluginWithSubscribe) {
|
|
474
|
+
pluginState.subscribe(handler);
|
|
475
|
+
} else {
|
|
476
|
+
eventDispatcher.on(pluginKey.key, handler);
|
|
477
|
+
}
|
|
478
|
+
_this7.listeners[pluginKey.key] = {
|
|
479
|
+
handler: handler,
|
|
480
|
+
pluginKey: pluginKey
|
|
481
|
+
};
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
}, {
|
|
485
|
+
key: "unsubscribe",
|
|
486
|
+
value: function unsubscribe() {
|
|
487
|
+
var _this8 = this;
|
|
488
|
+
var eventDispatcher = this.getEventDispatcher();
|
|
489
|
+
var editorView = this.getEditorView();
|
|
490
|
+
if (!eventDispatcher || !editorView || !this.isSubscribed) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
Object.keys(this.listeners).forEach(function (key) {
|
|
494
|
+
var pluginState = _this8.listeners[key].pluginKey.getState(editorView.state);
|
|
495
|
+
if (pluginState && pluginState.unsubscribe) {
|
|
496
|
+
pluginState.unsubscribe(_this8.listeners[key].handler);
|
|
497
|
+
} else {
|
|
498
|
+
eventDispatcher.off(key, _this8.listeners[key].handler);
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
this.listeners = [];
|
|
502
|
+
}
|
|
248
503
|
}, {
|
|
249
504
|
key: "subscribeToContextUpdates",
|
|
250
505
|
value: function subscribeToContextUpdates(context) {
|
|
@@ -288,10 +543,10 @@ var WithPluginState = exports.WithPluginState = /*#__PURE__*/function (_React$Co
|
|
|
288
543
|
return render(this.state);
|
|
289
544
|
}
|
|
290
545
|
}]);
|
|
291
|
-
return
|
|
546
|
+
return WithPluginStateOld;
|
|
292
547
|
}(_react.default.Component);
|
|
293
|
-
(0, _defineProperty2.default)(
|
|
294
|
-
(0, _defineProperty2.default)(
|
|
548
|
+
(0, _defineProperty2.default)(WithPluginStateOld, "displayName", 'WithPluginState');
|
|
549
|
+
(0, _defineProperty2.default)(WithPluginStateOld, "contextTypes", {
|
|
295
550
|
editorActions: _propTypes.default.object,
|
|
296
551
|
editorSharedConfig: _propTypes.default.object
|
|
297
552
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "93.
|
|
4
|
+
const packageVersion = "93.5.0";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "93.
|
|
16
|
+
const packageVersion = "93.5.0";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
class DropList extends Component {
|
|
@@ -9,7 +9,9 @@ import { css, jsx } from '@emotion/react';
|
|
|
9
9
|
import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext';
|
|
10
10
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
11
11
|
import Button from '@atlaskit/button/standard-button';
|
|
12
|
-
import
|
|
12
|
+
import LegacyExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
13
|
+
import ChevronDownIcon from '@atlaskit/icon/utility/chevron-down';
|
|
14
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
13
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
14
16
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, editorAnalyticsChannel, EVENT_TYPE } from '../../analytics';
|
|
15
17
|
import { ColorPalette, DEFAULT_BORDER_COLOR, getSelectedRowAndColumnFromPalette } from '../../ui-color';
|
|
@@ -22,8 +24,11 @@ import { ArrowKeyNavigationType } from '../ArrowKeyNavigationProvider/types';
|
|
|
22
24
|
const colorPickerButtonWrapper = css({
|
|
23
25
|
position: 'relative'
|
|
24
26
|
});
|
|
25
|
-
const colorPickerExpandContainer =
|
|
26
|
-
|
|
27
|
+
const colorPickerExpandContainer = xcss({
|
|
28
|
+
marginTop: 'space.0',
|
|
29
|
+
marginBottom: 'space.0',
|
|
30
|
+
marginLeft: 'space.negative.050',
|
|
31
|
+
marginRight: 'space.negative.050'
|
|
27
32
|
});
|
|
28
33
|
|
|
29
34
|
// Control the size of color picker buttons and preview
|
|
@@ -208,10 +213,13 @@ const ColorPickerButton = props => {
|
|
|
208
213
|
// TODO: (from codemod) Buttons with "component", "css" or "style" prop can't be automatically migrated with codemods. Please migrate it manually.
|
|
209
214
|
,
|
|
210
215
|
css: buttonStyle,
|
|
211
|
-
iconAfter: jsx(
|
|
212
|
-
|
|
213
|
-
}, jsx(
|
|
214
|
-
|
|
216
|
+
iconAfter: jsx(Box, {
|
|
217
|
+
xcss: colorPickerExpandContainer
|
|
218
|
+
}, jsx(ChevronDownIcon, {
|
|
219
|
+
color: "currentColor",
|
|
220
|
+
spacing: "spacious",
|
|
221
|
+
LEGACY_fallbackIcon: LegacyExpandIcon,
|
|
222
|
+
label: "color-picker-chevron-down"
|
|
215
223
|
})),
|
|
216
224
|
"data-selected-color": props.currentColor
|
|
217
225
|
})), renderPopup());
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
/* eslint-disable no-console */
|
|
6
5
|
|
|
7
6
|
import React, { useCallback, useLayoutEffect, useRef } from 'react';
|
|
8
7
|
|
|
9
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
9
|
import { css, jsx } from '@emotion/react';
|
|
11
10
|
import { ELEMENT_BROWSER_ID } from '../../element-browser';
|
|
12
|
-
import { fullPageMessages
|
|
11
|
+
import { fullPageMessages } from '../../messages';
|
|
12
|
+
import { mediaInsertMessages } from '../../messages/media-insert';
|
|
13
13
|
import { EDIT_AREA_ID } from '../../ui';
|
|
14
14
|
/*
|
|
15
15
|
** The context is used to handle the keydown events of submenus.
|
|
@@ -137,6 +137,11 @@ export const ToolbarArrowKeyNavigationProvider = ({
|
|
|
137
137
|
if (!filteredFocusableElements || (filteredFocusableElements === null || filteredFocusableElements === void 0 ? void 0 : filteredFocusableElements.length) === 0) {
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
|
+
|
|
141
|
+
// If the target element is the media picker then navigation is handled by the media picker
|
|
142
|
+
if (targetElement instanceof HTMLElement && targetElement.closest(`[aria-label="${intl.formatMessage(mediaInsertMessages.mediaPickerPopupAriaLabel)}"]`)) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
140
145
|
if (targetElement instanceof HTMLElement && !((_wrapperRef$current2 = wrapperRef.current) !== null && _wrapperRef$current2 !== void 0 && _wrapperRef$current2.contains(targetElement))) {
|
|
141
146
|
selectedItemIndex.current = -1;
|
|
142
147
|
} else {
|
|
@@ -189,7 +194,7 @@ export const ToolbarArrowKeyNavigationProvider = ({
|
|
|
189
194
|
editorViewDom === null || editorViewDom === void 0 ? void 0 : editorViewDom.removeEventListener('keydown', globalKeyDownHandler);
|
|
190
195
|
}
|
|
191
196
|
};
|
|
192
|
-
}, [selectedItemIndex, wrapperRef, editorView, disableArrowKeyNavigation, handleEscape, childComponentSelector, incrementIndex, decrementIndex, isShortcutToFocusToolbar, editorAppearance, useStickyToolbar]);
|
|
197
|
+
}, [selectedItemIndex, wrapperRef, editorView, disableArrowKeyNavigation, handleEscape, childComponentSelector, incrementIndex, decrementIndex, isShortcutToFocusToolbar, editorAppearance, useStickyToolbar, intl]);
|
|
193
198
|
return jsx("div", {
|
|
194
199
|
css: editorAppearance === 'comment' && centeredToolbarContainer
|
|
195
200
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -197,7 +202,7 @@ export const ToolbarArrowKeyNavigationProvider = ({
|
|
|
197
202
|
className: "custom-key-handler-wrapper",
|
|
198
203
|
ref: wrapperRef,
|
|
199
204
|
role: "toolbar",
|
|
200
|
-
"aria-label": intl.formatMessage(
|
|
205
|
+
"aria-label": intl.formatMessage(fullPageMessages.toolbarLabel),
|
|
201
206
|
"aria-controls": EDIT_AREA_ID
|
|
202
207
|
}, jsx(KeyDownHandlerContext.Provider, {
|
|
203
208
|
value: submenuKeydownHandleContext
|