@atlaskit/editor-plugin-mentions 8.2.4 → 8.2.5

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,12 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 8.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4880d63481d80`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4880d63481d80) -
8
+ Fix range error bug in new mentions detection logic
9
+
3
10
  ## 8.2.4
4
11
 
5
12
  ### Patch Changes
@@ -25,7 +25,7 @@ var ACTIONS = exports.ACTIONS = {
25
25
  SET_PROVIDER: 'SET_PROVIDER'
26
26
  };
27
27
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
28
- var PACKAGE_VERSION = "8.2.3";
28
+ var PACKAGE_VERSION = "0.0.0-development";
29
29
  var setProvider = function setProvider(provider) {
30
30
  return function (state, dispatch) {
31
31
  if (dispatch) {
@@ -100,8 +100,12 @@ function createMentionPlugin(_ref) {
100
100
  (_insm$session = _insm.insm.session) === null || _insm$session === void 0 || _insm$session.startFeature('mentionDeletionDetection');
101
101
  var mentionSchema = newState.schema.nodes.mention;
102
102
  var mentionsRemoved = new Map();
103
- tr.steps.forEach(function (step) {
104
- step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
103
+ tr.steps.forEach(function (step, index) {
104
+ step.getMap().forEach(function (from, to) {
105
+ var newStart = tr.mapping.slice(index).map(from, -1);
106
+ var newEnd = tr.mapping.slice(index).map(to);
107
+ var oldStart = tr.mapping.invert().map(newStart, -1);
108
+ var oldEnd = tr.mapping.invert().map(newEnd);
105
109
  var oldSlice = oldState.doc.slice(oldStart, oldEnd);
106
110
  var newSlice = newState.doc.slice(newStart, newEnd);
107
111
  var mentionsBefore = new Map();
@@ -14,7 +14,7 @@ export const ACTIONS = {
14
14
  SET_PROVIDER: 'SET_PROVIDER'
15
15
  };
16
16
  const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
17
- const PACKAGE_VERSION = "8.2.3";
17
+ const PACKAGE_VERSION = "0.0.0-development";
18
18
  const setProvider = provider => (state, dispatch) => {
19
19
  if (dispatch) {
20
20
  dispatch(state.tr.setMeta(mentionPluginKey, {
@@ -92,8 +92,12 @@ export function createMentionPlugin({
92
92
  (_insm$session = insm.session) === null || _insm$session === void 0 ? void 0 : _insm$session.startFeature('mentionDeletionDetection');
93
93
  const mentionSchema = newState.schema.nodes.mention;
94
94
  const mentionsRemoved = new Map();
95
- tr.steps.forEach(step => {
96
- step.getMap().forEach((oldStart, oldEnd, newStart, newEnd) => {
95
+ tr.steps.forEach((step, index) => {
96
+ step.getMap().forEach((from, to) => {
97
+ const newStart = tr.mapping.slice(index).map(from, -1);
98
+ const newEnd = tr.mapping.slice(index).map(to);
99
+ const oldStart = tr.mapping.invert().map(newStart, -1);
100
+ const oldEnd = tr.mapping.invert().map(newEnd);
97
101
  const oldSlice = oldState.doc.slice(oldStart, oldEnd);
98
102
  const newSlice = newState.doc.slice(newStart, newEnd);
99
103
  const mentionsBefore = new Map();
@@ -17,7 +17,7 @@ export var ACTIONS = {
17
17
  SET_PROVIDER: 'SET_PROVIDER'
18
18
  };
19
19
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
20
- var PACKAGE_VERSION = "8.2.3";
20
+ var PACKAGE_VERSION = "0.0.0-development";
21
21
  var setProvider = function setProvider(provider) {
22
22
  return function (state, dispatch) {
23
23
  if (dispatch) {
@@ -92,8 +92,12 @@ export function createMentionPlugin(_ref) {
92
92
  (_insm$session = insm.session) === null || _insm$session === void 0 || _insm$session.startFeature('mentionDeletionDetection');
93
93
  var mentionSchema = newState.schema.nodes.mention;
94
94
  var mentionsRemoved = new Map();
95
- tr.steps.forEach(function (step) {
96
- step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
95
+ tr.steps.forEach(function (step, index) {
96
+ step.getMap().forEach(function (from, to) {
97
+ var newStart = tr.mapping.slice(index).map(from, -1);
98
+ var newEnd = tr.mapping.slice(index).map(to);
99
+ var oldStart = tr.mapping.invert().map(newStart, -1);
100
+ var oldEnd = tr.mapping.invert().map(newEnd);
97
101
  var oldSlice = oldState.doc.slice(oldStart, oldEnd);
98
102
  var newSlice = newState.doc.slice(newStart, newEnd);
99
103
  var mentionsBefore = new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "8.2.4",
3
+ "version": "8.2.5",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -46,8 +46,8 @@
46
46
  "@atlaskit/portal": "^5.1.0",
47
47
  "@atlaskit/profilecard": "^24.20.0",
48
48
  "@atlaskit/theme": "^21.0.0",
49
- "@atlaskit/tmp-editor-statsig": "^13.23.0",
50
- "@atlaskit/tokens": "^7.0.0",
49
+ "@atlaskit/tmp-editor-statsig": "^13.26.0",
50
+ "@atlaskit/tokens": "^7.1.0",
51
51
  "@babel/runtime": "^7.0.0",
52
52
  "@compiled/react": "^0.18.6",
53
53
  "bind-event-listener": "^3.0.0",
@@ -55,7 +55,7 @@
55
55
  "uuid": "^3.1.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@atlaskit/editor-common": "^110.20.0",
58
+ "@atlaskit/editor-common": "^110.21.0",
59
59
  "react": "^18.2.0",
60
60
  "react-dom": "^18.2.0",
61
61
  "react-intl-next": "npm:react-intl@^5.18.1"