@atlaskit/prosemirror-collab 0.16.3 → 0.17.0
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 +18 -0
- package/dist/cjs/index.js +0 -8
- package/dist/cjs/movedContent.js +32 -20
- package/dist/es2019/index.js +0 -8
- package/dist/es2019/movedContent.js +27 -18
- package/dist/esm/index.js +0 -8
- package/dist/esm/movedContent.js +31 -19
- package/dist/types/movedContent.d.ts +20 -0
- package/dist/types-ts4.5/movedContent.d.ts +20 -0
- package/package.json +3 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/prosemirror-collab
|
|
2
2
|
|
|
3
|
+
## 0.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#154562](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154562)
|
|
8
|
+
[`9a3495cb72638`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9a3495cb72638) -
|
|
9
|
+
Support AnalyticsStep filtering for collab
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 0.16.4
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 0.16.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -74,14 +74,6 @@ unconfirmed) {
|
|
|
74
74
|
function unconfirmedFrom(transform) {
|
|
75
75
|
var result = [];
|
|
76
76
|
for (var i = 0; i < transform.steps.length; i++) {
|
|
77
|
-
// Filter out the analytics steps, they don't need to be sent to the collab service
|
|
78
|
-
// Commented out because it broke undo behaviour
|
|
79
|
-
|
|
80
|
-
// TODO: ED-26957 - Figure out how it broke undo
|
|
81
|
-
// if (transform.steps[i] instanceof AnalyticsStep) {
|
|
82
|
-
// continue;
|
|
83
|
-
// }
|
|
84
|
-
|
|
85
77
|
result.push(new Rebaseable(transform.steps[i], transform.steps[i].invert(transform.docs[i]), transform));
|
|
86
78
|
}
|
|
87
79
|
return result;
|
package/dist/cjs/movedContent.js
CHANGED
|
@@ -3,24 +3,36 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.mapStep = void 0;
|
|
6
|
+
exports.mapStep = exports.isMoveSequence = exports.createMoveMapStep = void 0;
|
|
7
|
+
var _steps = require("@atlaskit/adf-schema/steps");
|
|
7
8
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
9
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
10
|
+
// Iterate from the specified starting index down to 0
|
|
11
|
+
var findPreviousStepInverseIndex = function findPreviousStepInverseIndex(steps) {
|
|
12
|
+
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : steps.length - 1;
|
|
13
|
+
for (var i = startIndex; i >= 0; i--) {
|
|
14
|
+
if (!(steps[i] instanceof _steps.AnalyticsStep)) {
|
|
15
|
+
return i;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
9
19
|
var mapStep = exports.mapStep = function mapStep(steps, transform, index, mapped) {
|
|
10
20
|
if (index < 1) {
|
|
11
21
|
return undefined;
|
|
12
22
|
}
|
|
13
|
-
var
|
|
14
|
-
|
|
23
|
+
var previousRebaseableStepIndex = findPreviousStepInverseIndex(steps.map(function (s) {
|
|
24
|
+
return s.step;
|
|
25
|
+
}), index - 1);
|
|
26
|
+
|
|
15
27
|
// This checks the local steps are a "move" sequence
|
|
16
|
-
isMoveSequence(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var previousStep = transform.steps[transform.steps.length - 1];
|
|
28
|
+
if (previousRebaseableStepIndex !== undefined && isMoveSequence(steps[previousRebaseableStepIndex], steps[index].step)) {
|
|
29
|
+
var previousStepInverseIndex = findPreviousStepInverseIndex(transform.steps);
|
|
30
|
+
|
|
20
31
|
// Creates a new step based on the "current" steps (partially through the rebase)
|
|
21
|
-
|
|
32
|
+
if (previousStepInverseIndex !== undefined) {
|
|
33
|
+
return createMoveMapStep(mapped, transform.steps[previousStepInverseIndex], transform, previousStepInverseIndex);
|
|
34
|
+
}
|
|
22
35
|
}
|
|
23
|
-
return undefined;
|
|
24
36
|
};
|
|
25
37
|
|
|
26
38
|
// Only consider ReplaceStep (ReplaceAroundStep do not occur for moves)
|
|
@@ -37,20 +49,20 @@ var isReplaceTypeStep = function isReplaceTypeStep(step) {
|
|
|
37
49
|
* @param currentStep
|
|
38
50
|
* @param previousRebaseable
|
|
39
51
|
*/
|
|
40
|
-
var isMoveSequence = function isMoveSequence(
|
|
52
|
+
var isMoveSequence = exports.isMoveSequence = function isMoveSequence(previousRebaseableStep, currentStep) {
|
|
41
53
|
if (
|
|
42
54
|
// The both steps are replace
|
|
43
|
-
isReplaceTypeStep(
|
|
55
|
+
isReplaceTypeStep(previousRebaseableStep.step) && isReplaceTypeStep(currentStep) &&
|
|
44
56
|
// The current step is a deletion
|
|
45
|
-
|
|
57
|
+
previousRebaseableStep.step.slice.size === 0 &&
|
|
46
58
|
// The following step is an insertion with the same length that was deleted by the current step
|
|
47
|
-
Math.abs(
|
|
59
|
+
Math.abs(previousRebaseableStep.step.to - previousRebaseableStep.step.from) === currentStep.slice.size) {
|
|
48
60
|
// Ensure we're getting the doc before our step changes so we can compare node contents
|
|
49
|
-
var originStepIndex =
|
|
50
|
-
return s ===
|
|
61
|
+
var originStepIndex = previousRebaseableStep.origin.steps.findIndex(function (s) {
|
|
62
|
+
return s === previousRebaseableStep.step;
|
|
51
63
|
});
|
|
52
|
-
var originalDoc =
|
|
53
|
-
var currentSlice = originalDoc.slice(
|
|
64
|
+
var originalDoc = previousRebaseableStep.origin.docs[originStepIndex];
|
|
65
|
+
var currentSlice = originalDoc.slice(previousRebaseableStep.step.from, previousRebaseableStep.step.to);
|
|
54
66
|
// The content from the deleted + inserted slice is exactly the same (cut + paste or drag + drop)
|
|
55
67
|
if (currentSlice.eq(currentStep.slice)) {
|
|
56
68
|
return true;
|
|
@@ -68,11 +80,11 @@ var isMoveSequence = function isMoveSequence(previousStep, currentStep, previous
|
|
|
68
80
|
* @param transform
|
|
69
81
|
* @returns Step to apply missing changes
|
|
70
82
|
*/
|
|
71
|
-
var createMoveMapStep = function createMoveMapStep(mapped, previousStep, transform) {
|
|
83
|
+
var createMoveMapStep = exports.createMoveMapStep = function createMoveMapStep(mapped, previousStep, transform, previousStepIndex) {
|
|
72
84
|
if (!isReplaceTypeStep(previousStep) || mapped && !isReplaceTypeStep(mapped) || !mapped) {
|
|
73
85
|
return undefined;
|
|
74
86
|
}
|
|
75
|
-
var newSlice = transform.docs[
|
|
87
|
+
var newSlice = transform.docs[previousStepIndex].slice(previousStep === null || previousStep === void 0 ? void 0 : previousStep.from, previousStep === null || previousStep === void 0 ? void 0 : previousStep.to);
|
|
76
88
|
var diff = getDiffRange(mapped.slice.content, newSlice.content);
|
|
77
89
|
if (diff === undefined) {
|
|
78
90
|
return undefined;
|
|
@@ -87,7 +99,7 @@ var createMoveMapStep = function createMoveMapStep(mapped, previousStep, transfo
|
|
|
87
99
|
}
|
|
88
100
|
|
|
89
101
|
// Replace the diff range with the latest content in the document (at the old position)
|
|
90
|
-
return new _transform.ReplaceStep(start, start + offset, transform.docs[
|
|
102
|
+
return new _transform.ReplaceStep(start, start + offset, transform.docs[previousStepIndex].slice((previousStep === null || previousStep === void 0 ? void 0 : previousStep.from) + diff.start, (previousStep === null || previousStep === void 0 ? void 0 : previousStep.from) + diff.end));
|
|
91
103
|
};
|
|
92
104
|
|
|
93
105
|
/**
|
package/dist/es2019/index.js
CHANGED
|
@@ -60,14 +60,6 @@ class CollabState {
|
|
|
60
60
|
function unconfirmedFrom(transform) {
|
|
61
61
|
const result = [];
|
|
62
62
|
for (let i = 0; i < transform.steps.length; i++) {
|
|
63
|
-
// Filter out the analytics steps, they don't need to be sent to the collab service
|
|
64
|
-
// Commented out because it broke undo behaviour
|
|
65
|
-
|
|
66
|
-
// TODO: ED-26957 - Figure out how it broke undo
|
|
67
|
-
// if (transform.steps[i] instanceof AnalyticsStep) {
|
|
68
|
-
// continue;
|
|
69
|
-
// }
|
|
70
|
-
|
|
71
63
|
result.push(new Rebaseable(transform.steps[i], transform.steps[i].invert(transform.docs[i]), transform));
|
|
72
64
|
}
|
|
73
65
|
return result;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
+
import { AnalyticsStep } from '@atlaskit/adf-schema/steps';
|
|
1
2
|
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
+
// Iterate from the specified starting index down to 0
|
|
5
|
+
const findPreviousStepInverseIndex = (steps, startIndex = steps.length - 1) => {
|
|
6
|
+
for (let i = startIndex; i >= 0; i--) {
|
|
7
|
+
if (!(steps[i] instanceof AnalyticsStep)) {
|
|
8
|
+
return i;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
3
12
|
export const mapStep = (steps, transform, index, mapped) => {
|
|
4
13
|
if (index < 1) {
|
|
5
14
|
return undefined;
|
|
6
15
|
}
|
|
7
|
-
const
|
|
8
|
-
|
|
16
|
+
const previousRebaseableStepIndex = findPreviousStepInverseIndex(steps.map(s => s.step), index - 1);
|
|
17
|
+
|
|
9
18
|
// This checks the local steps are a "move" sequence
|
|
10
|
-
isMoveSequence(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const previousStep = transform.steps[transform.steps.length - 1];
|
|
19
|
+
if (previousRebaseableStepIndex !== undefined && isMoveSequence(steps[previousRebaseableStepIndex], steps[index].step)) {
|
|
20
|
+
const previousStepInverseIndex = findPreviousStepInverseIndex(transform.steps);
|
|
21
|
+
|
|
14
22
|
// Creates a new step based on the "current" steps (partially through the rebase)
|
|
15
|
-
|
|
23
|
+
if (previousStepInverseIndex !== undefined) {
|
|
24
|
+
return createMoveMapStep(mapped, transform.steps[previousStepInverseIndex], transform, previousStepInverseIndex);
|
|
25
|
+
}
|
|
16
26
|
}
|
|
17
|
-
return undefined;
|
|
18
27
|
};
|
|
19
28
|
|
|
20
29
|
// Only consider ReplaceStep (ReplaceAroundStep do not occur for moves)
|
|
@@ -29,18 +38,18 @@ const isReplaceTypeStep = step => step instanceof ReplaceStep;
|
|
|
29
38
|
* @param currentStep
|
|
30
39
|
* @param previousRebaseable
|
|
31
40
|
*/
|
|
32
|
-
const isMoveSequence = (
|
|
41
|
+
export const isMoveSequence = (previousRebaseableStep, currentStep) => {
|
|
33
42
|
if (
|
|
34
43
|
// The both steps are replace
|
|
35
|
-
isReplaceTypeStep(
|
|
44
|
+
isReplaceTypeStep(previousRebaseableStep.step) && isReplaceTypeStep(currentStep) &&
|
|
36
45
|
// The current step is a deletion
|
|
37
|
-
|
|
46
|
+
previousRebaseableStep.step.slice.size === 0 &&
|
|
38
47
|
// The following step is an insertion with the same length that was deleted by the current step
|
|
39
|
-
Math.abs(
|
|
48
|
+
Math.abs(previousRebaseableStep.step.to - previousRebaseableStep.step.from) === currentStep.slice.size) {
|
|
40
49
|
// Ensure we're getting the doc before our step changes so we can compare node contents
|
|
41
|
-
const originStepIndex =
|
|
42
|
-
const originalDoc =
|
|
43
|
-
const currentSlice = originalDoc.slice(
|
|
50
|
+
const originStepIndex = previousRebaseableStep.origin.steps.findIndex(s => s === previousRebaseableStep.step);
|
|
51
|
+
const originalDoc = previousRebaseableStep.origin.docs[originStepIndex];
|
|
52
|
+
const currentSlice = originalDoc.slice(previousRebaseableStep.step.from, previousRebaseableStep.step.to);
|
|
44
53
|
// The content from the deleted + inserted slice is exactly the same (cut + paste or drag + drop)
|
|
45
54
|
if (currentSlice.eq(currentStep.slice)) {
|
|
46
55
|
return true;
|
|
@@ -58,11 +67,11 @@ const isMoveSequence = (previousStep, currentStep, previousRebaseable) => {
|
|
|
58
67
|
* @param transform
|
|
59
68
|
* @returns Step to apply missing changes
|
|
60
69
|
*/
|
|
61
|
-
const createMoveMapStep = (mapped, previousStep, transform) => {
|
|
70
|
+
export const createMoveMapStep = (mapped, previousStep, transform, previousStepIndex) => {
|
|
62
71
|
if (!isReplaceTypeStep(previousStep) || mapped && !isReplaceTypeStep(mapped) || !mapped) {
|
|
63
72
|
return undefined;
|
|
64
73
|
}
|
|
65
|
-
const newSlice = transform.docs[
|
|
74
|
+
const newSlice = transform.docs[previousStepIndex].slice(previousStep === null || previousStep === void 0 ? void 0 : previousStep.from, previousStep === null || previousStep === void 0 ? void 0 : previousStep.to);
|
|
66
75
|
const diff = getDiffRange(mapped.slice.content, newSlice.content);
|
|
67
76
|
if (diff === undefined) {
|
|
68
77
|
return undefined;
|
|
@@ -77,7 +86,7 @@ const createMoveMapStep = (mapped, previousStep, transform) => {
|
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
// Replace the diff range with the latest content in the document (at the old position)
|
|
80
|
-
return new ReplaceStep(start, start + offset, transform.docs[
|
|
89
|
+
return new ReplaceStep(start, start + offset, transform.docs[previousStepIndex].slice((previousStep === null || previousStep === void 0 ? void 0 : previousStep.from) + diff.start, (previousStep === null || previousStep === void 0 ? void 0 : previousStep.from) + diff.end));
|
|
81
90
|
};
|
|
82
91
|
|
|
83
92
|
/**
|
package/dist/esm/index.js
CHANGED
|
@@ -60,14 +60,6 @@ unconfirmed) {
|
|
|
60
60
|
function unconfirmedFrom(transform) {
|
|
61
61
|
var result = [];
|
|
62
62
|
for (var i = 0; i < transform.steps.length; i++) {
|
|
63
|
-
// Filter out the analytics steps, they don't need to be sent to the collab service
|
|
64
|
-
// Commented out because it broke undo behaviour
|
|
65
|
-
|
|
66
|
-
// TODO: ED-26957 - Figure out how it broke undo
|
|
67
|
-
// if (transform.steps[i] instanceof AnalyticsStep) {
|
|
68
|
-
// continue;
|
|
69
|
-
// }
|
|
70
|
-
|
|
71
63
|
result.push(new Rebaseable(transform.steps[i], transform.steps[i].invert(transform.docs[i]), transform));
|
|
72
64
|
}
|
|
73
65
|
return result;
|
package/dist/esm/movedContent.js
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
|
+
import { AnalyticsStep } from '@atlaskit/adf-schema/steps';
|
|
1
2
|
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
+
// Iterate from the specified starting index down to 0
|
|
5
|
+
var findPreviousStepInverseIndex = function findPreviousStepInverseIndex(steps) {
|
|
6
|
+
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : steps.length - 1;
|
|
7
|
+
for (var i = startIndex; i >= 0; i--) {
|
|
8
|
+
if (!(steps[i] instanceof AnalyticsStep)) {
|
|
9
|
+
return i;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
3
13
|
export var mapStep = function mapStep(steps, transform, index, mapped) {
|
|
4
14
|
if (index < 1) {
|
|
5
15
|
return undefined;
|
|
6
16
|
}
|
|
7
|
-
var
|
|
8
|
-
|
|
17
|
+
var previousRebaseableStepIndex = findPreviousStepInverseIndex(steps.map(function (s) {
|
|
18
|
+
return s.step;
|
|
19
|
+
}), index - 1);
|
|
20
|
+
|
|
9
21
|
// This checks the local steps are a "move" sequence
|
|
10
|
-
isMoveSequence(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var previousStep = transform.steps[transform.steps.length - 1];
|
|
22
|
+
if (previousRebaseableStepIndex !== undefined && isMoveSequence(steps[previousRebaseableStepIndex], steps[index].step)) {
|
|
23
|
+
var previousStepInverseIndex = findPreviousStepInverseIndex(transform.steps);
|
|
24
|
+
|
|
14
25
|
// Creates a new step based on the "current" steps (partially through the rebase)
|
|
15
|
-
|
|
26
|
+
if (previousStepInverseIndex !== undefined) {
|
|
27
|
+
return createMoveMapStep(mapped, transform.steps[previousStepInverseIndex], transform, previousStepInverseIndex);
|
|
28
|
+
}
|
|
16
29
|
}
|
|
17
|
-
return undefined;
|
|
18
30
|
};
|
|
19
31
|
|
|
20
32
|
// Only consider ReplaceStep (ReplaceAroundStep do not occur for moves)
|
|
@@ -31,20 +43,20 @@ var isReplaceTypeStep = function isReplaceTypeStep(step) {
|
|
|
31
43
|
* @param currentStep
|
|
32
44
|
* @param previousRebaseable
|
|
33
45
|
*/
|
|
34
|
-
var isMoveSequence = function isMoveSequence(
|
|
46
|
+
export var isMoveSequence = function isMoveSequence(previousRebaseableStep, currentStep) {
|
|
35
47
|
if (
|
|
36
48
|
// The both steps are replace
|
|
37
|
-
isReplaceTypeStep(
|
|
49
|
+
isReplaceTypeStep(previousRebaseableStep.step) && isReplaceTypeStep(currentStep) &&
|
|
38
50
|
// The current step is a deletion
|
|
39
|
-
|
|
51
|
+
previousRebaseableStep.step.slice.size === 0 &&
|
|
40
52
|
// The following step is an insertion with the same length that was deleted by the current step
|
|
41
|
-
Math.abs(
|
|
53
|
+
Math.abs(previousRebaseableStep.step.to - previousRebaseableStep.step.from) === currentStep.slice.size) {
|
|
42
54
|
// Ensure we're getting the doc before our step changes so we can compare node contents
|
|
43
|
-
var originStepIndex =
|
|
44
|
-
return s ===
|
|
55
|
+
var originStepIndex = previousRebaseableStep.origin.steps.findIndex(function (s) {
|
|
56
|
+
return s === previousRebaseableStep.step;
|
|
45
57
|
});
|
|
46
|
-
var originalDoc =
|
|
47
|
-
var currentSlice = originalDoc.slice(
|
|
58
|
+
var originalDoc = previousRebaseableStep.origin.docs[originStepIndex];
|
|
59
|
+
var currentSlice = originalDoc.slice(previousRebaseableStep.step.from, previousRebaseableStep.step.to);
|
|
48
60
|
// The content from the deleted + inserted slice is exactly the same (cut + paste or drag + drop)
|
|
49
61
|
if (currentSlice.eq(currentStep.slice)) {
|
|
50
62
|
return true;
|
|
@@ -62,11 +74,11 @@ var isMoveSequence = function isMoveSequence(previousStep, currentStep, previous
|
|
|
62
74
|
* @param transform
|
|
63
75
|
* @returns Step to apply missing changes
|
|
64
76
|
*/
|
|
65
|
-
var createMoveMapStep = function createMoveMapStep(mapped, previousStep, transform) {
|
|
77
|
+
export var createMoveMapStep = function createMoveMapStep(mapped, previousStep, transform, previousStepIndex) {
|
|
66
78
|
if (!isReplaceTypeStep(previousStep) || mapped && !isReplaceTypeStep(mapped) || !mapped) {
|
|
67
79
|
return undefined;
|
|
68
80
|
}
|
|
69
|
-
var newSlice = transform.docs[
|
|
81
|
+
var newSlice = transform.docs[previousStepIndex].slice(previousStep === null || previousStep === void 0 ? void 0 : previousStep.from, previousStep === null || previousStep === void 0 ? void 0 : previousStep.to);
|
|
70
82
|
var diff = getDiffRange(mapped.slice.content, newSlice.content);
|
|
71
83
|
if (diff === undefined) {
|
|
72
84
|
return undefined;
|
|
@@ -81,7 +93,7 @@ var createMoveMapStep = function createMoveMapStep(mapped, previousStep, transfo
|
|
|
81
93
|
}
|
|
82
94
|
|
|
83
95
|
// Replace the diff range with the latest content in the document (at the old position)
|
|
84
|
-
return new ReplaceStep(start, start + offset, transform.docs[
|
|
96
|
+
return new ReplaceStep(start, start + offset, transform.docs[previousStepIndex].slice((previousStep === null || previousStep === void 0 ? void 0 : previousStep.from) + diff.start, (previousStep === null || previousStep === void 0 ? void 0 : previousStep.from) + diff.end));
|
|
85
97
|
};
|
|
86
98
|
|
|
87
99
|
/**
|
|
@@ -2,3 +2,23 @@ import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
|
2
2
|
import type { Step as ProseMirrorStep, Transform as ProseMirrorTransform } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
import type { Rebaseable } from './index';
|
|
4
4
|
export declare const mapStep: (steps: readonly Rebaseable[], transform: ProseMirrorTransform, index: number, mapped: ProseMirrorStep | null) => ReplaceStep | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Determines if a step pairing is a move sequence (ie. drag + drop or cut + paste).
|
|
7
|
+
*
|
|
8
|
+
* We determine this if we have a deletion followed by insertion and their content matches
|
|
9
|
+
*
|
|
10
|
+
* @param previousStep
|
|
11
|
+
* @param currentStep
|
|
12
|
+
* @param previousRebaseable
|
|
13
|
+
*/
|
|
14
|
+
export declare const isMoveSequence: (previousRebaseableStep: Rebaseable, currentStep: ProseMirrorStep) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Update the replace step slice of the insert part of a move
|
|
17
|
+
* to contain the slice of the current document rather than what was sliced originally.
|
|
18
|
+
*
|
|
19
|
+
* @param mapped
|
|
20
|
+
* @param previousStep
|
|
21
|
+
* @param transform
|
|
22
|
+
* @returns Step to apply missing changes
|
|
23
|
+
*/
|
|
24
|
+
export declare const createMoveMapStep: (mapped: ProseMirrorStep | null, previousStep: ProseMirrorStep, transform: ProseMirrorTransform, previousStepIndex: number) => ReplaceStep | undefined;
|
|
@@ -2,3 +2,23 @@ import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
|
2
2
|
import type { Step as ProseMirrorStep, Transform as ProseMirrorTransform } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
import type { Rebaseable } from './index';
|
|
4
4
|
export declare const mapStep: (steps: readonly Rebaseable[], transform: ProseMirrorTransform, index: number, mapped: ProseMirrorStep | null) => ReplaceStep | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Determines if a step pairing is a move sequence (ie. drag + drop or cut + paste).
|
|
7
|
+
*
|
|
8
|
+
* We determine this if we have a deletion followed by insertion and their content matches
|
|
9
|
+
*
|
|
10
|
+
* @param previousStep
|
|
11
|
+
* @param currentStep
|
|
12
|
+
* @param previousRebaseable
|
|
13
|
+
*/
|
|
14
|
+
export declare const isMoveSequence: (previousRebaseableStep: Rebaseable, currentStep: ProseMirrorStep) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Update the replace step slice of the insert part of a move
|
|
17
|
+
* to contain the slice of the current document rather than what was sliced originally.
|
|
18
|
+
*
|
|
19
|
+
* @param mapped
|
|
20
|
+
* @param previousStep
|
|
21
|
+
* @param transform
|
|
22
|
+
* @returns Step to apply missing changes
|
|
23
|
+
*/
|
|
24
|
+
export declare const createMoveMapStep: (mapped: ProseMirrorStep | null, previousStep: ProseMirrorStep, transform: ProseMirrorTransform, previousStepIndex: number) => ReplaceStep | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/prosemirror-collab",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Collaborative editing for ProseMirror - Atlassian Fork",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,14 +30,12 @@
|
|
|
30
30
|
".": "./src/index.ts"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@atlaskit/adf-schema": "^47.6.0",
|
|
33
34
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
34
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
35
|
+
"@atlaskit/tmp-editor-statsig": "^5.5.0",
|
|
35
36
|
"@babel/runtime": "^7.0.0",
|
|
36
37
|
"uuid": "^3.1.0"
|
|
37
38
|
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@atlaskit/adf-schema": "^47.6.0"
|
|
40
|
-
},
|
|
41
39
|
"techstack": {
|
|
42
40
|
"@atlassian/frontend": {
|
|
43
41
|
"import-structure": [
|