Comparing version 13.5.36 to 13.5.37
/** | ||
* @typedef {Object} UndoManagerOptions | ||
* @property {number} [UndoManagerOptions.captureTimeout=500] | ||
* @property {function(Transaction):boolean} [UndoManagerOptions.captureTransaction] Do not capture changes of a Transaction if result false. | ||
* @property {function(Item):boolean} [UndoManagerOptions.deleteFilter=()=>true] Sometimes | ||
@@ -25,3 +26,3 @@ * it is necessary to filter whan an Undo/Redo operation can delete. If this | ||
*/ | ||
constructor(typeScope: AbstractType<any> | Array<AbstractType<any>>, { captureTimeout, deleteFilter, trackedOrigins, ignoreRemoteMapChanges }?: UndoManagerOptions); | ||
constructor(typeScope: AbstractType<any> | Array<AbstractType<any>>, { captureTimeout, captureTransaction, deleteFilter, trackedOrigins, ignoreRemoteMapChanges }?: UndoManagerOptions); | ||
/** | ||
@@ -33,2 +34,3 @@ * @type {Array<AbstractType<any>>} | ||
trackedOrigins: Set<any>; | ||
captureTransaction: (arg0: Transaction) => boolean; | ||
/** | ||
@@ -118,2 +120,6 @@ * @type {Array<StackItem>} | ||
/** | ||
* Do not capture changes of a Transaction if result false. | ||
*/ | ||
captureTransaction?: ((arg0: Transaction) => boolean) | undefined; | ||
/** | ||
* Sometimes | ||
@@ -134,2 +140,3 @@ * it is necessary to filter whan an Undo/Redo operation can delete. If this | ||
import { Item } from "../structs/Item.js"; | ||
import { Transaction } from "./Transaction.js"; | ||
declare class StackItem { | ||
@@ -149,4 +156,3 @@ /** | ||
import { Doc } from "./Doc.js"; | ||
import { Transaction } from "./Transaction.js"; | ||
import { DeleteSet } from "./DeleteSet.js"; | ||
export {}; |
{ | ||
"name": "yjs", | ||
"version": "13.5.36", | ||
"version": "13.5.37", | ||
"description": "Shared Editing Library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/yjs.cjs", |
@@ -135,2 +135,3 @@ import { | ||
* @property {number} [UndoManagerOptions.captureTimeout=500] | ||
* @property {function(Transaction):boolean} [UndoManagerOptions.captureTransaction] Do not capture changes of a Transaction if result false. | ||
* @property {function(Item):boolean} [UndoManagerOptions.deleteFilter=()=>true] Sometimes | ||
@@ -158,3 +159,9 @@ * it is necessary to filter whan an Undo/Redo operation can delete. If this | ||
*/ | ||
constructor (typeScope, { captureTimeout = 500, deleteFilter = () => true, trackedOrigins = new Set([null]), ignoreRemoteMapChanges = false } = {}) { | ||
constructor (typeScope, { | ||
captureTimeout = 500, | ||
captureTransaction = tr => true, | ||
deleteFilter = () => true, | ||
trackedOrigins = new Set([null]), | ||
ignoreRemoteMapChanges = false | ||
} = {}) { | ||
super() | ||
@@ -169,2 +176,3 @@ /** | ||
this.trackedOrigins = trackedOrigins | ||
this.captureTransaction = captureTransaction | ||
/** | ||
@@ -193,3 +201,8 @@ * @type {Array<StackItem>} | ||
// Only track certain transactions | ||
if (!this.scope.some(type => transaction.changedParentTypes.has(type)) || (!this.trackedOrigins.has(transaction.origin) && (!transaction.origin || !this.trackedOrigins.has(transaction.origin.constructor)))) { | ||
if (this.captureTransaction(transaction) && ( | ||
!this.scope.some(type => transaction.changedParentTypes.has(type)) || | ||
( | ||
!this.trackedOrigins.has(transaction.origin) && (!transaction.origin || !this.trackedOrigins.has(transaction.origin.constructor)) | ||
) | ||
)) { | ||
return | ||
@@ -196,0 +209,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
2112639
32680