@atlaskit/editor-plugin-selection-marker 6.2.10 → 6.3.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,22 @@
1
1
  # @atlaskit/editor-plugin-selection-marker
2
2
 
3
+ ## 6.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 6.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`9323188ffa1db`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9323188ffa1db) -
14
+ Add userIntent plugin to selection marker, add check for block menu, if opened dont render marker
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 6.2.10
4
21
 
5
22
  ### Patch Changes
@@ -79,21 +79,23 @@ var selectionMarkerPlugin = exports.selectionMarkerPlugin = function selectionMa
79
79
  // relatch when editorView changes (pretty good signal for reinit)
80
80
  editorHasNotBeenFocused.current = true;
81
81
  }, [editorView]);
82
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['focus', 'typeAhead', 'editorDisabled', 'toolbar', 'decorations'], function (states) {
83
- var _states$focusState, _states$typeAheadStat, _states$editorDisable, _states$toolbarState, _states$decorationsSt;
82
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['focus', 'typeAhead', 'editorDisabled', 'toolbar', 'decorations', 'userIntent'], function (states) {
83
+ var _states$focusState, _states$typeAheadStat, _states$editorDisable, _states$toolbarState, _states$decorationsSt, _states$userIntentSta;
84
84
  return {
85
85
  hasFocus: (_states$focusState = states.focusState) === null || _states$focusState === void 0 ? void 0 : _states$focusState.hasFocus,
86
86
  isOpen: (_states$typeAheadStat = states.typeAheadState) === null || _states$typeAheadStat === void 0 ? void 0 : _states$typeAheadStat.isOpen,
87
87
  editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled,
88
88
  showToolbar: (_states$toolbarState = states.toolbarState) === null || _states$toolbarState === void 0 ? void 0 : _states$toolbarState.shouldShowToolbar,
89
- hasDangerDecorations: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? (_states$decorationsSt = states.decorationsState) === null || _states$decorationsSt === void 0 ? void 0 : _states$decorationsSt.hasDangerDecorations : undefined
89
+ hasDangerDecorations: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? (_states$decorationsSt = states.decorationsState) === null || _states$decorationsSt === void 0 ? void 0 : _states$decorationsSt.hasDangerDecorations : undefined,
90
+ currentUserIntent: (_states$userIntentSta = states.userIntentState) === null || _states$userIntentSta === void 0 ? void 0 : _states$userIntentSta.currentUserIntent
90
91
  };
91
92
  }),
92
93
  hasFocus = _useSharedPluginState.hasFocus,
93
94
  isOpen = _useSharedPluginState.isOpen,
94
95
  editorDisabled = _useSharedPluginState.editorDisabled,
95
96
  showToolbar = _useSharedPluginState.showToolbar,
96
- hasDangerDecorations = _useSharedPluginState.hasDangerDecorations;
97
+ hasDangerDecorations = _useSharedPluginState.hasDangerDecorations,
98
+ currentUserIntent = _useSharedPluginState.currentUserIntent;
97
99
  var isForcedHidden = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selectionMarker.isForcedHidden');
98
100
  (0, _react.useEffect)(function () {
99
101
  // On editor init we should use this latch to keep the marker hidden until
@@ -103,6 +105,7 @@ var selectionMarkerPlugin = exports.selectionMarkerPlugin = function selectionMa
103
105
  if (hasFocus === true) {
104
106
  editorHasNotBeenFocused.current = false;
105
107
  }
108
+ var isBlockMenuOpen = currentUserIntent === 'blockMenuOpen' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true);
106
109
 
107
110
  /**
108
111
  * There are a number of conditions we should not show the marker,
@@ -113,11 +116,11 @@ var selectionMarkerPlugin = exports.selectionMarkerPlugin = function selectionMa
113
116
  * - Via the API: If another plugin has requested it to be hidden (force hidden).
114
117
  * - If danger styles is shown in decorationsPlugin, then we don't need to show the selection marker
115
118
  */
116
- 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) || (showToolbar !== null && showToolbar !== void 0 ? showToolbar : false) || !!hasDangerDecorations && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true);
119
+ 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) || (showToolbar !== null && showToolbar !== void 0 ? showToolbar : false) || !!hasDangerDecorations && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) || isBlockMenuOpen;
117
120
  requestAnimationFrame(function () {
118
121
  return (0, _main.dispatchShouldHideDecorations)(editorView, shouldHide);
119
122
  });
120
- }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled, showToolbar, hasDangerDecorations]);
123
+ }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled, showToolbar, hasDangerDecorations, currentUserIntent]);
121
124
  },
122
125
  contentComponent: function contentComponent() {
123
126
  return /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, null);
@@ -76,15 +76,17 @@ export const selectionMarkerPlugin = ({
76
76
  isOpen,
77
77
  editorDisabled,
78
78
  showToolbar,
79
- hasDangerDecorations
80
- } = useSharedPluginStateWithSelector(api, ['focus', 'typeAhead', 'editorDisabled', 'toolbar', 'decorations'], states => {
81
- var _states$focusState, _states$typeAheadStat, _states$editorDisable, _states$toolbarState, _states$decorationsSt;
79
+ hasDangerDecorations,
80
+ currentUserIntent
81
+ } = useSharedPluginStateWithSelector(api, ['focus', 'typeAhead', 'editorDisabled', 'toolbar', 'decorations', 'userIntent'], states => {
82
+ var _states$focusState, _states$typeAheadStat, _states$editorDisable, _states$toolbarState, _states$decorationsSt, _states$userIntentSta;
82
83
  return {
83
84
  hasFocus: (_states$focusState = states.focusState) === null || _states$focusState === void 0 ? void 0 : _states$focusState.hasFocus,
84
85
  isOpen: (_states$typeAheadStat = states.typeAheadState) === null || _states$typeAheadStat === void 0 ? void 0 : _states$typeAheadStat.isOpen,
85
86
  editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled,
86
87
  showToolbar: (_states$toolbarState = states.toolbarState) === null || _states$toolbarState === void 0 ? void 0 : _states$toolbarState.shouldShowToolbar,
87
- hasDangerDecorations: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? (_states$decorationsSt = states.decorationsState) === null || _states$decorationsSt === void 0 ? void 0 : _states$decorationsSt.hasDangerDecorations : undefined
88
+ hasDangerDecorations: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? (_states$decorationsSt = states.decorationsState) === null || _states$decorationsSt === void 0 ? void 0 : _states$decorationsSt.hasDangerDecorations : undefined,
89
+ currentUserIntent: (_states$userIntentSta = states.userIntentState) === null || _states$userIntentSta === void 0 ? void 0 : _states$userIntentSta.currentUserIntent
88
90
  };
89
91
  });
90
92
  const isForcedHidden = useSharedPluginStateSelector(api, 'selectionMarker.isForcedHidden');
@@ -96,6 +98,7 @@ export const selectionMarkerPlugin = ({
96
98
  if (hasFocus === true) {
97
99
  editorHasNotBeenFocused.current = false;
98
100
  }
101
+ const isBlockMenuOpen = currentUserIntent === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true);
99
102
 
100
103
  /**
101
104
  * There are a number of conditions we should not show the marker,
@@ -106,9 +109,9 @@ export const selectionMarkerPlugin = ({
106
109
  * - Via the API: If another plugin has requested it to be hidden (force hidden).
107
110
  * - If danger styles is shown in decorationsPlugin, then we don't need to show the selection marker
108
111
  */
109
- 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) || (showToolbar !== null && showToolbar !== void 0 ? showToolbar : false) || !!hasDangerDecorations && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true);
112
+ 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) || (showToolbar !== null && showToolbar !== void 0 ? showToolbar : false) || !!hasDangerDecorations && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || isBlockMenuOpen;
110
113
  requestAnimationFrame(() => dispatchShouldHideDecorations(editorView, shouldHide));
111
- }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled, showToolbar, hasDangerDecorations]);
114
+ }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled, showToolbar, hasDangerDecorations, currentUserIntent]);
112
115
  },
113
116
  contentComponent() {
114
117
  return /*#__PURE__*/React.createElement(GlobalStylesWrapper, null);
@@ -71,21 +71,23 @@ export var selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
71
71
  // relatch when editorView changes (pretty good signal for reinit)
72
72
  editorHasNotBeenFocused.current = true;
73
73
  }, [editorView]);
74
- var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['focus', 'typeAhead', 'editorDisabled', 'toolbar', 'decorations'], function (states) {
75
- var _states$focusState, _states$typeAheadStat, _states$editorDisable, _states$toolbarState, _states$decorationsSt;
74
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['focus', 'typeAhead', 'editorDisabled', 'toolbar', 'decorations', 'userIntent'], function (states) {
75
+ var _states$focusState, _states$typeAheadStat, _states$editorDisable, _states$toolbarState, _states$decorationsSt, _states$userIntentSta;
76
76
  return {
77
77
  hasFocus: (_states$focusState = states.focusState) === null || _states$focusState === void 0 ? void 0 : _states$focusState.hasFocus,
78
78
  isOpen: (_states$typeAheadStat = states.typeAheadState) === null || _states$typeAheadStat === void 0 ? void 0 : _states$typeAheadStat.isOpen,
79
79
  editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled,
80
80
  showToolbar: (_states$toolbarState = states.toolbarState) === null || _states$toolbarState === void 0 ? void 0 : _states$toolbarState.shouldShowToolbar,
81
- hasDangerDecorations: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? (_states$decorationsSt = states.decorationsState) === null || _states$decorationsSt === void 0 ? void 0 : _states$decorationsSt.hasDangerDecorations : undefined
81
+ hasDangerDecorations: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? (_states$decorationsSt = states.decorationsState) === null || _states$decorationsSt === void 0 ? void 0 : _states$decorationsSt.hasDangerDecorations : undefined,
82
+ currentUserIntent: (_states$userIntentSta = states.userIntentState) === null || _states$userIntentSta === void 0 ? void 0 : _states$userIntentSta.currentUserIntent
82
83
  };
83
84
  }),
84
85
  hasFocus = _useSharedPluginState.hasFocus,
85
86
  isOpen = _useSharedPluginState.isOpen,
86
87
  editorDisabled = _useSharedPluginState.editorDisabled,
87
88
  showToolbar = _useSharedPluginState.showToolbar,
88
- hasDangerDecorations = _useSharedPluginState.hasDangerDecorations;
89
+ hasDangerDecorations = _useSharedPluginState.hasDangerDecorations,
90
+ currentUserIntent = _useSharedPluginState.currentUserIntent;
89
91
  var isForcedHidden = useSharedPluginStateSelector(api, 'selectionMarker.isForcedHidden');
90
92
  useEffect(function () {
91
93
  // On editor init we should use this latch to keep the marker hidden until
@@ -95,6 +97,7 @@ export var selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
95
97
  if (hasFocus === true) {
96
98
  editorHasNotBeenFocused.current = false;
97
99
  }
100
+ var isBlockMenuOpen = currentUserIntent === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true);
98
101
 
99
102
  /**
100
103
  * There are a number of conditions we should not show the marker,
@@ -105,11 +108,11 @@ export var selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
105
108
  * - Via the API: If another plugin has requested it to be hidden (force hidden).
106
109
  * - If danger styles is shown in decorationsPlugin, then we don't need to show the selection marker
107
110
  */
108
- 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) || (showToolbar !== null && showToolbar !== void 0 ? showToolbar : false) || !!hasDangerDecorations && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true);
111
+ 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) || (showToolbar !== null && showToolbar !== void 0 ? showToolbar : false) || !!hasDangerDecorations && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || isBlockMenuOpen;
109
112
  requestAnimationFrame(function () {
110
113
  return dispatchShouldHideDecorations(editorView, shouldHide);
111
114
  });
112
- }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled, showToolbar, hasDangerDecorations]);
115
+ }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled, showToolbar, hasDangerDecorations, currentUserIntent]);
113
116
  },
114
117
  contentComponent: function contentComponent() {
115
118
  return /*#__PURE__*/React.createElement(GlobalStylesWrapper, null);
@@ -4,6 +4,7 @@ import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabl
4
4
  import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
5
5
  import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
6
6
  import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
7
+ import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
7
8
  export type ReleaseHiddenDecoration = () => boolean | undefined;
8
9
  type SetCleanup = (cb: ReleaseHiddenDecoration | undefined) => void;
9
10
  type CancelQueue = (() => void) | undefined;
@@ -26,7 +27,8 @@ export type SelectionMarkerPlugin = NextEditorPlugin<'selectionMarker', {
26
27
  OptionalPlugin<TypeAheadPlugin>,
27
28
  OptionalPlugin<EditorDisabledPlugin>,
28
29
  OptionalPlugin<ToolbarPlugin>,
29
- OptionalPlugin<DecorationsPlugin>
30
+ OptionalPlugin<DecorationsPlugin>,
31
+ OptionalPlugin<UserIntentPlugin>
30
32
  ];
31
33
  pluginConfiguration?: SelectionMarkerPluginOptions;
32
34
  sharedState: {
@@ -4,6 +4,7 @@ import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabl
4
4
  import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
5
5
  import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
6
6
  import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
7
+ import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
7
8
  export type ReleaseHiddenDecoration = () => boolean | undefined;
8
9
  type SetCleanup = (cb: ReleaseHiddenDecoration | undefined) => void;
9
10
  type CancelQueue = (() => void) | undefined;
@@ -26,7 +27,8 @@ export type SelectionMarkerPlugin = NextEditorPlugin<'selectionMarker', {
26
27
  OptionalPlugin<TypeAheadPlugin>,
27
28
  OptionalPlugin<EditorDisabledPlugin>,
28
29
  OptionalPlugin<ToolbarPlugin>,
29
- OptionalPlugin<DecorationsPlugin>
30
+ OptionalPlugin<DecorationsPlugin>,
31
+ OptionalPlugin<UserIntentPlugin>
30
32
  ];
31
33
  pluginConfiguration?: SelectionMarkerPluginOptions;
32
34
  sharedState: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-marker",
3
- "version": "6.2.10",
3
+ "version": "6.3.1",
4
4
  "description": "Selection marker plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -10,7 +10,7 @@
10
10
  "atlassian": {
11
11
  "team": "Editor: Lego"
12
12
  },
13
- "repository": "https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo",
13
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-monorepo",
14
14
  "main": "dist/cjs/index.js",
15
15
  "module": "dist/esm/index.js",
16
16
  "module:es2019": "dist/es2019/index.js",
@@ -33,23 +33,24 @@
33
33
  "@atlaskit/editor-plugin-focus": "^5.0.0",
34
34
  "@atlaskit/editor-plugin-toolbar": "^3.4.0",
35
35
  "@atlaskit/editor-plugin-type-ahead": "^6.5.0",
36
- "@atlaskit/editor-prosemirror": "7.0.0",
36
+ "@atlaskit/editor-plugin-user-intent": "^4.0.0",
37
+ "@atlaskit/editor-prosemirror": "^7.2.0",
37
38
  "@atlaskit/link": "^3.2.0",
38
39
  "@atlaskit/platform-feature-flags": "^1.1.0",
39
40
  "@atlaskit/theme": "^21.0.0",
40
- "@atlaskit/tmp-editor-statsig": "^15.0.0",
41
- "@atlaskit/tokens": "^8.4.0",
41
+ "@atlaskit/tmp-editor-statsig": "^16.0.0",
42
+ "@atlaskit/tokens": "^9.0.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.40.0",
48
+ "@atlaskit/editor-common": "^110.46.0",
48
49
  "react": "^18.2.0",
49
50
  "react-dom": "^18.2.0"
50
51
  },
51
52
  "devDependencies": {
52
- "@testing-library/react": "^13.4.0",
53
+ "@testing-library/react": "^16.3.0",
53
54
  "wait-for-expect": "^1.2.0"
54
55
  },
55
56
  "techstack": {