@atlaskit/editor-plugin-selection-marker 2.0.4 → 2.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,25 @@
1
1
  # @atlaskit/editor-plugin-selection-marker
2
2
 
3
+ ## 2.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#132362](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132362)
14
+ [`2e90b51d52288`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2e90b51d52288) -
15
+ [ux] [ED-26841] Do not autofocus editor when it is a live page with content. Additionally hide
16
+ cursor marks and ensure cursor starts at the very start of document to prevent selection
17
+ appearance and toolbars.
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 2.0.4
4
24
 
5
25
  ### Patch Changes
@@ -33,7 +33,7 @@ function getDecorationType(tr, shouldHideDecorations) {
33
33
  if (shouldHideDecorations || (0, _utils.isEmptyDocument)(tr.doc)) {
34
34
  return 'none';
35
35
  }
36
- // TODO: implement "highlight" for AI features
36
+ // TODO: ED-26961 - implement "highlight" for AI features
37
37
  return 'blur';
38
38
  }
39
39
  var applyNextPluginState = exports.applyNextPluginState = function applyNextPluginState(tr, currentState, oldEditorState) {
@@ -8,12 +8,14 @@ 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 _main = require("./pm-plugins/main");
12
13
  var _globalStyles = require("./ui/global-styles");
13
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
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; }
15
16
  var selectionMarkerPlugin = exports.selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
16
- var api = _ref.api;
17
+ var config = _ref.config,
18
+ api = _ref.api;
17
19
  return {
18
20
  name: 'selectionMarker',
19
21
  pmPlugins: function pmPlugins() {
@@ -73,24 +75,53 @@ var selectionMarkerPlugin = exports.selectionMarkerPlugin = function selectionMa
73
75
  },
74
76
  usePluginHook: function usePluginHook(_ref4) {
75
77
  var editorView = _ref4.editorView;
78
+ var editorHasNotBeenFocused = (0, _react.useRef)(true);
79
+ (0, _react.useEffect)(function () {
80
+ // relatch when editorView changes (pretty good signal for reinit)
81
+ editorHasNotBeenFocused.current = true;
82
+ }, [editorView]);
76
83
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['focus', 'typeAhead', 'editorDisabled', 'selectionMarker']),
77
84
  focusState = _useSharedPluginState.focusState,
78
85
  typeAheadState = _useSharedPluginState.typeAheadState,
79
86
  editorDisabledState = _useSharedPluginState.editorDisabledState;
80
87
  var isForcedHidden = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selectionMarker.isForcedHidden');
81
88
  (0, _react.useEffect)(function () {
82
- var _ref5, _typeAheadState$isOpe, _editorDisabledState$;
83
- /**
84
- * There are a number of conditions we should not show the marker,
85
- * - Focus: to ensure it doesn't interrupt the normal cursor
86
- * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
87
- * - Disabled: So that it behaves similar to the renderer in live pages/disabled
88
- * - Via the API: If another plugin has requested it to be hidden (force hidden).
89
- */
90
- var shouldHide = (_ref5 = (focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) || ((_typeAheadState$isOpe = typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isOpen) !== null && _typeAheadState$isOpe !== void 0 ? _typeAheadState$isOpe : false) || isForcedHidden || ((_editorDisabledState$ = editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) !== null && _editorDisabledState$ !== void 0 ? _editorDisabledState$ : false)) !== null && _ref5 !== void 0 ? _ref5 : true;
91
- requestAnimationFrame(function () {
92
- return (0, _main.dispatchShouldHideDecorations)(editorView, shouldHide);
93
- });
89
+ if ((0, _platformFeatureFlags.fg)('platform_editor_no_cursor_on_live_doc_init')) {
90
+ var _ref5, _typeAheadState$isOpe, _editorDisabledState$;
91
+ // On editor init we should use this latch to keep the marker hidden until
92
+ // editor has received focus. This means editor will be initially hidden until
93
+ // the first focus occurs, and after first focus the normal above rules will
94
+ // apply
95
+ if ((focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) === true) {
96
+ editorHasNotBeenFocused.current = false;
97
+ }
98
+
99
+ /**
100
+ * There are a number of conditions we should not show the marker,
101
+ * - Editor has not been focused: to keep the marker hidden until first focus if config is set
102
+ * - Focus: to ensure it doesn't interrupt the normal cursor
103
+ * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
104
+ * - Disabled: So that it behaves similar to the renderer in live pages/disabled
105
+ * - Via the API: If another plugin has requested it to be hidden (force hidden).
106
+ */
107
+ var shouldHide = (_ref5 = (config === null || config === void 0 ? void 0 : config.hideCursorOnInit) && editorHasNotBeenFocused.current || (focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) || ((_typeAheadState$isOpe = typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isOpen) !== null && _typeAheadState$isOpe !== void 0 ? _typeAheadState$isOpe : false) || isForcedHidden || ((_editorDisabledState$ = editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) !== null && _editorDisabledState$ !== void 0 ? _editorDisabledState$ : false)) !== null && _ref5 !== void 0 ? _ref5 : true;
108
+ requestAnimationFrame(function () {
109
+ return (0, _main.dispatchShouldHideDecorations)(editorView, shouldHide);
110
+ });
111
+ } else {
112
+ var _ref6, _typeAheadState$isOpe2, _editorDisabledState$2;
113
+ /**
114
+ * There are a number of conditions we should not show the marker,
115
+ * - Focus: to ensure it doesn't interrupt the normal cursor
116
+ * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
117
+ * - Disabled: So that it behaves similar to the renderer in live pages/disabled
118
+ * - Via the API: If another plugin has requested it to be hidden (force hidden).
119
+ */
120
+ var _shouldHide = (_ref6 = (focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) || ((_typeAheadState$isOpe2 = typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isOpen) !== null && _typeAheadState$isOpe2 !== void 0 ? _typeAheadState$isOpe2 : false) || isForcedHidden || ((_editorDisabledState$2 = editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) !== null && _editorDisabledState$2 !== void 0 ? _editorDisabledState$2 : false)) !== null && _ref6 !== void 0 ? _ref6 : true;
121
+ requestAnimationFrame(function () {
122
+ return (0, _main.dispatchShouldHideDecorations)(editorView, _shouldHide);
123
+ });
124
+ }
94
125
  }, [editorView, focusState, typeAheadState, isForcedHidden, editorDisabledState]);
95
126
  },
96
127
  contentComponent: function contentComponent() {
@@ -105,8 +136,8 @@ function cleanupHiddenDecoration(api) {
105
136
  if (!hasRun && api !== null && api !== void 0 && (_api$selectionMarker3 = api.selectionMarker) !== null && _api$selectionMarker3 !== void 0 && (_api$selectionMarker3 = _api$selectionMarker3.sharedState.currentState()) !== null && _api$selectionMarker3 !== void 0 && _api$selectionMarker3.isForcedHidden) {
106
137
  var _api$core2;
107
138
  hasRun = true;
108
- return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(function (_ref6) {
109
- var tr = _ref6.tr;
139
+ return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(function (_ref7) {
140
+ var tr = _ref7.tr;
110
141
  return tr.setMeta(_main.key, {
111
142
  forceHide: false
112
143
  });
@@ -25,7 +25,7 @@ function getDecorationType(tr, shouldHideDecorations) {
25
25
  if (shouldHideDecorations || isEmptyDocument(tr.doc)) {
26
26
  return 'none';
27
27
  }
28
- // TODO: implement "highlight" for AI features
28
+ // TODO: ED-26961 - implement "highlight" for AI features
29
29
  return 'blur';
30
30
  }
31
31
  export const applyNextPluginState = (tr, currentState, oldEditorState) => {
@@ -1,9 +1,11 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
2
  import { useSharedPluginState } 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 { createPlugin, dispatchShouldHideDecorations, key } from './pm-plugins/main';
5
6
  import { GlobalStylesWrapper } from './ui/global-styles';
6
7
  export const selectionMarkerPlugin = ({
8
+ config,
7
9
  api
8
10
  }) => {
9
11
  return {
@@ -64,6 +66,11 @@ export const selectionMarkerPlugin = ({
64
66
  usePluginHook({
65
67
  editorView
66
68
  }) {
69
+ const editorHasNotBeenFocused = useRef(true);
70
+ useEffect(() => {
71
+ // relatch when editorView changes (pretty good signal for reinit)
72
+ editorHasNotBeenFocused.current = true;
73
+ }, [editorView]);
67
74
  const {
68
75
  focusState,
69
76
  typeAheadState,
@@ -71,16 +78,38 @@ export const selectionMarkerPlugin = ({
71
78
  } = useSharedPluginState(api, ['focus', 'typeAhead', 'editorDisabled', 'selectionMarker']);
72
79
  const isForcedHidden = useSharedPluginStateSelector(api, 'selectionMarker.isForcedHidden');
73
80
  useEffect(() => {
74
- var _ref, _typeAheadState$isOpe, _editorDisabledState$;
75
- /**
76
- * There are a number of conditions we should not show the marker,
77
- * - Focus: to ensure it doesn't interrupt the normal cursor
78
- * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
79
- * - Disabled: So that it behaves similar to the renderer in live pages/disabled
80
- * - Via the API: If another plugin has requested it to be hidden (force hidden).
81
- */
82
- const shouldHide = (_ref = (focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) || ((_typeAheadState$isOpe = typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isOpen) !== null && _typeAheadState$isOpe !== void 0 ? _typeAheadState$isOpe : false) || isForcedHidden || ((_editorDisabledState$ = editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) !== null && _editorDisabledState$ !== void 0 ? _editorDisabledState$ : false)) !== null && _ref !== void 0 ? _ref : true;
83
- requestAnimationFrame(() => dispatchShouldHideDecorations(editorView, shouldHide));
81
+ if (fg('platform_editor_no_cursor_on_live_doc_init')) {
82
+ var _ref, _typeAheadState$isOpe, _editorDisabledState$;
83
+ // On editor init we should use this latch to keep the marker hidden until
84
+ // editor has received focus. This means editor will be initially hidden until
85
+ // the first focus occurs, and after first focus the normal above rules will
86
+ // apply
87
+ if ((focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) === true) {
88
+ editorHasNotBeenFocused.current = false;
89
+ }
90
+
91
+ /**
92
+ * There are a number of conditions we should not show the marker,
93
+ * - Editor has not been focused: to keep the marker hidden until first focus if config is set
94
+ * - Focus: to ensure it doesn't interrupt the normal cursor
95
+ * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
96
+ * - Disabled: So that it behaves similar to the renderer in live pages/disabled
97
+ * - Via the API: If another plugin has requested it to be hidden (force hidden).
98
+ */
99
+ const shouldHide = (_ref = (config === null || config === void 0 ? void 0 : config.hideCursorOnInit) && editorHasNotBeenFocused.current || (focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) || ((_typeAheadState$isOpe = typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isOpen) !== null && _typeAheadState$isOpe !== void 0 ? _typeAheadState$isOpe : false) || isForcedHidden || ((_editorDisabledState$ = editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) !== null && _editorDisabledState$ !== void 0 ? _editorDisabledState$ : false)) !== null && _ref !== void 0 ? _ref : true;
100
+ requestAnimationFrame(() => dispatchShouldHideDecorations(editorView, shouldHide));
101
+ } else {
102
+ var _ref2, _typeAheadState$isOpe2, _editorDisabledState$2;
103
+ /**
104
+ * There are a number of conditions we should not show the marker,
105
+ * - Focus: to ensure it doesn't interrupt the normal cursor
106
+ * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
107
+ * - Disabled: So that it behaves similar to the renderer in live pages/disabled
108
+ * - Via the API: If another plugin has requested it to be hidden (force hidden).
109
+ */
110
+ const shouldHide = (_ref2 = (focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) || ((_typeAheadState$isOpe2 = typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isOpen) !== null && _typeAheadState$isOpe2 !== void 0 ? _typeAheadState$isOpe2 : false) || isForcedHidden || ((_editorDisabledState$2 = editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) !== null && _editorDisabledState$2 !== void 0 ? _editorDisabledState$2 : false)) !== null && _ref2 !== void 0 ? _ref2 : true;
111
+ requestAnimationFrame(() => dispatchShouldHideDecorations(editorView, shouldHide));
112
+ }
84
113
  }, [editorView, focusState, typeAheadState, isForcedHidden, editorDisabledState]);
85
114
  },
86
115
  contentComponent() {
@@ -24,7 +24,7 @@ function getDecorationType(tr, shouldHideDecorations) {
24
24
  if (shouldHideDecorations || isEmptyDocument(tr.doc)) {
25
25
  return 'none';
26
26
  }
27
- // TODO: implement "highlight" for AI features
27
+ // TODO: ED-26961 - implement "highlight" for AI features
28
28
  return 'blur';
29
29
  }
30
30
  export var applyNextPluginState = function applyNextPluginState(tr, currentState, oldEditorState) {
@@ -1,10 +1,12 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
2
  import { useSharedPluginState } 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 { createPlugin, dispatchShouldHideDecorations, key } from './pm-plugins/main';
5
6
  import { GlobalStylesWrapper } from './ui/global-styles';
6
7
  export var selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
7
- var api = _ref.api;
8
+ var config = _ref.config,
9
+ api = _ref.api;
8
10
  return {
9
11
  name: 'selectionMarker',
10
12
  pmPlugins: function pmPlugins() {
@@ -64,24 +66,53 @@ export var selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
64
66
  },
65
67
  usePluginHook: function usePluginHook(_ref4) {
66
68
  var editorView = _ref4.editorView;
69
+ var editorHasNotBeenFocused = useRef(true);
70
+ useEffect(function () {
71
+ // relatch when editorView changes (pretty good signal for reinit)
72
+ editorHasNotBeenFocused.current = true;
73
+ }, [editorView]);
67
74
  var _useSharedPluginState = useSharedPluginState(api, ['focus', 'typeAhead', 'editorDisabled', 'selectionMarker']),
68
75
  focusState = _useSharedPluginState.focusState,
69
76
  typeAheadState = _useSharedPluginState.typeAheadState,
70
77
  editorDisabledState = _useSharedPluginState.editorDisabledState;
71
78
  var isForcedHidden = useSharedPluginStateSelector(api, 'selectionMarker.isForcedHidden');
72
79
  useEffect(function () {
73
- var _ref5, _typeAheadState$isOpe, _editorDisabledState$;
74
- /**
75
- * There are a number of conditions we should not show the marker,
76
- * - Focus: to ensure it doesn't interrupt the normal cursor
77
- * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
78
- * - Disabled: So that it behaves similar to the renderer in live pages/disabled
79
- * - Via the API: If another plugin has requested it to be hidden (force hidden).
80
- */
81
- var shouldHide = (_ref5 = (focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) || ((_typeAheadState$isOpe = typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isOpen) !== null && _typeAheadState$isOpe !== void 0 ? _typeAheadState$isOpe : false) || isForcedHidden || ((_editorDisabledState$ = editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) !== null && _editorDisabledState$ !== void 0 ? _editorDisabledState$ : false)) !== null && _ref5 !== void 0 ? _ref5 : true;
82
- requestAnimationFrame(function () {
83
- return dispatchShouldHideDecorations(editorView, shouldHide);
84
- });
80
+ if (fg('platform_editor_no_cursor_on_live_doc_init')) {
81
+ var _ref5, _typeAheadState$isOpe, _editorDisabledState$;
82
+ // On editor init we should use this latch to keep the marker hidden until
83
+ // editor has received focus. This means editor will be initially hidden until
84
+ // the first focus occurs, and after first focus the normal above rules will
85
+ // apply
86
+ if ((focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) === true) {
87
+ editorHasNotBeenFocused.current = false;
88
+ }
89
+
90
+ /**
91
+ * There are a number of conditions we should not show the marker,
92
+ * - Editor has not been focused: to keep the marker hidden until first focus if config is set
93
+ * - Focus: to ensure it doesn't interrupt the normal cursor
94
+ * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
95
+ * - Disabled: So that it behaves similar to the renderer in live pages/disabled
96
+ * - Via the API: If another plugin has requested it to be hidden (force hidden).
97
+ */
98
+ var shouldHide = (_ref5 = (config === null || config === void 0 ? void 0 : config.hideCursorOnInit) && editorHasNotBeenFocused.current || (focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) || ((_typeAheadState$isOpe = typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isOpen) !== null && _typeAheadState$isOpe !== void 0 ? _typeAheadState$isOpe : false) || isForcedHidden || ((_editorDisabledState$ = editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) !== null && _editorDisabledState$ !== void 0 ? _editorDisabledState$ : false)) !== null && _ref5 !== void 0 ? _ref5 : true;
99
+ requestAnimationFrame(function () {
100
+ return dispatchShouldHideDecorations(editorView, shouldHide);
101
+ });
102
+ } else {
103
+ var _ref6, _typeAheadState$isOpe2, _editorDisabledState$2;
104
+ /**
105
+ * There are a number of conditions we should not show the marker,
106
+ * - Focus: to ensure it doesn't interrupt the normal cursor
107
+ * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
108
+ * - Disabled: So that it behaves similar to the renderer in live pages/disabled
109
+ * - Via the API: If another plugin has requested it to be hidden (force hidden).
110
+ */
111
+ var _shouldHide = (_ref6 = (focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) || ((_typeAheadState$isOpe2 = typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isOpen) !== null && _typeAheadState$isOpe2 !== void 0 ? _typeAheadState$isOpe2 : false) || isForcedHidden || ((_editorDisabledState$2 = editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) !== null && _editorDisabledState$2 !== void 0 ? _editorDisabledState$2 : false)) !== null && _ref6 !== void 0 ? _ref6 : true;
112
+ requestAnimationFrame(function () {
113
+ return dispatchShouldHideDecorations(editorView, _shouldHide);
114
+ });
115
+ }
85
116
  }, [editorView, focusState, typeAheadState, isForcedHidden, editorDisabledState]);
86
117
  },
87
118
  contentComponent: function contentComponent() {
@@ -96,8 +127,8 @@ function cleanupHiddenDecoration(api) {
96
127
  if (!hasRun && api !== null && api !== void 0 && (_api$selectionMarker3 = api.selectionMarker) !== null && _api$selectionMarker3 !== void 0 && (_api$selectionMarker3 = _api$selectionMarker3.sharedState.currentState()) !== null && _api$selectionMarker3 !== void 0 && _api$selectionMarker3.isForcedHidden) {
97
128
  var _api$core2;
98
129
  hasRun = true;
99
- return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(function (_ref6) {
100
- var tr = _ref6.tr;
130
+ return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(function (_ref7) {
131
+ var tr = _ref7.tr;
101
132
  return tr.setMeta(key, {
102
133
  forceHide: false
103
134
  });
@@ -1,2 +1,2 @@
1
1
  export { selectionMarkerPlugin } from './selectionMarkerPlugin';
2
- export type { SelectionMarkerPlugin, ReleaseHiddenDecoration } from './selectionMarkerPluginType';
2
+ export type { SelectionMarkerPlugin, SelectionMarkerPluginConfiguration, ReleaseHiddenDecoration, } from './selectionMarkerPluginType';
@@ -5,12 +5,16 @@ import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
5
5
  export type ReleaseHiddenDecoration = () => boolean | undefined;
6
6
  type SetCleanup = (cb: ReleaseHiddenDecoration | undefined) => void;
7
7
  type CancelQueue = (() => void) | undefined;
8
+ export type SelectionMarkerPluginConfiguration = {
9
+ hideCursorOnInit?: boolean;
10
+ };
8
11
  export type SelectionMarkerPlugin = NextEditorPlugin<'selectionMarker', {
9
12
  dependencies: [
10
13
  FocusPlugin,
11
14
  OptionalPlugin<TypeAheadPlugin>,
12
15
  OptionalPlugin<EditorDisabledPlugin>
13
16
  ];
17
+ pluginConfiguration?: SelectionMarkerPluginConfiguration;
14
18
  sharedState: {
15
19
  isForcedHidden: boolean;
16
20
  isMarkerActive: boolean;
@@ -1,2 +1,2 @@
1
1
  export { selectionMarkerPlugin } from './selectionMarkerPlugin';
2
- export type { SelectionMarkerPlugin, ReleaseHiddenDecoration } from './selectionMarkerPluginType';
2
+ export type { SelectionMarkerPlugin, SelectionMarkerPluginConfiguration, ReleaseHiddenDecoration, } from './selectionMarkerPluginType';
@@ -5,12 +5,16 @@ import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
5
5
  export type ReleaseHiddenDecoration = () => boolean | undefined;
6
6
  type SetCleanup = (cb: ReleaseHiddenDecoration | undefined) => void;
7
7
  type CancelQueue = (() => void) | undefined;
8
+ export type SelectionMarkerPluginConfiguration = {
9
+ hideCursorOnInit?: boolean;
10
+ };
8
11
  export type SelectionMarkerPlugin = NextEditorPlugin<'selectionMarker', {
9
12
  dependencies: [
10
13
  FocusPlugin,
11
14
  OptionalPlugin<TypeAheadPlugin>,
12
15
  OptionalPlugin<EditorDisabledPlugin>
13
16
  ];
17
+ pluginConfiguration?: SelectionMarkerPluginConfiguration;
14
18
  sharedState: {
15
19
  isForcedHidden: boolean;
16
20
  isMarkerActive: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-marker",
3
- "version": "2.0.4",
3
+ "version": "2.1.1",
4
4
  "description": "Selection marker plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,15 +31,15 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^102.0.0",
34
+ "@atlaskit/editor-common": "^103.0.0",
35
35
  "@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
36
36
  "@atlaskit/editor-plugin-focus": "^1.5.0",
37
- "@atlaskit/editor-plugin-type-ahead": "^2.1.0",
37
+ "@atlaskit/editor-plugin-type-ahead": "^2.3.0",
38
38
  "@atlaskit/editor-prosemirror": "7.0.0",
39
39
  "@atlaskit/platform-feature-flags": "^1.1.0",
40
- "@atlaskit/primitives": "^14.1.0",
40
+ "@atlaskit/primitives": "^14.3.0",
41
41
  "@atlaskit/theme": "^18.0.0",
42
- "@atlaskit/tokens": "^4.3.0",
42
+ "@atlaskit/tokens": "^4.7.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@emotion/react": "^11.7.1",
45
45
  "lodash": "^4.17.21"
@@ -96,6 +96,9 @@
96
96
  "platform-feature-flags": {
97
97
  "platform_editor_plugin_selection_marker_bugfix": {
98
98
  "type": "boolean"
99
+ },
100
+ "platform_editor_no_cursor_on_live_doc_init": {
101
+ "type": "boolean"
99
102
  }
100
103
  }
101
104
  }