@atlaskit/editor-plugin-floating-toolbar 8.2.10 → 8.2.11
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 +8 -0
- package/dist/cjs/floatingToolbarPlugin.js +16 -9
- package/dist/es2019/floatingToolbarPlugin.js +16 -9
- package/dist/esm/floatingToolbarPlugin.js +16 -9
- package/dist/types/floatingToolbarPlugin.d.ts +1 -0
- package/dist/types-ts4.5/floatingToolbarPlugin.d.ts +1 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-floating-toolbar
|
|
2
2
|
|
|
3
|
+
## 8.2.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`28ba94dae8f9a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/28ba94dae8f9a) -
|
|
8
|
+
[ux] EDITOR-2458 Replace usage of \_\_suppressAllToolbars with userIntentPlugin
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 8.2.10
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -25,6 +25,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
25
25
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
26
26
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
27
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
28
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
28
29
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
29
30
|
var _commands = require("./pm-plugins/commands");
|
|
30
31
|
var _forceFocus = _interopRequireWildcard(require("./pm-plugins/force-focus"));
|
|
@@ -147,6 +148,7 @@ var floatingToolbarPlugin = exports.floatingToolbarPlugin = function floatingToo
|
|
|
147
148
|
var providerFactory = _ref2.providerFactory,
|
|
148
149
|
getIntl = _ref2.getIntl;
|
|
149
150
|
return floatingToolbarPluginFactory({
|
|
151
|
+
api: api,
|
|
150
152
|
floatingToolbarHandlers: floatingToolbarHandlers,
|
|
151
153
|
providerFactory: providerFactory,
|
|
152
154
|
getIntl: getIntl
|
|
@@ -253,15 +255,13 @@ function ContentComponent(_ref5) {
|
|
|
253
255
|
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)) {
|
|
254
256
|
return null;
|
|
255
257
|
}
|
|
256
|
-
|
|
258
|
+
var userIntentEnabled = Boolean((pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.userIntent) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true));
|
|
259
|
+
if (((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'dragging' || (userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && (0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_block_menu_hide_floating_toolbar')) && !userIntentEnabled) {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
if (userIntentState !== null && userIntentState !== void 0 && userIntentState.currentUserIntent && ['dragging', 'tablePopupOpen', 'commenting', 'resizing', 'blockMenuOpen'].includes(userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) && userIntentEnabled) {
|
|
257
263
|
return null;
|
|
258
264
|
}
|
|
259
|
-
|
|
260
|
-
// TODO: ED-27539 - This feature is unreleased and rendering logic needs to be move userIntentState which is not ready yet
|
|
261
|
-
// if (blockControlsState?.isMenuOpen && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
262
|
-
// return null;
|
|
263
|
-
// }
|
|
264
|
-
|
|
265
265
|
var config = configWithNodeInfo.config,
|
|
266
266
|
node = configWithNodeInfo.node;
|
|
267
267
|
|
|
@@ -552,7 +552,8 @@ function sanitizeFloatingToolbarConfig(config) {
|
|
|
552
552
|
function floatingToolbarPluginFactory(options) {
|
|
553
553
|
var floatingToolbarHandlers = options.floatingToolbarHandlers,
|
|
554
554
|
providerFactory = options.providerFactory,
|
|
555
|
-
getIntl = options.getIntl
|
|
555
|
+
getIntl = options.getIntl,
|
|
556
|
+
api = options.api;
|
|
556
557
|
var intl = getIntl();
|
|
557
558
|
var getConfigWithNodeInfo = function getConfigWithNodeInfo(editorState) {
|
|
558
559
|
var activeConfigs = [];
|
|
@@ -560,7 +561,13 @@ function floatingToolbarPluginFactory(options) {
|
|
|
560
561
|
var handler = floatingToolbarHandlers[index];
|
|
561
562
|
var config = handler(editorState, intl, providerFactory, activeConfigs);
|
|
562
563
|
if (config) {
|
|
563
|
-
|
|
564
|
+
var _api$userIntent;
|
|
565
|
+
var userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true));
|
|
566
|
+
if (config.__suppressAllToolbars && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !userIntentEnabled) {
|
|
567
|
+
activeConfigs = undefined;
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
if (userIntentEnabled && ['dragging', 'tablePopupOpen', 'commenting', 'resizing', 'blockMenuOpen'].includes((api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) || '')) {
|
|
564
571
|
activeConfigs = undefined;
|
|
565
572
|
break;
|
|
566
573
|
}
|
|
@@ -14,6 +14,7 @@ import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemi
|
|
|
14
14
|
import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
15
15
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
16
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
17
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
18
19
|
import { copyNode } from './pm-plugins/commands';
|
|
19
20
|
import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
|
|
@@ -136,6 +137,7 @@ export const floatingToolbarPlugin = ({
|
|
|
136
137
|
providerFactory,
|
|
137
138
|
getIntl
|
|
138
139
|
}) => floatingToolbarPluginFactory({
|
|
140
|
+
api,
|
|
139
141
|
floatingToolbarHandlers,
|
|
140
142
|
providerFactory,
|
|
141
143
|
getIntl
|
|
@@ -243,15 +245,13 @@ export function ContentComponent({
|
|
|
243
245
|
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)) {
|
|
244
246
|
return null;
|
|
245
247
|
}
|
|
246
|
-
|
|
248
|
+
const userIntentEnabled = Boolean((pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.userIntent) && expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true));
|
|
249
|
+
if (((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'dragging' || (userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && expValEquals('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_hide_floating_toolbar')) && !userIntentEnabled) {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
if (userIntentState !== null && userIntentState !== void 0 && userIntentState.currentUserIntent && ['dragging', 'tablePopupOpen', 'commenting', 'resizing', 'blockMenuOpen'].includes(userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) && userIntentEnabled) {
|
|
247
253
|
return null;
|
|
248
254
|
}
|
|
249
|
-
|
|
250
|
-
// TODO: ED-27539 - This feature is unreleased and rendering logic needs to be move userIntentState which is not ready yet
|
|
251
|
-
// if (blockControlsState?.isMenuOpen && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
252
|
-
// return null;
|
|
253
|
-
// }
|
|
254
|
-
|
|
255
255
|
const {
|
|
256
256
|
config,
|
|
257
257
|
node
|
|
@@ -537,7 +537,8 @@ export function floatingToolbarPluginFactory(options) {
|
|
|
537
537
|
const {
|
|
538
538
|
floatingToolbarHandlers,
|
|
539
539
|
providerFactory,
|
|
540
|
-
getIntl
|
|
540
|
+
getIntl,
|
|
541
|
+
api
|
|
541
542
|
} = options;
|
|
542
543
|
const intl = getIntl();
|
|
543
544
|
const getConfigWithNodeInfo = editorState => {
|
|
@@ -546,7 +547,13 @@ export function floatingToolbarPluginFactory(options) {
|
|
|
546
547
|
const handler = floatingToolbarHandlers[index];
|
|
547
548
|
const config = handler(editorState, intl, providerFactory, activeConfigs);
|
|
548
549
|
if (config) {
|
|
549
|
-
|
|
550
|
+
var _api$userIntent, _api$userIntent$share;
|
|
551
|
+
const userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true));
|
|
552
|
+
if (config.__suppressAllToolbars && editorExperiment('platform_editor_controls', 'variant1') && !userIntentEnabled) {
|
|
553
|
+
activeConfigs = undefined;
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
if (userIntentEnabled && ['dragging', 'tablePopupOpen', 'commenting', 'resizing', 'blockMenuOpen'].includes((api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share === void 0 ? void 0 : _api$userIntent$share.currentUserIntent) || '')) {
|
|
550
557
|
activeConfigs = undefined;
|
|
551
558
|
break;
|
|
552
559
|
}
|
|
@@ -18,6 +18,7 @@ import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemi
|
|
|
18
18
|
import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
19
19
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
20
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
21
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
21
22
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
22
23
|
import { copyNode as _copyNode } from './pm-plugins/commands';
|
|
23
24
|
import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
|
|
@@ -138,6 +139,7 @@ export var floatingToolbarPlugin = function floatingToolbarPlugin(_ref) {
|
|
|
138
139
|
var providerFactory = _ref2.providerFactory,
|
|
139
140
|
getIntl = _ref2.getIntl;
|
|
140
141
|
return floatingToolbarPluginFactory({
|
|
142
|
+
api: api,
|
|
141
143
|
floatingToolbarHandlers: floatingToolbarHandlers,
|
|
142
144
|
providerFactory: providerFactory,
|
|
143
145
|
getIntl: getIntl
|
|
@@ -244,15 +246,13 @@ export function ContentComponent(_ref5) {
|
|
|
244
246
|
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)) {
|
|
245
247
|
return null;
|
|
246
248
|
}
|
|
247
|
-
|
|
249
|
+
var userIntentEnabled = Boolean((pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.userIntent) && expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true));
|
|
250
|
+
if (((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'dragging' || (userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && expValEquals('platform_editor_block_menu', 'isEnabled', true) && fg('platform_editor_block_menu_hide_floating_toolbar')) && !userIntentEnabled) {
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
if (userIntentState !== null && userIntentState !== void 0 && userIntentState.currentUserIntent && ['dragging', 'tablePopupOpen', 'commenting', 'resizing', 'blockMenuOpen'].includes(userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) && userIntentEnabled) {
|
|
248
254
|
return null;
|
|
249
255
|
}
|
|
250
|
-
|
|
251
|
-
// TODO: ED-27539 - This feature is unreleased and rendering logic needs to be move userIntentState which is not ready yet
|
|
252
|
-
// if (blockControlsState?.isMenuOpen && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
253
|
-
// return null;
|
|
254
|
-
// }
|
|
255
|
-
|
|
256
256
|
var config = configWithNodeInfo.config,
|
|
257
257
|
node = configWithNodeInfo.node;
|
|
258
258
|
|
|
@@ -543,7 +543,8 @@ function sanitizeFloatingToolbarConfig(config) {
|
|
|
543
543
|
export function floatingToolbarPluginFactory(options) {
|
|
544
544
|
var floatingToolbarHandlers = options.floatingToolbarHandlers,
|
|
545
545
|
providerFactory = options.providerFactory,
|
|
546
|
-
getIntl = options.getIntl
|
|
546
|
+
getIntl = options.getIntl,
|
|
547
|
+
api = options.api;
|
|
547
548
|
var intl = getIntl();
|
|
548
549
|
var getConfigWithNodeInfo = function getConfigWithNodeInfo(editorState) {
|
|
549
550
|
var activeConfigs = [];
|
|
@@ -551,7 +552,13 @@ export function floatingToolbarPluginFactory(options) {
|
|
|
551
552
|
var handler = floatingToolbarHandlers[index];
|
|
552
553
|
var config = handler(editorState, intl, providerFactory, activeConfigs);
|
|
553
554
|
if (config) {
|
|
554
|
-
|
|
555
|
+
var _api$userIntent;
|
|
556
|
+
var userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true));
|
|
557
|
+
if (config.__suppressAllToolbars && editorExperiment('platform_editor_controls', 'variant1') && !userIntentEnabled) {
|
|
558
|
+
activeConfigs = undefined;
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
if (userIntentEnabled && ['dragging', 'tablePopupOpen', 'commenting', 'resizing', 'blockMenuOpen'].includes((api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) || '')) {
|
|
555
562
|
activeConfigs = undefined;
|
|
556
563
|
break;
|
|
557
564
|
}
|
|
@@ -51,6 +51,7 @@ export declare const pluginKey: PluginKey<FloatingToolbarPluginState>;
|
|
|
51
51
|
* @returns A SafePlugin instance that manages floating toolbar state and behavior
|
|
52
52
|
*/
|
|
53
53
|
export declare function floatingToolbarPluginFactory(options: {
|
|
54
|
+
api: ExtractInjectionAPI<FloatingToolbarPlugin> | undefined;
|
|
54
55
|
floatingToolbarHandlers: Array<FloatingToolbarHandler>;
|
|
55
56
|
getIntl: () => IntlShape;
|
|
56
57
|
providerFactory: ProviderFactory;
|
|
@@ -51,6 +51,7 @@ export declare const pluginKey: PluginKey<FloatingToolbarPluginState>;
|
|
|
51
51
|
* @returns A SafePlugin instance that manages floating toolbar state and behavior
|
|
52
52
|
*/
|
|
53
53
|
export declare function floatingToolbarPluginFactory(options: {
|
|
54
|
+
api: ExtractInjectionAPI<FloatingToolbarPlugin> | undefined;
|
|
54
55
|
floatingToolbarHandlers: Array<FloatingToolbarHandler>;
|
|
55
56
|
getIntl: () => IntlShape;
|
|
56
57
|
providerFactory: ProviderFactory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-floating-toolbar",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.11",
|
|
4
4
|
"description": "Floating toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/editor-plugin-decorations": "^6.1.0",
|
|
32
32
|
"@atlaskit/editor-plugin-editor-disabled": "^6.1.0",
|
|
33
33
|
"@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
|
|
34
|
-
"@atlaskit/editor-plugin-emoji": "^7.
|
|
34
|
+
"@atlaskit/editor-plugin-emoji": "^7.5.0",
|
|
35
35
|
"@atlaskit/editor-plugin-extension": "^9.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-interaction": "^9.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-table": "^15.3.0",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"@atlaskit/menu": "^8.4.0",
|
|
43
43
|
"@atlaskit/modal-dialog": "^14.6.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
|
-
"@atlaskit/primitives": "^16.
|
|
45
|
+
"@atlaskit/primitives": "^16.1.0",
|
|
46
46
|
"@atlaskit/select": "^21.3.0",
|
|
47
47
|
"@atlaskit/theme": "^21.0.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^13.21.0",
|
|
49
49
|
"@atlaskit/tokens": "^7.0.0",
|
|
50
|
-
"@atlaskit/tooltip": "^20.
|
|
50
|
+
"@atlaskit/tooltip": "^20.7.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"@emotion/react": "^11.7.1",
|
|
53
53
|
"bind-event-listener": "^3.0.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"react-loadable": "^5.1.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@atlaskit/editor-common": "^110.
|
|
60
|
+
"@atlaskit/editor-common": "^110.19.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-dom": "^18.2.0"
|
|
63
63
|
},
|