Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d80512d690 | ||
|
|
6886881b76 |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.5.6",
|
"version": "13.5.7",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.5.6",
|
"version": "13.5.7",
|
||||||
"description": "Shared Editing Library",
|
"description": "Shared Editing Library",
|
||||||
"main": "./dist/yjs.cjs",
|
"main": "./dist/yjs.cjs",
|
||||||
"module": "./dist/yjs.mjs",
|
"module": "./dist/yjs.mjs",
|
||||||
|
|||||||
@@ -566,6 +566,19 @@ export class Item extends AbstractStruct {
|
|||||||
this.content.constructor === right.content.constructor &&
|
this.content.constructor === right.content.constructor &&
|
||||||
this.content.mergeWith(right.content)
|
this.content.mergeWith(right.content)
|
||||||
) {
|
) {
|
||||||
|
const searchMarker = /** @type {AbstractType<any>} */ (this.parent)._searchMarker
|
||||||
|
if (searchMarker) {
|
||||||
|
searchMarker.forEach(marker => {
|
||||||
|
if (marker.p === right) {
|
||||||
|
// right is going to be "forgotten" so we need to update the marker
|
||||||
|
marker.p = this
|
||||||
|
// adjust marker index
|
||||||
|
if (!this.deleted) {
|
||||||
|
marker.index -= this.length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
if (right.keep) {
|
if (right.keep) {
|
||||||
this.keep = true
|
this.keep = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,35 @@ export const testSlice = tc => {
|
|||||||
t.compareArrays(arr.slice(0, 2), [0, 1])
|
t.compareArrays(arr.slice(0, 2), [0, 1])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debugging yjs#297 - a critical bug connected to the search-marker approach
|
||||||
|
*
|
||||||
|
* @param {t.TestCase} tc
|
||||||
|
*/
|
||||||
|
export const testLengthIssue = tc => {
|
||||||
|
const doc1 = new Y.Doc()
|
||||||
|
const arr = doc1.getArray('array')
|
||||||
|
arr.push([0, 1, 2, 3])
|
||||||
|
arr.delete(0)
|
||||||
|
arr.insert(0, [0])
|
||||||
|
t.assert(arr.length === arr.toArray().length)
|
||||||
|
doc1.transact(() => {
|
||||||
|
arr.delete(1)
|
||||||
|
t.assert(arr.length === arr.toArray().length)
|
||||||
|
arr.insert(1, [1])
|
||||||
|
t.assert(arr.length === arr.toArray().length)
|
||||||
|
arr.delete(2)
|
||||||
|
t.assert(arr.length === arr.toArray().length)
|
||||||
|
arr.insert(2, [2])
|
||||||
|
t.assert(arr.length === arr.toArray().length)
|
||||||
|
})
|
||||||
|
t.assert(arr.length === arr.toArray().length)
|
||||||
|
arr.delete(1)
|
||||||
|
t.assert(arr.length === arr.toArray().length)
|
||||||
|
arr.insert(1, [1])
|
||||||
|
t.assert(arr.length === arr.toArray().length)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {t.TestCase} tc
|
* @param {t.TestCase} tc
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user