@atlaskit/editor-plugin-collab-edit 13.0.0 → 13.0.1
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 +8 -0
- package/dist/cjs/pm-plugins/preserve-node-identity.js +1 -2
- package/dist/cjs/pm-plugins/utils.js +2 -7
- package/dist/es2019/pm-plugins/preserve-node-identity.js +1 -3
- package/dist/es2019/pm-plugins/utils.js +2 -7
- package/dist/esm/pm-plugins/preserve-node-identity.js +1 -3
- package/dist/esm/pm-plugins/utils.js +2 -7
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 13.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`82b4d7793fb01`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/82b4d7793fb01) -
|
|
8
|
+
Clean up experiment `platform_editor_preserve_node_identity`
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 13.0.0
|
|
4
12
|
|
|
5
13
|
### Major Changes
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.preserveNodeIdentity = preserveNodeIdentity;
|
|
7
7
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
8
|
/**
|
|
10
9
|
* Walk two Fragments (old and new) and return a Fragment that reuses old node
|
|
11
10
|
* references wherever structurally equal (`node.eq()` returns true).
|
|
@@ -59,7 +58,7 @@ function preserveNodeIdentity(oldFragment, newFragment) {
|
|
|
59
58
|
} else if (oldChild.eq(newChild)) {
|
|
60
59
|
// Structurally equal — reuse old reference (THE KEY OPERATION)
|
|
61
60
|
children.push(oldChild);
|
|
62
|
-
} else if (oldChild.type === newChild.type && oldChild.sameMarkup(newChild) && oldChild.content.childCount > 0 && newChild.content.childCount > 0
|
|
61
|
+
} else if (oldChild.type === newChild.type && oldChild.sameMarkup(newChild) && oldChild.content.childCount > 0 && newChild.content.childCount > 0) {
|
|
63
62
|
// Same type and markup but different content — recurse into children
|
|
64
63
|
var preservedContent = preserveNodeIdentity(oldChild.content, newChild.content);
|
|
65
64
|
if (preservedContent === oldChild.content) {
|
|
@@ -17,7 +17,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
17
17
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
18
18
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
19
19
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
20
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
21
20
|
var _preserveNodeIdentity = require("./preserve-node-identity");
|
|
22
21
|
var findPointers = exports.findPointers = function findPointers(id, decorations) {
|
|
23
22
|
return decorations.find().reduce(function (arr, deco) {
|
|
@@ -112,9 +111,7 @@ var replaceDocument = exports.replaceDocument = function replaceDocument(doc, st
|
|
|
112
111
|
var parsedDoc = (0, _processRawValue.processRawValueWithoutValidation)(schema, doc, editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.fireAnalyticsEvent);
|
|
113
112
|
var hasContent = !!(parsedDoc !== null && parsedDoc !== void 0 && parsedDoc.childCount);
|
|
114
113
|
var content = parsedDoc === null || parsedDoc === void 0 ? void 0 : parsedDoc.content;
|
|
115
|
-
if (hasContent && content
|
|
116
|
-
exposure: true
|
|
117
|
-
})) {
|
|
114
|
+
if (hasContent && content) {
|
|
118
115
|
var preservedContent = (0, _preserveNodeIdentity.preserveNodeIdentity)(state.doc.content, content);
|
|
119
116
|
|
|
120
117
|
// If the entire content is identical, skip the replaceWith entirely
|
|
@@ -156,9 +153,7 @@ var replaceDocument = exports.replaceDocument = function replaceDocument(doc, st
|
|
|
156
153
|
};
|
|
157
154
|
tr.setMeta('collab$', _collabState);
|
|
158
155
|
}
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
if (hasContent) {
|
|
156
|
+
} else if (hasContent) {
|
|
162
157
|
tr.setMeta('addToHistory', false);
|
|
163
158
|
// Ignored via go/ees005
|
|
164
159
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
-
|
|
4
2
|
/**
|
|
5
3
|
* Walk two Fragments (old and new) and return a Fragment that reuses old node
|
|
6
4
|
* references wherever structurally equal (`node.eq()` returns true).
|
|
@@ -54,7 +52,7 @@ export function preserveNodeIdentity(oldFragment, newFragment) {
|
|
|
54
52
|
} else if (oldChild.eq(newChild)) {
|
|
55
53
|
// Structurally equal — reuse old reference (THE KEY OPERATION)
|
|
56
54
|
children.push(oldChild);
|
|
57
|
-
} else if (oldChild.type === newChild.type && oldChild.sameMarkup(newChild) && oldChild.content.childCount > 0 && newChild.content.childCount > 0
|
|
55
|
+
} else if (oldChild.type === newChild.type && oldChild.sameMarkup(newChild) && oldChild.content.childCount > 0 && newChild.content.childCount > 0) {
|
|
58
56
|
// Same type and markup but different content — recurse into children
|
|
59
57
|
const preservedContent = preserveNodeIdentity(oldChild.content, newChild.content);
|
|
60
58
|
if (preservedContent === oldChild.content) {
|
|
@@ -7,7 +7,6 @@ import { Transaction, Selection, TextSelection } from '@atlaskit/editor-prosemir
|
|
|
7
7
|
import { AttrStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
8
8
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
9
9
|
import { getParticipantColor } from '@atlaskit/editor-shared-styles';
|
|
10
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
10
|
import { preserveNodeIdentity } from './preserve-node-identity';
|
|
12
11
|
export const findPointers = (id, decorations) => decorations.find().reduce((arr, deco) => deco.spec.pointer.presenceId === id ? arr.concat(deco) : arr, []);
|
|
13
12
|
function style(options) {
|
|
@@ -100,9 +99,7 @@ export const replaceDocument = (doc, state, version, options, reserveCursor, edi
|
|
|
100
99
|
const parsedDoc = processRawValueWithoutValidation(schema, doc, editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.fireAnalyticsEvent);
|
|
101
100
|
const hasContent = !!(parsedDoc !== null && parsedDoc !== void 0 && parsedDoc.childCount);
|
|
102
101
|
const content = parsedDoc === null || parsedDoc === void 0 ? void 0 : parsedDoc.content;
|
|
103
|
-
if (hasContent && content
|
|
104
|
-
exposure: true
|
|
105
|
-
})) {
|
|
102
|
+
if (hasContent && content) {
|
|
106
103
|
const preservedContent = preserveNodeIdentity(state.doc.content, content);
|
|
107
104
|
|
|
108
105
|
// If the entire content is identical, skip the replaceWith entirely
|
|
@@ -144,9 +141,7 @@ export const replaceDocument = (doc, state, version, options, reserveCursor, edi
|
|
|
144
141
|
};
|
|
145
142
|
tr.setMeta('collab$', collabState);
|
|
146
143
|
}
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
if (hasContent) {
|
|
144
|
+
} else if (hasContent) {
|
|
150
145
|
tr.setMeta('addToHistory', false);
|
|
151
146
|
// Ignored via go/ees005
|
|
152
147
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
-
|
|
4
2
|
/**
|
|
5
3
|
* Walk two Fragments (old and new) and return a Fragment that reuses old node
|
|
6
4
|
* references wherever structurally equal (`node.eq()` returns true).
|
|
@@ -54,7 +52,7 @@ export function preserveNodeIdentity(oldFragment, newFragment) {
|
|
|
54
52
|
} else if (oldChild.eq(newChild)) {
|
|
55
53
|
// Structurally equal — reuse old reference (THE KEY OPERATION)
|
|
56
54
|
children.push(oldChild);
|
|
57
|
-
} else if (oldChild.type === newChild.type && oldChild.sameMarkup(newChild) && oldChild.content.childCount > 0 && newChild.content.childCount > 0
|
|
55
|
+
} else if (oldChild.type === newChild.type && oldChild.sameMarkup(newChild) && oldChild.content.childCount > 0 && newChild.content.childCount > 0) {
|
|
58
56
|
// Same type and markup but different content — recurse into children
|
|
59
57
|
var preservedContent = preserveNodeIdentity(oldChild.content, newChild.content);
|
|
60
58
|
if (preservedContent === oldChild.content) {
|
|
@@ -8,7 +8,6 @@ import { Transaction, Selection, TextSelection } from '@atlaskit/editor-prosemir
|
|
|
8
8
|
import { AttrStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
9
9
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import { getParticipantColor } from '@atlaskit/editor-shared-styles';
|
|
11
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
11
|
import { preserveNodeIdentity } from './preserve-node-identity';
|
|
13
12
|
export var findPointers = function findPointers(id, decorations) {
|
|
14
13
|
return decorations.find().reduce(function (arr, deco) {
|
|
@@ -103,9 +102,7 @@ export var replaceDocument = function replaceDocument(doc, state, version, optio
|
|
|
103
102
|
var parsedDoc = processRawValueWithoutValidation(schema, doc, editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.fireAnalyticsEvent);
|
|
104
103
|
var hasContent = !!(parsedDoc !== null && parsedDoc !== void 0 && parsedDoc.childCount);
|
|
105
104
|
var content = parsedDoc === null || parsedDoc === void 0 ? void 0 : parsedDoc.content;
|
|
106
|
-
if (hasContent && content
|
|
107
|
-
exposure: true
|
|
108
|
-
})) {
|
|
105
|
+
if (hasContent && content) {
|
|
109
106
|
var preservedContent = preserveNodeIdentity(state.doc.content, content);
|
|
110
107
|
|
|
111
108
|
// If the entire content is identical, skip the replaceWith entirely
|
|
@@ -147,9 +144,7 @@ export var replaceDocument = function replaceDocument(doc, state, version, optio
|
|
|
147
144
|
};
|
|
148
145
|
tr.setMeta('collab$', _collabState);
|
|
149
146
|
}
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
if (hasContent) {
|
|
147
|
+
} else if (hasContent) {
|
|
153
148
|
tr.setMeta('addToHistory', false);
|
|
154
149
|
// Ignored via go/ees005
|
|
155
150
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.1",
|
|
4
4
|
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"@atlaskit/frontend-utilities": "^4.0.0",
|
|
32
32
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
33
33
|
"@atlaskit/prosemirror-collab": "^1.0.0",
|
|
34
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
34
|
+
"@atlaskit/tmp-editor-statsig": "^105.0.0",
|
|
35
35
|
"@atlaskit/tokens": "^14.0.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
37
37
|
"memoize-one": "^6.0.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@atlaskit/editor-common": "^116.
|
|
40
|
+
"@atlaskit/editor-common": "^116.1.0",
|
|
41
41
|
"react": "^18.2.0",
|
|
42
42
|
"react-dom": "^18.2.0"
|
|
43
43
|
},
|