Comparing version 13.5.23 to 13.5.24
@@ -134,2 +134,5 @@ export class ArraySearchMarker { | ||
} | Array<any> | number | null | string | Uint8Array>): void; | ||
export function typeListPushGenerics(transaction: Transaction, parent: AbstractType<any>, content: Array<{ | ||
[x: string]: any; | ||
} | Array<any> | number | null | string | Uint8Array>): void; | ||
export function typeListDelete(transaction: Transaction, parent: AbstractType<any>, index: number, length: number): void; | ||
@@ -136,0 +139,0 @@ export function typeMapDelete(transaction: Transaction, parent: AbstractType<any>, key: string): void; |
@@ -54,2 +54,4 @@ /** | ||
* @param {Array<T>} content Array of content to append. | ||
* | ||
* @todo Use the following implementation in all types. | ||
*/ | ||
@@ -56,0 +58,0 @@ push(content: Array<T>): void; |
{ | ||
"name": "yjs", | ||
"version": "13.5.23", | ||
"version": "13.5.24", | ||
"description": "Shared Editing Library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/yjs.cjs", |
@@ -739,4 +739,27 @@ | ||
/** | ||
* Pushing content is special as we generally want to push after the last item. So we don't have to update | ||
* the serach marker. | ||
* | ||
* @param {Transaction} transaction | ||
* @param {AbstractType<any>} parent | ||
* @param {Array<Object<string,any>|Array<any>|number|null|string|Uint8Array>} content | ||
* | ||
* @private | ||
* @function | ||
*/ | ||
export const typeListPushGenerics = (transaction, parent, content) => { | ||
// Use the marker with the highest index and iterate to the right. | ||
const marker = (parent._searchMarker || []).reduce((maxMarker, currMarker) => currMarker.index > maxMarker.index ? currMarker : maxMarker, { index: 0, p: parent._start }) | ||
let n = marker.p | ||
if (n) { | ||
while (n.right) { | ||
n = n.right | ||
} | ||
} | ||
return typeListInsertGenericsAfter(transaction, parent, n, content) | ||
} | ||
/** | ||
* @param {Transaction} transaction | ||
* @param {AbstractType<any>} parent | ||
* @param {number} index | ||
@@ -743,0 +766,0 @@ * @param {number} length |
@@ -13,2 +13,3 @@ /** | ||
typeListInsertGenerics, | ||
typeListPushGenerics, | ||
typeListDelete, | ||
@@ -146,5 +147,13 @@ typeListMap, | ||
* @param {Array<T>} content Array of content to append. | ||
* | ||
* @todo Use the following implementation in all types. | ||
*/ | ||
push (content) { | ||
this.insert(this.length, content) | ||
if (this.doc !== null) { | ||
transact(this.doc, transaction => { | ||
typeListPushGenerics(transaction, this, content) | ||
}) | ||
} else { | ||
/** @type {Array<any>} */ (this._prelimContent).push(...content) | ||
} | ||
} | ||
@@ -151,0 +160,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2067358
31954