@atlaskit/editor-plugin-selection-marker 2.5.2 → 2.5.3

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,13 @@
1
1
  # @atlaskit/editor-plugin-selection-marker
2
2
 
3
+ ## 2.5.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#180346](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/180346)
8
+ [`d00d1d362bd18`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d00d1d362bd18) -
9
+ ED-28086 Clean up platform_editor_no_cursor_on_live_doc_init
10
+
3
11
  ## 2.5.2
4
12
 
5
13
  ### Patch Changes
@@ -8,7 +8,6 @@ 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");
12
11
  var _main = require("./pm-plugins/main");
13
12
  var _globalStyles = require("./ui/global-styles");
14
13
  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); }
@@ -105,42 +104,27 @@ var selectionMarkerPlugin = exports.selectionMarkerPlugin = function selectionMa
105
104
  editorDisabled = _useSharedState.editorDisabled;
106
105
  var isForcedHidden = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selectionMarker.isForcedHidden');
107
106
  (0, _react.useEffect)(function () {
108
- if ((0, _platformFeatureFlags.fg)('platform_editor_no_cursor_on_live_doc_init')) {
109
- var _ref5;
110
- // On editor init we should use this latch to keep the marker hidden until
111
- // editor has received focus. This means editor will be initially hidden until
112
- // the first focus occurs, and after first focus the normal above rules will
113
- // apply
114
- if (hasFocus === true) {
115
- editorHasNotBeenFocused.current = false;
116
- }
117
-
118
- /**
119
- * There are a number of conditions we should not show the marker,
120
- * - Editor has not been focused: to keep the marker hidden until first focus if config is set
121
- * - Focus: to ensure it doesn't interrupt the normal cursor
122
- * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
123
- * - Disabled: So that it behaves similar to the renderer in live pages/disabled
124
- * - Via the API: If another plugin has requested it to be hidden (force hidden).
125
- */
126
- var shouldHide = (_ref5 = (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)) !== null && _ref5 !== void 0 ? _ref5 : true;
127
- requestAnimationFrame(function () {
128
- return (0, _main.dispatchShouldHideDecorations)(editorView, shouldHide);
129
- });
130
- } else {
131
- var _ref6;
132
- /**
133
- * There are a number of conditions we should not show the marker,
134
- * - Focus: to ensure it doesn't interrupt the normal cursor
135
- * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
136
- * - Disabled: So that it behaves similar to the renderer in live pages/disabled
137
- * - Via the API: If another plugin has requested it to be hidden (force hidden).
138
- */
139
- var _shouldHide = (_ref6 = hasFocus || (isOpen !== null && isOpen !== void 0 ? isOpen : false) || isForcedHidden || (editorDisabled !== null && editorDisabled !== void 0 ? editorDisabled : false)) !== null && _ref6 !== void 0 ? _ref6 : true;
140
- requestAnimationFrame(function () {
141
- return (0, _main.dispatchShouldHideDecorations)(editorView, _shouldHide);
142
- });
107
+ var _ref5;
108
+ // On editor init we should use this latch to keep the marker hidden until
109
+ // editor has received focus. This means editor will be initially hidden until
110
+ // the first focus occurs, and after first focus the normal above rules will
111
+ // apply
112
+ if (hasFocus === true) {
113
+ editorHasNotBeenFocused.current = false;
143
114
  }
115
+
116
+ /**
117
+ * There are a number of conditions we should not show the marker,
118
+ * - Editor has not been focused: to keep the marker hidden until first focus if config is set
119
+ * - Focus: to ensure it doesn't interrupt the normal cursor
120
+ * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
121
+ * - Disabled: So that it behaves similar to the renderer in live pages/disabled
122
+ * - Via the API: If another plugin has requested it to be hidden (force hidden).
123
+ */
124
+ var shouldHide = (_ref5 = (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)) !== null && _ref5 !== void 0 ? _ref5 : true;
125
+ requestAnimationFrame(function () {
126
+ return (0, _main.dispatchShouldHideDecorations)(editorView, shouldHide);
127
+ });
144
128
  }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled]);
145
129
  },
146
130
  contentComponent: function contentComponent() {
@@ -155,8 +139,8 @@ function cleanupHiddenDecoration(api) {
155
139
  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) {
156
140
  var _api$core2;
157
141
  hasRun = true;
158
- return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(function (_ref7) {
159
- var tr = _ref7.tr;
142
+ return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(function (_ref6) {
143
+ var tr = _ref6.tr;
160
144
  return tr.setMeta(_main.key, {
161
145
  forceHide: false
162
146
  });
@@ -1,7 +1,6 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
2
  import { useSharedPluginState, sharedPluginStateHookMigratorFactory } 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';
5
4
  import { createPlugin, dispatchShouldHideDecorations, key } from './pm-plugins/main';
6
5
  import { GlobalStylesWrapper } from './ui/global-styles';
7
6
  const useSharedState = sharedPluginStateHookMigratorFactory(api => {
@@ -99,38 +98,25 @@ export const selectionMarkerPlugin = ({
99
98
  } = useSharedState(api);
100
99
  const isForcedHidden = useSharedPluginStateSelector(api, 'selectionMarker.isForcedHidden');
101
100
  useEffect(() => {
102
- if (fg('platform_editor_no_cursor_on_live_doc_init')) {
103
- var _ref;
104
- // On editor init we should use this latch to keep the marker hidden until
105
- // editor has received focus. This means editor will be initially hidden until
106
- // the first focus occurs, and after first focus the normal above rules will
107
- // apply
108
- if (hasFocus === true) {
109
- editorHasNotBeenFocused.current = false;
110
- }
111
-
112
- /**
113
- * There are a number of conditions we should not show the marker,
114
- * - Editor has not been focused: to keep the marker hidden until first focus if config is set
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
- const shouldHide = (_ref = (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)) !== null && _ref !== void 0 ? _ref : true;
121
- requestAnimationFrame(() => dispatchShouldHideDecorations(editorView, shouldHide));
122
- } else {
123
- var _ref2;
124
- /**
125
- * There are a number of conditions we should not show the marker,
126
- * - Focus: to ensure it doesn't interrupt the normal cursor
127
- * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
128
- * - Disabled: So that it behaves similar to the renderer in live pages/disabled
129
- * - Via the API: If another plugin has requested it to be hidden (force hidden).
130
- */
131
- const shouldHide = (_ref2 = hasFocus || (isOpen !== null && isOpen !== void 0 ? isOpen : false) || isForcedHidden || (editorDisabled !== null && editorDisabled !== void 0 ? editorDisabled : false)) !== null && _ref2 !== void 0 ? _ref2 : true;
132
- requestAnimationFrame(() => dispatchShouldHideDecorations(editorView, shouldHide));
101
+ var _ref;
102
+ // On editor init we should use this latch to keep the marker hidden until
103
+ // editor has received focus. This means editor will be initially hidden until
104
+ // the first focus occurs, and after first focus the normal above rules will
105
+ // apply
106
+ if (hasFocus === true) {
107
+ editorHasNotBeenFocused.current = false;
133
108
  }
109
+
110
+ /**
111
+ * There are a number of conditions we should not show the marker,
112
+ * - Editor has not been focused: to keep the marker hidden until first focus if config is set
113
+ * - Focus: to ensure it doesn't interrupt the normal cursor
114
+ * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
115
+ * - Disabled: So that it behaves similar to the renderer in live pages/disabled
116
+ * - Via the API: If another plugin has requested it to be hidden (force hidden).
117
+ */
118
+ const shouldHide = (_ref = (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)) !== null && _ref !== void 0 ? _ref : true;
119
+ requestAnimationFrame(() => dispatchShouldHideDecorations(editorView, shouldHide));
134
120
  }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled]);
135
121
  },
136
122
  contentComponent() {
@@ -1,7 +1,6 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
2
  import { useSharedPluginState, sharedPluginStateHookMigratorFactory } 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';
5
4
  import { createPlugin, dispatchShouldHideDecorations, key } from './pm-plugins/main';
6
5
  import { GlobalStylesWrapper } from './ui/global-styles';
7
6
  var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
@@ -97,42 +96,27 @@ export var selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
97
96
  editorDisabled = _useSharedState.editorDisabled;
98
97
  var isForcedHidden = useSharedPluginStateSelector(api, 'selectionMarker.isForcedHidden');
99
98
  useEffect(function () {
100
- if (fg('platform_editor_no_cursor_on_live_doc_init')) {
101
- var _ref5;
102
- // On editor init we should use this latch to keep the marker hidden until
103
- // editor has received focus. This means editor will be initially hidden until
104
- // the first focus occurs, and after first focus the normal above rules will
105
- // apply
106
- if (hasFocus === true) {
107
- editorHasNotBeenFocused.current = false;
108
- }
109
-
110
- /**
111
- * There are a number of conditions we should not show the marker,
112
- * - Editor has not been focused: to keep the marker hidden until first focus if config is set
113
- * - Focus: to ensure it doesn't interrupt the normal cursor
114
- * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
115
- * - Disabled: So that it behaves similar to the renderer in live pages/disabled
116
- * - Via the API: If another plugin has requested it to be hidden (force hidden).
117
- */
118
- var shouldHide = (_ref5 = (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)) !== null && _ref5 !== void 0 ? _ref5 : true;
119
- requestAnimationFrame(function () {
120
- return dispatchShouldHideDecorations(editorView, shouldHide);
121
- });
122
- } else {
123
- var _ref6;
124
- /**
125
- * There are a number of conditions we should not show the marker,
126
- * - Focus: to ensure it doesn't interrupt the normal cursor
127
- * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
128
- * - Disabled: So that it behaves similar to the renderer in live pages/disabled
129
- * - Via the API: If another plugin has requested it to be hidden (force hidden).
130
- */
131
- var _shouldHide = (_ref6 = hasFocus || (isOpen !== null && isOpen !== void 0 ? isOpen : false) || isForcedHidden || (editorDisabled !== null && editorDisabled !== void 0 ? editorDisabled : false)) !== null && _ref6 !== void 0 ? _ref6 : true;
132
- requestAnimationFrame(function () {
133
- return dispatchShouldHideDecorations(editorView, _shouldHide);
134
- });
99
+ var _ref5;
100
+ // On editor init we should use this latch to keep the marker hidden until
101
+ // editor has received focus. This means editor will be initially hidden until
102
+ // the first focus occurs, and after first focus the normal above rules will
103
+ // apply
104
+ if (hasFocus === true) {
105
+ editorHasNotBeenFocused.current = false;
135
106
  }
107
+
108
+ /**
109
+ * There are a number of conditions we should not show the marker,
110
+ * - Editor has not been focused: to keep the marker hidden until first focus if config is set
111
+ * - Focus: to ensure it doesn't interrupt the normal cursor
112
+ * - Typeahead Open: To ensure it doesn't show when we're typing in the typeahead
113
+ * - Disabled: So that it behaves similar to the renderer in live pages/disabled
114
+ * - Via the API: If another plugin has requested it to be hidden (force hidden).
115
+ */
116
+ var shouldHide = (_ref5 = (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)) !== null && _ref5 !== void 0 ? _ref5 : true;
117
+ requestAnimationFrame(function () {
118
+ return dispatchShouldHideDecorations(editorView, shouldHide);
119
+ });
136
120
  }, [editorView, hasFocus, isOpen, isForcedHidden, editorDisabled]);
137
121
  },
138
122
  contentComponent: function contentComponent() {
@@ -147,8 +131,8 @@ function cleanupHiddenDecoration(api) {
147
131
  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) {
148
132
  var _api$core2;
149
133
  hasRun = true;
150
- return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(function (_ref7) {
151
- var tr = _ref7.tr;
134
+ return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(function (_ref6) {
135
+ var tr = _ref6.tr;
152
136
  return tr.setMeta(key, {
153
137
  forceHide: false
154
138
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-marker",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "Selection marker plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,17 +31,17 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^107.0.0",
34
+ "@atlaskit/editor-common": "^107.4.0",
35
35
  "@atlaskit/editor-plugin-editor-disabled": "^2.1.0",
36
36
  "@atlaskit/editor-plugin-focus": "^1.5.0",
37
37
  "@atlaskit/editor-plugin-type-ahead": "^2.7.0",
38
38
  "@atlaskit/editor-prosemirror": "7.0.0",
39
39
  "@atlaskit/link": "^3.2.0",
40
40
  "@atlaskit/platform-feature-flags": "^1.1.0",
41
- "@atlaskit/primitives": "^14.9.0",
41
+ "@atlaskit/primitives": "^14.10.0",
42
42
  "@atlaskit/theme": "^18.0.0",
43
- "@atlaskit/tmp-editor-statsig": "^8.0.0",
44
- "@atlaskit/tokens": "^5.3.0",
43
+ "@atlaskit/tmp-editor-statsig": "^8.6.0",
44
+ "@atlaskit/tokens": "^5.4.0",
45
45
  "@babel/runtime": "^7.0.0",
46
46
  "@emotion/react": "^11.7.1",
47
47
  "lodash": "^4.17.21"
@@ -99,9 +99,6 @@
99
99
  "platform_editor_plugin_selection_marker_bugfix": {
100
100
  "type": "boolean"
101
101
  },
102
- "platform_editor_no_cursor_on_live_doc_init": {
103
- "type": "boolean"
104
- },
105
102
  "dst-a11y__replace-anchor-with-link__editor-lego": {
106
103
  "type": "boolean"
107
104
  },