@atlaskit/editor-plugin-floating-toolbar 8.2.9 → 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 CHANGED
@@ -1,5 +1,21 @@
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
+
11
+ ## 8.2.10
12
+
13
+ ### Patch Changes
14
+
15
+ - [`9842848622554`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9842848622554) -
16
+ ENGHEALTH-23797:Fixed aria prohibited attr from selection marker
17
+ - Updated dependencies
18
+
3
19
  ## 8.2.9
4
20
 
5
21
  ### 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
- 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')) {
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
 
@@ -431,6 +431,7 @@ function ContentComponent(_ref5) {
431
431
  fallbackComponent: null
432
432
  }, /*#__PURE__*/_react.default.createElement(_ui.Popup, {
433
433
  ariaLabel: title,
434
+ role: (0, _platformFeatureFlags.fg)('platform_editor_a11y_add_role_to_popup') ? 'toolbar' : undefined,
434
435
  offset: offset,
435
436
  target: targetRef,
436
437
  alignY: "bottom",
@@ -551,7 +552,8 @@ function sanitizeFloatingToolbarConfig(config) {
551
552
  function floatingToolbarPluginFactory(options) {
552
553
  var floatingToolbarHandlers = options.floatingToolbarHandlers,
553
554
  providerFactory = options.providerFactory,
554
- getIntl = options.getIntl;
555
+ getIntl = options.getIntl,
556
+ api = options.api;
555
557
  var intl = getIntl();
556
558
  var getConfigWithNodeInfo = function getConfigWithNodeInfo(editorState) {
557
559
  var activeConfigs = [];
@@ -559,7 +561,13 @@ function floatingToolbarPluginFactory(options) {
559
561
  var handler = floatingToolbarHandlers[index];
560
562
  var config = handler(editorState, intl, providerFactory, activeConfigs);
561
563
  if (config) {
562
- if (config.__suppressAllToolbars && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
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) || '')) {
563
571
  activeConfigs = undefined;
564
572
  break;
565
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
- 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')) {
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
@@ -417,6 +417,7 @@ export function ContentComponent({
417
417
  fallbackComponent: null
418
418
  }, /*#__PURE__*/React.createElement(Popup, {
419
419
  ariaLabel: title,
420
+ role: fg('platform_editor_a11y_add_role_to_popup') ? 'toolbar' : undefined,
420
421
  offset: offset,
421
422
  target: targetRef,
422
423
  alignY: "bottom",
@@ -536,7 +537,8 @@ export function floatingToolbarPluginFactory(options) {
536
537
  const {
537
538
  floatingToolbarHandlers,
538
539
  providerFactory,
539
- getIntl
540
+ getIntl,
541
+ api
540
542
  } = options;
541
543
  const intl = getIntl();
542
544
  const getConfigWithNodeInfo = editorState => {
@@ -545,7 +547,13 @@ export function floatingToolbarPluginFactory(options) {
545
547
  const handler = floatingToolbarHandlers[index];
546
548
  const config = handler(editorState, intl, providerFactory, activeConfigs);
547
549
  if (config) {
548
- if (config.__suppressAllToolbars && editorExperiment('platform_editor_controls', 'variant1')) {
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) || '')) {
549
557
  activeConfigs = undefined;
550
558
  break;
551
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
- 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')) {
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
 
@@ -422,6 +422,7 @@ export function ContentComponent(_ref5) {
422
422
  fallbackComponent: null
423
423
  }, /*#__PURE__*/React.createElement(Popup, {
424
424
  ariaLabel: title,
425
+ role: fg('platform_editor_a11y_add_role_to_popup') ? 'toolbar' : undefined,
425
426
  offset: offset,
426
427
  target: targetRef,
427
428
  alignY: "bottom",
@@ -542,7 +543,8 @@ function sanitizeFloatingToolbarConfig(config) {
542
543
  export function floatingToolbarPluginFactory(options) {
543
544
  var floatingToolbarHandlers = options.floatingToolbarHandlers,
544
545
  providerFactory = options.providerFactory,
545
- getIntl = options.getIntl;
546
+ getIntl = options.getIntl,
547
+ api = options.api;
546
548
  var intl = getIntl();
547
549
  var getConfigWithNodeInfo = function getConfigWithNodeInfo(editorState) {
548
550
  var activeConfigs = [];
@@ -550,7 +552,13 @@ export function floatingToolbarPluginFactory(options) {
550
552
  var handler = floatingToolbarHandlers[index];
551
553
  var config = handler(editorState, intl, providerFactory, activeConfigs);
552
554
  if (config) {
553
- if (config.__suppressAllToolbars && editorExperiment('platform_editor_controls', 'variant1')) {
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) || '')) {
554
562
  activeConfigs = undefined;
555
563
  break;
556
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.9",
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,23 +31,23 @@
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.4.0",
35
- "@atlaskit/editor-plugin-extension": "^9.1.0",
34
+ "@atlaskit/editor-plugin-emoji": "^7.5.0",
35
+ "@atlaskit/editor-plugin-extension": "^9.2.0",
36
36
  "@atlaskit/editor-plugin-interaction": "^9.0.0",
37
- "@atlaskit/editor-plugin-table": "^15.2.0",
37
+ "@atlaskit/editor-plugin-table": "^15.3.0",
38
38
  "@atlaskit/editor-plugin-user-intent": "^4.0.0",
39
39
  "@atlaskit/editor-prosemirror": "7.0.0",
40
40
  "@atlaskit/emoji": "^69.6.0",
41
41
  "@atlaskit/icon": "^28.5.0",
42
42
  "@atlaskit/menu": "^8.4.0",
43
- "@atlaskit/modal-dialog": "^14.5.0",
43
+ "@atlaskit/modal-dialog": "^14.6.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
- "@atlaskit/primitives": "^16.0.0",
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.16.0",
48
+ "@atlaskit/tmp-editor-statsig": "^13.21.0",
49
49
  "@atlaskit/tokens": "^7.0.0",
50
- "@atlaskit/tooltip": "^20.6.0",
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.15.0",
60
+ "@atlaskit/editor-common": "^110.19.0",
61
61
  "react": "^18.2.0",
62
62
  "react-dom": "^18.2.0"
63
63
  },
@@ -125,6 +125,9 @@
125
125
  "platform_editor_fix_confirm_table_removal": {
126
126
  "type": "boolean"
127
127
  },
128
+ "platform_editor_a11y_add_role_to_popup": {
129
+ "type": "boolean"
130
+ },
128
131
  "platform_editor_update_modal_close_button": {
129
132
  "type": "boolean"
130
133
  },