@atlaskit/editor-plugin-selection-extension 7.1.2 → 7.1.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-extension
2
2
 
3
+ ## 7.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`096e1ff839aa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/096e1ff839aa4) -
8
+ Clean up `platform_editor_clear_active_extension_fix` feature gate
9
+ - Updated dependencies
10
+
3
11
  ## 7.1.2
4
12
 
5
13
  ### Patch Changes
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.replaceWithAdf = void 0;
7
7
  var _model = require("@atlaskit/editor-prosemirror/model");
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
9
  var _types = require("../../types");
9
10
  var _main = require("../main");
10
11
  var replaceWithAdf = exports.replaceWithAdf = function replaceWithAdf(nodeAdf, api) {
@@ -32,7 +33,7 @@ var replaceWithAdf = exports.replaceWithAdf = function replaceWithAdf(nodeAdf, a
32
33
  if (!selectedNode || nodePos === undefined) {
33
34
  throw new Error('No selected node or node position found');
34
35
  }
35
- var endPos = selectedNode.nodeSize + nodePos;
36
+ var endPos = selectedNode.type.name === 'doc' && (0, _platformFeatureFlags.fg)('platform_editor_selection_extension_improvement') ? nodePos + selectedNode.content.size : nodePos + selectedNode.nodeSize;
36
37
  var modifiedNode = _model.Node.fromJSON(schema, nodeAdf);
37
38
  modifiedNode.check();
38
39
  var updatedTr = tr.replaceWith(nodePos, endPos, modifiedNode).scrollIntoView();
@@ -41,7 +42,7 @@ var replaceWithAdf = exports.replaceWithAdf = function replaceWithAdf(nodeAdf, a
41
42
  return {
42
43
  status: 'success'
43
44
  };
44
- } catch (error) {
45
+ } catch (_unused) {
45
46
  dispatch(tr);
46
47
  return {
47
48
  status: 'failed-to-replace'
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
10
  var _state = require("@atlaskit/editor-prosemirror/state");
11
11
  var _transform = require("@atlaskit/editor-prosemirror/transform");
12
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
12
  var _types = require("../types");
14
13
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
15
14
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -56,7 +55,7 @@ var createPlugin = exports.createPlugin = function createPlugin() {
56
55
  });
57
56
  }
58
57
  // clear activeExtension if the selection has changed and not empty
59
- if (tr.selectionSet && !tr.selection.empty && (0, _platformFeatureFlags.fg)('platform_editor_clear_active_extension_fix')) {
58
+ if (tr.selectionSet && !tr.selection.empty) {
60
59
  return _objectSpread(_objectSpread({}, pluginState), {}, {
61
60
  activeExtension: undefined // Clear active extension on selection change
62
61
  });
@@ -1,4 +1,5 @@
1
1
  import { Node } from '@atlaskit/editor-prosemirror/model';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { SelectionExtensionActionTypes } from '../../types';
3
4
  import { selectionExtensionPluginKey } from '../main';
4
5
  export const replaceWithAdf = (nodeAdf, api) => (state, dispatch) => {
@@ -27,7 +28,7 @@ export const replaceWithAdf = (nodeAdf, api) => (state, dispatch) => {
27
28
  if (!selectedNode || nodePos === undefined) {
28
29
  throw new Error('No selected node or node position found');
29
30
  }
30
- const endPos = selectedNode.nodeSize + nodePos;
31
+ const endPos = selectedNode.type.name === 'doc' && fg('platform_editor_selection_extension_improvement') ? nodePos + selectedNode.content.size : nodePos + selectedNode.nodeSize;
31
32
  const modifiedNode = Node.fromJSON(schema, nodeAdf);
32
33
  modifiedNode.check();
33
34
  const updatedTr = tr.replaceWith(nodePos, endPos, modifiedNode).scrollIntoView();
@@ -36,7 +37,7 @@ export const replaceWithAdf = (nodeAdf, api) => (state, dispatch) => {
36
37
  return {
37
38
  status: 'success'
38
39
  };
39
- } catch (error) {
40
+ } catch {
40
41
  dispatch(tr);
41
42
  return {
42
43
  status: 'failed-to-replace'
@@ -1,7 +1,6 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  import { SelectionExtensionActionTypes } from '../types';
6
5
  export const selectionExtensionPluginKey = new PluginKey('selectionExtensionPlugin');
7
6
  export const createPlugin = () => {
@@ -49,7 +48,7 @@ export const createPlugin = () => {
49
48
  };
50
49
  }
51
50
  // clear activeExtension if the selection has changed and not empty
52
- if (tr.selectionSet && !tr.selection.empty && fg('platform_editor_clear_active_extension_fix')) {
51
+ if (tr.selectionSet && !tr.selection.empty) {
53
52
  return {
54
53
  ...pluginState,
55
54
  activeExtension: undefined // Clear active extension on selection change
@@ -1,4 +1,5 @@
1
1
  import { Node } from '@atlaskit/editor-prosemirror/model';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { SelectionExtensionActionTypes } from '../../types';
3
4
  import { selectionExtensionPluginKey } from '../main';
4
5
  export var replaceWithAdf = function replaceWithAdf(nodeAdf, api) {
@@ -26,7 +27,7 @@ export var replaceWithAdf = function replaceWithAdf(nodeAdf, api) {
26
27
  if (!selectedNode || nodePos === undefined) {
27
28
  throw new Error('No selected node or node position found');
28
29
  }
29
- var endPos = selectedNode.nodeSize + nodePos;
30
+ var endPos = selectedNode.type.name === 'doc' && fg('platform_editor_selection_extension_improvement') ? nodePos + selectedNode.content.size : nodePos + selectedNode.nodeSize;
30
31
  var modifiedNode = Node.fromJSON(schema, nodeAdf);
31
32
  modifiedNode.check();
32
33
  var updatedTr = tr.replaceWith(nodePos, endPos, modifiedNode).scrollIntoView();
@@ -35,7 +36,7 @@ export var replaceWithAdf = function replaceWithAdf(nodeAdf, api) {
35
36
  return {
36
37
  status: 'success'
37
38
  };
38
- } catch (error) {
39
+ } catch (_unused) {
39
40
  dispatch(tr);
40
41
  return {
41
42
  status: 'failed-to-replace'
@@ -4,7 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
7
  import { SelectionExtensionActionTypes } from '../types';
9
8
  export var selectionExtensionPluginKey = new PluginKey('selectionExtensionPlugin');
10
9
  export var createPlugin = function createPlugin() {
@@ -49,7 +48,7 @@ export var createPlugin = function createPlugin() {
49
48
  });
50
49
  }
51
50
  // clear activeExtension if the selection has changed and not empty
52
- if (tr.selectionSet && !tr.selection.empty && fg('platform_editor_clear_active_extension_fix')) {
51
+ if (tr.selectionSet && !tr.selection.empty) {
53
52
  return _objectSpread(_objectSpread({}, pluginState), {}, {
54
53
  activeExtension: undefined // Clear active extension on selection change
55
54
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-extension",
3
- "version": "7.1.2",
3
+ "version": "7.1.3",
4
4
  "description": "editor-plugin-selection-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -49,14 +49,14 @@
49
49
  "@atlaskit/icon": "^29.0.0",
50
50
  "@atlaskit/platform-feature-flags": "^1.1.0",
51
51
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
52
- "@atlaskit/tmp-editor-statsig": "^14.4.0",
52
+ "@atlaskit/tmp-editor-statsig": "^14.5.0",
53
53
  "@babel/runtime": "^7.0.0",
54
54
  "lodash": "^4.17.21",
55
55
  "react-intl-next": "npm:react-intl@^5.18.1",
56
56
  "uuid": "^3.1.0"
57
57
  },
58
58
  "peerDependencies": {
59
- "@atlaskit/editor-common": "^110.37.0",
59
+ "@atlaskit/editor-common": "^110.38.0",
60
60
  "react": "^18.2.0"
61
61
  },
62
62
  "devDependencies": {
@@ -103,9 +103,6 @@
103
103
  }
104
104
  },
105
105
  "platform-feature-flags": {
106
- "platform_editor_clear_active_extension_fix": {
107
- "type": "boolean"
108
- },
109
106
  "platform_editor_use_preferences_plugin": {
110
107
  "type": "boolean"
111
108
  },