@atlaskit/editor-plugin-floating-toolbar 4.1.13 → 4.1.15
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/floatingToolbarPlugin.js +22 -70
- package/dist/cjs/ui/CheckboxModal.js +1 -2
- package/dist/cjs/ui/Dropdown.js +1 -2
- package/dist/cjs/ui/EmojiPickerButton.js +1 -2
- package/dist/cjs/ui/ExtensionsPlaceholder.js +1 -2
- package/dist/cjs/ui/Input.js +1 -2
- package/dist/cjs/ui/ScrollButton.js +1 -2
- package/dist/cjs/ui/ScrollButtons.js +1 -2
- package/dist/cjs/ui/Select.js +1 -2
- package/dist/cjs/ui/SimpleModal.js +1 -2
- package/dist/cjs/ui/Toolbar.js +2 -3
- package/dist/cjs/ui/ToolbarLoader.js +1 -2
- package/dist/es2019/floatingToolbarPlugin.js +23 -68
- package/dist/es2019/ui/Toolbar.js +1 -1
- package/dist/esm/floatingToolbarPlugin.js +24 -69
- package/dist/esm/ui/Toolbar.js +1 -1
- package/package.json +6 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-floating-toolbar
|
|
2
2
|
|
|
3
|
+
## 4.1.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#164168](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/164168)
|
|
8
|
+
[`d8a91ac7d6399`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d8a91ac7d6399) -
|
|
9
|
+
Revert to using useSharedPluginState in `floatingToolbarPlugin`
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 4.1.14
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#161914](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/161914)
|
|
17
|
+
[`b1a7ef0ae8d44`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b1a7ef0ae8d44) -
|
|
18
|
+
Switches text formatting options optimisation from FG to Experiment flag
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 4.1.13
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -20,7 +20,6 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
20
20
|
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
21
21
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
22
22
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
23
|
-
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
24
23
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
25
24
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
26
25
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -34,8 +33,7 @@ var _utils2 = require("./pm-plugins/utils");
|
|
|
34
33
|
var _ConfirmationModal = require("./ui/ConfirmationModal");
|
|
35
34
|
var _ToolbarLoader = require("./ui/ToolbarLoader");
|
|
36
35
|
var _utils3 = require("./ui/utils");
|
|
37
|
-
function
|
|
38
|
-
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; }
|
|
36
|
+
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); }
|
|
39
37
|
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; }
|
|
40
38
|
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; }
|
|
41
39
|
// TODO: AFP-2532 - Fix automatic suppressions below
|
|
@@ -215,56 +213,6 @@ var floatingToolbarPlugin = exports.floatingToolbarPlugin = function floatingToo
|
|
|
215
213
|
}
|
|
216
214
|
};
|
|
217
215
|
};
|
|
218
|
-
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
219
|
-
// floatingToolbar
|
|
220
|
-
var configWithNodeInfo = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'floatingToolbar.configWithNodeInfo');
|
|
221
|
-
var floatingToolbarData = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'floatingToolbar.floatingToolbarData');
|
|
222
|
-
|
|
223
|
-
// editorDisabled
|
|
224
|
-
var editorDisabledState = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorDisabled.editorDisabled');
|
|
225
|
-
|
|
226
|
-
// editorViewMode
|
|
227
|
-
var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorViewMode.mode');
|
|
228
|
-
|
|
229
|
-
// userIntent
|
|
230
|
-
var currentUserIntent = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'userIntent.currentUserIntent');
|
|
231
|
-
|
|
232
|
-
// blockControls
|
|
233
|
-
var isDragging = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi,
|
|
234
|
-
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
235
|
-
'blockControls.isDragging');
|
|
236
|
-
// isMenuOpen
|
|
237
|
-
var isMenuOpen = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi,
|
|
238
|
-
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
239
|
-
'blockControls.isMenuOpen');
|
|
240
|
-
return {
|
|
241
|
-
configWithNodeInfo: configWithNodeInfo,
|
|
242
|
-
floatingToolbarData: floatingToolbarData,
|
|
243
|
-
editorDisabled: editorDisabledState,
|
|
244
|
-
mode: mode,
|
|
245
|
-
currentUserIntent: currentUserIntent,
|
|
246
|
-
isDragging: isDragging,
|
|
247
|
-
isMenuOpen: isMenuOpen
|
|
248
|
-
};
|
|
249
|
-
}, function (pluginInjectionApi) {
|
|
250
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent',
|
|
251
|
-
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
252
|
-
'blockControls']),
|
|
253
|
-
floatingToolbarState = _useSharedPluginState.floatingToolbarState,
|
|
254
|
-
editorDisabledState = _useSharedPluginState.editorDisabledState,
|
|
255
|
-
editorViewModeState = _useSharedPluginState.editorViewModeState,
|
|
256
|
-
userIntentState = _useSharedPluginState.userIntentState,
|
|
257
|
-
blockControlsState = _useSharedPluginState.blockControlsState;
|
|
258
|
-
return {
|
|
259
|
-
configWithNodeInfo: floatingToolbarState === null || floatingToolbarState === void 0 ? void 0 : floatingToolbarState.configWithNodeInfo,
|
|
260
|
-
floatingToolbarData: floatingToolbarState === null || floatingToolbarState === void 0 ? void 0 : floatingToolbarState.floatingToolbarData,
|
|
261
|
-
editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled,
|
|
262
|
-
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
263
|
-
currentUserIntent: userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent,
|
|
264
|
-
isDragging: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isDragging,
|
|
265
|
-
isMenuOpen: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isMenuOpen
|
|
266
|
-
};
|
|
267
|
-
});
|
|
268
216
|
function ContentComponent(_ref5) {
|
|
269
217
|
var _configWithNodeInfo$c, _configWithNodeInfo$c2, _items, _pluginInjectionApi$c, _pluginInjectionApi$d;
|
|
270
218
|
var pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
@@ -274,24 +222,27 @@ function ContentComponent(_ref5) {
|
|
|
274
222
|
popupsScrollableElement = _ref5.popupsScrollableElement,
|
|
275
223
|
providerFactory = _ref5.providerFactory,
|
|
276
224
|
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
|
|
277
|
-
var
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
225
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent',
|
|
226
|
+
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
227
|
+
'blockControls']),
|
|
228
|
+
floatingToolbarState = _useSharedPluginState.floatingToolbarState,
|
|
229
|
+
editorDisabledState = _useSharedPluginState.editorDisabledState,
|
|
230
|
+
editorViewModeState = _useSharedPluginState.editorViewModeState,
|
|
231
|
+
userIntentState = _useSharedPluginState.userIntentState,
|
|
232
|
+
blockControlsState = _useSharedPluginState.blockControlsState;
|
|
233
|
+
var _ref6 = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {},
|
|
234
|
+
configWithNodeInfo = _ref6.configWithNodeInfo,
|
|
235
|
+
floatingToolbarData = _ref6.floatingToolbarData;
|
|
236
|
+
if ((0, _experiments.editorExperiment)('platform_editor_hide_floating_toolbar_in_ssr', true, {
|
|
286
237
|
exposure: true
|
|
287
|
-
})) {
|
|
238
|
+
}) && (0, _coreUtils.isSSR)()) {
|
|
288
239
|
return null;
|
|
289
240
|
}
|
|
290
241
|
if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
|
|
291
242
|
return null;
|
|
292
243
|
}
|
|
293
244
|
if ((0, _platformFeatureFlags.fg)('platform_editor_user_intent_plugin')) {
|
|
294
|
-
if (currentUserIntent === 'dragging') {
|
|
245
|
+
if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'dragging') {
|
|
295
246
|
return null;
|
|
296
247
|
}
|
|
297
248
|
|
|
@@ -300,10 +251,10 @@ function ContentComponent(_ref5) {
|
|
|
300
251
|
// return null;
|
|
301
252
|
// }
|
|
302
253
|
} else {
|
|
303
|
-
if (isDragging) {
|
|
254
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isDragging) {
|
|
304
255
|
return null;
|
|
305
256
|
}
|
|
306
|
-
if (isMenuOpen && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
257
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isMenuOpen && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
307
258
|
return null;
|
|
308
259
|
}
|
|
309
260
|
}
|
|
@@ -339,8 +290,9 @@ function ContentComponent(_ref5) {
|
|
|
339
290
|
_config$stick = config.stick,
|
|
340
291
|
stick = _config$stick === void 0 ? true : _config$stick;
|
|
341
292
|
var targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
|
|
342
|
-
var
|
|
343
|
-
|
|
293
|
+
var isEditorDisabled = editorDisabledState && editorDisabledState.editorDisabled;
|
|
294
|
+
var isInViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
295
|
+
if (!targetRef || isEditorDisabled && !isInViewMode) {
|
|
344
296
|
return null;
|
|
345
297
|
}
|
|
346
298
|
|
|
@@ -393,8 +345,8 @@ function ContentComponent(_ref5) {
|
|
|
393
345
|
};
|
|
394
346
|
|
|
395
347
|
// Confirm dialog
|
|
396
|
-
var
|
|
397
|
-
confirmDialogForItem =
|
|
348
|
+
var _ref7 = floatingToolbarData || {},
|
|
349
|
+
confirmDialogForItem = _ref7.confirmDialogForItem;
|
|
398
350
|
var confirmButtonItem = confirmDialogForItem ?
|
|
399
351
|
// Ignored via go/ees005
|
|
400
352
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -14,8 +14,7 @@ var _checkbox = require("@atlaskit/checkbox");
|
|
|
14
14
|
var _floatingToolbar = require("@atlaskit/editor-common/floating-toolbar");
|
|
15
15
|
var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
|
|
16
16
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
17
|
-
function
|
|
18
|
-
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; }
|
|
17
|
+
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); }
|
|
19
18
|
var CheckboxModal = exports.CheckboxModal = function CheckboxModal(props) {
|
|
20
19
|
var _options$getChildrenI;
|
|
21
20
|
var _useState = (0, _react.useState)(false),
|
package/dist/cjs/ui/Dropdown.js
CHANGED
|
@@ -22,8 +22,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
22
22
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
23
23
|
var _Divider = require("./Divider");
|
|
24
24
|
var _DropdownMenu = _interopRequireWildcard(require("./DropdownMenu"));
|
|
25
|
-
function
|
|
26
|
-
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; }
|
|
25
|
+
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); }
|
|
27
26
|
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; }
|
|
28
27
|
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; }
|
|
29
28
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
@@ -19,8 +19,7 @@ var _emojiAdd = _interopRequireDefault(require("@atlaskit/icon/core/emoji-add"))
|
|
|
19
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
20
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
21
21
|
var _EditorEmojiAddIcon = _interopRequireDefault(require("./EditorEmojiAddIcon"));
|
|
22
|
-
function
|
|
23
|
-
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; }
|
|
22
|
+
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); }
|
|
24
23
|
/**
|
|
25
24
|
* @jsxRuntime classic
|
|
26
25
|
* @jsx jsx
|
|
@@ -18,8 +18,7 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
18
18
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
19
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
20
|
var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
|
21
|
-
function
|
|
22
|
-
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; }
|
|
21
|
+
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); }
|
|
23
22
|
var noop = function noop() {
|
|
24
23
|
return null;
|
|
25
24
|
};
|
package/dist/cjs/ui/Input.js
CHANGED
|
@@ -10,8 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
13
|
-
function
|
|
14
|
-
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; }
|
|
13
|
+
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); }
|
|
15
14
|
/**
|
|
16
15
|
* @jsxRuntime classic
|
|
17
16
|
* @jsx jsx
|
|
@@ -15,8 +15,7 @@ var _floatingToolbar = require("@atlaskit/editor-common/floating-toolbar");
|
|
|
15
15
|
var _chevronLeftChevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-left--chevron-left-large"));
|
|
16
16
|
var _chevronRightChevronRightLarge = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-right--chevron-right-large"));
|
|
17
17
|
var _primitives = require("@atlaskit/primitives");
|
|
18
|
-
function
|
|
19
|
-
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
|
+
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); }
|
|
20
19
|
var rightSideStyles = (0, _primitives.xcss)({
|
|
21
20
|
borderLeft: "solid ".concat("var(--ds-border, #091E4224)", " 1px"),
|
|
22
21
|
right: 'space.0',
|
|
@@ -15,8 +15,7 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
15
15
|
var _chevronLeftChevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-left--chevron-left-large"));
|
|
16
16
|
var _chevronRightChevronRightLarge = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-right--chevron-right-large"));
|
|
17
17
|
var _colors = require("@atlaskit/theme/colors");
|
|
18
|
-
function
|
|
19
|
-
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
|
+
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); }
|
|
20
19
|
/**
|
|
21
20
|
* @jsxRuntime classic
|
|
22
21
|
* @jsx jsx
|
package/dist/cjs/ui/Select.js
CHANGED
|
@@ -9,8 +9,7 @@ exports.default = Search;
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _select = _interopRequireDefault(require("@atlaskit/select"));
|
|
12
|
-
function
|
|
13
|
-
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; }
|
|
12
|
+
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); }
|
|
14
13
|
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; }
|
|
15
14
|
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; }
|
|
16
15
|
function Search(props) {
|
|
@@ -11,8 +11,7 @@ var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
|
11
11
|
var _floatingToolbar = require("@atlaskit/editor-common/floating-toolbar");
|
|
12
12
|
var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
|
|
13
13
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
14
|
-
function
|
|
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; }
|
|
14
|
+
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); }
|
|
16
15
|
var SimpleModal = exports.SimpleModal = function SimpleModal(props) {
|
|
17
16
|
var onConfirm = props.onConfirm,
|
|
18
17
|
onClose = props.onClose,
|
package/dist/cjs/ui/Toolbar.js
CHANGED
|
@@ -37,8 +37,7 @@ var _Input = require("./Input");
|
|
|
37
37
|
var _ScrollButton = require("./ScrollButton");
|
|
38
38
|
var _ScrollButtons = require("./ScrollButtons");
|
|
39
39
|
var _Select = _interopRequireDefault(require("./Select"));
|
|
40
|
-
function
|
|
41
|
-
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; }
|
|
40
|
+
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); }
|
|
42
41
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
43
42
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation */ /**
|
|
44
43
|
* @jsxRuntime classic
|
|
@@ -703,7 +702,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
703
702
|
handleEscape: this.handleEscape,
|
|
704
703
|
disableArrowKeyNavigation: !this.shouldHandleArrowKeys(),
|
|
705
704
|
childComponentSelector: "[data-testid='editor-floating-toolbar']",
|
|
706
|
-
isShortcutToFocusToolbar: (0,
|
|
705
|
+
isShortcutToFocusToolbar: (0, _experiments.editorExperiment)('platform_editor_toolbar_rerender_optimization_exp', true) ? this.isShortcutToFocusToolbar : isShortcutToFocusToolbar,
|
|
707
706
|
intl: intl
|
|
708
707
|
}, (0, _react2.jsx)("div", {
|
|
709
708
|
ref: this.toolbarContainerRef,
|
|
@@ -7,8 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ToolbarLoader = void 0;
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _reactLoadable = _interopRequireDefault(require("react-loadable"));
|
|
10
|
-
function
|
|
11
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != (0, _typeof2.default)(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; }
|
|
10
|
+
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" != (0, _typeof2.default)(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); }
|
|
12
11
|
var ToolbarLoader = exports.ToolbarLoader = (0, _reactLoadable.default)({
|
|
13
12
|
loader: function loader() {
|
|
14
13
|
return Promise.resolve().then(function () {
|
|
@@ -3,11 +3,12 @@ import camelCase from 'lodash/camelCase';
|
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, CONTENT_COMPONENT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
5
5
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
// Deprecated API - Look at removing this sometime in the future
|
|
8
|
+
useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
9
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
8
10
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
9
11
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
10
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
11
12
|
import { AllSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
12
13
|
import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
13
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -198,58 +199,6 @@ export const floatingToolbarPlugin = ({
|
|
|
198
199
|
}
|
|
199
200
|
};
|
|
200
201
|
};
|
|
201
|
-
const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
202
|
-
// floatingToolbar
|
|
203
|
-
const configWithNodeInfo = useSharedPluginStateSelector(pluginInjectionApi, 'floatingToolbar.configWithNodeInfo');
|
|
204
|
-
const floatingToolbarData = useSharedPluginStateSelector(pluginInjectionApi, 'floatingToolbar.floatingToolbarData');
|
|
205
|
-
|
|
206
|
-
// editorDisabled
|
|
207
|
-
const editorDisabledState = useSharedPluginStateSelector(pluginInjectionApi, 'editorDisabled.editorDisabled');
|
|
208
|
-
|
|
209
|
-
// editorViewMode
|
|
210
|
-
const mode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
|
|
211
|
-
|
|
212
|
-
// userIntent
|
|
213
|
-
const currentUserIntent = useSharedPluginStateSelector(pluginInjectionApi, 'userIntent.currentUserIntent');
|
|
214
|
-
|
|
215
|
-
// blockControls
|
|
216
|
-
const isDragging = useSharedPluginStateSelector(pluginInjectionApi,
|
|
217
|
-
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
218
|
-
'blockControls.isDragging');
|
|
219
|
-
// isMenuOpen
|
|
220
|
-
const isMenuOpen = useSharedPluginStateSelector(pluginInjectionApi,
|
|
221
|
-
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
222
|
-
'blockControls.isMenuOpen');
|
|
223
|
-
return {
|
|
224
|
-
configWithNodeInfo,
|
|
225
|
-
floatingToolbarData,
|
|
226
|
-
editorDisabled: editorDisabledState,
|
|
227
|
-
mode,
|
|
228
|
-
currentUserIntent,
|
|
229
|
-
isDragging,
|
|
230
|
-
isMenuOpen
|
|
231
|
-
};
|
|
232
|
-
}, pluginInjectionApi => {
|
|
233
|
-
const {
|
|
234
|
-
floatingToolbarState,
|
|
235
|
-
editorDisabledState,
|
|
236
|
-
editorViewModeState,
|
|
237
|
-
userIntentState,
|
|
238
|
-
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
239
|
-
blockControlsState
|
|
240
|
-
} = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent',
|
|
241
|
-
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
242
|
-
'blockControls']);
|
|
243
|
-
return {
|
|
244
|
-
configWithNodeInfo: floatingToolbarState === null || floatingToolbarState === void 0 ? void 0 : floatingToolbarState.configWithNodeInfo,
|
|
245
|
-
floatingToolbarData: floatingToolbarState === null || floatingToolbarState === void 0 ? void 0 : floatingToolbarState.floatingToolbarData,
|
|
246
|
-
editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled,
|
|
247
|
-
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
248
|
-
currentUserIntent: userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent,
|
|
249
|
-
isDragging: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isDragging,
|
|
250
|
-
isMenuOpen: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isMenuOpen
|
|
251
|
-
};
|
|
252
|
-
});
|
|
253
202
|
export function ContentComponent({
|
|
254
203
|
pluginInjectionApi,
|
|
255
204
|
editorView,
|
|
@@ -260,25 +209,30 @@ export function ContentComponent({
|
|
|
260
209
|
dispatchAnalyticsEvent
|
|
261
210
|
}) {
|
|
262
211
|
var _configWithNodeInfo$c, _configWithNodeInfo$c2, _items, _pluginInjectionApi$c, _pluginInjectionApi$d;
|
|
212
|
+
const {
|
|
213
|
+
floatingToolbarState,
|
|
214
|
+
editorDisabledState,
|
|
215
|
+
editorViewModeState,
|
|
216
|
+
userIntentState,
|
|
217
|
+
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
218
|
+
blockControlsState
|
|
219
|
+
} = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent',
|
|
220
|
+
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
221
|
+
'blockControls']);
|
|
263
222
|
const {
|
|
264
223
|
configWithNodeInfo,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
isDragging,
|
|
269
|
-
isMenuOpen,
|
|
270
|
-
mode
|
|
271
|
-
} = useSharedState(pluginInjectionApi);
|
|
272
|
-
if (isSSR() && editorExperiment('platform_editor_hide_floating_toolbar_in_ssr', true, {
|
|
224
|
+
floatingToolbarData
|
|
225
|
+
} = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {};
|
|
226
|
+
if (editorExperiment('platform_editor_hide_floating_toolbar_in_ssr', true, {
|
|
273
227
|
exposure: true
|
|
274
|
-
})) {
|
|
228
|
+
}) && isSSR()) {
|
|
275
229
|
return null;
|
|
276
230
|
}
|
|
277
231
|
if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
|
|
278
232
|
return null;
|
|
279
233
|
}
|
|
280
234
|
if (fg('platform_editor_user_intent_plugin')) {
|
|
281
|
-
if (currentUserIntent === 'dragging') {
|
|
235
|
+
if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'dragging') {
|
|
282
236
|
return null;
|
|
283
237
|
}
|
|
284
238
|
|
|
@@ -287,10 +241,10 @@ export function ContentComponent({
|
|
|
287
241
|
// return null;
|
|
288
242
|
// }
|
|
289
243
|
} else {
|
|
290
|
-
if (isDragging) {
|
|
244
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isDragging) {
|
|
291
245
|
return null;
|
|
292
246
|
}
|
|
293
|
-
if (isMenuOpen && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
247
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isMenuOpen && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
294
248
|
return null;
|
|
295
249
|
}
|
|
296
250
|
}
|
|
@@ -327,8 +281,9 @@ export function ContentComponent({
|
|
|
327
281
|
stick = true
|
|
328
282
|
} = config;
|
|
329
283
|
const targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
|
|
330
|
-
const
|
|
331
|
-
|
|
284
|
+
const isEditorDisabled = editorDisabledState && editorDisabledState.editorDisabled;
|
|
285
|
+
const isInViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
286
|
+
if (!targetRef || isEditorDisabled && !isInViewMode) {
|
|
332
287
|
return null;
|
|
333
288
|
}
|
|
334
289
|
|
|
@@ -654,7 +654,7 @@ class Toolbar extends Component {
|
|
|
654
654
|
handleEscape: this.handleEscape,
|
|
655
655
|
disableArrowKeyNavigation: !this.shouldHandleArrowKeys(),
|
|
656
656
|
childComponentSelector: "[data-testid='editor-floating-toolbar']",
|
|
657
|
-
isShortcutToFocusToolbar:
|
|
657
|
+
isShortcutToFocusToolbar: editorExperiment('platform_editor_toolbar_rerender_optimization_exp', true) ? this.isShortcutToFocusToolbar : isShortcutToFocusToolbar,
|
|
658
658
|
intl: intl
|
|
659
659
|
}, jsx("div", {
|
|
660
660
|
ref: this.toolbarContainerRef,
|
|
@@ -7,11 +7,12 @@ import camelCase from 'lodash/camelCase';
|
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, CONTENT_COMPONENT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
9
9
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
// Deprecated API - Look at removing this sometime in the future
|
|
12
|
+
useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
11
13
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
12
14
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
13
15
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
14
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
15
16
|
import { AllSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
16
17
|
import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
17
18
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -203,56 +204,6 @@ export var floatingToolbarPlugin = function floatingToolbarPlugin(_ref) {
|
|
|
203
204
|
}
|
|
204
205
|
};
|
|
205
206
|
};
|
|
206
|
-
var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
|
|
207
|
-
// floatingToolbar
|
|
208
|
-
var configWithNodeInfo = useSharedPluginStateSelector(pluginInjectionApi, 'floatingToolbar.configWithNodeInfo');
|
|
209
|
-
var floatingToolbarData = useSharedPluginStateSelector(pluginInjectionApi, 'floatingToolbar.floatingToolbarData');
|
|
210
|
-
|
|
211
|
-
// editorDisabled
|
|
212
|
-
var editorDisabledState = useSharedPluginStateSelector(pluginInjectionApi, 'editorDisabled.editorDisabled');
|
|
213
|
-
|
|
214
|
-
// editorViewMode
|
|
215
|
-
var mode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
|
|
216
|
-
|
|
217
|
-
// userIntent
|
|
218
|
-
var currentUserIntent = useSharedPluginStateSelector(pluginInjectionApi, 'userIntent.currentUserIntent');
|
|
219
|
-
|
|
220
|
-
// blockControls
|
|
221
|
-
var isDragging = useSharedPluginStateSelector(pluginInjectionApi,
|
|
222
|
-
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
223
|
-
'blockControls.isDragging');
|
|
224
|
-
// isMenuOpen
|
|
225
|
-
var isMenuOpen = useSharedPluginStateSelector(pluginInjectionApi,
|
|
226
|
-
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
227
|
-
'blockControls.isMenuOpen');
|
|
228
|
-
return {
|
|
229
|
-
configWithNodeInfo: configWithNodeInfo,
|
|
230
|
-
floatingToolbarData: floatingToolbarData,
|
|
231
|
-
editorDisabled: editorDisabledState,
|
|
232
|
-
mode: mode,
|
|
233
|
-
currentUserIntent: currentUserIntent,
|
|
234
|
-
isDragging: isDragging,
|
|
235
|
-
isMenuOpen: isMenuOpen
|
|
236
|
-
};
|
|
237
|
-
}, function (pluginInjectionApi) {
|
|
238
|
-
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent',
|
|
239
|
-
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
240
|
-
'blockControls']),
|
|
241
|
-
floatingToolbarState = _useSharedPluginState.floatingToolbarState,
|
|
242
|
-
editorDisabledState = _useSharedPluginState.editorDisabledState,
|
|
243
|
-
editorViewModeState = _useSharedPluginState.editorViewModeState,
|
|
244
|
-
userIntentState = _useSharedPluginState.userIntentState,
|
|
245
|
-
blockControlsState = _useSharedPluginState.blockControlsState;
|
|
246
|
-
return {
|
|
247
|
-
configWithNodeInfo: floatingToolbarState === null || floatingToolbarState === void 0 ? void 0 : floatingToolbarState.configWithNodeInfo,
|
|
248
|
-
floatingToolbarData: floatingToolbarState === null || floatingToolbarState === void 0 ? void 0 : floatingToolbarState.floatingToolbarData,
|
|
249
|
-
editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled,
|
|
250
|
-
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
251
|
-
currentUserIntent: userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent,
|
|
252
|
-
isDragging: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isDragging,
|
|
253
|
-
isMenuOpen: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isMenuOpen
|
|
254
|
-
};
|
|
255
|
-
});
|
|
256
207
|
export function ContentComponent(_ref5) {
|
|
257
208
|
var _configWithNodeInfo$c, _configWithNodeInfo$c2, _items, _pluginInjectionApi$c, _pluginInjectionApi$d;
|
|
258
209
|
var pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
@@ -262,24 +213,27 @@ export function ContentComponent(_ref5) {
|
|
|
262
213
|
popupsScrollableElement = _ref5.popupsScrollableElement,
|
|
263
214
|
providerFactory = _ref5.providerFactory,
|
|
264
215
|
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
|
|
265
|
-
var
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
216
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'userIntent',
|
|
217
|
+
// @ts-expect-error - excluded from FloatingToolbarPlugin dependencies to avoid circular dependency
|
|
218
|
+
'blockControls']),
|
|
219
|
+
floatingToolbarState = _useSharedPluginState.floatingToolbarState,
|
|
220
|
+
editorDisabledState = _useSharedPluginState.editorDisabledState,
|
|
221
|
+
editorViewModeState = _useSharedPluginState.editorViewModeState,
|
|
222
|
+
userIntentState = _useSharedPluginState.userIntentState,
|
|
223
|
+
blockControlsState = _useSharedPluginState.blockControlsState;
|
|
224
|
+
var _ref6 = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {},
|
|
225
|
+
configWithNodeInfo = _ref6.configWithNodeInfo,
|
|
226
|
+
floatingToolbarData = _ref6.floatingToolbarData;
|
|
227
|
+
if (editorExperiment('platform_editor_hide_floating_toolbar_in_ssr', true, {
|
|
274
228
|
exposure: true
|
|
275
|
-
})) {
|
|
229
|
+
}) && isSSR()) {
|
|
276
230
|
return null;
|
|
277
231
|
}
|
|
278
232
|
if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
|
|
279
233
|
return null;
|
|
280
234
|
}
|
|
281
235
|
if (fg('platform_editor_user_intent_plugin')) {
|
|
282
|
-
if (currentUserIntent === 'dragging') {
|
|
236
|
+
if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'dragging') {
|
|
283
237
|
return null;
|
|
284
238
|
}
|
|
285
239
|
|
|
@@ -288,10 +242,10 @@ export function ContentComponent(_ref5) {
|
|
|
288
242
|
// return null;
|
|
289
243
|
// }
|
|
290
244
|
} else {
|
|
291
|
-
if (isDragging) {
|
|
245
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isDragging) {
|
|
292
246
|
return null;
|
|
293
247
|
}
|
|
294
|
-
if (isMenuOpen && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
248
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isMenuOpen && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
295
249
|
return null;
|
|
296
250
|
}
|
|
297
251
|
}
|
|
@@ -327,8 +281,9 @@ export function ContentComponent(_ref5) {
|
|
|
327
281
|
_config$stick = config.stick,
|
|
328
282
|
stick = _config$stick === void 0 ? true : _config$stick;
|
|
329
283
|
var targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
|
|
330
|
-
var
|
|
331
|
-
|
|
284
|
+
var isEditorDisabled = editorDisabledState && editorDisabledState.editorDisabled;
|
|
285
|
+
var isInViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
286
|
+
if (!targetRef || isEditorDisabled && !isInViewMode) {
|
|
332
287
|
return null;
|
|
333
288
|
}
|
|
334
289
|
|
|
@@ -381,8 +336,8 @@ export function ContentComponent(_ref5) {
|
|
|
381
336
|
};
|
|
382
337
|
|
|
383
338
|
// Confirm dialog
|
|
384
|
-
var
|
|
385
|
-
confirmDialogForItem =
|
|
339
|
+
var _ref7 = floatingToolbarData || {},
|
|
340
|
+
confirmDialogForItem = _ref7.confirmDialogForItem;
|
|
386
341
|
var confirmButtonItem = confirmDialogForItem ?
|
|
387
342
|
// Ignored via go/ees005
|
|
388
343
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
package/dist/esm/ui/Toolbar.js
CHANGED
|
@@ -696,7 +696,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
696
696
|
handleEscape: this.handleEscape,
|
|
697
697
|
disableArrowKeyNavigation: !this.shouldHandleArrowKeys(),
|
|
698
698
|
childComponentSelector: "[data-testid='editor-floating-toolbar']",
|
|
699
|
-
isShortcutToFocusToolbar:
|
|
699
|
+
isShortcutToFocusToolbar: editorExperiment('platform_editor_toolbar_rerender_optimization_exp', true) ? this.isShortcutToFocusToolbar : isShortcutToFocusToolbar,
|
|
700
700
|
intl: intl
|
|
701
701
|
}, jsx("div", {
|
|
702
702
|
ref: this.toolbarContainerRef,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-floating-toolbar",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.15",
|
|
4
4
|
"description": "Floating toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@atlaskit/adf-utils": "^19.20.0",
|
|
29
29
|
"@atlaskit/button": "^23.2.0",
|
|
30
30
|
"@atlaskit/checkbox": "^17.1.0",
|
|
31
|
-
"@atlaskit/editor-common": "^106.
|
|
31
|
+
"@atlaskit/editor-common": "^106.1.0",
|
|
32
32
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
34
34
|
"@atlaskit/editor-plugin-context-panel": "^4.1.0",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-editor-viewmode": "^4.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-emoji": "^3.7.0",
|
|
40
|
-
"@atlaskit/editor-plugin-extension": "^5.
|
|
41
|
-
"@atlaskit/editor-plugin-interaction": "^
|
|
40
|
+
"@atlaskit/editor-plugin-extension": "^5.5.0",
|
|
41
|
+
"@atlaskit/editor-plugin-interaction": "^2.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-table": "^10.11.0",
|
|
43
43
|
"@atlaskit/editor-plugin-user-intent": "^0.1.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"@atlaskit/primitives": "^14.8.0",
|
|
51
51
|
"@atlaskit/select": "^20.6.0",
|
|
52
52
|
"@atlaskit/theme": "^18.0.0",
|
|
53
|
-
"@atlaskit/tmp-editor-statsig": "^5.
|
|
54
|
-
"@atlaskit/tokens": "^
|
|
53
|
+
"@atlaskit/tmp-editor-statsig": "^5.7.0",
|
|
54
|
+
"@atlaskit/tokens": "^5.0.0",
|
|
55
55
|
"@atlaskit/tooltip": "^20.2.0",
|
|
56
56
|
"@babel/runtime": "^7.0.0",
|
|
57
57
|
"@emotion/react": "^11.7.1",
|
|
@@ -154,9 +154,6 @@
|
|
|
154
154
|
},
|
|
155
155
|
"platform_editor_interaction_api_refactor": {
|
|
156
156
|
"type": "boolean"
|
|
157
|
-
},
|
|
158
|
-
"platform_editor_toolbar_rerender_optimization": {
|
|
159
|
-
"type": "boolean"
|
|
160
157
|
}
|
|
161
158
|
}
|
|
162
159
|
}
|