@atlaskit/editor-common 108.7.0 → 109.0.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 +18 -0
- package/dist/cjs/card/MediaAndEmbedsToolbar/index.js +2 -1
- package/dist/cjs/extensibility/Extension/Extension/index.js +6 -23
- package/dist/cjs/extensibility/Extension/InlineExtension/index.js +11 -28
- package/dist/cjs/extensibility/MultiBodiedExtension/index.js +5 -18
- package/dist/cjs/hooks/index.js +0 -7
- package/dist/cjs/hooks/usePluginStateEffect.js +1 -11
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/card/MediaAndEmbedsToolbar/index.js +2 -1
- package/dist/es2019/extensibility/Extension/Extension/index.js +9 -28
- package/dist/es2019/extensibility/Extension/InlineExtension/index.js +12 -31
- package/dist/es2019/extensibility/MultiBodiedExtension/index.js +8 -23
- package/dist/es2019/hooks/index.js +0 -1
- package/dist/es2019/hooks/usePluginStateEffect.js +2 -12
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/card/MediaAndEmbedsToolbar/index.js +2 -1
- package/dist/esm/extensibility/Extension/Extension/index.js +7 -24
- package/dist/esm/extensibility/Extension/InlineExtension/index.js +12 -29
- package/dist/esm/extensibility/MultiBodiedExtension/index.js +6 -19
- package/dist/esm/hooks/index.js +0 -1
- package/dist/esm/hooks/usePluginStateEffect.js +2 -12
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/hooks/index.d.ts +0 -1
- package/dist/types-ts4.5/hooks/index.d.ts +0 -1
- package/package.json +3 -3
- package/dist/cjs/hooks/sharedPluginStateHookMigratorFactory.js +0 -23
- package/dist/es2019/hooks/sharedPluginStateHookMigratorFactory.js +0 -16
- package/dist/esm/hooks/sharedPluginStateHookMigratorFactory.js +0 -18
- package/dist/types/hooks/sharedPluginStateHookMigratorFactory.d.ts +0 -11
- package/dist/types-ts4.5/hooks/sharedPluginStateHookMigratorFactory.d.ts +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 109.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`0d0fe7a300841`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0d0fe7a300841) -
|
|
8
|
+
Cleanup platform_editor_usesharedpluginstatewithselector experiment
|
|
9
|
+
|
|
10
|
+
- BREAKING CHANGE: sharedPluginStateHookMigratorFactory is deleted from @atlaskit/editor-common
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`3764ac0028e9d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3764ac0028e9d) -
|
|
15
|
+
[ux] CONFCLOUD-68427-allow-elements-in-expands-to-be-aligned
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 108.7.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -27,6 +27,7 @@ var _alignImageLeft2 = _interopRequireDefault(require("@atlaskit/icon/glyph/edit
|
|
|
27
27
|
var _alignImageRight2 = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/align-image-right"));
|
|
28
28
|
var _mediaWrapLeft = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/media-wrap-left"));
|
|
29
29
|
var _mediaWrapRight = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/media-wrap-right"));
|
|
30
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
30
31
|
var _analytics = require("../../analytics");
|
|
31
32
|
var _coreUtils = require("../../core-utils");
|
|
32
33
|
var _keymaps = require("../../keymaps");
|
|
@@ -253,7 +254,7 @@ var mapIconsToDropdownOptions = function mapIconsToDropdownOptions(_ref2) {
|
|
|
253
254
|
};
|
|
254
255
|
var shouldHideLayoutToolbar = function shouldHideLayoutToolbar(selection, _ref3, allowResizingInTables) {
|
|
255
256
|
var nodes = _ref3.nodes;
|
|
256
|
-
return (0, _utils.hasParentNodeOfType)([nodes.bodiedExtension, nodes.extensionFrame, nodes.listItem, nodes.expand, nodes.nestedExpand]
|
|
257
|
+
return (0, _utils.hasParentNodeOfType)([nodes.bodiedExtension, nodes.extensionFrame, nodes.listItem].concat((0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('editor_enable_image_alignment_in_expand', 'isEnabled', true) ? [] : [nodes.expand, nodes.nestedExpand]), (0, _toConsumableArray2.default)(allowResizingInTables ? [] : [nodes.table])).filter(Boolean))(selection);
|
|
257
258
|
};
|
|
258
259
|
var buildLayoutButtons = function buildLayoutButtons(state, intl, nodeType, widthPluginDependencyApi, analyticsApi, allowResizing, allowResizingInTables) {
|
|
259
260
|
var allowWrapping = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
@@ -221,7 +221,8 @@ function ExtensionWithPluginState(props) {
|
|
|
221
221
|
ref: handleContentDOMRef
|
|
222
222
|
}))))));
|
|
223
223
|
}
|
|
224
|
-
var
|
|
224
|
+
var Extension = function Extension(props) {
|
|
225
|
+
var pluginInjectionApi = props.pluginInjectionApi;
|
|
225
226
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['width'], function (states) {
|
|
226
227
|
var _states$widthState$wi, _states$widthState, _states$widthState2;
|
|
227
228
|
return {
|
|
@@ -231,32 +232,14 @@ var useExtensionSharedPluginState = (0, _hooks.sharedPluginStateHookMigratorFact
|
|
|
231
232
|
}),
|
|
232
233
|
lineLength = _useSharedPluginState.lineLength,
|
|
233
234
|
width = _useSharedPluginState.width;
|
|
234
|
-
|
|
235
|
+
|
|
236
|
+
// Ignored via go/ees005
|
|
237
|
+
return (0, _react2.jsx)(ExtensionWithPluginState, (0, _extends2.default)({
|
|
235
238
|
widthState: {
|
|
236
239
|
width: width !== null && width !== void 0 ? width : 0,
|
|
237
240
|
lineLength: lineLength
|
|
238
241
|
}
|
|
239
|
-
|
|
240
|
-
}, function (pluginInjectionApi) {
|
|
241
|
-
var _widthState$width;
|
|
242
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['width']),
|
|
243
|
-
widthState = _useSharedPluginState2.widthState;
|
|
244
|
-
return {
|
|
245
|
-
widthState: {
|
|
246
|
-
width: (_widthState$width = widthState === null || widthState === void 0 ? void 0 : widthState.width) !== null && _widthState$width !== void 0 ? _widthState$width : 0,
|
|
247
|
-
lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
});
|
|
251
|
-
var Extension = function Extension(props) {
|
|
252
|
-
var pluginInjectionApi = props.pluginInjectionApi;
|
|
253
|
-
var _useExtensionSharedPl = useExtensionSharedPluginState(pluginInjectionApi),
|
|
254
|
-
widthState = _useExtensionSharedPl.widthState;
|
|
255
|
-
|
|
256
|
-
// Ignored via go/ees005
|
|
257
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
258
|
-
return (0, _react2.jsx)(ExtensionWithPluginState, (0, _extends2.default)({
|
|
259
|
-
widthState: widthState
|
|
242
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
260
243
|
}, props));
|
|
261
244
|
};
|
|
262
245
|
var _default = exports.default = (0, _ui.overflowShadow)(Extension, {
|
|
@@ -24,28 +24,6 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
24
24
|
|
|
25
25
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
|
|
27
|
-
var useInlineExtensionSharedPluginState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
28
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['width'], function (states) {
|
|
29
|
-
var _states$widthState;
|
|
30
|
-
return {
|
|
31
|
-
width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width
|
|
32
|
-
};
|
|
33
|
-
}),
|
|
34
|
-
width = _useSharedPluginState.width;
|
|
35
|
-
return {
|
|
36
|
-
widthState: {
|
|
37
|
-
width: width
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}, function (pluginInjectionApi) {
|
|
41
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['width']),
|
|
42
|
-
widthState = _useSharedPluginState2.widthState;
|
|
43
|
-
return {
|
|
44
|
-
widthState: {
|
|
45
|
-
width: widthState === null || widthState === void 0 ? void 0 : widthState.width
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
27
|
var InlineExtension = function InlineExtension(props) {
|
|
50
28
|
var node = props.node,
|
|
51
29
|
pluginInjectionApi = props.pluginInjectionApi,
|
|
@@ -57,8 +35,13 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
57
35
|
isLivePageViewMode = props.isLivePageViewMode;
|
|
58
36
|
var _ref = macroInteractionDesignFeatureFlags || {},
|
|
59
37
|
showMacroInteractionDesignUpdates = _ref.showMacroInteractionDesignUpdates;
|
|
60
|
-
var
|
|
61
|
-
|
|
38
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['width'], function (states) {
|
|
39
|
+
var _states$widthState;
|
|
40
|
+
return {
|
|
41
|
+
width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width
|
|
42
|
+
};
|
|
43
|
+
}),
|
|
44
|
+
width = _useSharedPluginState.width;
|
|
62
45
|
var hasChildren = !!children;
|
|
63
46
|
var classNames = (0, _classnames.default)('extension-container', 'inline', {
|
|
64
47
|
'with-overlay': !showMacroInteractionDesignUpdates,
|
|
@@ -68,12 +51,12 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
68
51
|
});
|
|
69
52
|
var rendererContainerWidth = 0;
|
|
70
53
|
if ((0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
|
|
71
|
-
if (
|
|
72
|
-
var padding =
|
|
73
|
-
rendererContainerWidth =
|
|
54
|
+
if (width) {
|
|
55
|
+
var padding = width > _editorSharedStyles.akEditorFullPageNarrowBreakout ? (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() : _editorSharedStyles.akEditorGutterPaddingReduced;
|
|
56
|
+
rendererContainerWidth = width - padding * 2;
|
|
74
57
|
}
|
|
75
58
|
} else {
|
|
76
|
-
rendererContainerWidth =
|
|
59
|
+
rendererContainerWidth = width ? width - (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2 : 0;
|
|
77
60
|
}
|
|
78
61
|
var handleMouseEvent = function handleMouseEvent(didHover) {
|
|
79
62
|
if (setIsNodeHovered) {
|
|
@@ -239,7 +239,8 @@ var MultiBodiedExtensionWithWidth = function MultiBodiedExtensionWithWidth(_ref2
|
|
|
239
239
|
"data-testid": "multiBodiedExtension-navigation"
|
|
240
240
|
}, extensionHandlerResult), childrenContainer))));
|
|
241
241
|
};
|
|
242
|
-
var
|
|
242
|
+
var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
243
|
+
var pluginInjectionApi = props.pluginInjectionApi;
|
|
243
244
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['width'], function (states) {
|
|
244
245
|
var _states$widthState, _states$widthState2;
|
|
245
246
|
return {
|
|
@@ -249,27 +250,13 @@ var useMultiBodyExtensionSharedPluginState = (0, _hooks.sharedPluginStateHookMig
|
|
|
249
250
|
}),
|
|
250
251
|
width = _useSharedPluginState.width,
|
|
251
252
|
lineLength = _useSharedPluginState.lineLength;
|
|
252
|
-
|
|
253
|
+
// Ignored via go/ees005
|
|
254
|
+
return (0, _react2.jsx)(MultiBodiedExtensionWithWidth, (0, _extends2.default)({
|
|
253
255
|
widthState: width === undefined ? undefined : {
|
|
254
256
|
width: width,
|
|
255
257
|
lineLength: lineLength
|
|
256
258
|
}
|
|
257
|
-
|
|
258
|
-
}, function (pluginInjectionApi) {
|
|
259
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['width']),
|
|
260
|
-
widthState = _useSharedPluginState2.widthState;
|
|
261
|
-
return {
|
|
262
|
-
widthState: widthState
|
|
263
|
-
};
|
|
264
|
-
});
|
|
265
|
-
var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
266
|
-
var pluginInjectionApi = props.pluginInjectionApi;
|
|
267
|
-
var _useMultiBodyExtensio = useMultiBodyExtensionSharedPluginState(pluginInjectionApi),
|
|
268
|
-
widthState = _useMultiBodyExtensio.widthState;
|
|
269
|
-
// Ignored via go/ees005
|
|
270
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
271
|
-
return (0, _react2.jsx)(MultiBodiedExtensionWithWidth, (0, _extends2.default)({
|
|
272
|
-
widthState: widthState
|
|
259
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
273
260
|
}, props));
|
|
274
261
|
};
|
|
275
262
|
var _default = exports.default = MultiBodiedExtension;
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -4,12 +4,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
Object.defineProperty(exports, "sharedPluginStateHookMigratorFactory", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _sharedPluginStateHookMigratorFactory.sharedPluginStateHookMigratorFactory;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
7
|
Object.defineProperty(exports, "useConstructor", {
|
|
14
8
|
enumerable: true,
|
|
15
9
|
get: function get() {
|
|
@@ -37,5 +31,4 @@ Object.defineProperty(exports, "useSharedPluginStateWithSelector", {
|
|
|
37
31
|
var _usePreviousState = _interopRequireDefault(require("./usePreviousState"));
|
|
38
32
|
var _useConstructor = _interopRequireDefault(require("./useConstructor"));
|
|
39
33
|
var _useSharedPluginState = require("./useSharedPluginState");
|
|
40
|
-
var _sharedPluginStateHookMigratorFactory = require("./sharedPluginStateHookMigratorFactory");
|
|
41
34
|
var _useSharedPluginStateWithSelector = require("./useSharedPluginStateWithSelector");
|
|
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
12
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
12
|
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; }
|
|
14
13
|
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; }
|
|
15
14
|
// Ignored via go/ees005
|
|
@@ -107,16 +106,7 @@ function usePluginStateEffectInternal(externalPlugins, effect) {
|
|
|
107
106
|
// We should store the latest effect in a reference so it is more intuitive to the user
|
|
108
107
|
// and we are not causing a memory leak by having references to old state.
|
|
109
108
|
(0, _react.useLayoutEffect)(function () {
|
|
110
|
-
if (options.disabled
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
latestEffect.current = (0, _debounce.default)(effect);
|
|
114
|
-
return function () {
|
|
115
|
-
latestEffect.current = undefined;
|
|
116
|
-
};
|
|
117
|
-
}, [effect, options.disabled]);
|
|
118
|
-
(0, _react.useEffect)(function () {
|
|
119
|
-
if (options.disabled || (0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true)) {
|
|
109
|
+
if (options.disabled) {
|
|
120
110
|
return;
|
|
121
111
|
}
|
|
122
112
|
latestEffect.current = (0, _debounce.default)(effect);
|
|
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
16
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "108.
|
|
19
|
+
var packageVersion = "108.7.0";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// Ignored via go/ees007
|
|
@@ -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 = "108.
|
|
27
|
+
var packageVersion = "108.7.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -17,6 +17,7 @@ import EditorAlignImageLeft from '@atlaskit/icon/glyph/editor/align-image-left';
|
|
|
17
17
|
import EditorAlignImageRight from '@atlaskit/icon/glyph/editor/align-image-right';
|
|
18
18
|
import WrapLeftIcon from '@atlaskit/icon/glyph/editor/media-wrap-left';
|
|
19
19
|
import WrapRightIcon from '@atlaskit/icon/glyph/editor/media-wrap-right';
|
|
20
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
20
21
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics';
|
|
21
22
|
import { insideTable } from '../../core-utils';
|
|
22
23
|
import { alignCenter, alignLeft, alignRight, tooltip } from '../../keymaps';
|
|
@@ -249,7 +250,7 @@ const mapIconsToDropdownOptions = ({
|
|
|
249
250
|
const shouldHideLayoutToolbar = (selection, {
|
|
250
251
|
nodes
|
|
251
252
|
}, allowResizingInTables) => {
|
|
252
|
-
return hasParentNodeOfType([nodes.bodiedExtension, nodes.extensionFrame, nodes.listItem, nodes.expand, nodes.nestedExpand, ...(allowResizingInTables ? [] : [nodes.table])].filter(Boolean))(selection);
|
|
253
|
+
return hasParentNodeOfType([nodes.bodiedExtension, nodes.extensionFrame, nodes.listItem, ...(expValEquals('editor_enable_image_alignment_in_expand', 'isEnabled', true) ? [] : [nodes.expand, nodes.nestedExpand]), ...(allowResizingInTables ? [] : [nodes.table])].filter(Boolean))(selection);
|
|
253
254
|
};
|
|
254
255
|
const buildLayoutButtons = (state, intl, nodeType, widthPluginDependencyApi, analyticsApi, allowResizing, allowResizingInTables, allowWrapping = true, allowAlignment = true, isChangingLayoutDisabled, allowPixelResizing) => {
|
|
255
256
|
const {
|
|
@@ -11,7 +11,7 @@ import { jsx } from '@emotion/react';
|
|
|
11
11
|
import classnames from 'classnames';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
-
import {
|
|
14
|
+
import { useSharedPluginStateWithSelector } from '../../../hooks';
|
|
15
15
|
import { overflowShadow } from '../../../ui';
|
|
16
16
|
import { calculateBreakoutStyles } from '../../../utils';
|
|
17
17
|
import { LegacyContentHeader } from '../LegacyContentHeader';
|
|
@@ -213,7 +213,10 @@ function ExtensionWithPluginState(props) {
|
|
|
213
213
|
ref: handleContentDOMRef
|
|
214
214
|
}))))));
|
|
215
215
|
}
|
|
216
|
-
const
|
|
216
|
+
const Extension = props => {
|
|
217
|
+
const {
|
|
218
|
+
pluginInjectionApi
|
|
219
|
+
} = props;
|
|
217
220
|
const {
|
|
218
221
|
lineLength,
|
|
219
222
|
width
|
|
@@ -224,36 +227,14 @@ const useExtensionSharedPluginState = sharedPluginStateHookMigratorFactory(plugi
|
|
|
224
227
|
lineLength: (_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.lineLength
|
|
225
228
|
};
|
|
226
229
|
});
|
|
227
|
-
|
|
230
|
+
|
|
231
|
+
// Ignored via go/ees005
|
|
232
|
+
return jsx(ExtensionWithPluginState, _extends({
|
|
228
233
|
widthState: {
|
|
229
234
|
width: width !== null && width !== void 0 ? width : 0,
|
|
230
235
|
lineLength
|
|
231
236
|
}
|
|
232
|
-
|
|
233
|
-
}, pluginInjectionApi => {
|
|
234
|
-
var _widthState$width;
|
|
235
|
-
const {
|
|
236
|
-
widthState
|
|
237
|
-
} = useSharedPluginState(pluginInjectionApi, ['width']);
|
|
238
|
-
return {
|
|
239
|
-
widthState: {
|
|
240
|
-
width: (_widthState$width = widthState === null || widthState === void 0 ? void 0 : widthState.width) !== null && _widthState$width !== void 0 ? _widthState$width : 0,
|
|
241
|
-
lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
});
|
|
245
|
-
const Extension = props => {
|
|
246
|
-
const {
|
|
247
|
-
pluginInjectionApi
|
|
248
|
-
} = props;
|
|
249
|
-
const {
|
|
250
|
-
widthState
|
|
251
|
-
} = useExtensionSharedPluginState(pluginInjectionApi);
|
|
252
|
-
|
|
253
|
-
// Ignored via go/ees005
|
|
254
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
255
|
-
return jsx(ExtensionWithPluginState, _extends({
|
|
256
|
-
widthState: widthState
|
|
237
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
257
238
|
}, props));
|
|
258
239
|
};
|
|
259
240
|
export default overflowShadow(Extension, {
|
|
@@ -9,35 +9,11 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
import classnames from 'classnames';
|
|
10
10
|
import { akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
11
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
|
-
import {
|
|
12
|
+
import { useSharedPluginStateWithSelector } from '../../../hooks';
|
|
13
13
|
import { createWidthContext, WidthContext } from '../../../ui';
|
|
14
14
|
import ExtensionLozenge from '../Lozenge';
|
|
15
15
|
import { overlay } from '../styles';
|
|
16
16
|
import { inlineWrapperStyles, wrapperStyle } from './styles';
|
|
17
|
-
const useInlineExtensionSharedPluginState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
18
|
-
const {
|
|
19
|
-
width
|
|
20
|
-
} = useSharedPluginStateWithSelector(pluginInjectionApi, ['width'], states => {
|
|
21
|
-
var _states$widthState;
|
|
22
|
-
return {
|
|
23
|
-
width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
return {
|
|
27
|
-
widthState: {
|
|
28
|
-
width
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}, pluginInjectionApi => {
|
|
32
|
-
const {
|
|
33
|
-
widthState
|
|
34
|
-
} = useSharedPluginState(pluginInjectionApi, ['width']);
|
|
35
|
-
return {
|
|
36
|
-
widthState: {
|
|
37
|
-
width: widthState === null || widthState === void 0 ? void 0 : widthState.width
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
17
|
const InlineExtension = props => {
|
|
42
18
|
const {
|
|
43
19
|
node,
|
|
@@ -53,8 +29,13 @@ const InlineExtension = props => {
|
|
|
53
29
|
showMacroInteractionDesignUpdates
|
|
54
30
|
} = macroInteractionDesignFeatureFlags || {};
|
|
55
31
|
const {
|
|
56
|
-
|
|
57
|
-
} =
|
|
32
|
+
width
|
|
33
|
+
} = useSharedPluginStateWithSelector(pluginInjectionApi, ['width'], states => {
|
|
34
|
+
var _states$widthState;
|
|
35
|
+
return {
|
|
36
|
+
width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width
|
|
37
|
+
};
|
|
38
|
+
});
|
|
58
39
|
const hasChildren = !!children;
|
|
59
40
|
const classNames = classnames('extension-container', 'inline', {
|
|
60
41
|
'with-overlay': !showMacroInteractionDesignUpdates,
|
|
@@ -64,12 +45,12 @@ const InlineExtension = props => {
|
|
|
64
45
|
});
|
|
65
46
|
let rendererContainerWidth = 0;
|
|
66
47
|
if (expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
|
|
67
|
-
if (
|
|
68
|
-
const padding =
|
|
69
|
-
rendererContainerWidth =
|
|
48
|
+
if (width) {
|
|
49
|
+
const padding = width > akEditorFullPageNarrowBreakout ? akEditorGutterPaddingDynamic() : akEditorGutterPaddingReduced;
|
|
50
|
+
rendererContainerWidth = width - padding * 2;
|
|
70
51
|
}
|
|
71
52
|
} else {
|
|
72
|
-
rendererContainerWidth =
|
|
53
|
+
rendererContainerWidth = width ? width - akEditorGutterPaddingDynamic() * 2 : 0;
|
|
73
54
|
}
|
|
74
55
|
const handleMouseEvent = didHover => {
|
|
75
56
|
if (setIsNodeHovered) {
|
|
@@ -11,7 +11,7 @@ import React, { Fragment, useState } from 'react';
|
|
|
11
11
|
import { css, jsx } from '@emotion/react';
|
|
12
12
|
import classnames from 'classnames';
|
|
13
13
|
import EditorFileIcon from '@atlaskit/icon/core/migration/file--editor-file';
|
|
14
|
-
import {
|
|
14
|
+
import { useSharedPluginStateWithSelector } from '../../hooks';
|
|
15
15
|
import { removeMarginsAndBorder, sharedMultiBodiedExtensionStyles } from '../../ui/MultiBodiedExtension';
|
|
16
16
|
import { calculateBreakoutStyles, getExtensionLozengeData } from '../../utils';
|
|
17
17
|
import ExtensionLozenge from '../Extension/Lozenge';
|
|
@@ -226,7 +226,10 @@ const MultiBodiedExtensionWithWidth = ({
|
|
|
226
226
|
"data-testid": "multiBodiedExtension-navigation"
|
|
227
227
|
}, extensionHandlerResult), childrenContainer))));
|
|
228
228
|
};
|
|
229
|
-
const
|
|
229
|
+
const MultiBodiedExtension = props => {
|
|
230
|
+
const {
|
|
231
|
+
pluginInjectionApi
|
|
232
|
+
} = props;
|
|
230
233
|
const {
|
|
231
234
|
width,
|
|
232
235
|
lineLength
|
|
@@ -237,31 +240,13 @@ const useMultiBodyExtensionSharedPluginState = sharedPluginStateHookMigratorFact
|
|
|
237
240
|
lineLength: (_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.lineLength
|
|
238
241
|
};
|
|
239
242
|
});
|
|
240
|
-
|
|
243
|
+
// Ignored via go/ees005
|
|
244
|
+
return jsx(MultiBodiedExtensionWithWidth, _extends({
|
|
241
245
|
widthState: width === undefined ? undefined : {
|
|
242
246
|
width,
|
|
243
247
|
lineLength
|
|
244
248
|
}
|
|
245
|
-
|
|
246
|
-
}, pluginInjectionApi => {
|
|
247
|
-
const {
|
|
248
|
-
widthState
|
|
249
|
-
} = useSharedPluginState(pluginInjectionApi, ['width']);
|
|
250
|
-
return {
|
|
251
|
-
widthState
|
|
252
|
-
};
|
|
253
|
-
});
|
|
254
|
-
const MultiBodiedExtension = props => {
|
|
255
|
-
const {
|
|
256
|
-
pluginInjectionApi
|
|
257
|
-
} = props;
|
|
258
|
-
const {
|
|
259
|
-
widthState
|
|
260
|
-
} = useMultiBodyExtensionSharedPluginState(pluginInjectionApi);
|
|
261
|
-
// Ignored via go/ees005
|
|
262
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
263
|
-
return jsx(MultiBodiedExtensionWithWidth, _extends({
|
|
264
|
-
widthState: widthState
|
|
249
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
265
250
|
}, props));
|
|
266
251
|
};
|
|
267
252
|
export default MultiBodiedExtension;
|
|
@@ -4,5 +4,4 @@
|
|
|
4
4
|
export { default as usePreviousState } from './usePreviousState';
|
|
5
5
|
export { default as useConstructor } from './useConstructor';
|
|
6
6
|
export { useSharedPluginState } from './useSharedPluginState';
|
|
7
|
-
export { sharedPluginStateHookMigratorFactory } from './sharedPluginStateHookMigratorFactory';
|
|
8
7
|
export { useSharedPluginStateWithSelector } from './useSharedPluginStateWithSelector';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useLayoutEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import debounce from 'lodash/debounce';
|
|
3
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
3
|
|
|
5
4
|
// Ignored via go/ees005
|
|
6
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -90,16 +89,7 @@ function usePluginStateEffectInternal(externalPlugins, effect, options = {}) {
|
|
|
90
89
|
// We should store the latest effect in a reference so it is more intuitive to the user
|
|
91
90
|
// and we are not causing a memory leak by having references to old state.
|
|
92
91
|
useLayoutEffect(() => {
|
|
93
|
-
if (options.disabled
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
latestEffect.current = debounce(effect);
|
|
97
|
-
return () => {
|
|
98
|
-
latestEffect.current = undefined;
|
|
99
|
-
};
|
|
100
|
-
}, [effect, options.disabled]);
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
if (options.disabled || expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true)) {
|
|
92
|
+
if (options.disabled) {
|
|
103
93
|
return;
|
|
104
94
|
}
|
|
105
95
|
latestEffect.current = debounce(effect);
|
|
@@ -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 = "108.
|
|
4
|
+
const packageVersion = "108.7.0";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// Ignored via go/ees007
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "108.
|
|
17
|
+
const packageVersion = "108.7.0";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -21,6 +21,7 @@ import EditorAlignImageLeft from '@atlaskit/icon/glyph/editor/align-image-left';
|
|
|
21
21
|
import EditorAlignImageRight from '@atlaskit/icon/glyph/editor/align-image-right';
|
|
22
22
|
import WrapLeftIcon from '@atlaskit/icon/glyph/editor/media-wrap-left';
|
|
23
23
|
import WrapRightIcon from '@atlaskit/icon/glyph/editor/media-wrap-right';
|
|
24
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
24
25
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics';
|
|
25
26
|
import { insideTable } from '../../core-utils';
|
|
26
27
|
import { alignCenter, alignLeft, alignRight, tooltip } from '../../keymaps';
|
|
@@ -245,7 +246,7 @@ var mapIconsToDropdownOptions = function mapIconsToDropdownOptions(_ref2) {
|
|
|
245
246
|
};
|
|
246
247
|
var shouldHideLayoutToolbar = function shouldHideLayoutToolbar(selection, _ref3, allowResizingInTables) {
|
|
247
248
|
var nodes = _ref3.nodes;
|
|
248
|
-
return hasParentNodeOfType([nodes.bodiedExtension, nodes.extensionFrame, nodes.listItem, nodes.expand, nodes.nestedExpand]
|
|
249
|
+
return hasParentNodeOfType([nodes.bodiedExtension, nodes.extensionFrame, nodes.listItem].concat(_toConsumableArray(expValEquals('editor_enable_image_alignment_in_expand', 'isEnabled', true) ? [] : [nodes.expand, nodes.nestedExpand]), _toConsumableArray(allowResizingInTables ? [] : [nodes.table])).filter(Boolean))(selection);
|
|
249
250
|
};
|
|
250
251
|
var buildLayoutButtons = function buildLayoutButtons(state, intl, nodeType, widthPluginDependencyApi, analyticsApi, allowResizing, allowResizingInTables) {
|
|
251
252
|
var allowWrapping = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
@@ -16,7 +16,7 @@ import { jsx } from '@emotion/react';
|
|
|
16
16
|
import classnames from 'classnames';
|
|
17
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
18
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
19
|
-
import {
|
|
19
|
+
import { useSharedPluginStateWithSelector } from '../../../hooks';
|
|
20
20
|
import { overflowShadow } from '../../../ui';
|
|
21
21
|
import { calculateBreakoutStyles } from '../../../utils';
|
|
22
22
|
import { LegacyContentHeader } from '../LegacyContentHeader';
|
|
@@ -214,7 +214,8 @@ function ExtensionWithPluginState(props) {
|
|
|
214
214
|
ref: handleContentDOMRef
|
|
215
215
|
}))))));
|
|
216
216
|
}
|
|
217
|
-
var
|
|
217
|
+
var Extension = function Extension(props) {
|
|
218
|
+
var pluginInjectionApi = props.pluginInjectionApi;
|
|
218
219
|
var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['width'], function (states) {
|
|
219
220
|
var _states$widthState$wi, _states$widthState, _states$widthState2;
|
|
220
221
|
return {
|
|
@@ -224,32 +225,14 @@ var useExtensionSharedPluginState = sharedPluginStateHookMigratorFactory(functio
|
|
|
224
225
|
}),
|
|
225
226
|
lineLength = _useSharedPluginState.lineLength,
|
|
226
227
|
width = _useSharedPluginState.width;
|
|
227
|
-
|
|
228
|
+
|
|
229
|
+
// Ignored via go/ees005
|
|
230
|
+
return jsx(ExtensionWithPluginState, _extends({
|
|
228
231
|
widthState: {
|
|
229
232
|
width: width !== null && width !== void 0 ? width : 0,
|
|
230
233
|
lineLength: lineLength
|
|
231
234
|
}
|
|
232
|
-
|
|
233
|
-
}, function (pluginInjectionApi) {
|
|
234
|
-
var _widthState$width;
|
|
235
|
-
var _useSharedPluginState2 = useSharedPluginState(pluginInjectionApi, ['width']),
|
|
236
|
-
widthState = _useSharedPluginState2.widthState;
|
|
237
|
-
return {
|
|
238
|
-
widthState: {
|
|
239
|
-
width: (_widthState$width = widthState === null || widthState === void 0 ? void 0 : widthState.width) !== null && _widthState$width !== void 0 ? _widthState$width : 0,
|
|
240
|
-
lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
});
|
|
244
|
-
var Extension = function Extension(props) {
|
|
245
|
-
var pluginInjectionApi = props.pluginInjectionApi;
|
|
246
|
-
var _useExtensionSharedPl = useExtensionSharedPluginState(pluginInjectionApi),
|
|
247
|
-
widthState = _useExtensionSharedPl.widthState;
|
|
248
|
-
|
|
249
|
-
// Ignored via go/ees005
|
|
250
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
251
|
-
return jsx(ExtensionWithPluginState, _extends({
|
|
252
|
-
widthState: widthState
|
|
235
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
253
236
|
}, props));
|
|
254
237
|
};
|
|
255
238
|
export default overflowShadow(Extension, {
|
|
@@ -9,33 +9,11 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
import classnames from 'classnames';
|
|
10
10
|
import { akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
11
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
|
-
import {
|
|
12
|
+
import { useSharedPluginStateWithSelector } from '../../../hooks';
|
|
13
13
|
import { createWidthContext, WidthContext } from '../../../ui';
|
|
14
14
|
import ExtensionLozenge from '../Lozenge';
|
|
15
15
|
import { overlay } from '../styles';
|
|
16
16
|
import { inlineWrapperStyles, wrapperStyle } from './styles';
|
|
17
|
-
var useInlineExtensionSharedPluginState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
|
|
18
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['width'], function (states) {
|
|
19
|
-
var _states$widthState;
|
|
20
|
-
return {
|
|
21
|
-
width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width
|
|
22
|
-
};
|
|
23
|
-
}),
|
|
24
|
-
width = _useSharedPluginState.width;
|
|
25
|
-
return {
|
|
26
|
-
widthState: {
|
|
27
|
-
width: width
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}, function (pluginInjectionApi) {
|
|
31
|
-
var _useSharedPluginState2 = useSharedPluginState(pluginInjectionApi, ['width']),
|
|
32
|
-
widthState = _useSharedPluginState2.widthState;
|
|
33
|
-
return {
|
|
34
|
-
widthState: {
|
|
35
|
-
width: widthState === null || widthState === void 0 ? void 0 : widthState.width
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
17
|
var InlineExtension = function InlineExtension(props) {
|
|
40
18
|
var node = props.node,
|
|
41
19
|
pluginInjectionApi = props.pluginInjectionApi,
|
|
@@ -47,8 +25,13 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
47
25
|
isLivePageViewMode = props.isLivePageViewMode;
|
|
48
26
|
var _ref = macroInteractionDesignFeatureFlags || {},
|
|
49
27
|
showMacroInteractionDesignUpdates = _ref.showMacroInteractionDesignUpdates;
|
|
50
|
-
var
|
|
51
|
-
|
|
28
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['width'], function (states) {
|
|
29
|
+
var _states$widthState;
|
|
30
|
+
return {
|
|
31
|
+
width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width
|
|
32
|
+
};
|
|
33
|
+
}),
|
|
34
|
+
width = _useSharedPluginState.width;
|
|
52
35
|
var hasChildren = !!children;
|
|
53
36
|
var classNames = classnames('extension-container', 'inline', {
|
|
54
37
|
'with-overlay': !showMacroInteractionDesignUpdates,
|
|
@@ -58,12 +41,12 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
58
41
|
});
|
|
59
42
|
var rendererContainerWidth = 0;
|
|
60
43
|
if (expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
|
|
61
|
-
if (
|
|
62
|
-
var padding =
|
|
63
|
-
rendererContainerWidth =
|
|
44
|
+
if (width) {
|
|
45
|
+
var padding = width > akEditorFullPageNarrowBreakout ? akEditorGutterPaddingDynamic() : akEditorGutterPaddingReduced;
|
|
46
|
+
rendererContainerWidth = width - padding * 2;
|
|
64
47
|
}
|
|
65
48
|
} else {
|
|
66
|
-
rendererContainerWidth =
|
|
49
|
+
rendererContainerWidth = width ? width - akEditorGutterPaddingDynamic() * 2 : 0;
|
|
67
50
|
}
|
|
68
51
|
var handleMouseEvent = function handleMouseEvent(didHover) {
|
|
69
52
|
if (setIsNodeHovered) {
|
|
@@ -16,7 +16,7 @@ import React, { Fragment, useState } from 'react';
|
|
|
16
16
|
import { css, jsx } from '@emotion/react';
|
|
17
17
|
import classnames from 'classnames';
|
|
18
18
|
import EditorFileIcon from '@atlaskit/icon/core/migration/file--editor-file';
|
|
19
|
-
import {
|
|
19
|
+
import { useSharedPluginStateWithSelector } from '../../hooks';
|
|
20
20
|
import { removeMarginsAndBorder, sharedMultiBodiedExtensionStyles } from '../../ui/MultiBodiedExtension';
|
|
21
21
|
import { calculateBreakoutStyles, getExtensionLozengeData } from '../../utils';
|
|
22
22
|
import ExtensionLozenge from '../Extension/Lozenge';
|
|
@@ -232,7 +232,8 @@ var MultiBodiedExtensionWithWidth = function MultiBodiedExtensionWithWidth(_ref2
|
|
|
232
232
|
"data-testid": "multiBodiedExtension-navigation"
|
|
233
233
|
}, extensionHandlerResult), childrenContainer))));
|
|
234
234
|
};
|
|
235
|
-
var
|
|
235
|
+
var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
236
|
+
var pluginInjectionApi = props.pluginInjectionApi;
|
|
236
237
|
var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['width'], function (states) {
|
|
237
238
|
var _states$widthState, _states$widthState2;
|
|
238
239
|
return {
|
|
@@ -242,27 +243,13 @@ var useMultiBodyExtensionSharedPluginState = sharedPluginStateHookMigratorFactor
|
|
|
242
243
|
}),
|
|
243
244
|
width = _useSharedPluginState.width,
|
|
244
245
|
lineLength = _useSharedPluginState.lineLength;
|
|
245
|
-
|
|
246
|
+
// Ignored via go/ees005
|
|
247
|
+
return jsx(MultiBodiedExtensionWithWidth, _extends({
|
|
246
248
|
widthState: width === undefined ? undefined : {
|
|
247
249
|
width: width,
|
|
248
250
|
lineLength: lineLength
|
|
249
251
|
}
|
|
250
|
-
|
|
251
|
-
}, function (pluginInjectionApi) {
|
|
252
|
-
var _useSharedPluginState2 = useSharedPluginState(pluginInjectionApi, ['width']),
|
|
253
|
-
widthState = _useSharedPluginState2.widthState;
|
|
254
|
-
return {
|
|
255
|
-
widthState: widthState
|
|
256
|
-
};
|
|
257
|
-
});
|
|
258
|
-
var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
259
|
-
var pluginInjectionApi = props.pluginInjectionApi;
|
|
260
|
-
var _useMultiBodyExtensio = useMultiBodyExtensionSharedPluginState(pluginInjectionApi),
|
|
261
|
-
widthState = _useMultiBodyExtensio.widthState;
|
|
262
|
-
// Ignored via go/ees005
|
|
263
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
264
|
-
return jsx(MultiBodiedExtensionWithWidth, _extends({
|
|
265
|
-
widthState: widthState
|
|
252
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
266
253
|
}, props));
|
|
267
254
|
};
|
|
268
255
|
export default MultiBodiedExtension;
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -4,5 +4,4 @@
|
|
|
4
4
|
export { default as usePreviousState } from './usePreviousState';
|
|
5
5
|
export { default as useConstructor } from './useConstructor';
|
|
6
6
|
export { useSharedPluginState } from './useSharedPluginState';
|
|
7
|
-
export { sharedPluginStateHookMigratorFactory } from './sharedPluginStateHookMigratorFactory';
|
|
8
7
|
export { useSharedPluginStateWithSelector } from './useSharedPluginStateWithSelector';
|
|
@@ -2,9 +2,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
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; }
|
|
4
4
|
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) { _defineProperty(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; }
|
|
5
|
-
import {
|
|
5
|
+
import { useLayoutEffect, useMemo, useRef } from 'react';
|
|
6
6
|
import debounce from 'lodash/debounce';
|
|
7
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
7
|
|
|
9
8
|
// Ignored via go/ees005
|
|
10
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -101,16 +100,7 @@ function usePluginStateEffectInternal(externalPlugins, effect) {
|
|
|
101
100
|
// We should store the latest effect in a reference so it is more intuitive to the user
|
|
102
101
|
// and we are not causing a memory leak by having references to old state.
|
|
103
102
|
useLayoutEffect(function () {
|
|
104
|
-
if (options.disabled
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
latestEffect.current = debounce(effect);
|
|
108
|
-
return function () {
|
|
109
|
-
latestEffect.current = undefined;
|
|
110
|
-
};
|
|
111
|
-
}, [effect, options.disabled]);
|
|
112
|
-
useEffect(function () {
|
|
113
|
-
if (options.disabled || expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true)) {
|
|
103
|
+
if (options.disabled) {
|
|
114
104
|
return;
|
|
115
105
|
}
|
|
116
106
|
latestEffect.current = debounce(effect);
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "108.
|
|
10
|
+
var packageVersion = "108.7.0";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// Ignored via go/ees007
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "108.
|
|
24
|
+
var packageVersion = "108.7.0";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as usePreviousState } from './usePreviousState';
|
|
2
2
|
export { default as useConstructor } from './useConstructor';
|
|
3
3
|
export { useSharedPluginState } from './useSharedPluginState';
|
|
4
|
-
export { sharedPluginStateHookMigratorFactory } from './sharedPluginStateHookMigratorFactory';
|
|
5
4
|
export { useSharedPluginStateWithSelector, type NamedPluginStatesFromInjectionAPI, } from './useSharedPluginStateWithSelector';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as usePreviousState } from './usePreviousState';
|
|
2
2
|
export { default as useConstructor } from './useConstructor';
|
|
3
3
|
export { useSharedPluginState } from './useSharedPluginState';
|
|
4
|
-
export { sharedPluginStateHookMigratorFactory } from './sharedPluginStateHookMigratorFactory';
|
|
5
4
|
export { useSharedPluginStateWithSelector, type NamedPluginStatesFromInjectionAPI, } from './useSharedPluginStateWithSelector';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "109.0.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
},
|
|
128
128
|
"dependencies": {
|
|
129
129
|
"@atlaskit/activity-provider": "^2.5.0",
|
|
130
|
-
"@atlaskit/adf-schema": "^
|
|
130
|
+
"@atlaskit/adf-schema": "^51.0.0",
|
|
131
131
|
"@atlaskit/adf-utils": "^19.21.0",
|
|
132
132
|
"@atlaskit/analytics-listeners": "^9.0.0",
|
|
133
133
|
"@atlaskit/analytics-namespaced-context": "^7.0.0",
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
"@atlaskit/task-decision": "^19.2.0",
|
|
178
178
|
"@atlaskit/textfield": "^8.0.0",
|
|
179
179
|
"@atlaskit/theme": "^20.0.0",
|
|
180
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
180
|
+
"@atlaskit/tmp-editor-statsig": "^12.9.0",
|
|
181
181
|
"@atlaskit/tokens": "^6.3.0",
|
|
182
182
|
"@atlaskit/tooltip": "^20.4.0",
|
|
183
183
|
"@atlaskit/width-detector": "^5.0.0",
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.sharedPluginStateHookMigratorFactory = sharedPluginStateHookMigratorFactory;
|
|
7
|
-
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
8
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
|
-
/**
|
|
10
|
-
* **Warning: This hook is controlled by the `platform_editor_usesharedpluginstatewithselector` experiment.**
|
|
11
|
-
*
|
|
12
|
-
* This hook is a migrator for the legacy `useSharedPluginState` hook and will be removed in the future.
|
|
13
|
-
* Please use `useSharedPluginStateSelector` instead.
|
|
14
|
-
*
|
|
15
|
-
* @param newHook A new hook that builds the state from `useSharedPluginStateSelector`
|
|
16
|
-
* @param oldHook The legacy useSharedPluginState hook
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
function sharedPluginStateHookMigratorFactory(newHook, oldHook) {
|
|
20
|
-
return (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
|
|
21
|
-
return (0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true);
|
|
22
|
-
}, newHook, oldHook);
|
|
23
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* **Warning: This hook is controlled by the `platform_editor_usesharedpluginstatewithselector` experiment.**
|
|
6
|
-
*
|
|
7
|
-
* This hook is a migrator for the legacy `useSharedPluginState` hook and will be removed in the future.
|
|
8
|
-
* Please use `useSharedPluginStateSelector` instead.
|
|
9
|
-
*
|
|
10
|
-
* @param newHook A new hook that builds the state from `useSharedPluginStateSelector`
|
|
11
|
-
* @param oldHook The legacy useSharedPluginState hook
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
export function sharedPluginStateHookMigratorFactory(newHook, oldHook) {
|
|
15
|
-
return conditionalHooksFactory(() => expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true), newHook, oldHook);
|
|
16
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* **Warning: This hook is controlled by the `platform_editor_usesharedpluginstatewithselector` experiment.**
|
|
6
|
-
*
|
|
7
|
-
* This hook is a migrator for the legacy `useSharedPluginState` hook and will be removed in the future.
|
|
8
|
-
* Please use `useSharedPluginStateSelector` instead.
|
|
9
|
-
*
|
|
10
|
-
* @param newHook A new hook that builds the state from `useSharedPluginStateSelector`
|
|
11
|
-
* @param oldHook The legacy useSharedPluginState hook
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
export function sharedPluginStateHookMigratorFactory(newHook, oldHook) {
|
|
15
|
-
return conditionalHooksFactory(function () {
|
|
16
|
-
return expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true);
|
|
17
|
-
}, newHook, oldHook);
|
|
18
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* **Warning: This hook is controlled by the `platform_editor_usesharedpluginstatewithselector` experiment.**
|
|
3
|
-
*
|
|
4
|
-
* This hook is a migrator for the legacy `useSharedPluginState` hook and will be removed in the future.
|
|
5
|
-
* Please use `useSharedPluginStateSelector` instead.
|
|
6
|
-
*
|
|
7
|
-
* @param newHook A new hook that builds the state from `useSharedPluginStateSelector`
|
|
8
|
-
* @param oldHook The legacy useSharedPluginState hook
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
export declare function sharedPluginStateHookMigratorFactory<Result, A>(newHook: (...args: A[]) => Result, oldHook: (...args: A[]) => Result): (...args: A[]) => Result;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* **Warning: This hook is controlled by the `platform_editor_usesharedpluginstatewithselector` experiment.**
|
|
3
|
-
*
|
|
4
|
-
* This hook is a migrator for the legacy `useSharedPluginState` hook and will be removed in the future.
|
|
5
|
-
* Please use `useSharedPluginStateSelector` instead.
|
|
6
|
-
*
|
|
7
|
-
* @param newHook A new hook that builds the state from `useSharedPluginStateSelector`
|
|
8
|
-
* @param oldHook The legacy useSharedPluginState hook
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
export declare function sharedPluginStateHookMigratorFactory<Result, A>(newHook: (...args: A[]) => Result, oldHook: (...args: A[]) => Result): (...args: A[]) => Result;
|