@atlaskit/editor-plugin-selection-marker 6.0.0 → 6.1.1

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,24 @@
1
1
  # @atlaskit/editor-plugin-selection-marker
2
2
 
3
+ ## 6.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`76ffc91d514f3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/76ffc91d514f3) -
8
+ Changed packages over to using the generic AIFC FG rather then an experiment
9
+ - Updated dependencies
10
+
11
+ ## 6.1.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`f4c0936dc05fe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f4c0936dc05fe) -
16
+ ED-29391 Add keyboard support for block menu
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 6.0.0
4
23
 
5
24
  ### Patch Changes
@@ -8,7 +8,9 @@ exports.selectionMarkerPlugin = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _hooks = require("@atlaskit/editor-common/hooks");
10
10
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
12
14
  var _main = require("./pm-plugins/main");
13
15
  var _globalStyles = require("./ui/global-styles");
14
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -79,19 +81,21 @@ var selectionMarkerPlugin = exports.selectionMarkerPlugin = function selectionMa
79
81
  // relatch when editorView changes (pretty good signal for reinit)
80
82
  editorHasNotBeenFocused.current = true;
81
83
  }, [editorView]);
82
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['focus', 'typeAhead', 'editorDisabled', 'toolbar'], function (states) {
83
- var _states$focusState, _states$typeAheadStat, _states$editorDisable, _states$toolbarState;
84
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['focus', 'typeAhead', 'editorDisabled', 'toolbar', 'decorations'], function (states) {
85
+ var _states$focusState, _states$typeAheadStat, _states$editorDisable, _states$toolbarState, _states$decorationsSt;
84
86
  return {
85
87
  hasFocus: (_states$focusState = states.focusState) === null || _states$focusState === void 0 ? void 0 : _states$focusState.hasFocus,
86
88
  isOpen: (_states$typeAheadStat = states.typeAheadState) === null || _states$typeAheadStat === void 0 ? void 0 : _states$typeAheadStat.isOpen,
87
89
  editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled,
88
- showToolbar: (_states$toolbarState = states.toolbarState) === null || _states$toolbarState === void 0 ? void 0 : _states$toolbarState.shouldShowToolbar
90
+ showToolbar: (_states$toolbarState = states.toolbarState) === null || _states$toolbarState === void 0 ? void 0 : _states$toolbarState.shouldShowToolbar,
91
+ hasDangerDecorations: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (_states$decorationsSt = states.decorationsState) === null || _states$decorationsSt === void 0 ? void 0 : _states$decorationsSt.hasDangerDecorations : undefined
89
92
  };
90
93
  }),
91
94
  hasFocus = _useSharedPluginState.hasFocus,
92
95
  isOpen = _useSharedPluginState.isOpen,
93
96
  editorDisabled = _useSharedPluginState.editorDisabled,
94
- showToolbar = _useSharedPluginState.showToolbar;
97
+ showToolbar = _useSharedPluginState.showToolbar,
98
+ hasDangerDecorations = _useSharedPluginState.hasDangerDecorations;
95
99
  var isForcedHidden = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selectionMarker.isForcedHidden');
96
100
  (0, _react.useEffect)(function () {
97
101
  // On editor init we should use this latch to keep the marker hidden until
@@ -109,12 +113,13 @@ var selectionMarkerPlugin = exports.selectionMarkerPlugin = function selectionMa
109
113
  * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
110
114
  * - Disabled: So that it behaves similar to the renderer in live pages/disabled
111
115
  * - Via the API: If another plugin has requested it to be hidden (force hidden).
116
+ * - If danger styles is shown in decorationsPlugin, then we don't need to show the selection marker
112
117
  */
113
- var shouldHide = (config === null || config === void 0 ? void 0 : config.hideCursorOnInit) && editorHasNotBeenFocused.current || hasFocus || (isOpen !== null && isOpen !== void 0 ? isOpen : false) || isForcedHidden || (editorDisabled !== null && editorDisabled !== void 0 ? editorDisabled : false) || (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_1', 'isEnabled', true) && (showToolbar !== null && showToolbar !== void 0 ? showToolbar : false) || (0, _expValEquals.expValEquals)('platform_editor_ai_aifc', 'isEnabled', true);
118
+ var shouldHide = (config === null || config === void 0 ? void 0 : config.hideCursorOnInit) && editorHasNotBeenFocused.current || hasFocus || (isOpen !== null && isOpen !== void 0 ? isOpen : false) || isForcedHidden || (editorDisabled !== null && editorDisabled !== void 0 ? editorDisabled : false) || (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_1', 'isEnabled', true) && (showToolbar !== null && showToolbar !== void 0 ? showToolbar : false) || (0, _platformFeatureFlags.fg)('aifc_create_enabled') || !!hasDangerDecorations && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true);
114
119
  requestAnimationFrame(function () {
115
120
  return (0, _main.dispatchShouldHideDecorations)(editorView, shouldHide);
116
121
  });
117
- }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled, showToolbar]);
122
+ }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled, showToolbar, hasDangerDecorations]);
118
123
  },
119
124
  contentComponent: function contentComponent() {
120
125
  return /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, null);
@@ -1,7 +1,9 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
2
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
5
7
  import { createPlugin, dispatchShouldHideDecorations, key } from './pm-plugins/main';
6
8
  import { GlobalStylesWrapper } from './ui/global-styles';
7
9
  export const selectionMarkerPlugin = ({
@@ -75,14 +77,16 @@ export const selectionMarkerPlugin = ({
75
77
  hasFocus,
76
78
  isOpen,
77
79
  editorDisabled,
78
- showToolbar
79
- } = useSharedPluginStateWithSelector(api, ['focus', 'typeAhead', 'editorDisabled', 'toolbar'], states => {
80
- var _states$focusState, _states$typeAheadStat, _states$editorDisable, _states$toolbarState;
80
+ showToolbar,
81
+ hasDangerDecorations
82
+ } = useSharedPluginStateWithSelector(api, ['focus', 'typeAhead', 'editorDisabled', 'toolbar', 'decorations'], states => {
83
+ var _states$focusState, _states$typeAheadStat, _states$editorDisable, _states$toolbarState, _states$decorationsSt;
81
84
  return {
82
85
  hasFocus: (_states$focusState = states.focusState) === null || _states$focusState === void 0 ? void 0 : _states$focusState.hasFocus,
83
86
  isOpen: (_states$typeAheadStat = states.typeAheadState) === null || _states$typeAheadStat === void 0 ? void 0 : _states$typeAheadStat.isOpen,
84
87
  editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled,
85
- showToolbar: (_states$toolbarState = states.toolbarState) === null || _states$toolbarState === void 0 ? void 0 : _states$toolbarState.shouldShowToolbar
88
+ showToolbar: (_states$toolbarState = states.toolbarState) === null || _states$toolbarState === void 0 ? void 0 : _states$toolbarState.shouldShowToolbar,
89
+ hasDangerDecorations: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (_states$decorationsSt = states.decorationsState) === null || _states$decorationsSt === void 0 ? void 0 : _states$decorationsSt.hasDangerDecorations : undefined
86
90
  };
87
91
  });
88
92
  const isForcedHidden = useSharedPluginStateSelector(api, 'selectionMarker.isForcedHidden');
@@ -102,10 +106,11 @@ export const selectionMarkerPlugin = ({
102
106
  * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
103
107
  * - Disabled: So that it behaves similar to the renderer in live pages/disabled
104
108
  * - Via the API: If another plugin has requested it to be hidden (force hidden).
109
+ * - If danger styles is shown in decorationsPlugin, then we don't need to show the selection marker
105
110
  */
106
- const shouldHide = (config === null || config === void 0 ? void 0 : config.hideCursorOnInit) && editorHasNotBeenFocused.current || hasFocus || (isOpen !== null && isOpen !== void 0 ? isOpen : false) || isForcedHidden || (editorDisabled !== null && editorDisabled !== void 0 ? editorDisabled : false) || expValEquals('platform_editor_toolbar_aifc_patch_1', 'isEnabled', true) && (showToolbar !== null && showToolbar !== void 0 ? showToolbar : false) || expValEquals('platform_editor_ai_aifc', 'isEnabled', true);
111
+ const shouldHide = (config === null || config === void 0 ? void 0 : config.hideCursorOnInit) && editorHasNotBeenFocused.current || hasFocus || (isOpen !== null && isOpen !== void 0 ? isOpen : false) || isForcedHidden || (editorDisabled !== null && editorDisabled !== void 0 ? editorDisabled : false) || expValEquals('platform_editor_toolbar_aifc_patch_1', 'isEnabled', true) && (showToolbar !== null && showToolbar !== void 0 ? showToolbar : false) || fg('aifc_create_enabled') || !!hasDangerDecorations && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true);
107
112
  requestAnimationFrame(() => dispatchShouldHideDecorations(editorView, shouldHide));
108
- }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled, showToolbar]);
113
+ }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled, showToolbar, hasDangerDecorations]);
109
114
  },
110
115
  contentComponent() {
111
116
  return /*#__PURE__*/React.createElement(GlobalStylesWrapper, null);
@@ -1,7 +1,9 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
2
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
5
7
  import { createPlugin, dispatchShouldHideDecorations, key } from './pm-plugins/main';
6
8
  import { GlobalStylesWrapper } from './ui/global-styles';
7
9
  export var selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
@@ -71,19 +73,21 @@ export var selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
71
73
  // relatch when editorView changes (pretty good signal for reinit)
72
74
  editorHasNotBeenFocused.current = true;
73
75
  }, [editorView]);
74
- var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['focus', 'typeAhead', 'editorDisabled', 'toolbar'], function (states) {
75
- var _states$focusState, _states$typeAheadStat, _states$editorDisable, _states$toolbarState;
76
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['focus', 'typeAhead', 'editorDisabled', 'toolbar', 'decorations'], function (states) {
77
+ var _states$focusState, _states$typeAheadStat, _states$editorDisable, _states$toolbarState, _states$decorationsSt;
76
78
  return {
77
79
  hasFocus: (_states$focusState = states.focusState) === null || _states$focusState === void 0 ? void 0 : _states$focusState.hasFocus,
78
80
  isOpen: (_states$typeAheadStat = states.typeAheadState) === null || _states$typeAheadStat === void 0 ? void 0 : _states$typeAheadStat.isOpen,
79
81
  editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled,
80
- showToolbar: (_states$toolbarState = states.toolbarState) === null || _states$toolbarState === void 0 ? void 0 : _states$toolbarState.shouldShowToolbar
82
+ showToolbar: (_states$toolbarState = states.toolbarState) === null || _states$toolbarState === void 0 ? void 0 : _states$toolbarState.shouldShowToolbar,
83
+ hasDangerDecorations: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (_states$decorationsSt = states.decorationsState) === null || _states$decorationsSt === void 0 ? void 0 : _states$decorationsSt.hasDangerDecorations : undefined
81
84
  };
82
85
  }),
83
86
  hasFocus = _useSharedPluginState.hasFocus,
84
87
  isOpen = _useSharedPluginState.isOpen,
85
88
  editorDisabled = _useSharedPluginState.editorDisabled,
86
- showToolbar = _useSharedPluginState.showToolbar;
89
+ showToolbar = _useSharedPluginState.showToolbar,
90
+ hasDangerDecorations = _useSharedPluginState.hasDangerDecorations;
87
91
  var isForcedHidden = useSharedPluginStateSelector(api, 'selectionMarker.isForcedHidden');
88
92
  useEffect(function () {
89
93
  // On editor init we should use this latch to keep the marker hidden until
@@ -101,12 +105,13 @@ export var selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
101
105
  * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
102
106
  * - Disabled: So that it behaves similar to the renderer in live pages/disabled
103
107
  * - Via the API: If another plugin has requested it to be hidden (force hidden).
108
+ * - If danger styles is shown in decorationsPlugin, then we don't need to show the selection marker
104
109
  */
105
- var shouldHide = (config === null || config === void 0 ? void 0 : config.hideCursorOnInit) && editorHasNotBeenFocused.current || hasFocus || (isOpen !== null && isOpen !== void 0 ? isOpen : false) || isForcedHidden || (editorDisabled !== null && editorDisabled !== void 0 ? editorDisabled : false) || expValEquals('platform_editor_toolbar_aifc_patch_1', 'isEnabled', true) && (showToolbar !== null && showToolbar !== void 0 ? showToolbar : false) || expValEquals('platform_editor_ai_aifc', 'isEnabled', true);
110
+ var shouldHide = (config === null || config === void 0 ? void 0 : config.hideCursorOnInit) && editorHasNotBeenFocused.current || hasFocus || (isOpen !== null && isOpen !== void 0 ? isOpen : false) || isForcedHidden || (editorDisabled !== null && editorDisabled !== void 0 ? editorDisabled : false) || expValEquals('platform_editor_toolbar_aifc_patch_1', 'isEnabled', true) && (showToolbar !== null && showToolbar !== void 0 ? showToolbar : false) || fg('aifc_create_enabled') || !!hasDangerDecorations && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true);
106
111
  requestAnimationFrame(function () {
107
112
  return dispatchShouldHideDecorations(editorView, shouldHide);
108
113
  });
109
- }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled, showToolbar]);
114
+ }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled, showToolbar, hasDangerDecorations]);
110
115
  },
111
116
  contentComponent: function contentComponent() {
112
117
  return /*#__PURE__*/React.createElement(GlobalStylesWrapper, null);
@@ -1,4 +1,5 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
2
3
  import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
3
4
  import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
4
5
  import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
@@ -24,7 +25,8 @@ export type SelectionMarkerPlugin = NextEditorPlugin<'selectionMarker', {
24
25
  FocusPlugin,
25
26
  OptionalPlugin<TypeAheadPlugin>,
26
27
  OptionalPlugin<EditorDisabledPlugin>,
27
- OptionalPlugin<ToolbarPlugin>
28
+ OptionalPlugin<ToolbarPlugin>,
29
+ OptionalPlugin<DecorationsPlugin>
28
30
  ];
29
31
  pluginConfiguration?: SelectionMarkerPluginOptions;
30
32
  sharedState: {
@@ -1,4 +1,5 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
2
3
  import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
3
4
  import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
4
5
  import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
@@ -24,7 +25,8 @@ export type SelectionMarkerPlugin = NextEditorPlugin<'selectionMarker', {
24
25
  FocusPlugin,
25
26
  OptionalPlugin<TypeAheadPlugin>,
26
27
  OptionalPlugin<EditorDisabledPlugin>,
27
- OptionalPlugin<ToolbarPlugin>
28
+ OptionalPlugin<ToolbarPlugin>,
29
+ OptionalPlugin<DecorationsPlugin>
28
30
  ];
29
31
  pluginConfiguration?: SelectionMarkerPluginOptions;
30
32
  sharedState: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-marker",
3
- "version": "6.0.0",
3
+ "version": "6.1.1",
4
4
  "description": "Selection marker plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,23 +28,24 @@
28
28
  ],
29
29
  "atlaskit:src": "src/index.ts",
30
30
  "dependencies": {
31
+ "@atlaskit/editor-plugin-decorations": "^6.1.0",
31
32
  "@atlaskit/editor-plugin-editor-disabled": "^6.0.0",
32
33
  "@atlaskit/editor-plugin-focus": "^5.0.0",
33
34
  "@atlaskit/editor-plugin-toolbar": "^3.0.0",
34
- "@atlaskit/editor-plugin-type-ahead": "^6.0.0",
35
+ "@atlaskit/editor-plugin-type-ahead": "^6.1.0",
35
36
  "@atlaskit/editor-prosemirror": "7.0.0",
36
37
  "@atlaskit/link": "^3.2.0",
37
38
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
39
  "@atlaskit/primitives": "^14.15.0",
39
40
  "@atlaskit/theme": "^21.0.0",
40
- "@atlaskit/tmp-editor-statsig": "^12.31.0",
41
- "@atlaskit/tokens": "^6.3.0",
41
+ "@atlaskit/tmp-editor-statsig": "^12.32.0",
42
+ "@atlaskit/tokens": "^6.4.0",
42
43
  "@babel/runtime": "^7.0.0",
43
44
  "@emotion/react": "^11.7.1",
44
45
  "lodash": "^4.17.21"
45
46
  },
46
47
  "peerDependencies": {
47
- "@atlaskit/editor-common": "^110.0.0",
48
+ "@atlaskit/editor-common": "^110.3.0",
48
49
  "react": "^18.2.0",
49
50
  "react-dom": "^18.2.0"
50
51
  },
@@ -97,6 +98,9 @@
97
98
  },
98
99
  "platform_editor_inline_selection_marker_cursor": {
99
100
  "type": "boolean"
101
+ },
102
+ "aifc_create_enabled": {
103
+ "type": "boolean"
100
104
  }
101
105
  }
102
106
  }