@atlaskit/editor-plugin-selection-extension 2.4.5 → 2.4.6

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-extension
2
2
 
3
+ ## 2.4.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#175281](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/175281)
8
+ [`f720d2c80d128`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f720d2c80d128) -
9
+ [ux] Fix inconsistent references in getSelection to state that could cause unhandled exceptions
10
+
3
11
  ## 2.4.5
4
12
 
5
13
  ### Patch Changes
@@ -9,6 +9,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _messages = require("@atlaskit/editor-common/messages");
11
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _main = require("./pm-plugins/main");
13
14
  var _SelectionExtensionComponentWrapper = require("./ui/extension/SelectionExtensionComponentWrapper");
14
15
  var _getBoundingBoxFromSelection = require("./ui/getBoundingBoxFromSelection");
@@ -109,7 +110,8 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
109
110
  var currentSelection = view.state.selection;
110
111
  var from = currentSelection.from,
111
112
  to = currentSelection.to;
112
- var text = state.doc.textBetween(from, to, '\n');
113
+ var currentState = (0, _platformFeatureFlags.fg)('platform_editor_fix_get_selection_state_mismatch') ? view.state : state;
114
+ var text = currentState.doc.textBetween(from, to, '\n');
113
115
  var coords = (0, _getBoundingBoxFromSelection.getBoundingBoxFromSelection)(view, from, to);
114
116
  return {
115
117
  text: text,
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { selectionExtensionMessages } from '@atlaskit/editor-common/messages';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { createPlugin, selectionExtensionPluginKey } from './pm-plugins/main';
5
6
  import { SelectionExtensionComponentWrapper } from './ui/extension/SelectionExtensionComponentWrapper';
6
7
  import { getBoundingBoxFromSelection } from './ui/getBoundingBoxFromSelection';
@@ -107,7 +108,8 @@ export const selectionExtensionPlugin = ({
107
108
  from,
108
109
  to
109
110
  } = currentSelection;
110
- const text = state.doc.textBetween(from, to, '\n');
111
+ const currentState = fg('platform_editor_fix_get_selection_state_mismatch') ? view.state : state;
112
+ const text = currentState.doc.textBetween(from, to, '\n');
111
113
  const coords = getBoundingBoxFromSelection(view, from, to);
112
114
  return {
113
115
  text,
@@ -2,6 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import React from 'react';
3
3
  import { selectionExtensionMessages } from '@atlaskit/editor-common/messages';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { createPlugin, selectionExtensionPluginKey } from './pm-plugins/main';
6
7
  import { SelectionExtensionComponentWrapper } from './ui/extension/SelectionExtensionComponentWrapper';
7
8
  import { getBoundingBoxFromSelection } from './ui/getBoundingBoxFromSelection';
@@ -102,7 +103,8 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
102
103
  var currentSelection = view.state.selection;
103
104
  var from = currentSelection.from,
104
105
  to = currentSelection.to;
105
- var text = state.doc.textBetween(from, to, '\n');
106
+ var currentState = fg('platform_editor_fix_get_selection_state_mismatch') ? view.state : state;
107
+ var text = currentState.doc.textBetween(from, to, '\n');
106
108
  var coords = getBoundingBoxFromSelection(view, from, to);
107
109
  return {
108
110
  text: text,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-extension",
3
- "version": "2.4.5",
3
+ "version": "2.4.6",
4
4
  "description": "editor-plugin-selection-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,12 +36,12 @@
36
36
  ".": "./src/index.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@atlaskit/editor-common": "^107.0.0",
39
+ "@atlaskit/editor-common": "^107.2.0",
40
40
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
41
41
  "@atlaskit/editor-plugin-editor-viewmode": "^4.0.0",
42
42
  "@atlaskit/editor-plugin-selection-toolbar": "^3.7.0",
43
43
  "@atlaskit/editor-prosemirror": "7.0.0",
44
- "@atlaskit/icon": "^27.0.0",
44
+ "@atlaskit/icon": "^27.1.0",
45
45
  "@atlaskit/platform-feature-flags": "^1.1.0",
46
46
  "@atlaskit/primitives": "^14.9.0",
47
47
  "@atlaskit/tmp-editor-statsig": "^8.0.0",
@@ -99,5 +99,10 @@
99
99
  "import-no-extraneous-disable-for-examples-and-docs"
100
100
  ]
101
101
  }
102
+ },
103
+ "platform-feature-flags": {
104
+ "platform_editor_fix_get_selection_state_mismatch": {
105
+ "type": "boolean"
106
+ }
102
107
  }
103
108
  }